Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

srun can also be invoked outside of a job allocation. In that case, srun requests resources, and when those resources are granted, launches tasks across those resources as a single job and job step.

Load any environment modules before the srun/sbatch/salloc commands. These commands will copy your environment as it is at job submission time.

srun

You can start a calculation/job directly from the commandprompt by using srun. This command submits jobs to the slurm job submission system and can also be used to start the same command on multiple nodes. srun has a wide variety of options to specify resource requirements, including: minimum and maximum node count, processor count, specific nodes to use or not use, and specific node characteristics such as memory and disk space. 

...

Code Block
languagebash
$ srun -n1 --x11 --pty bash
srun: error: No DISPLAY variable set, cannot setup x11 forwarding.

sbatch Examples

Load any environment modules before using the sbatch command to submit your job.

With sbatch, your script file will contain special #SBATCH commands detailing your job requirements. Here is an example:
Code Block
languagebash
#!/bin/bash
 
#SBATCH -J test           # job name
#SBATCH -o job.%j.out     # Name of standard output file (%j expands to %jobId)
#SBATCH -N 2              # Number of nodes requested
#SBATCH -n 16             # Total number of mpi tasks requested
#SBATCH -t 01:30:00       # Run tim e(hh:mm:ss)
 
# Launch MPI-based executable
prun ./a.out

...