Skip to content

Latest commit

 

History

History
70 lines (64 loc) · 2.68 KB

3. sbatchOnBeluga.md

File metadata and controls

70 lines (64 loc) · 2.68 KB

Compute Canada is not made to be used like a regular terminal. In fact, very little computation power is dedicated to the terminals of its users. Most of the computing power is done through sbatch. These will allow you to run a job without having your terminal open.
General information on sbatch can be found: https://docs.computecanada.ca/wiki/Running_jobs

The sbatch script need to be saved as a file within your private directory. The script will include two part. First, it will include the character sequence to run the sbatch, include the memory allocation and time allowed. Second, it will be the actual command that you want to run.

Example of serial job using fmriprep

Note that your command would be the same as you would run it on your terminal. Hence, you need to load a module prior the using it

#!/bin/bash
#SBATCH --job-name=JOB_NAME
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus=16
#SBATCH --mem=32G
#SBATCH --time=20:00:00
#SBATCH --account=def-PI
#SBATCH --mail-user=youremail@gmail.com
#SBATCH --mail-type=BEGIN
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-type=REQUEUE
#SBATCH --mail-type=ALL

module load singularity/3.2
cd /path/to/working/directory
singularity run --cleanenv --bind /path/to/dataset:/data \
--bind /path/to/fmriprep/fmriprepOutput:/out \
--bind '/path/to/working/directory/WorkingDirectory:/working.directory' \
--bind '/path/to/fmriprep/license.txt:/license.txt' \
/path/to/fmriprep/software/fmriprep.1.4.1.simg \
--participant-label 011 \
--ignore slicetiming \
--output-spaces 'MNI152NLin6Asym' 'T1w' \
--fs-license-file '/license.txt' \
-w '/working.directory/' \
/data /out participant

Example of job runned in parallel

It is better to run small array (1-2 participants, to make sure your script work). Then, run all your participants in parallel.

#!/bin/bash
#SBATCH --job-name=Job_Array_Name
#SBATCH --output=fMRIPrepArray_%A_%a.out
#SBATCH --time=2-00:00
#SBATCH --mem-per-cpu=30GB
#SBATCH --mail-user=youremail@gmail.com
#SBATCH --mail-type=FAIL
#SBATCH --array=1-123
#SBATCH --account=def-mathroy

module load singularity/3.2
cd /path/to/working/directory
sub=$( printf "%03d" ${SLURM_ARRAY_TASK_ID} )
echo "SLURM_ARRAY_TASK_ID: " $sub
singularity run --cleanenv --bind /path/to/dataset:/data:ro \
--bind /path/to/fmriprep/ouput/:/out \
--bind '/path/to/working/directory/:/working.directory' \
--bind '/path/to/fmriprep/license.txt:/license.txt' \
/path/to/fmriprep/software/fmriprep.1.4.1.simg \
--participant-label sub-${sub} \
--ignore slicetiming \
--output-spaces 'MNI152NLin6Asym' 'T1w' \
--fs-license-file '/license.txt' \
-w '/working.directory/' \
--notrack \
--skip_bids_validation \
/data /out participant