Running
This page gives information on how to run NekRS after it has been installed (see Installation instructions ) and appropriate input files have been generated (see Case files).
Native Running
To run NekRS natively from the directory containing the Case files, use the following general command
mpirun -np <number of MPI tasks> nekrs --setup <par|sess file> [options]
Below are the command line options/argument that can be used to further modifiy how NekRS is run.
Command line argument |
Options |
Description |
Required |
|---|---|---|---|
|
None |
Prints summary of available command line arguments |
No |
|
|
Name of |
Yes |
|
None |
Runs JIT compilation for |
No |
|
|
Runs NekRS in CI mode corresponding to specified |
No |
|
None |
Run NekRS in debug mode |
No |
|
None |
Pause NekRS at startup to allow attaching gdb for interactive debugging |
No |
|
|
Manually set the backend device for running |
No |
|
|
Name of log file to print NekRS output |
No |
|
|
Manually set OCCA device ID for GPU |
No |
MPI launch scripts
A number of scripts ship with NekRS itself and are located in the $NEKRS_HOME/bin. A brief summary of these scripts and their usage is as follows.
nrsmpi <casename> <processes>: run NekRS in parallel with<processes>parallel processes for the case files that are prefixed withcasename.nrsbmpi <casename> <processes>: same asnrsmpi, except that nekRS runs in the background and the output is printed to log file
Running on HPC Systems
Specific scripts and instructions for running on specific HPC systems can be found in nekRS_HPCsupport Github repository. After installing nekRS, clone this repository for the latest scripts:
git clone https://github.com/Nek5000/nekRS_HPCsupport
cd nekRS_HPCsupport
With NEKRS_HOME pointing to your nekRS installation, run:
./install.sh
The HPC scripts will be installed into $NEKRS_HOME/bin with a lower case machine-name suffix.
For example, $NEKRS_HOME/bin/nrsqsub_frontier.
Typical usage is as follows:
PROJ_ID=<project> ./nrsqsub_frontier <case> <#nodes> <hh:mm>
PROJ_ID: your allocation/accountcase: case name, .par or .sess file#nodes: number of nodeshh:mm: walltime (hours:minutes).
For example, this requests to run 1 node with 30 mins on Frontier:
PROJ_ID=ABC123 ./nrsqsub_frontier turbPipe.par 1 00:30
You can see the full list of environment variables via --help:
$ ./nrsqsub_frontier --help
Usage: [<env-var>] $0 <par or sess file> <number of compute nodes> <hh:mm>
env-var Values(s) Description / Comment
------------------------------------------------------------------------------------
NEKRS_HOME string path to installation
PROJ_ID string
QUEUE string
CPUONLY 0/1 backend=serial
RUN_ONLY 0/1 skip pre-compilation
BUILD_ONLY 0/1 run pre-compilation only
FP32 0/1 run solver in single precision
OPT_ARGS string optional arguements e.g. "--cimode 1 --debug"
Runtime Control with Signals
A signal is a small, asynchronous message the OS sends to a process to request an action.
Examples include SIGTERM (polite terminate), SIGSTOP (suspend), and SIGKILL (force kill).
NekRS installs handlers for specific signals (e.g., SIGUSR1/SIGUSR2) to perform runtime tasks.
You can map which signals trigger which actions via environment variables (see nrsman env):
Variable |
Value |
Description |
|---|---|---|
|
<int> |
Signal number to trigger stack trace |
|
<int> |
Signal number to exit gracefully. |
|
<int> |
Signal number to process update (trigger) file |
Note
Systems differ slightly.
Check which numbers correspond to which signals on your terminal with kill -l, kill -l SIGUSR2, or the manuals (man 7 signal).
We suggest using catchable signals like SIGUSR1/SIGUSR2.
Suppose SIGUSR2 is 12 on your system.
Export the mapping before running NekRS with export NEKRS_SIGNUM_BACKTRACE=12.
Then, at runtime, send the signal to produce per-rank backtraces (useful when a simulation hangs):
# by pid (process id, from "top" or "ps aux")
kill -12 <pid>
# by name
pkill -12 nekrs
pkill -USR2 nekrs
# On HPC using slurm scheduler
scancel -s USR2 <job id>