Skip to content

Commit b58d55d

Browse files
Merge pull request #36 from marcobarilari/main
ENH and debuged fmriprep and mriqc for lemaitre4
2 parents 550546c + 1912a72 commit b58d55d

File tree

5 files changed

+77
-72
lines changed

5 files changed

+77
-72
lines changed

doc/cpp_fmriprep.slurm

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
#SBATCH --mail-user=marco.barilari@uclouvain.be
1212
#SBATCH --mail-type=ALL
13-
#SBATCH --output=/home/ucl/irsp/marcobar/jobs_report/fmriprep_job-%j.txt
13+
#SBATCH --output=/home/ucl/cosy/marcobar/jobs_report/fmriprep_job-%j.txt
1414

1515
#SBATCH --comment=project-name
1616

1717
#export OMP_NUM_THREADS=4
1818
#export MKL_NUM_THREADS=4
1919

20-
## CPP frmiprep script for CECI cluster v0.2.0
20+
## CPP frmiprep script for CECI cluster v0.3.0
2121
#
2222
# writtent by CPP people
2323
#
@@ -70,11 +70,15 @@ ceci_username="marcobar"
7070
# set fmriprep arguments
7171
nb_dummy_scans=0
7272

73+
# cluster paths
7374
path_to_singularity_image="$HOME/tools/containers/images/bids/bids-fmriprep--${FMRIPREP_VERSION}.sing"
74-
scratch_dir="/scratch/users/m/a/${ceci_username}"
75-
bids_dir="$HOME/fmriprep_trial/raw"
76-
output_dir="$HOME/fmriprep_trial/derivatives/fmriprep"
77-
freesurfer_license_folder="$HOME/tools/freesurfer_license"
75+
scratch_dir=$GLOBALSCRATCH
76+
freesurfer_license_folder="$HOME/tools"
77+
78+
# data paths
79+
root_dir="$HOME/path-to-project-yoda-fodler"
80+
bids_dir="$root_dir/inputs/raw"
81+
output_dir="$root_dir/outputs/derivatives/fmriprep"
7882

7983
# make the scratch folder, here there is no limit space and fmriprep can store stuff in case of crash and do not start from zero again
8084
mkdir -p "${scratch_dir}"/work-fmriprep
@@ -99,3 +103,8 @@ singularity run --cleanenv \
99103
--notrack \
100104
--skip_bids_validation \
101105
--stop-on-first-crash
106+
107+
108+
# more useful options to keep in mind:
109+
#
110+
# --fs-no-reconall # skip freesurfer segmentation

doc/cpp_mriqc.slurm

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,26 @@
44
#SBATCH --time=4:00:00 # hh:mm:ss
55

66
#SBATCH --ntasks=1
7-
#SBATCH --cpus-per-task=9
7+
#SBATCH --cpus-per-task=4
88
#SBATCH --mem-per-cpu=10000 # megabytes
9-
#SBATCH --partition=batch,debug
9+
#SBATCH --partition=batch
1010

1111
#SBATCH --mail-user=marco.barilari@uclouvain.be
1212
#SBATCH --mail-type=ALL
13-
#SBATCH --output=/home/ucl/irsp/marcobar/jobs_report/mriqc_job-%j.txt
13+
#SBATCH --output=/home/ucl/cosy/marcobar/jobs_report/mriqc_job-%j.txt
1414

1515
#SBATCH --comment=project-name
1616

17-
#export OMP_NUM_THREADS=9
18-
#export MKL_NUM_THREADS=9
17+
#export OMP_NUM_THREADS=4
18+
#export MKL_NUM_THREADS=4
1919

20-
## CPP MRIqc script for CECI cluster v0.2.0
20+
## CPP MRIqc script for CECI cluster v0.3.0
2121
#
2222
# writtent by CPP people
2323
#
2424
# Submission command for Lemaitre4
2525
#
26-
# sbatch cpp_mriqc.slurm <subjID>
27-
#
28-
# examples:
29-
# - 1 subject
30-
# sbatch cpp_mriqc.slurm sub-01
31-
#
32-
# - all subjects
33-
# sbatch cpp_mriqc.slurm ''
34-
#
35-
# - multiple subjects
36-
# sbatch cpp_mriqc.slurm 'sub-01 sub-02'
37-
#
38-
# - submit all the subjects (1 per job) all at once
39-
# read subj list to submit each to a job
40-
# !!! to run from within `raw` folder
41-
# ls -d sub* | xargs -n1 -I{} sbatch path/to/cpp_mriqc.slurm {}
26+
# sbatch cpp_mriqc_group.slurm
4227

4328
# create jobs_report folder in case they don't exist
4429
mkdir -p $HOME/jobs_report/
@@ -55,22 +40,30 @@ module --force purge
5540
subjID=$1
5641

5742
# "latest" or procide specific version number
58-
MRIQC_VERSION="23.1.0"
59-
60-
# set username to locate scratch folder
61-
ceci_username="marcobar"
43+
MRIQC_VERSION="24.0.0"
6244

45+
# cluster paths
6346
path_to_singularity_image="$HOME/tools/containers/images/bids/bids-mriqc--${MRIQC_VERSION}.sing"
64-
bids_dir="$HOME/mriqc_trial/raw"
65-
output_dir="$HOME/mriqc_trial/derivatives/mriqc"
47+
scratch_dir=$GLOBALSCRATCH
48+
49+
# data paths
50+
root_dir="$HOME/path-to-project-yoda-fodler"
51+
bids_dir="$root_dir/inputs/raw"
52+
output_dir="$root_dir/outputs/derivatives/mriqc"
53+
54+
# make the scratch folder, here there is no limit space and fmriprep can store stuff in case of crash and do not start from zero again
55+
mkdir -p "${scratch_dir}"/work-mriqc
6656

6757
# create output folder in case it does not exists
6858
mkdir -p "${output_dir}"
6959

7060
singularity run --cleanenv \
71-
-B "${bids_dir}":/data \
72-
-B "${output_dir}":/out \
73-
"${path_to_singularity_image}" \
74-
/data \
75-
/out \
76-
participant --participant-label "${subjID}"
61+
-B "${scratch_dir}":/scratch_dir \
62+
-B "${bids_dir}":/bids_dir \
63+
-B "${output_dir}":/output \
64+
"${path_to_singularity_image}" \
65+
/bids_dir \
66+
/output \
67+
participant --participant-label "${subjID}" \
68+
--work-dir /scratch_dir/work-mriqc/"${subjID}" \
69+
--verbose-reports

doc/cpp_mriqc_group.slurm

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#!/bin/bash
22

33
#SBATCH --job-name=MRIqc
4-
#SBATCH --time=9:00:00 # hh:mm:ss
4+
#SBATCH --time=4:00:00 # hh:mm:ss
55

66
#SBATCH --ntasks=1
7-
#SBATCH --cpus-per-task=9
7+
#SBATCH --cpus-per-task=4
88
#SBATCH --mem-per-cpu=10000 # megabytes
9-
#SBATCH --partition=batch,debug
9+
#SBATCH --partition=batch
1010

1111
#SBATCH --mail-user=marco.barilari@uclouvain.be
1212
#SBATCH --mail-type=ALL
13-
#SBATCH --output=/home/ucl/irsp/marcobar/jobs_report/mriqc_job-%j.txt
13+
#SBATCH --output=/home/ucl/cosy/marcobar/jobs_report/mriqc_job-%j.txt
1414

1515
#SBATCH --comment=project-name
1616

17-
#export OMP_NUM_THREADS=9
18-
#export MKL_NUM_THREADS=9
17+
#export OMP_NUM_THREADS=4
18+
#export MKL_NUM_THREADS=4
1919

20-
## CPP MRIqc script for CECI cluster
20+
## CPP MRIqc script for CECI cluster v0.3.0
2121
#
2222
# writtent by CPP people
2323
#
@@ -38,22 +38,30 @@ set -e -x -u -o pipefail
3838
module --force purge
3939

4040
# "latest" or procide specific version number
41-
MRIQC_VERSION="23.1.0"
42-
43-
# set username to locate scratch folder
44-
ceci_username="marcobar"
41+
MRIQC_VERSION="24.0.0"
4542

43+
# cluster paths
4644
path_to_singularity_image="$HOME/tools/containers/images/bids/bids-mriqc--${MRIQC_VERSION}.sing"
47-
bids_dir="$HOME/mriqc_trial/raw"
48-
output_dir="$HOME/mriqc_trial/derivatives/mriqc"
45+
scratch_dir=$GLOBALSCRATCH
46+
47+
# data paths
48+
root_dir="$HOME/path-to-project-yoda-fodler"
49+
bids_dir="$root_dir/inputs/raw"
50+
output_dir="$root_dir/outputs/derivatives/mriqc"
51+
52+
# make the scratch folder, here there is no limit space and fmriprep can store stuff in case of crash and do not start from zero again
53+
mkdir -p "${scratch_dir}"/work-mriqc
4954

5055
# create mriqc output folder in case they don't exist
5156
mkdir -p "${output_dir}"
5257

5358
singularity run --cleanenv \
54-
-B "${bids_dir}":/data \
55-
-B "${output_dir}":/out \
56-
"${path_to_singularity_image}" \
57-
/data \
58-
/out \
59-
group
59+
-B "${scratch_dir}":/scratch_dir \
60+
-B "${bids_dir}":/bids_dir \
61+
-B "${output_dir}":/output \
62+
"${path_to_singularity_image}" \
63+
/bids_dir \
64+
/output \
65+
--work-dir /scratch_dir/work-mriqc/"${subjID}" \
66+
--verbose-reports \
67+
group

doc/run_fmriprep.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ To contribute see [here](https://cpp-lln-lab.github.io/CPP_HPC/contributing/)
1515

1616
## Prepare to run fmriprep on the cluster
1717

18-
- have your data on the cluster
18+
- have your data on the cluster and unlock them if they are managed by datalad
19+
- get your `freesurfer` license (user specific) for free [here](https://surfer.nmr.mgh.harvard.edu/registration.html) and move it to the cluster at `~/tools`
1920
- install datalad on your user (see [here](https://github.com/cpp-lln-lab/CPP_HPC/install_datalad))
2021
- get the fmriprep singularity image as follow:
2122

@@ -38,14 +39,12 @@ cd path/to/containers
3839
datald update --merge
3940
``````
4041

41-
Depending on the cluster “unlock” is needed or not. No need for `lemaitre3`. !!! TO CHECK ON LEMAITRE4
42+
Depending on the cluster “unlock” is needed or not. No need for `lemaitre4`.
4243

4344
```bash
4445
datalad unlock containers/images/bids/bids-fmriprep--24.0.0.sing
4546
```
4647

47-
- get your `freesurfer` license (user specific) for free [here](https://surfer.nmr.mgh.harvard.edu/registration.html) and move it to the cluster
48-
4948
## Submit a fmriprep job via a `slurm` script
5049

5150
- pros:
@@ -60,7 +59,7 @@ Content of the `cpp_fmriprep.slurm` file (download and edit from [here](cpp_fmri
6059
!!! Warning
6160

6261
1. Read the fmriprep documentation to know what you are doing and how the arguments of the run call effects the results
63-
2. All the paths and email are set afte Marco's users for demosntration.
62+
2. All the paths and email are set afte Marco's users for demosntration. Change them for your user.
6463
3. Edit the scripts with the info you need to make it run for your user from top to buttom of the script, do not over look the first "commented" chunk cause it is not a real commented section (check the email and job report path, data paths and the `username` etc.).
6564
6665
```bash

doc/run_mriqc.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ Written by CPP lab people
44

55
To contribute see [here](https://cpp-lln-lab.github.io/CPP_HPC/contributing/)
66

7-
!!! Warning
8-
9-
Space problem since the `work` folder is not set in the script. Marco is working on it.
10-
117

128
## General tips
139

@@ -43,7 +39,7 @@ cd path/to/containers
4339
datald update --merge
4440
``````
4541

46-
Depending on the cluster “unlock” is needed or not. No need for `lemaitre3`. !! TO CHECK ON LEMAITRE4
42+
Depending on the cluster “unlock” is needed or not. No need for `lemaitre4`.
4743

4844
```bash
4945
datalad unlock containers/images/bids/bids-mriqc--24.0.0.sing
@@ -65,7 +61,7 @@ Content of the `cpp_mriqc.slurm` file (download and edit from [here](cpp_mriqc.s
6561
!!! Warning
6662

6763
1. Read the MRIqc documentation to know what you are doing and how the arguments of the run call effects the results
68-
2. All the paths and email are set afte Marco's users for demosntration.
64+
2. All the paths and email are set afte Marco's users for demosntration. Change them for your user.
6965
3. Edit the scripts with the info you need to make it run for your user from top to buttom of the script, do not over look the first "commented" chunk cause it is not a real commented section (check the email and job report path, data paths and the `username` etc.).
7066
7167
```bash
@@ -99,7 +95,7 @@ Content of the `cpp_mriqc_group.slurm` file (download and edit from [here](cpp_m
9995
!!! Warning
10096
10197
1. Read the MRIqc documentation to know what you are doing and how the arguments of the run call effects the results
102-
2. All the paths and email are set afte Marco's users for demosntration.
98+
2. All the paths and email are set afte Marco's users for demosntration. Change them for your user.
10399
3. Edit the scripts with the info you need to make it run for your user from top to buttom of the script, do not over look the first "commented" chunk cause it is not a real commented section (check the email and job report path, data paths and the `username` etc.).
104100

105101
```bash
@@ -122,6 +118,6 @@ sbatch cpp_mriqc_group.slurm
122118

123119
### check your job
124120

125-
see [here](https://github.com/cpp-lln-lab/CPP_HPC/cluster_code_snippets/#check-your-running-jobs)
121+
see [here](https://github.com/cpp-lln-lab.github.io/CPP_HPC/cluster_code_snippets/#check-your-running-jobs)
126122

127123
To contribute see [here](https://cpp-lln-lab.github.io/CPP_HPC/contributing/)

0 commit comments

Comments
 (0)