-
Notifications
You must be signed in to change notification settings - Fork 2
/
regtest_job_cpac_code.sh
executable file
·191 lines (171 loc) · 5.59 KB
/
regtest_job_cpac_code.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/usr/bin/bash
while [[ "$#" -gt 0 ]]; do
case $1 in
--username) user="$2"; shift ;;
--out_dir) out_dir="$2"; shift ;;
--image_dir) image_dir="$2"; shift ;;
--cpac_dir) cpac_dir="$2"; shift ;;
esac
shift
done
MED=/ocean/projects/med220004p
HOME=${MED}/${user}
GIT_REPO=${HOME}/slurm_testing
DATA=${MED}/shared/data_raw/CPAC-Regression
OUT=${out_dir}
CONFIG=${GIT_REPO}/data_configs
IMAGE=${image_dir}
CPAC=${cpac_dir}
PIPELINE_CONFIGS=${GIT_REPO}/pipeline_configs
PRECONFIGS="default benchmark-FNIRT fmriprep-options ndmg fx-options abcd-options ccs-options rodent monkey"
DATA_SOURCE="KKI Site-CBIC Site-SI HNU_1"
for pipeline in ${PRECONFIGS}
do
if [ ${pipeline} == 'rodent' ] || [ ${pipeline} == 'monkey' ]
then
OUTPUT=${OUT}/${pipeline}
[ ! -d ${OUTPUT} ] && mkdir -p ${OUTPUT}
if [ ${pipeline} == 'rodent' ]
then
cat << TMP > regtest_${pipeline}.sh
#!/usr/bin/bash
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 1:00:00
#SBATCH --ntasks-per-node=20
HOME=${HOME} \
singularity run \
--cleanenv \
-B ${MED} \
-B ${DATA}:${DATA} \
-B ${CPAC}/CPAC:/code/CPAC \
-B ${CPAC}/dev/docker_data/run.py:/code/run.py \
-B ${CPAC}/dev/docker_data/run-with-freesurfer.sh:/code/run-with-freesurfer.sh \
-B ${OUTPUT}:${OUTPUT} \
-B ${CONFIG}:${CONFIG} \
-B ${PIPELINE_CONFIGS}:${PIPELINE_CONFIGS} \
${IMAGE} ${DATA} ${OUTPUT} participant \
--save_working_dir --skip_bids_validator \
--pipeline_file ${PIPELINE_CONFIGS}/${pipeline}_seed.yml \
--data_config_file ${CONFIG}/data_config_regtest_rodent.yml \
--n_cpus 18 --mem_gb 40
TMP
chmod +x regtest_${pipeline}.sh
sbatch regtest_${pipeline}.sh
elif [ ${pipeline} == 'monkey' ]
then
cat << TMP > regtest_${pipeline}.sh
#!/usr/bin/bash
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 2:00:00
#SBATCH --ntasks-per-node=20
HOME=${HOME} \
singularity run \
--cleanenv \
-B ${MED} \
-B ${DATA}:${DATA} \
-B ${CPAC}/CPAC:/code/CPAC \
-B ${CPAC}/dev/docker_data/run.py:/code/run.py \
-B ${CPAC}/dev/docker_data/run-with-freesurfer.sh:/code/run-with-freesurfer.sh \
-B ${OUTPUT}:${OUTPUT} \
-B ${CONFIG}:${CONFIG} \
-B ${PIPELINE_CONFIGS}:${PIPELINE_CONFIGS} \
${IMAGE} ${DATA} ${OUTPUT} participant \
--save_working_dir --skip_bids_validator \
--pipeline_file ${PIPELINE_CONFIGS}/${pipeline}_seed.yml \
--data_config_file ${CONFIG}/data_config_regtest_nhp.yml \
--n_cpus 18 --mem_gb 40
TMP
chmod +x regtest_${pipeline}.sh
sbatch regtest_${pipeline}.sh
fi
else
for data in ${DATA_SOURCE}
do
OUTPUT=${OUT}/${pipeline}/${data}
[ ! -d ${OUTPUT} ] && mkdir -p ${OUTPUT}
if [ ${pipeline} == 'abcd-options' ] || [ ${pipeline} == 'ccs-options' ]
then
cat << TMP > regtest_${pipeline}_${data}.sh
#!/usr/bin/bash
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 47:00:00
#SBATCH --ntasks-per-node=20
HOME=${HOME} \
singularity run \
--cleanenv \
-B ${MED} \
-B ${DATA}:${DATA} \
-B ${CPAC}/CPAC:/code/CPAC \
-B ${CPAC}/dev/docker_data/run.py:/code/run.py \
-B ${CPAC}/dev/docker_data/run-with-freesurfer.sh:/code/run-with-freesurfer.sh \
-B ${OUTPUT}:${OUTPUT} \
-B ${CONFIG}:${CONFIG} \
-B ${PIPELINE_CONFIGS}:${PIPELINE_CONFIGS} \
${IMAGE} ${DATA} ${OUTPUT} participant \
--save_working_dir --skip_bids_validator \
--pipeline_file ${PIPELINE_CONFIGS}/${pipeline}_seed.yml \
--data_config_file ${CONFIG}/data_config_regtest_${data}.yml \
--n_cpus 18 --mem_gb 40
TMP
chmod +x regtest_${pipeline}_${data}.sh
sbatch regtest_${pipeline}_${data}.sh
elif [ ${pipeline} == 'fmriprep-options' ] || [ ${pipeline} == 'fx-options' ]
then
cat << TMP > regtest_${pipeline}_${data}.sh
#!/usr/bin/bash
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 20:00:00
#SBATCH --ntasks-per-node=20
HOME=${HOME} \
singularity run \
--cleanenv \
-B ${MED} \
-B ${DATA}:${DATA} \
-B ${CPAC}/CPAC:/code/CPAC \
-B ${CPAC}/dev/docker_data/run.py:/code/run.py \
-B ${CPAC}/dev/docker_data/run-with-freesurfer.sh:/code/run-with-freesurfer.sh \
-B ${OUTPUT}:${OUTPUT} \
-B ${CONFIG}:${CONFIG} \
-B ${PIPELINE_CONFIGS}:${PIPELINE_CONFIGS} \
${IMAGE} ${DATA} ${OUTPUT} participant \
--save_working_dir --skip_bids_validator \
--pipeline_file ${PIPELINE_CONFIGS}/${pipeline}_seed.yml \
--data_config_file ${CONFIG}/data_config_regtest_${data}.yml \
--n_cpus 18 --mem_gb 40
TMP
chmod +x regtest_${pipeline}_${data}.sh
sbatch regtest_${pipeline}_${data}.sh
else
cat << TMP > regtest_${pipeline}_${data}.sh
#!/usr/bin/bash
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 20:00:00
#SBATCH --ntasks-per-node=20
HOME=${HOME} \
singularity run \
--cleanenv \
-B ${MED} \
-B ${DATA}:${DATA} \
-B ${CPAC}/CPAC:/code/CPAC \
-B ${CPAC}/dev/docker_data/run.py:/code/run.py \
-B ${CPAC}/dev/docker_data/run-with-freesurfer.sh:/code/run-with-freesurfer.sh \
-B ${OUTPUT}:${OUTPUT} \
-B ${CONFIG}:${CONFIG} \
-B ${PIPELINE_CONFIGS}:${PIPELINE_CONFIGS} \
${IMAGE} ${DATA} ${OUTPUT} participant \
--save_working_dir --skip_bids_validator \
--pipeline_file ${PIPELINE_CONFIGS}/${pipeline}_seed.yml \
--data_config_file ${CONFIG}/data_config_regtest_${data}.yml \
--n_cpus 18 --mem_gb 40
TMP
chmod +x regtest_${pipeline}_${data}.sh
sbatch regtest_${pipeline}_${data}.sh
fi
done
fi
done