Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.
Commentaire: Removed a space (would cause errors if copy and pasted))

...

Every script you submit to Slurm through sbatch should have the following options specified in the file:

Basic sbatch Options.
#SBATCH -J <jobName>
Gives the job a name that will make it easy to find when you run squeue or sacct.
#SBATCH -t Days-Hours:Minutes:Seconds

Sets the time limit for the job. Other acceptable time formats include:

  • Minutes
  • Minutes:Seconds
  • Hours:Minutes:Seconds
  • Days-Hours
  • Days-Hours:Minutes
#SBATCH -p <partition>

Specifies which partition to run your job on. Choices includes:

  • tier1
  • tier2
  • tier3
  • onboard
  • debug

Run my-accounts to see which partitions you can run jobs on.

#SBATCH -A <accountName>
Specifies which account to run the job under. Run my-accounts to see your accounts.
#SBATCH --mem=<size[units]>
How much memory your job will need. Units include: K, M, G, and T. If no unit is specified M will be used. If your job runs out of memory, just increase size.
#SBATCH -o <filename.o>
Where the output of your job is stored. End the file name with a .o so it is easy to find.
#SBATCH -e <filename.e>
Same as -o, but for error.
#SBATCH --mail-user=<email>
Email address to mail any notifications to for the job
#SBATCH --mail-type=<type>
Under what circumstances you want to be emailed about. Type could be BEGIN for when the job starts, END for when the job ends, FAIL for if the job fails, of ALL for all the above.
sbatch Options for Resources
#SBATCH -n <number>
The number of tasks your job will generate. Specifying this tells Slurm how many cores you will need. By default 1 core is used per task; use -c to change this value.
#SBATCH -c <ncpus>
Specifies number of CPUs needed for each task. For example, if you have 4 tasks that use 20 cores each, you would get a total of 80 cores. So, you would use #SBATCH -c 20. This option makes sure that those 20 cores for each task are on the same node.
#SBATCH --gres=gpu[:type:count]
For when your job needs to run on a GPU. See the documentation on --gres here.

Example Bash Script

The following is the example script slurm-mpisingle-core.sh. This can be found by running grab-examples when you log into SPORC. 

...

# This is an example job file for a multi-single core CPU MPIbound job.program
# Note that all of the following statements below that begin

...

# Name of the job - You'll probably want to customize this.
#SBATCH -J mpi_test
# Standard out and Standard Error output files
#SBATCH -o mpi_test.o
#SBATCH -e mpi_test.e
# To send emails, set the address below and remove one of the '#' sings

...

#Put the job in the appropriate partition matching the account and request FOURone courscore
#SBATCH - A <account_name> -p <onboard, tier1, tier2, tier3> -nc 41
#Job membory requirements in MB=m (default), GB=g, or TB=t

...

echo "(${HOSTNAME}) sleeping for 1 minute to simulate work (ish)"
sleep 60
echo "(${HOSTNAME}) evenAhhh, though this script as claimed for cores"
echo "(${HOSTNAME}) ... it won't be using all "
sleep 60
echo "(${HOSTNAME}) Ahhh, alarm clock!"

Running sbatch 

[abc1234@sporcsubmit ~]$ sbatch slurm-mpi.sh
Submitted batch job 2914
  • If no filename is specified, then sbatch will read from the command line
  • The number after job is the job_id
  • See squeue and sacct for how to check the progress of the job

See Using the Cluster - Advanced Usage for topics such as loops and dependent jobs. Some documentation will also give you example bash scripts for your specific program.

srun

...

alarm clock!"

Running sbatch 

[abc1234@sporcsubmit ~]$ sbatch slurm-mpi.sh
Submitted batch job 2914
  • If no filename is specified, then sbatch will read from the command line
  • The number after job is the job_id
  • See squeue and sacct for how to check the progress of the job

See Using the Cluster - Advanced Usage for topics such as loops and dependent jobs. Some documentation will also give you example bash scripts for your specific program.

srun

srun is used for jobs that require MPI. It schedules your job to be ran on the Slurm Scheduler similar to sbatch. To use simply create an sbatch file like the example above and add srun ./<mpi_program> below the sbatch commands. Then run the sbatch file as you normally would.

Small srun Example

#!/bin/bash -l
# NOTE the -l flag!
# This is an example job file for a multi-core MPI job.
# If you need any help,please email rc-help@rit.edu
# Name of the job 
#SBATCH -J mpi_test
# Standard out and Standard Error output files
#SBATCH -o mpi_test.o
#SBATCH -e mpi_test.e
#Put the job in the appropriate partition matching the account and request FOUR cores
#SBATCH - A <account_name> -p <onboard, tier1, tier2, tier3> -n 4
#Job membory requirements in MB=m (default), GB=g, or TB=t
#SBATCH --mem=3g
#
# Your job script goes below this line.
#
srun ./mpi_program

sinteractive

If you need user interaction or are only running something once then run `sinteractive`. This will ask you for the resources you require and then connect you to the scheduled node. If you don't know what that entails, just try it. Be sure to exit from your sinteractive session by running exit when you're done, otherwise you're a terrible person for requesting resources you aren't using. For the full process, see our documentation

...