NWPconf
Version1.0
|
Module with utilities for parallel computing and batch scheduling. More...
Functions | |
parcomp_init () | |
Setup the environment for parallel computing. More... | |
parcomp_computetopo ($1) | |
Compute a 2-D processor topology from the total number of tasks. More... | |
parcomp_mpirun ($*) | |
Run a parallel MPI process starting the required number of tasks. More... | |
get_job_status ($1) | |
Get the status of a batch job. More... | |
cd_submit_dir () | |
Change working directory to submit directory. More... | |
Module with utilities for parallel computing and batch scheduling.
This module provides some functions that help in performing operations related to parallel computing and interaction with a batch scheduler, such as defining a Cartesian topology and starting parallel MPI executables in an MPI implementation- and scheduler-independent way. It is an optional module and it has to be sourced after the main nwpconf.sh module.
parcomp_init | ( | ) |
Setup the environment for parallel computing.
This functions is implicitly called when the module is sourced, it sets up the environment for parallel computing from the HPC scheduling environment of the process, if available (Slurm, PBS and LoadLeveler supported). If no scheduling environment is available, the environmental variable $NPTOTAL is used as number of desired parallel tasks. If set in input, the variable $NPIO indicates the number of tasks dedicated to I/O, not involved in Cartesian computation. The parcomp_computetopo() function is implicitly called by this function with the proper mumber of computational tasks. On output, the variables $NPX
, $NPY
, $NPIO
(if not set on input) and $NP
(total number of parallel tasks including I/O tasks) are set.
parcomp_computetopo | ( | $1 | ) |
Compute a 2-D processor topology from the total number of tasks.
This function computes a reasonable 2-D task (processor) Cartesian topology for parallel computing given the total number of computational tasks. The topology is set in the $NPX
$NPY
environment variables.
$1 | the number of computational tasks requested |
parcomp_mpirun | ( | $* | ) |
Run a parallel MPI process starting the required number of tasks.
This function runs a parallel MPI process starting the required number of tasks, in a scheduler-independent and MPI implementation-independent way (not yet implemented).
$* | additional arguments to mpirun, parallel executable and its optional arguments |
get_job_status | ( | $1 | ) |
Get the status of a batch job.
This function queries the batch scheduler and prints on stdout the status of a batch job; it recognises slurm and pbs schedulers. The output is one letter (possibly scheduler dependent) indicating the job status, no output with error code 0 if the job does not exists or no output with error code 1 if the scheduler is not recognized.
$1 | the id of the job |
cd_submit_dir | ( | ) |
Change working directory to submit directory.
This function changes the current working directory to the directory from which a job was submitted to a batch scheduler; outside a batch environment it silently does nothing. It is useful to write portable scripts that can work both on the command line and under a batch scheduler.