pygsti.protocols.protocol.SlurmSettings#
- class SlurmSettings(script_path, partition=None, time=None, nodes=1, job_name=None, output=None, error=None)#
Bases:
objectSettings for auto-generating a SLURM batch script via
Protocol.stage_slurm().Pass an instance as the
slurmargument toProtocol.stage_slurm(). The resulting.sbatchfile can be submitted directly withsbatch <script_path>.- Parameters:
script_path (str or Path) – Where to write the
.sbatchfile.partition (str or None) – SLURM partition (queue) name. Written as
#SBATCH --partition=<value>. WhenNone, aFILL_INplaceholder is emitted and a comment reminds you to edit before submitting.time (str or None) – Walltime limit in SLURM format, e.g.
'4:00:00'or'1-00:00:00'. WhenNone, aFILL_INplaceholder is emitted.nodes (int) – Number of nodes to request (
#SBATCH --nodes). Default1. Used together withnum_ranksto compute--ntasks-per-node.job_name (str or None) – Job name (
#SBATCH --job-name). Defaults to the protocol class name when passed toProtocol.stage_slurm().output (str or None) – Path for the SLURM stdout log (
#SBATCH --output). Defaults toslurm-%j.outin the same directory asscript_path.error (str or None) – Path for the SLURM stderr log (
#SBATCH --error). Defaults toslurm-%j.errin the same directory asscript_path.
Notes
The generated script uses
srunto launch the MPI workers; this is the SLURM-native launcher and inherits the job allocation automatically (no-nflag needed).--cpus-per-taskand the BLAS thread environment variables (OMP_NUM_THREADS,MKL_NUM_THREADS, etc.) are set to the value ofblas_threads_per_rankpassed toProtocol.stage_slurm(). If that value is0(the default auto-detect), note that it is measured on the machine where you callstage_slurm, which may differ from the HPC compute nodes. Pass an explicitblas_threads_per_ranktoProtocol.stage_slurm()if your nodes have a different core count.The generated script includes a commented block of optional
#SBATCHdirectives (--account,--qos,--constraint,--exclusive,--mem,--mail-user, etc.) that are commonly needed but too site-specific to set automatically. Edit the script and uncomment the ones you need before submitting.Methods
__init__(script_path[, partition, time, ...])Attributes
errorjob_namenodesoutputpartitiontimescript_path