Chapter 12 Mindboggle

12.1 Job Script

On the remote computer create job script.

vi ~/scripts/ACAP/mindboggle-job.sh

Copy and paste.

#!/bin/bash

#SBATCH --time=30:00:00   # walltime
#SBATCH --ntasks=1   # number of processor cores (i.e. tasks)
#SBATCH --nodes=1   # number of nodes
#SBATCH --mem-per-cpu=16G  # memory per CPU core

# LOAD ENVIRONMENTAL VARIABLES
username=`id -un`

# INSERT CODE, AND RUN YOUR PROGRAMS HERE
singularity run \
--bind /work/${username}/data/ACAP/mindboggle:/home/jovyan/work \
/home/${username}/apps/mindboggle.img \
mindboggle \
/home/jovyan/work/freesurfer_subjects/${1} \
--ants /home/jovyan/work/ants_subjects/${1}/antsBrainSegmentation.nii.gz \
--roygbiv \
--working /home/jovyan/work/mindboggled/working \
--out /home/jovyan/work/mindboggled

12.2 Batch Script

Create batch script.

vi ~/scripts/ACAP/mindboggle-batch.sh

Copy and paste.

#!/bin/bash
curTime=`date +"%Y%m%d-%H%M%S"`
username=`id -un`
mkdir -p ~/logfiles/ACAP/${curTime}
for subjid in $(ls /work/${username}/data/ACAP/mindboggle/freesurfer_subjects/ | grep -e "^sub*"); do
  sbatch \
  -o ~/logfiles/ACAP/${curTime}/output-${subjid}.txt \
  -e ~/logfiles/ACAP/${curTime}/error-${subjid}.txt \
  ~/scripts/ACAP/mindboggle-job.sh \
  ${subjid}
  sleep 1
done

12.3 Submit Jobs with Batch Script

Submit jobs.

sh ~/scripts/ACAP/mindboggle-batch.sh

You can check the status of your jobs by checking if it is running or pending.

squeue

You can check the outputs.

tail -n 5 ~/logfiles/ACAP/<date>/output*

12.4 Download Directory / Sync Directory with Arc

Back on your local computer make sure you have the directory already.

mkdir -p /Volumes/bobo/data/ACAP/mindboggle/mindboggled/

Then sync the data from the remote computer to your local computer.

rsync -rauv \
ashley.ware@arc.ucalgary.ca:/work/ashley.ware/data/ACAP/mindboggle/mindboggled/ \
/Volumes/bobo/data/ACAP/mindboggle/mindboggled/