Sample Job Script

This is a sample job script that can easily be modified for most Slurm jobs. By setting the value of BIGSCRATCH to either true or false, the script allows user to designate whether to use scratch space on the local compute node (smaller, faster) or on the primary storage node (larger, slightly slower). For assistance configuring your job scripts for your specific workflow, please reach out to Jason Simms (jsimms1@swarthmore.edu).

#!/bin/bash #SBATCH --partition=unowned # Partition (job queue) #SBATCH --requeue # Return job to the queue if preempted #SBATCH --job-name=SAMPLE # Assign a short name to your job #SBATCH --nodes=1 # Number of nodes you require #SBATCH --cpus-per-task=1 # Cores per task (>1 if multithread tasks) #SBATCH --mem-per-cpu=16gb # Real memory per cpu #SBATCH --time=00-01:00:00 # Total run time limit (DD-HH:MM:SS) #SBATCH --output=slurm.%N.%j.out # STDOUT file for SLURM output #SBATCH --mail-type=ALL # Email if anything happens (job start, end, failure, requeue, etc.) #SBATCH --mail-user=NetID@swarthmore.edu ## Set the value of BIGSCRATCH to 'true' if your job is ## anticipated to require more than a few hundred gigabytes ## of scratch space, which includes all input, temporary, ## and output data. If BIGSCRATCH is true, then the job ## will use scratch space on the parallel storage node. ## This is slower than local scratch space on the compute ## nodes but has significantly more space. BIGSCRATCH=false SCRATCHDIR='scratch' if [ "$BIGSCRATCH" = true ] then SCRATCHDIR='data/scratch' fi ## Move files to the scratch location so we can execute the ## job. Make certain to replace the placeholder filenames ## below (data_file_1, my_script) with all files required ## for your job (wildcards such as * are allowed, and by ## default any directories listed will be copied recursively). mkdir -p /$SCRATCHDIR/$USER/$SLURM_JOB_NAME-$SLURM_JOB_ID cp -r \ data_file_1 \ my_script \ /$SCRATCHDIR/$USER/$SLURM_JOB_NAME-$SLURM_JOB_ID ## Change to the scratch directory. cd /$SCRATCHDIR/$USER/$SLURM_JOB_NAME-$SLURM_JOB_ID ## ADD YOUR COMMANDS HERE srun my_script data_file_1 ## Move any outputs and files back to the original submit ## directory and clean-up. cp -pru /$SCRATCHDIR/$USER/$SLURM_JOB_NAME-$SLURM_JOB_ID/* $SLURM_SUBMIT_DIR cd rm -rf /$SCRATCHDIR/$USER/$SLURM_JOB_NAME-$SLURM_JOB_ID ## Hang out for 10 seconds just to ensure all actions complete. sleep 10

Ways you can contact ITS or find information:

ITS Support Portal: https://support.swarthmore.edu
Email: support@swarthmore.edu
Phone: x4357 (HELP) or 610-328-8513
Check out our remote resources at https://swatkb.atlassian.net/wiki/spaces/remote/overview
Check our homepage at https://swarthmore.edu/its