xref: /libCEED/examples/README.md (revision dfafb49c89722b38297bb587c0d371c098faeb52)
1# libCEED: Examples
2
3libCEED comes with several examples of its usage, ranging from standalone C
4codes to examples based on external packages,such as MFEM, PETSc and Nek5000.
5
6## Example 1
7
8This example uses the mass matrix to compute the length, area, or volume of a
9region, depending upon runtime parameters.
10
11## Bakeoff Problems
12
13This section provides a brief description of the bakeoff problems, used as examples
14for the libCEED library. These bakeoff problems are high-order benchmarks designed
15to test and compare the performance of high-order finite element codes.
16
17For further documentation, readers may wish to consult the
18[CEED documentation](http://ceed.exascaleproject.org/bps/) of the bakeoff problems.
19
20### Bakeoff Problem 1
21
22Bakeoff problem 1 is the *L<sup>2</sup>* projection problem into the finite element space.
23
24The supplied examples solve *_B_ u = f*, where *_B_* is the mass matrix.
25
26### Bakeoff Problem 3
27
28Bakeoff problem 1 is the Poisson problem.
29
30The supplied examples solve *_A_ u = f*, where *_A_* is the Poisson operator.
31
32## Running Examples
33
34To build the examples, set the `MFEM_DIR`, `PETSC_DIR` and `NEK5K_DIR` variables
35and run:
36
37```console
38# libCEED examples on CPU and GPU
39cd ceed
40make
41./ex1 -ceed /cpu/self
42./ex1 -ceed /gpu/occa
43cd ../..
44
45# MFEM+libCEED examples on CPU and GPU
46cd mfem
47make
48./bp1 -ceed /cpu/self -no-vis
49./bp1 -ceed /gpu/occa -no-vis
50cd ../..
51
52# PETSc+libCEED examples on CPU and GPU
53cd petsc
54make
55./bp1 -ceed /cpu/self
56./bp1 -ceed /gpu/occa
57cd ../..
58
59# Nek+libCEED examples on CPU and GPU
60cd nek5000
61./make-nek-examples.sh
62./run-nek-example.sh -ceed /cpu/self -b 3
63./run-nek-example.sh -ceed /gpu/occa -b 3
64cd ../..
65```
66
67The above code assumes a GPU-capable machine with the OCCA backend
68enabled. Depending on the available backends, other Ceed resource specifiers can
69be provided with the `-ceed` option.
70