pygsti.tools.mpitools.build_slurm_script#
- build_slurm_script(*, job_name, nodes, ntasks_per_node, cpus_per_task, time, partition, output, error, ranks_per_host, num_ranks, runner_path, script_path)#
Build and return the text of a SLURM batch script.
The returned string is suitable for writing directly to a
.sbatchfile and submitting withsbatch. The script usessrunas the MPI launcher (SLURM-native; inherits the job allocation automatically).- Parameters:
job_name (str) – Value for
#SBATCH --job-name.nodes (int) – Value for
#SBATCH --nodes.ntasks_per_node (int) – Value for
#SBATCH --ntasks-per-node.cpus_per_task (int) – Value for
#SBATCH --cpus-per-task. Also used for the BLAS thread environment variable exports.time (str or None) – Walltime limit (e.g.
'4:00:00').Noneemits aFILL_INplaceholder.partition (str or None) – SLURM partition name.
Noneemits aFILL_INplaceholder.output (str or None) – Path for SLURM stdout log.
Nonedefaults toslurm-%j.outin the same directory as script_path.error (str or None) – Path for SLURM stderr log.
Nonedefaults toslurm-%j.errin the same directory as script_path.ranks_per_host (int or None) – Used to set a suggested
PYGSTI_MAX_HOST_PROCScomment in the script.Noneusesnum_ranks // nodesas the suggestion.num_ranks (int) – Total number of MPI ranks (used only when ranks_per_host is
Noneto compute the suggestion).runner_path (str) – Path to the
mpi_runner.pyscript (embedded in thesruninvocation).script_path (str) – Destination path for the
.sbatchfile (embedded in the header comment).
- Returns:
Complete text of the batch script, ending with a newline.
- Return type:
str