Versions Compared

Key

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

...

Code Block
languagebash
titleExample CPU job
#!/bin/bash -l
#SBATCH --job-name=job_name
#SBATCH --time=01:00:00
#SBATCH --account=grantname<grantname-cpucpu>
#SBATCH --partition=plgrid

## change directory to one where sbatch command was invoked
cd $SLURM_SUBMIT_DIR

module load python 
python myapp.py

The job will be named "job_name", declares a run time of 1 hour, is being run with the "grantname-cpu" account, is submitted to "plgrid" (default for CPU jobs) partition. The job operates in the directory where the batch command was issued, loads a python module, and executes a python application. Job's output will be written to a file named slurm-<JOBID>.out in the current directory. More information and a detailed explanation for each parameter can be found here: https://slurm.schedmd.com/quickstart.html and https://slurm.schedmd.com/sbatch.html

...

Code Block
languagebash
titleExample advanced CPU job
#!/bin/bash -l
#SBATCH --job-name=job_name
#SBATCH --time=01:00:00
#SBATCH --account=grantname-cpu
#SBATCH --partition=plgrid
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --mem=180G
#SBATCH --output="joblog.txt"
#SBATCH --error="joberr.txt"

## change directory to one where sbatch command was invoked
cd $SLURM_SUBMIT_DIR

module load scipy-bundle 
mpiexec myapp-mpi.py

...

Code Block
languagebash
titleExample advanced CPU job
#!/bin/bash -l
#SBATCH --job-name=job_name
#SBATCH --time=01:00:00
#SBATCH --account=grantname-gpu
#SBATCH --partition=plgrid-gpu-v100
#SBATCH --cpus-per-task=4
#SBATCH --mem=40G
#SBATCH --gres=gpu

## change directory to one where sbatch command was invoked
cd $SLURM_SUBMIT_DIR

module load cuda 
./myapp

Please note the specific account name and partition for GPU jobs. The job allocated one GPU with the --gres parameter. The whole GPU is allocated for the job, --memory parameter refers to the system memory used by the job. More information on how to use GPU's can be found here: https://slurm.schedmd.com/gres.html