RunRules

This module manages the parameters used to define the mpi and omp parellelization strategy.

class mppi.Calculators.RunRules.RunRules(scheduler='direct', omp_num_threads=1, mpi=1, nodes=1, ntasks_per_node=1, cpus_per_task=1, gpus_per_node=None, memory=None, time=None, partition=None, account=None, qos=None, map_by=None, pe=1, rank_by=None)[source]

Bases: dict

Defines and manage a dictionary with all the parameters needed to set up the rules for parallel computing.

Parameters:
  • scheduler (string) – choose the scheduler used to submit the job

  • omp_num_threads (int) – the value of the environment variable OMP_NUM_THREADS

  • mpi (int) – number of mpi processes. This parameter is used only if scheduler is direct, otherwise the nodes and ntasks_per_node parameters as used.

  • nodes (int) – slurm nodes variable

  • ntasks_per_node (int) – slurm ntasks-per-node variable

  • cpus_per_task (int) – slurm cpus-per-task variable

  • gpus_per_node (int) – slurm gpus-per-node variable

  • memory (string) – slurm mem variable

  • time (string) – slurm time variable, format ‘HH:MM:SS’

  • partition (string) – slurm parition variable

  • account (string) – slurm account variable

  • qos (string) – slurm qos variable

  • map_by (string) – the mpi unit for the –map-by option of mpirun

  • pe (int) – number of processing elements in the –map-by:unit:PE=n option of mpirun

  • rank_by (string) – the unit for the –rank-by option of mpirun

mppi.Calculators.RunRules.build_slurm_header(pars)[source]

Define the header of the slurm script. Note that the name variable is not present in the RunRules parameter but it is added by the Calculator in the run_options dictionary.

Parameters:

pars (dict) – dictionary with the structure of an instance of the RunRules

Returns:

a list with the lines of the header of the script

Return type:

list

mppi.Calculators.RunRules.mpi_command(pars)[source]

Define the mpi run command.

Parameters:

pars (dict) – dictionary with the structure of an instance of the RunRules

Returns:

command that defines the mpi run

Return type:

string