This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision |
| tutorials_scheduler [2025/05/27 19:25] – [Non-interactive Jobs] docuadmin | tutorials_scheduler [2025/05/27 19:32] (current) – [Non-interactive Jobs] docuadmin |
|---|
| |
| Following the ''#SBATCH'' directives will be the commands or scripts that make up the compute job you want to execute. To distribute the tasks across the allocated processors, the batch script should contain an 'srun' command or similar command (''mpirun'', ''mpiexec'', etc) to assign tasks to allocated processors. Without such a command the commands issued in the batch script will just be steps in a single task assigned to a single processor. The output of the following batch script will illustrate this: | Following the ''#SBATCH'' directives will be the commands or scripts that make up the compute job you want to execute. To distribute the tasks across the allocated processors, the batch script should contain an 'srun' command or similar command (''mpirun'', ''mpiexec'', etc) to assign tasks to allocated processors. Without such a command the commands issued in the batch script will just be steps in a single task assigned to a single processor. The output of the following batch script will illustrate this: |
| | |
| | File ''printhostname.sub'': |
| |
| #!/bin/bash | #!/bin/bash |
| | |
| #SBATCH -N2 | #SBATCH -N 2 |
| #SBATCH -n 10 | #SBATCH -n 10 |
| | |
| echo "The following 'hostname' commands come from 'srun':" | echo "The following 'hostname' commands come from 'srun':" |
| srun hostname | sort | srun hostname | sort |
| | |
| | Submit a batch job by supplying the batch script as the first argument of the 'sbatch' command: |
| | |
| | sbatch printhostname.sub |
| |
| Output: | Output: |
| node2 | node2 |
| node2 | node2 |
| | |
| | |