xref: /libCEED/examples/nek/README.md (revision 39b2de37682296be8460181179eb4e44de5cc3de)
1## libCEED + Nek5000 Examples
2
3### Prerequisites
4
5Nek5000 v18.0 or greater must be [installed](https://nek5000.mcs.anl.gov/getstarted/) to run
6these examples.  It is assumed to exist at `../../../Nek5000` (a sibling to the
7libCEED directory) or at a path defined in the environment variable `NEK5K_DIR`.
8For example, you could set
9```sh
10    export NEK5K_DIR=/scratch/Nek5000
11```
12if that is where it is located.
13
14The Nek5000 examples depend on the Nek5000 tools: `genbox`, `genmap`,
15and `reatore2`. They can be built using
16```sh
17   ( cd $NEK5K_DIR/tools && ./maketools genbox genmap reatore2 )
18```
19See also the [Nek5000 documentation](https://nek5000.mcs.anl.gov/getstarted/).
20
21### Building the Nek5000 examples
22
23You can build the Nek5000 libCEED examples with the command `make bps`.
24
25You can also build the Nek5000 libCEED examples by invoking `nek-examples.sh` script.
26```sh
27  ./nek-examples.sh -m
28```
29
30By default, the examples are built with MPI. To build the examples without MPI,
31set the environment variable `MPI=0`.
32
33Note: Nek5000 examples must be built sequentially. Due to the Nek5000 build
34process, multiple examples cannot be built in parallel. At present, there is
35only one Nek5000 example file to build, which handles both CEED BP 1 and
36CEED BP 3.
37
38### Running Nek5000 examples
39
40You can run the Nek5000 libCEED examples by invoking `nek-examples.sh`
41script. The syntax is:
42```sh
43  ./nek-examples.sh -c <ceed_backend> -e <example_name> \
44                   -n <mpi_ranks> -b <box_geometry>
45```
46The different options that can be used for the script are listed below:
47```
48options:
49   -h|-help     Print this usage information and exit
50   -c|-ceed     Ceed backend to be used for the run (optional, default: /cpu/self)
51   -e|-example  Example name (optional, default: bp1)
52   -n|-np       Specify number of MPI ranks for the run (optional, default: 1)
53   -t|-test     Run in test mode (not on by default)
54   -b|-box      Box case in boxes sub-directory found along with this script (default: 2x2x2)
55   -clean       clean the examples directory
56   -m|-make     Make the examples
57```
58The only mandatory argument is `-b` or `-box` which sets the box geometry to be
59used. This geometry should be found in `./boxes` directory.
60
61For example, you can run bp1 as follows:
62```sh
63  ./run-nek-example.sh -ceed /cpu/self -e bp1 -n 4 -b 3
64```
65which is the same as running:
66```sh
67  ./run-nek-example.sh -b 3
68```
69