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