emdupre / poldracklab.github.io

Poldracklab guide
https://poldracklab.org/
Creative Commons Attribution 4.0 International
0 stars 0 forks source link

Job submission #3

Open ebridge2 opened 5 months ago

ebridge2 commented 5 months ago

Make an example of a job, and an array job, and assign back to me to test when finished

emdupre commented 5 months ago
#!/bin/bash
#
#SBATCH --job-name=fMRIPrep
#SBATCH --output=fmriprep.%j.out
#SBATCH --time=1-00:00
#SBATCH --cpus-per-task=16
#SBATCH --mem-per-cpu=8GB
#SBATCH --mail-user=<your-email>@stanford.edu
#SBATCH --mail-type=FAIL
#SBATCH --array=1-5
#SBATCH -p russpold,owners,normal

# Define directories

DATADIR=</your/project/directory>
SCRATCH=</your/scratch/directory>
SIMGDIR=</your/project/directory/simgs>

# Begin work section
subj_list=(`find $DATADIR -maxdepth 1 -type d -name 'sub-s*' -printf '%f\n' | sort -n -ts -k2.1`)
sub="${subj_list[$SLURM_ARRAY_TASK_ID]}"
echo "SUBJECT_ID: " $sub

singularity run --cleanenv -B ${DATADIR}:/data:ro \
    -B ${SCRATCH}:/out \
    -B ${DATADIR}/license.txt:/license/license.txt:ro \
    ${SIMGDIR}/fmriprep-23-2-0.simg \
    /data /out participant \
        --participant-label ${sub} \
    --output-space MNI152NLin2009cAsym:res-2 \
    -w /out/workdir \
    --notrack \
        --fs-license-file /license/license.txt 
ebridge2 commented 5 months ago

Need to pull fmriprep-23-2-0.simg first to $SIMGDIR @emdupre ?

emdupre commented 5 months ago

Yes ! That assumes the image exists :)

Creating images is probably a separate section.... WDYT ?

ebridge2 commented 5 months ago

Could definitely make sense

Do you think it would be valuable to make a "mini" working example, such as having like 2 subjects broken out somewhere in a new folder called like "dummy_example" on oak, so that one would be able to run the command without needing to submit a massive fmriprep job?

emdupre commented 5 months ago

We could just duplicate (or link out to) the example in the Sherlock docs for normal, non-array jobs : https://www.sherlock.stanford.edu/docs/getting-started/submitting/#batch-scripts

I do think, though, that we should have an example of submitting fMRIPrep array jobs, just since it's such a common use case in the lab ! Maybe we'd have both ? So a sub-section on array jobs within submitting jobs ?

There's also this new Sherlock experiment slurm-o-matic that we could consider linking out to.