SubmitFunction¶
- class SubmitFunction(callable, timeout_per_job=5, ntasks_per_node=1, nodes_per_job=1, cpus_per_task=1, mem=512, slurm_wckey='P120K:SALOME', slurm_additional_parameters={})¶
The aim of this class is to ease the realization of parallel evaluations of a numerical simulation model in a HPC environment. This class gives an example of a HPC wrapper for an executable numerical model using the Python package submitit.
- Parameters:
- callable
openturns.Function The unit function for which can either be sequential (a unit evaluation only requires one CPU), multi-cores or multi-nodes (a unit evaluation requires multiple cores and possibly multiple nodes).
- timeout_per_jobint
Timeout requested (in minutes) per SLURM job.
- ntasks_per_nodeint
Number of tasks (a task is a single evaluation of callable) that can be handled by a single SLURM job. Passed to SLURM as –ntasks-per-node.
- nodes_per_jobint
Number of HPC nodes requested per SLURM job submitted. Passed to SLURM as –nodes.
- cpus_per_taskint
Number of CPUs required to perform one task, i.e. one evaluation of callable. Passed to SLURM as –cpus-per-task.
- memint
Memory (in MB) requested per node. Passed to SLURM as –mem.
- slurm_wckeystr
Only for clusters that require a WCKEY (EDF clusters for example), i.e. a project identification key. To check the current wckeys, use the bash command cce_wckeys. Passed to SLURM as –wckey.
- slurm_additional_parametersdictionary
Extra parameters to pass to SLURM (for example, {“exclusive”: True, “mem_per_cpu”: 12}). Empty by default.
- callable
Methods
Input description accessor.
Input dimension accessor.
Output description accessor.
Output dimension accessor.
setInputDescription(descIn)Input description accessor.
setOutputDescription(descOut)Output description accessor.
task(X)Wrapper around callable to allow us to dispatch a single evaluation as a SLURM task
Examples
>>> import othpc >>> import openturns as ot >>> from othpc.example import CantileverBeam
>>> cb = CantileverBeam("my_results") >>> slurm_cb = othpc.SubmitFunction(cb) >>> X = [[30e3, 28e6, 250.0, 400.0], [20e3, 35e6, 250.0, 400.0]] >>> Y = slurm_cb(X)
- getInputDescription()¶
Input description accessor.
- getInputDimension()¶
Input dimension accessor.
- getOutputDescription()¶
Output description accessor.
- getOutputDimension()¶
Output dimension accessor.
- setInputDescription(descIn)¶
Input description accessor.
- setOutputDescription(descOut)¶
Output description accessor.
- task(X)¶
Wrapper around callable to allow us to dispatch a single evaluation as a SLURM task
othpc