Option(s) define multiple jobs in a co\-scheduled heterogeneous job. For more details about heterogeneous jobs see the document .br https://slurm.schedmd.com/heterogeneous_jobs.html .SH "DESCRIPTION" Run a parallel job on cluster managed by Slurm. If necessary, srun will first create a resource allocation in which to run the parallel job. The following document describes the influence of various options on the allocation of cpus to jobs and tasks. .br https://slurm.schedmd.com/cpu_management.html .SH "RETURN VALUE" srun will return the highest exit code of all tasks run or the highest signal (with the high\-order bit set in an 8\-bit integer \-\- e.g. 128 + signal) of any task that exited with a signal. .br The value 253 is reserved for out\-of\-memory errors. .SH "EXECUTABLE PATH RESOLUTION" The executable is resolved in the following order: .br 1. If executable starts with ".", then path is constructed as: current working directory / executable .br 2. If executable starts with a "/", then path is considered absolute. .br 3. If executable can be resolved through PATH. See \fBpath_resolution\fR(7). .br 4. If executable is in current working directory. .br .P Current working directory is the calling process working directory unless the \fB\-\-chdir\fR argument is passed, which will override the current working directory. .SH "OPTIONS" .LP .TP \fB\-A\fR, \fB\-\-account\fR=<\fIaccount\fR> Charge resources used by this job to specified account. The \fIaccount\fR is an arbitrary string. The account name may be changed after job submission using the \fBscontrol\fR command. This option applies to job allocations. .IP Sampling interval for the jobacct_gather plugins and for task profiling by the acct_gather_profile plugin. .br \fBNOTE\fR: This frequency is used to monitor memory usage. If memory limits are enforced the highest frequency a user can request is what is configured in the slurm.conf file. It can not be disabled. .IP .TP \fBenergy\fR Sampling interval for energy profiling using the acct_gather_energy plugin. .IP .TP \fBnetwork\fR Sampling interval for infiniband profiling using the acct_gather_interconnect plugin. .IP .TP \fBfilesystem\fR Sampling interval for filesystem profiling using the acct_gather_filesystem plugin. .LP The default value for the task sampling interval is 30 seconds. The default value for all other intervals is 0. An interval of 0 disables sampling of the specified type. If the task sampling interval is 0, accounting information is collected only at job termination (reducing Slurm interference with the job). .br Smaller (non\-zero) values have a greater impact upon job performance, but a value of 30 seconds is not likely to be noticeable for applications having less than 10,000 tasks. This option applies to job allocations. .RE .IP .TP \fB\-\-bb\fR=<\fIspec\fR> Burst buffer specification. The form of the specification is system dependent. Also see \fB\-\-bbf\fR. This option applies to job allocations. When the \fB\-\-bb\fR option is used, Slurm parses this option and creates a temporary burst buffer script file that is used internally by the burst buffer plugins. See Slurm's burst buffer guide for more information and examples: .br https://slurm.schedmd.com/burst_buffer.html .IP .TP If the path specified ends with '/' it is treated as a target directory, and the destination file name will be slurm_bcast_<job_id>.<step_id>_<nodename>. If no dest_path is specified and the slurm.conf \fBBcastParameters\fR \fBDestDir\fR is configured then it is used, and the filename follows the above pattern. If none of the previous is specified, then \fB\-\-chdir\fR is used, and the filename follows the above pattern too. For example, "srun \-\-bcast=/tmp/mine \-N3 a.out" will copy the file "a.out" from your current directory to the file "/tmp/mine" on each of the three allocated compute nodes and execute that file. This option applies to step allocations. .IP .TP \fB\-\-bcast\-exclude\fR={NONE|<\fIexclude_path\fR>[,<\fIexclude_path\fR>...]} Comma\-separated list of absolute directory paths to be excluded when autodetecting and broadcasting executable shared object dependencies through \fB\-\-bcast\fR. If the keyword "\fINONE\fR" is configured, no directory paths will be excluded. The default value is that of slurm.conf \fBBcastExclude\fR and this option overrides it. See also \fB\-\-bcast\fR and \fB\-\-send\-libs\fR. .IP .TP \fB\-b\fR, \fB\-\-begin\fR=<\fItime\fR> Defer initiation of this job until the specified time. It accepts times of the form \fIHH:MM:SS\fR to run a job at a specific time of day (seconds are optional). (If that time is already past, the next day is assumed.) You may also specify \fImidnight\fR, \fInoon\fR, \fIfika\fR (3 PM) or \fIteatime\fR (4 PM) and you can have a time\-of\-day suffixed with \fIAM\fR or \fIPM\fR for running in the morning or the evening. You can also say what day the job will be run, by specifying a date of the form \fIMMDDYY\fR or \fIMM/DD/YY\fR \fIYYYY\-MM\-DD\fR. Combine date and time using the following format \fIYYYY\-MM\-DD[THH:MM[:SS]]\fR. You can also give times like \fInow + count time\-units\fR, where the time\-units can be \fIseconds\fR (default), \fIminutes\fR, \fIhours\fR, \fIdays\fR, or \fIweeks\fR and you can tell Slurm to run the job today with the keyword \fItoday\fR and to run the job tomorrow with the keyword \fItomorrow\fR. The value may be changed after job submission using the \fBscontrol\fR command. For example: .IP .nf \-\-begin=16:00 \-\-begin=now+1hour \-\-begin=now+60 (seconds by default) \-\-begin=2010\-01\-20T12:34:00 .fi .RS .PP .IP .TP \fB\-D\fR, \fB\-\-chdir\fR=<\fIpath\fR> Have the remote processes do a chdir to \fIpath\fR before beginning execution. The default is to chdir to the current working directory of the \fBsrun\fR process. The path can be specified as full path or relative path to the directory where the command is executed. This option applies to job allocations. .IP .TP \fB\-\-cluster\-constraint\fR=<\fIlist\fR> Specifies features that a federated cluster must have to have a sibling job submitted to it. Slurm will attempt to submit a sibling job to a cluster if it has at least one of the specified features. .IP .TP \fB\-M\fR, \fB\-\-clusters\fR=<\fIstring\fR> Clusters to issue commands to. Multiple cluster names may be comma separated. The job will be submitted to the one cluster providing the earliest expected job initiation time. The default value is the current cluster. A value of \(aq\fIall\fR' will query to run on all clusters. Note the \fB\-\-export\fR option to control environment variables exported between clusters. This option applies only to job allocations. Note that the SlurmDBD must be up for this option to work properly. .IP .TP \fB\-\-comment\fR=<\fIstring\fR> An arbitrary comment. This option applies to job allocations. .IP .TP \fB\-\-compress\fR[=\fItype\fR] Compress file before sending it to compute hosts. The optional argument specifies the data compression library to be used. The default is \fBBcastParameters\fR \fBCompression=\fR if set or "lz4" otherwise. Supported values are "lz4". Some compression libraries may be unavailable on some systems. For use with the \fB\-\-bcast\fR option. This option applies to step allocations. .IP .TP \fB\-C\fR, \fB\-\-constraint\fR=<\fIlist\fR> Nodes can have \fBfeatures\fR assigned to them by the Slurm administrator. Users can specify which of these \fBfeatures\fR are required by their job using the constraint option. If you are looking for 'soft' constraints please Only nodes which have the specified feature will be used. For example, \fB\-\-constraint="intel"\fR .IP .TP \fBNode Count\fR A request can specify the number of nodes needed with some feature by appending an asterisk and count after the feature name. For example, \fB\-\-nodes=16 \-\-constraint="graphics*4"\fR indicates that the job requires 16 nodes and that at least four of those nodes must have the feature "graphics." If requesting more than one feature and using node counts, the request must have square brackets surrounding it. \fBNOTE\fR: This option is not supported by the helpers NodeFeatures plugin. Heterogeneous jobs can be used instead. .IP .TP \fBAND\fR Only nodes with all of specified features will be used. The ampersand is used for an AND operator. For example, \fB\-\-constraint="intel&gpu"\fR .IP .TP \fBOR\fR Only nodes with at least one of specified features will be used. The vertical bar is used for an OR operator. If changeable features are not requested, nodes in the allocation can have different features. For example, \fBsalloc -N2 \-\-constraint="intel|amd"\fR can result in a job allocation where one node has the intel feature and the other node has the amd feature. However, if the expression contains a changeable feature, then all OR operators are automatically treated as Matching OR so that all nodes in the job allocation have the same set of features. For example, \fBsalloc -N2 \-\-constraint="foo|bar&baz"\fR The job is allocated two nodes where both nodes have foo, or bar and baz (one or both nodes could have foo, bar, and baz). The helpers NodeFeatures plugin will find the first set of node features that matches all nodes in the job allocation; these features are set as active features on the node and passed to RebootProgram (see \fBslurm.conf\fR(5)) and the helper script (see \fBhelpers.conf\fR(5)). In this case, the helpers plugin uses the first of "foo" or "bar,baz" that match the two nodes in the job allocation. .IP .TP \fBMatching OR\fR If only one of a set of possible options should be used for all allocated nodes, then use the OR operator and enclose the options within square brackets. For example, \fB\-\-constraint="[rack1|rack2|rack3|rack4]"\fR might be used to specify that all nodes must be allocated on a single rack of the cluster, but any of those four racks can be used. Specification of multiple KNL modes requires the use of a heterogeneous job. \fBNOTE\fR: This option is not supported by the helpers NodeFeatures plugin. \fBNOTE\fR: Multiple Counts can cause jobs to be allocated with a non-optimal network layout. .IP .TP \fBBrackets\fR Brackets can be used to indicate that you are looking for a set of nodes with the different requirements contained within the brackets. For example, \fB\-\-constraint="[(rack1|rack2)*1&(rack3)*2]"\fR will get you one node with either the "rack1" or "rack2" features and two nodes with the "rack3" feature. If requesting more than one feature and using node counts, the request must have square brackets surrounding it. \fBNOTE\fR: Brackets are only reserved for \fBMultiple Counts\fR and \fBMatching OR\fR syntax. AND operators require a count for each feature inside square brackets (i.e. "[quad*2&hemi*1]"). Slurm will only allow a single set of bracketed constraints per job. \fBNOTE\fR: Square brackets are not supported by the helpers NodeFeatures plugin. Matching OR can be requested without square brackets by using the vertical bar character with at least one changeable feature. .IP .TP \fBParentheses\fR Parentheses can be used to group like node features together. For example, \fB\-\-constraint="[(knl&snc4&flat)*4&haswell*1]"\fR might be used to specify that four nodes with the features "knl", "snc4" and "flat" plus one node with the feature "haswell" are required. Parentheses can also be used to group operations. Without parentheses, node features are parsed strictly from left to right. For example, \fB\-\-constraint="foo&bar|baz"\fR requests nodes with foo and bar, or baz. \fB\-\-constraint="foo|bar&baz"\fR requests nodes with foo and baz, or bar and baz (note how baz was AND'd with everything). \fB\-\-constraint="foo&(bar|baz)"\fR requests nodes with foo and at least one of bar or baz. \fBNOTE\fR: OR within parentheses should not be used with a KNL NodeFeatures plugin but is supported by the helpers NodeFeatures plugin. .RE .IP .RS \fBWARNING\fR: When srun is executed from within salloc or sbatch, the constraint value can only contain a single feature name. None of the other operators are currently supported for job steps. .br .TP \fB\-\-contiguous\fR If set, then the allocated nodes must form a contiguous set. \fBNOTE\fR: If the SelectType is cons_tres this option won't be honored with the \fBtopology/tree\fR or \fBtopology/3d_torus\fR plugins, both of which can modify the node ordering. This option applies to job allocations. .IP .TP \fB\-S\fR, \fB\-\-core\-spec\fR=<\fInum\fR> Count of Specialized Cores per node reserved by the job for system operations and not used by the application. If AllowSpecResourcesUsage is enabled a job can override the CoreSpecCount of all its allocated nodes with this option. The overridden Specialized Cores will still be reserved for system processes. The job will get an implicit \fB--exclusive\fR allocation for the rest of the Cores on the nodes, resulting in the job's processes being able to use (and being charged for) all the Cores on the nodes except for the overridden Specialized Cores. This option can not be used with the \fB\-\-thread\-spec\fR option. \fBNOTE\fR: Explicitly setting a job's specialized core value implicitly sets the --exclusive option. \fBNOTE\fR: This option may implicitly impact the number of tasks if \fB\-n\fR was not specified. This option applies to job allocations. .IP .TP \fB\-\-cores\-per\-socket\fR=<\fIcores\fR> Restrict node selection to nodes with at least the specified number of cores per socket. See additional information under \fB\-B\fR option above when task/affinity plugin is enabled. This option applies to job allocations. .IP .TP \fB\-\-cpu\-bind\fR=[{quiet|verbose},]<\fItype\fR> Bind tasks to CPUs. Used only when the task/affinity plugin is enabled. \fBNOTE\fR: To have Slurm always report on the selected CPU binding for all commands executed in a shell, you can enable verbose mode by setting the SLURM_CPU_BIND environment variable value to "verbose". The following informational environment variables are set when \fB\-\-cpu\-bind\fR is in use: .IP .nf than one allowed CPU) could be used for the tasks in order to provide multiple CPUs for the multithreaded tasks. Note that a job step can be allocated different numbers of CPUs on each node or be allocated CPUs not starting at location zero. Therefore one of the options which automatically generate the task binding is recommended. Explicitly specified masks or bindings are only honored when the job step has been allocated every available CPU on the node. Binding a task to a NUMA locality domain means to bind the task to the set of CPUs that belong to the NUMA locality domain or "NUMA node". If NUMA locality domain options are used on systems with no NUMA support, then each socket is considered a locality domain. If the \fB\-\-cpu\-bind\fR option is not used, the default binding mode will depend upon Slurm's configuration and the step's resource allocation. If all allocated nodes have the same configured CpuBind mode, that will be used. Otherwise if the job's Partition has a configured CpuBind mode, that will be used. Otherwise if Slurm has a configured TaskPluginParam value, that mode will be used. Otherwise automatic binding will be performed as described below. .IP .RS .TP \fBAuto Binding\fR Applies only when task/affinity is enabled. If the job step allocation includes an allocation with a number of sockets, cores, or threads equal to the number of tasks times cpus\-per\-task, then the tasks will by default be bound to the appropriate resources (auto binding). Disable this mode of operation by explicitly setting "\-\-cpu\-bind=none". Use TaskPluginParam=autobind=[threads|cores|sockets] to set a default cpu binding in case "auto binding" doesn't find a match. .RE .IP .RS Supported options include: .PD 1 .RS .TP .B q[uiet] Quietly bind before task runs (default) .IP .TP .B v[erbose] Verbosely report binding before task runs .IP .TP .B no[ne] Do not bind tasks to CPUs (default unless auto binding is applied) .IP the list. To simplify support for large task counts, the lists may follow a map with an asterisk and repetition count. For example "map_cpu:0*4,3*4". .IP .TP .B mask_cpu:<list> Bind by setting CPU masks on tasks (or ranks) as specified where <list> isfR(5) man page and \fBOverMemoryKill\fR in the \fBslurm.conf\fR(5) man page for more details. any memory. This option is typically used to ensure that each task is bound to the memory closest to its assigned CPU. \fBThe use of any type other than "none" or "local" is not recommended.\fR If you want greater control, try running a simple test code with the options "\-\-cpu\-bind=verbose,none \-\-mem\-bind=verbose,none" to determine the specific configuration. \fBNOTE\fR: To have Slurm always report on the selected memory binding for all commands executed in a shell, you can enable verbose mode by setting the SLURM_MEM_BIND environment variable value to "verbose". The following informational environment variables are set when \fB\-\-mem\-bind\fR is in use: .IP .nf SLURM_MEM_BIND_LIST SLURM_MEM_BIND_PREFER SLURM_MEM_BIND_SORT SLURM_MEM_BIND_TYPE SLURM_MEM_BIND_VERBOSE .fi See the \fBENVIRONMENT VARIABLES\fR section for a more detailed description of the individual SLURM_MEM_BIND* variables. Supported options include: .IP .RS .TP .B help show this help message .IP .TP .B local Use memory local to the processor in use .IP .TP .B map_mem:<list> Bind by setting memory masks on tasks (or ranks) as specified where <list> is setbuf(3). If this option is specified the tasks are executed with a pseudo terminal so that the application output is unbuffered. This option applies to step allocations. .IP .TP \fB\-\-usage\fR Display brief help message and exit. .IP .TP \fB\-\-use\-min\-nodes\fR If a range of node counts is given, prefer the smaller count. .IP .TP \fB\-v\fR, \fB\-\-verbose\fR Increase the verbosity of srun's informational messages. Multiple '\fB\-v\fR's will further increase srun's verbosity. By default only errors will be displayed. This option applies to job and step allocations. .IP .TP \fB\-V\fR, \fB\-\-version\fR Display version information and exit. .IP .TP \fB\-W\fR, \fB\-\-wait\fR=<\fIseconds\fR> Specify how long to wait after the first task terminates before terminating all remaining tasks. A value of 0 indicates an unlimited wait (a warning will be issued after 60 seconds). The default value is set by the WaitTime parameter in the slurm configuration file (see \fBslurm.conf(5)\fR). This option can be useful to ensure that a job is terminated in a timely fashion Sets up X11 forwarding on "all", "first" or "last" node(s) of the allocation. This option is only enabled if Slurm was compiled with X11 support and PrologFlags=x11 is defined in the slurm.conf. Default is "all". .IP .PP .B srun will submit the job request to the slurm job controller, then initiate all processes on the remote nodes. If the request cannot be met immediately, .B srun will block until the resources are free to run the job. If the \fB\-I\fR (\fB\-\-immediate\fR) option is specified .B srun will terminate if resources are not immediately available. .PP When initiating remote processes .B srun will propagate the current working directory, unless \fB\-\-chdir\fR=<\fIpath\fR> is specified, in which case \fIpath\fR will become the working directory for the remote processes. .PP The \fB\-n\fB, \fB\-c\fR, and \fB\-N\fR options control how CPUs and nodes will be allocated to the job. When specifying only the number of processes to run with \fB\-n\fR, a default of one CPU per process is allocated. By specifying the number of CPUs required per task (\fB\-c\fR), more than one CPU may be allocated per process. If the number of nodes is specified with \fB\-N\fR, .B srun will attempt to allocate \fIat least\fR the number of nodes specified. .PP Combinations of the above three options may be used to change how processes are distributed across nodes and cpus. For instance, by specifying both the number of processes and number of nodes on which to run, the number of processes per node is implied. However, if the number of CPUs per process is more important then number of processes (\fB\-n\fR) and the number of CPUs per process (\fB\-c\fR) should be specified. .PP .B srun will refuse to allocate more than one process per CPU unless \fB\-\-overcommit\fR (\fB\-O\fR) is also specified. .PP .B srun will attempt to meet the above specifications "at a minimum." That is, if 16 nodes are requested for 32 processes, and some nodes do not have 2 CPUs, the allocation of nodes will be increased in order to meet the demand for CPUs. In other words, a \fIminimum\fR of 16 nodes are being requested. However, if 16 nodes are requested for 15 processes, .B srun will consider this an error, as 15 processes cannot run across 16 nodes. .PP .B "IO Redirection" Note that \fB\-\-error\fR won't redirect the stderr of srun itself, only the stderr from the tasks. Valid format specifications for these options are .TP 10 \fBall\fR stdout stderr is redirected from all tasks to srun. stdin is broadcast to all remote tasks. (This is the default behavior) .IP .TP \fBnone\fR stdout and stderr is not received from any task. stdin is not sent to any task (stdin is closed). .IP .TP \fBtaskid\fR stdout and/or stderr are redirected from only the task with relative id equal to \fItaskid\fR, where 0 <= \fItaskid\fR <= \fIntasks\fR, where \fIntasks\fR is the total number of tasks in the current job step. stdin is redirected from the stdin of \fBsrun\fR to this same task. This file will be written on the node executing the task. .IP .TP \fBfilename\fR \fBsrun\fR will redirect stdout and/or stderr to the named file from all tasks. stdin will be redirected from the named file and broadcast to all tasks in the job. \fIfilename\fR refers to a path on the host that runs \fBsrun\fR. Depending on the cluster's file system layout, this may result in the output appearing in different places depending on whether the job is run in batch mode. .IP .TP \fBfilename pattern\fR \fBsrun\fR allows for a filename pattern to be used to generate the named IO file described above. The following list of format specifiers may be used in the format string to generate a filename that will be unique to a given jobid, stepid, node, or task. In each case, the appropriate number of files are opened and associated with the corresponding tasks. Note that any format string containing %t, %n, and/or %N will be written on the node executing the task rather than the node where \fBsrun\fR executes, these format specifiers are not supported on a BGQ system. .IP .RS 10 .TP \fB%a\fR Job array ID (index) number. .IP .TP \fB%J\fR jobid.stepid of the running job. (e.g. "128.0") .IP .TP \fB%j\fR jobid of the running job. .IP .TP \fB%s\fR stepid of the running job. .IP .TP \fB%N\fR short hostname. This will create a separate IO file per node. .IP .TP \fB%n\fR Node identifier relative to current job (e.g. "0" is the first node of the running job) This will create a separate IO file per node. .IP .TP \fB%t\fR task identifier (rank) relative to current job. This will create a separate IO file per task. .IP .TP \fB%u\fR User name. .IP .TP \fB%x\fR Job name. .IP .PP A number placed between the percent character and format specifier may be used to zero\-pad the result in the IO filename to at minimum of specified numbers. This number is ignored if the format specifier corresponds to non\-numeric data (%N for example). The maximal number is 10, if a value greater .TP job%2j\-%2t.out job128\-00.out, job128\-01.out, ... .IP .PP .RS -10 .PP .SH "PERFORMANCE" .PP Executing \fBsrun\fR sends a remote procedure call to \fBslurmctld\fR. If enough calls from \fBsrun\fR or other Slurm client commands that send remote procedure calls to the \fBslurmctld\fR daemon come in at once, it can result in a degradation of performance of the \fBslurmctld\fR daemon, possibly resulting in a denial of service. .PP Do not run \fBsrun\fR or other Slurm client commands that send remote procedure calls to \fBslurmctld\fR from loops in shell scripts or other programs. Ensure that programs limit calls to \fBsrun\fR to the minimum necessary for the information you are trying to gather. .SH "INPUT ENVIRONMENT VARIABLES" .PP Upon startup, srun will read and handle the options set in the following environment variables. The majority of these variables are set the same way the options are set, as defined above. For flag options that are defined to expect no argument, the option can be enabled by setting the environment variable without a value (empty or NULL string), the string 'yes', or a non-zero number. Any other value for the environment variable will result in the option not being set. There are a couple exceptions to these rules that are noted below. .br \fBNOTE\fR: Command line options always override environment variable settings. .TP 22 \fBPMI_FANOUT\fR This is used exclusively with PMI (MPICH2 and MVAPICH2) and controls the fanout of data communications. The srun command sends messages to application programs (via the PMI library) and those applications may be called upon to forward that data to up to this number of additional tasks. Higher values offload work from the srun command to the applications and likely increase the vulnerability to failures. The default value is 32. .IP .TP \fBPMI_FANOUT_OFF_HOST\fR This is used exclusively with PMI (MPICH2 and MVAPICH2) and controls the fanout of data communications. The srun command sends messages to application programs (via the PMI library) and those applications may be called upon to forward that This is used exclusively with PMI (MPICH2 and MVAPICH2) and controls how much the communications from the tasks to the srun are spread out in time in order to avoid overwhelming the srun command with work. The default value is 500 (microseconds) per task. On relatively slow processors or systems with very large processor counts (and large PMI data sets), higher values may be required. .IP .TP \fBSLURM_ACCOUNT\fR Same as \fB\-A, \-\-account\fR .IP .TP \fBSLURM_ACCTG_FREQ\fR Same as \fB\-\-acctg\-freq\fR .IP .TP \fBSLURM_BCAST\fR Same as \fB\-\-bcast\fR .IP .TP \fBSLURM_BCAST_EXCLUDE\fR Same as \fB\-\-bcast\-exclude\fR .IP .TP \fBSLURM_BURST_BUFFER\fR Same as \fB\-\-bb\fR .IP .TP \fBSLURM_CLUSTERS\fR Same as \fB\-M\fR, \fB\-\-clusters\fR .IP .TP \fBSLURM_COMPRESS\fR Same as \fB\-\-compress\fR .IP .TP \fBSLURM_CONF\fR The location of the Slurm configuration file. .IP .TP \fBSLURM_CONSTRAINT\fR Same as \fB\-C\fR, \fB\-\-constraint\fR Same as \fB\-\-cpu\-freq\fR. .IP .TP \fBSLURM_CPUS_PER_GPU\fR Same as \fB\-\-cpus\-per\-gpu\fR .IP .TP \fBSLURM_CPUS_PER_TASK\fR Same as \fB\-c, \-\-cpus\-per\-task\fR or \fB\-\-tres\-per\-task=cpu:#\fR .IP .TP \fBSLURM_DEBUG\fR Same as \fB\-v, \-\-verbose\fR, when set to 1, when set to 2 gives -vv, etc. .IP .TP \fBSLURM_DEBUG_FLAGS\fR Specify debug flags for srun to use. See DebugFlags in the \fBslurm.conf\fR(5) man page for a full list of flags. The environment variable takes precedence over the setting in the slurm.conf. .IP .TP \fBSLURM_DELAY_BOOT\fR Same as \fB\-\-delay\-boot\fR .IP .TP \fBSLURM_DEPENDENCY\fR Same as \fB\-d, \-\-dependency\fR=<\fIjobid\fR> .IP .TP \fBSLURM_DISABLE_STATUS\fR Same as \fB\-X, \-\-disable\-status\fR .IP .TP \fBSLURM_DIST_PLANESIZE\fR Plane distribution size. Only used if \fB\-\-distribution=plane\fR, without \fI=<size>\fR, is set. .IP .TP \fBSLURM_DISTRIBUTION\fR Same as \fB\-m, \-\-distribution\fR .IP .TP .TP \fBSLURM_EXIT_ERROR\fR Specifies the exit code generated when a Slurm error occurs (e.g. invalid options). This can be used by a script to distinguish application exit codes from various Slurm error conditions. Also see \fBSLURM_EXIT_IMMEDIATE\fR. .IP .TP \fBSLURM_EXIT_IMMEDIATE\fR Specifies the exit code generated when the \fB\-\-immediate\fR option is used and resources are not currently available. This can be used by a script to distinguish application exit codes from various Slurm error conditions. Also see \fBSLURM_EXIT_ERROR\fR. .IP .TP \fBSLURM_EXPORT_ENV\fR Same as \fB\-\-export\fR .IP .TP \fBSLURM_GPU_BIND\fR Same as \fB\-\-gpu\-bind\fR .IP .TP \fBSLURM_GPU_FREQ\fR Same as \fB\-\-gpu\-freq\fR .IP .TP \fBSLURM_GPUS\fR Same as \fB\-G, \-\-gpus\fR .IP .TP \fBSLURM_GPUS_PER_NODE\fR Same as \fB\-\-gpus\-per\-node\fR .IP .TP \fBSLURM_GPUS_PER_TASK\fR Same as \fB\-\-gpus\-per\-task\fR .IP .TP \fBSLURM_GRES\fR Same as \fB\-\-gres\fR. Also see \fBSLURM_STEP_GRES\fR .IP .IP .TP \fBSLURM_JOB_ID\fR Same as \fB\-\-jobid\fR .IP .TP \fBSLURM_JOB_NAME\fR Same as \fB\-J, \-\-job\-name\fR except within an existing allocation, in which case it is ignored to avoid using the batch job's name as the name of each job step. .IP .TP \fBSLURM_JOB_NUM_NODES\fR Same as \fB\-N, \-\-nodes\fR. Total number of nodes in the job's resource allocation. .IP .TP \fBSLURM_KILL_BAD_EXIT\fR Same as \fB\-K, \-\-kill\-on\-bad\-exit\fR. Must be set to 0 or 1 to disable or enable the option. .IP .TP \fBSLURM_LABELIO\fR Same as \fB\-l, \-\-label\fR .IP .TP \fBSLURM_MEM_BIND\fR Same as \fB\-\-mem\-bind\fR .IP .TP \fBSLURM_MEM_PER_CPU\fR Same as \fB\-\-mem\-per\-cpu\fR .IP .TP \fBSLURM_MEM_PER_GPU\fR Same as \fB\-\-mem\-per\-gpu\fR .IP .TP \fBSLURM_MEM_PER_NODE\fR Same as \fB\-\-mem\fR .IP .TP .IP .TP \fBSLURM_NO_KILL\fR Same as \fB\-k\fR, \fB\-\-no\-kill\fR .IP .TP \fBSLURM_NPROCS\fR Same as \fB\-n, \-\-ntasks\fR. See \fBSLURM_NTASKS\fR. Included for backwards compatibility. .IP .TP \fBSLURM_NTASKS\fR Same as \fB\-n, \-\-ntasks\fR .IP .TP \fBSLURM_NTASKS_PER_CORE\fR Same as \fB\-\-ntasks\-per\-core\fR .IP .TP \fBSLURM_NTASKS_PER_GPU\fR Same as \fB\-\-ntasks\-per\-gpu\fR .IP .TP \fBSLURM_NTASKS_PER_NODE\fR Same as \fB\-\-ntasks\-per\-node\fR .IP .TP \fBSLURM_NTASKS_PER_SOCKET\fR Same as \fB\-\-ntasks\-per\-socket\fR .IP .TP \fBSLURM_OPEN_MODE\fR Same as \fB\-\-open\-mode\fR .IP .TP \fBSLURM_OVERCOMMIT\fR Same as \fB\-O, \-\-overcommit\fR .IP .TP \fBSLURM_OVERLAP\fR Same as \fB\-\-overlap\fR .IP .TP \fBSLURM_POWER\fR Same as \fB\-\-power\fR .IP .TP \fBSLURM_PROFILE\fR Same as \fB\-\-profile\fR .IP .TP \fBSLURM_PROLOG\fR Same as \fB\-\-prolog\fR .IP .TP \fBSLURM_QOS\fR Same as \fB\-\-qos\fR .IP .TP \fBSLURM_REMOTE_CWD\fR Same as \fB\-D, \-\-chdir=\fR .IP .TP \fBSLURM_REQ_SWITCH\fR When a tree topology is used, this defines the maximum count of switches desired for the job allocation and optionally the maximum time to wait for that number of switches. See \fB\-\-switches\fR .IP .TP \fBSLURM_RESERVATION\fR Same as \fB\-\-reservation\fR .IP .TP \fBSLURM_RESV_PORTS\fR Same as \fB\-\-resv\-ports\fR .IP .TP \fBSLURM_SEND_LIBS\fR Same as \fB\-\-send\-libs\fR .IP .TP \fBSLURM_SIGNAL\fR Same as \fB\-\-signal\fR .IP Same as \fB\-e, \-\-error\fR .IP .TP \fBSRUN_INPUT\fR Same as \fB\-i, \-\-input\fR .IP .TP \fBSRUN_OUTPUT\fR Same as \fB\-o, \-\-output\fR .IP .TP \fBSLURM_STEP_GRES\fR Same as \fB\-\-gres\fR (only applies to job steps, not to job allocations). Also see \fBSLURM_GRES\fR .IP .TP \fBSLURM_STEP_KILLED_MSG_NODE_ID\fR=ID If set, only the specified node will log when the job or step are killed by a signal. .IP .TP \fBSLURM_TASK_EPILOG\fR Same as \fB\-\-task\-epilog\fR .IP .TP \fBSLURM_TASK_PROLOG\fR Same as \fB\-\-task\-prolog .IP .TP \fBSLURM_TEST_EXEC\fR If defined, srun will verify existence of the executable program along with user execute permission on the node where srun was called before attempting to launch it on nodes in the step. .IP .TP \fBSLURM_THREAD_SPEC\fR Same as \fB\-\-thread\-spec\fR .IP .TP \fBSLURM_THREADS\fR Same as \fB\-T, \-\-threads\fR .IP .IP .TP \fBSLURM_TRES_PER_TASK\fR Set to the value of \fB\-\-tres\-per\-task\fR. If \fB\-\-cpus\-per\-task\fR or \fB\-\-gpus\-per\-task\fR is specified, it is also set in \fBSLURM_TRES_PER_TASK\fR as if it were specified in \fB\-\-tres\-per\-task\fR. .IP .TP \fBSLURM_UMASK\fR If defined, Slurm will use the defined \fIumask\fR to set permissions when creating the output/error files for the job. .IP .TP \fBSLURM_UNBUFFEREDIO\fR Same as \fB\-u, \-\-unbuffered\fR .IP .TP \fBSLURM_USE_MIN_NODES\fR Same as \fB\-\-use\-min\-nodes\fR .IP .TP \fBSLURM_WAIT\fR Same as \fB\-W, \-\-wait\fR .IP .TP \fBSLURM_WAIT4SWITCH\fR Max time waiting for requested switches. See \fB\-\-switches\fR .IP .TP \fBSLURM_WCKEY\fR Same as \fB\-W, \-\-wckey\fR .IP .TP \fBSLURM_WORKING_DIR\fR \fB\-D, \-\-chdir\fR .IP .TP \fBSLURMD_DEBUG\fR Same as \fB\-\-slurmd\-debug\fR. .IP .TP \fBSRUN_CONTAINER\fR .SH "OUTPUT ENVIRONMENT VARIABLES" .PP srun will set some environment variables in the environment of the executing tasks on the remote compute nodes. These environment variables are: .TP 22 \fBSLURM_*_HET_GROUP_#\fR For a heterogeneous job allocation, the environment variables are set separately for each component. .IP .TP \fBSLURM_CLUSTER_NAME\fR Name of the cluster on which the job is executing. .IP .TP \fBSLURM_CPU_BIND_LIST\fR \fB\-\-cpu\-bind\fR map or mask list (list of Slurm CPU IDs or masks for this node, CPU_ID = Board_ID x threads_per_board + Socket_ID x threads_per_socket + Core_ID x threads_per_core + Thread_ID). .IP .TP \fBSLURM_CPU_BIND_TYPE\fR \fB\-\-cpu\-bind\fR type (none,rank,map_cpu:,mask_cpu:). .IP .TP \fBSLURM_CPU_BIND_VERBOSE\fR \fB\-\-cpu\-bind\fR verbosity (quiet,verbose). .IP .TP \fBSLURM_CPU_FREQ_REQ\fR Contains the value requested for cpu frequency on the srun command as a numerical frequency in kilohertz, or a coded value for a request of \fIlow\fR, \fImedium\fR,\fIhighm1\fR or \fIhigh\fR for the frequency. See the description of the \fB\-\-cpu\-freq\fR option or the \fBSLURM_CPU_FREQ_REQ\fR input environment variable. .IP .TP \fBSLURM_CPUS_ON_NODE\fR Number of CPUs available to the step on this node. \fBNOTE\fR: The \fBselect/linear\fR plugin allocates entire nodes to jobs, so the value indicates the total count of CPUs on the node. For the \fBcons/tres\fR plugin, this number indicates the number of CPUs on this node allocated to the step. .IP .TP \fBSLURM_GPUS_ON_NODE\fR Number of GPUs available to the step on this node. .IP .TP \fBSLURM_GTIDS\fR Global task IDs running on this node. Zero origin and comma separated. It is read internally by pmi if Slurm was built with pmi support. Leaving the variable set may cause problems when using external packages from within the job (Abaqus and Ansys have been known to have problems when it is set \- consult the appropriate documentation for 3rd party software). .IP .TP \fBSLURM_HET_SIZE\fR Set to count of components in heterogeneous job. .IP .TP \fBSLURM_JOB_ACCOUNT\fR Account name associated of the job allocation. .IP .TP \fBSLURM_JOB_CPUS_PER_NODE\fR Count of CPUs available to the job on the nodes in the allocation, using the format \fICPU_count\fR[(x\fInumber_of_nodes\fR)][,\fICPU_count\fR [(x\fInumber_of_nodes\fR)] ...]. For example: SLURM_JOB_CPUS_PER_NODE='72(x2),36' indicates that on the first and second nodes (as listed by SLURM_JOB_NODELIST) the allocation has 72 CPUs, while the third node has 36 CPUs. \fBNOTE\fR: The \fBselect/linear\fR plugin allocates entire nodes to jobs, so the value indicates the total count of CPUs on allocated nodes. The \fBselect/cons_tres\fR plugin allocates individual CPUs to jobs, so this number indicates the number of CPUs allocated to the job. .IP .TP \fBSLURM_JOB_DEPENDENCY\fR Set to value of the \fB\-\-dependency\fR option. .IP .TP \fBSLURM_JOB_END_TIME\fR The UNIX timestamp for a job's projected end time. .IP .TP \fBSLURM_JOB_GPUS\fR The global GPU IDs of the GPUs allocated to this job. The GPU IDs are not .IP .TP \fBSLURM_JOB_NODELIST\fR List of nodes allocated to the job. .IP .TP \fBSLURM_JOB_NODES\fR Total number of nodes in the job's resource allocation. .IP .TP \fBSLURM_JOB_PARTITION\fR Name of the partition in which the job is running. .IP .TP \fBSLURM_JOB_QOS\fR Quality Of Service (QOS) of the job allocation. .IP .TP \fBSLURM_JOB_RESERVATION\fR Advanced reservation containing the job allocation, if any. .IP .TP \fBSLURM_JOB_START_TIME\fR The UNIX timestamp for a job's start time. .IP .TP \fBSLURM_JOBID\fR Job id of the executing job. See \fBSLURM_JOB_ID\fR. Included for backwards compatibility. .IP .TP \fBSLURM_LAUNCH_NODE_IPADDR\fR IP address of the node from which the task launch was initiated (where the srun command ran from). .IP .TP \fBSLURM_LOCALID\fR Node local task ID for the process within a job. .IP .TP \fBSLURM_MEM_BIND_LIST\fR \fB\-\-mem\-bind\fR map or mask list (<list of IDs or masks for this node>). \fB\-\-mem\-bind\fR type (none,rank,map_mem:,mask_mem:). .IP .TP \fBSLURM_MEM_BIND_VERBOSE\fR \fB\-\-mem\-bind\fR verbosity (quiet,verbose). .IP .TP \fBSLURM_NODEID\fR The relative node ID of the current node. .IP .TP \fBSLURM_NPROCS\fR Total number of processes in the current job or job step. See \fBSLURM_NTASKS\fR. Included for backwards compatibility. .IP .TP \fBSLURM_NTASKS\fR Total number of processes in the current job or job step. .IP .TP \fBSLURM_OVERCOMMIT\fR Set to \fB1\fR if \fB\-\-overcommit\fR was specified. .IP .TP \fBSLURM_PRIO_PROCESS\fR The scheduling priority (nice value) at the time of job submission. This value is propagated to the spawned processes. .IP .TP \fBSLURM_PROCID\fR The MPI rank (or relative process ID) of the current process. .IP .TP \fBSLURM_SRUN_COMM_HOST\fR IP address of srun communication host. .IP .TP \fBSLURM_SRUN_COMM_PORT\fR srun communication port. .IP .TP \fBSLURM_CONTAINER\fR .TP \fBSLURM_STEP_GPUS\fR The global GPU IDs of the GPUs allocated to this step (excluding batch and interactive steps). The GPU IDs are not relative to any device cgroup, even if devices are constrained with task/cgroup. .IP .TP \fBSLURM_STEP_ID\fR The step ID of the current job. .IP .TP \fBSLURM_STEP_LAUNCHER_PORT\fR Step launcher port. .IP .TP \fBSLURM_STEP_NODELIST\fR List of nodes allocated to the step. .IP .TP \fBSLURM_STEP_NUM_NODES\fR Number of nodes allocated to the step. .IP .TP \fBSLURM_STEP_NUM_TASKS\fR Number of processes in the job step or whole heterogeneous job step. .IP .TP \fBSLURM_STEP_TASKS_PER_NODE\fR Number of processes per node within the step. .IP .TP \fBSLURM_STEPID\fR The step ID of the current job. See \fBSLURM_STEP_ID\fR. Included for backwards compatibility. .IP .TP \fBSLURM_SUBMIT_DIR\fR The directory from which the allocation was invoked from. .IP .TP \fBSLURM_SUBMIT_HOST\fR The hostname of the computer from which the allocation was invoked from. indicates that the first three nodes will each execute two tasks and the fourth node will execute one task. .IP .TP \fBSLURM_TOPOLOGY_ADDR\fR This is set only if the system has the topology/tree plugin configured. The value will be set to the names network switches which may be involved in the job's communications from the system's top level switch down to the leaf switch and ending with node name. A period is used to separate each hardware component name. .IP .TP \fBSLURM_TOPOLOGY_ADDR_PATTERN\fR This is set only if the system has the topology/tree plugin configured. The value will be set component types listed in \fBSLURM_TOPOLOGY_ADDR\fR. Each component will be identified as either "switch" or "node". A period is used to separate each hardware component type. .IP .TP \fBSLURM_TRES_PER_TASK\fR Set to the value of \fB\-\-tres\-per\-task\fR. .IP .TP \fBSLURM_UMASK\fR The \fIumask\fR in effect when the job was submitted. .IP .TP \fBSLURMD_NODENAME\fR Name of the node running the task. In the case of a parallel job executing on multiple compute nodes, the various tasks will have this environment variable set to different values on each compute node. .IP .TP \fBSRUN_DEBUG\fR Set to the logging level of the \fBsrun\fR command. Default value is 3 (info level). The value is incremented or decremented based upon the \fB\-\-verbose\fR and \fB\-\-quiet\fR options. .IP .SH "SIGNALS AND ESCAPE SEQUENCES" Signals sent to the \fBsrun\fR command are automatically forwarded to the tasks it is controlling with a few exceptions. The escape sequence \fB<control\-c>\fR will report the state of all tasks associated with the \fBsrun\fR command. If \fB<control\-c>\fR is entered twice within one second, then the associated SIGINT signal will be sent to all tasks of communications through the PMI2 or PMIx APIs. For example: "srun \-n16 a.out". 2. Slurm creates a resource allocation for the job and then mpirun launches tasks using Slurm's infrastructure (OpenMPI). 3. Slurm creates a resource allocation for the job and then mpirun launches tasks using some mechanism other than Slurm, such as SSH or RSH. These tasks are initiated outside of Slurm's monitoring or control. Slurm's epilog should be configured to purge these tasks when the job's allocation is relinquished, or the use of pam_slurm_adopt is highly recommended. See \fIhttps://slurm.schedmd.com/mpi_guide.html\fR for more information on use of these various MPI implementations with Slurm. .SH "MULTIPLE PROGRAM CONFIGURATION" Comments in the configuration file must have a "#" in column one. The configuration file contains the following fields separated by white space: .TP Task rank One or more task ranks to use this configuration. Multiple values may be comma separated. Ranges may be indicated with two numbers separated with a '\-' with the smaller number first (e.g. "0\-4" and not "4\-0"). To indicate all tasks not otherwise specified, specify a rank of '*' as the last line of the file. If an attempt is made to initiate a task for which no executable program is defined, the following error message will be produced "No executable program specified for this task". .IP .TP Executable The name of the program to execute. May be fully qualified pathname if desired. .IP .TP Arguments Program arguments. The expression "%t" will be replaced with the task's number. The expression "%o" will be replaced with the task's offset within this range (e.g. a configured task rank value of "1\-5" would have offset values of "0\-4"). Single quotes may be used to avoid having the enclosed values interpreted. This field is optional. Any arguments for the program entered on the command line will be added $ srun \-n8 \-l \-\-multi\-prog silly.conf 0: offset:0 1: task:1 2: offset:1 3: offset:2 4: linux15.llnl.gov 5: linux16.llnl.gov 6: linux17.llnl.gov 7: task:7 .fi .SH "EXAMPLES" .TP \fBExample 1:\fR This simple example demonstrates the execution of the command \fBhostname\fR in eight tasks. At least eight processors will be allocated to the job (the same as the task count) on however many nodes are required to satisfy the request. The output of each task will be proceeded with its task number. (The machine "dev" in the example below has a total of two CPUs per node) .IP .nf $ srun \-n8 \-l hostname 0: dev0 1: dev0 2: dev1 3: dev1 4: dev2 5: dev2 6: dev3 7: dev3 .fi .TP \fBExample 2:\fR The srun \fB\-r\fR option is used within a job script to run two job steps on disjoint nodes in the following example. The script is run using allocate mode instead of as a batch job in this case. .IP .nf $ cat test.sh #!/bin/sh echo $SLURM_JOB_NODELIST srun \-lN2 \-r2 hostname srun \-lN2 hostname $ salloc \-N4 test.sh dev[7\-10] 0: dev9 1: dev10 0: dev7 squeue squeue \-s wait $ salloc \-N4 test.sh JOBID PARTITION NAME USER ST TIME NODES NODELIST 65641 batch test.sh grondo R 0:01 4 dev[7\-10] STEPID PARTITION USER TIME NODELIST 65641.0 batch grondo 0:01 dev[7\-8] 65641.1 batch grondo 0:01 dev[9\-10] .fi .TP \fBExample 4:\fR This example demonstrates how one executes a simple MPI job. We use \fBsrun\fR to build a list of machines (nodes) to be used by \fBmpirun\fR in its required format. A sample command line and the script to be executed follow. .IP .nf $ cat test.sh #!/bin/sh MACHINEFILE="nodes.$SLURM_JOB_ID" # Generate Machinefile for mpi such that hosts are in the same # order as if run via srun # srun \-l /bin/hostname | sort \-n | awk '{print $2}' > $MACHINEFILE # Run using generated Machine file: mpirun \-np $SLURM_NTASKS \-machinefile $MACHINEFILE mpi\-app rm $MACHINEFILE $ salloc \-N2 \-n4 test.sh .fi .TP \fBExample 5:\fR This simple example demonstrates the execution of different jobs on different nodes in the same srun. You can do this for any number of nodes or any number of jobs. The executables are placed on the nodes sited by the SLURM_NODEID env var. Starting at 0 and going to the number specified on the srun command line. .IP .nf $ cat test.sh case $SLURM_NODEID in 0) echo "I am running on " hostname ;; 1) hostname We request that four sockets per node and two cores per socket be dedicated to the job. .IP .nf $ srun \-N2 \-B 4\-4:2\-2 a.out .fi .TP \fBExample 7:\fR This example shows a script in which Slurm is used to provide resource management for a job by executing the various job steps as processors become available for their dedicated use. .IP .nf $ cat my.script #!/bin/bash srun \-n4 prog1 & srun \-n3 prog2 & srun \-n1 prog3 & srun \-n1 prog4 & wait .fi .TP \fBExample 8:\fR This example shows how to launch an application called "server" with one task, 8 CPUs and 16 GB of memory (2 GB per CPU) plus another application called "client" with 16 tasks, 1 CPU per task (the default) and 1 GB of memory per task. .IP .nf $ srun \-n1 \-c16 \-\-mem\-per\-cpu=1gb server : \-n16 \-\-mem\-per\-cpu=1gb client .fi .TP \fBExample 9:\fR This example highlights the difference in behavior with srun's \fB\-\-exclusive\fR and \fB\-\-overlap\fR flags when run from inside a job allocation. The \fB\-\-overlap\fR flag allows both steps to start at the same time. The \fB\-\-exclusive\fR flag makes the second step wait until the first has finished. .IP .nf $ salloc -n1 salloc: Granted job allocation 9553 salloc: Waiting for resource configuration salloc: Nodes node01 are ready for job $ date +%T; srun -n1 --overlap -l sleep 3 & $ srun -n1 --overlap -l date +%T & 14:36:04 [1] 144341 [2]+ Done srun -n1 --exclusive -l date +%T .fi .TP \fBExample 10:\fR This example demonstrates how jobs that are not evenly split among multiple nodes can run into problems of tasks not being able to start when there are enough CPUs free to run that task on a single node. This example shows a job that was allocated 2 CPUs on one node and 24 CPUs on the other node. .IP .nf $ echo $SLURM_NODELIST; echo $SLURM_JOB_CPUS_PER_NODE node[01-02] 2,24 .fi If a task is started that occupies the CPUs on the node with fewer CPUs, then a subsequent task that should be able to start on the other node will not start because it inherits the requirement for the number of nodes from the job allocation. The job step will stay pending until the first job step completes or until it is cancelled. .nf $ srun -n4 --exact sleep 1800 & [1] 151837 $ srun -n2 --exact hostname ^Csrun: Cancelled pending job step with signal 2 srun: error: Unable to create step for job 2677: Job/step already completing or completed .fi If the job step is started, explicitly requesting a single node, then the step is able to run. .nf $ srun -n2 -N1 --exact hostname node02 node02 .fi This behavior can be changed by adding \fBSelectTypeParameters=CR_Pack_Nodes\fR to your slurm.conf. The logic to pack nodes will allow job steps to start on a single node without having to explicitly request a single node. .SH "COPYING" Copyright (C) 2006\-2007 The Regents of the University of California. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). .br Copyright (C) 2008\-2010 Lawrence Livermore National Security. .br Copyright (C) 2010\-2022 SchedMD LLC. .LP \fBsalloc\fR(1), \fBsattach\fR(1), \fBsbatch\fR(1), \fBsbcast\fR(1), \fBscancel\fR(1), \fBscontrol\fR(1), \fBsqueue\fR(1), \fBslurm.conf\fR(5), \fBsched_setaffinity\fR (2), \fBnuma\fR (3) \fBgetrlimit\fR (2)