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