forked from sgiavasis/CPAC_regtest_pack
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_cpac_container_preproc.sh
executable file
·126 lines (112 loc) · 3.95 KB
/
run_cpac_container_preproc.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
#!/bin/bash
# usage
# > ./run_cpac_container.sh {docker tag} {mode}
# /\ optional
# {mode} options:
# (leave this blank to simply run C-PAC)
# - enter = enter the container instead of running C-PAC
# - current = use C-PAC install from code in current branch of C-PAC repo listed in "repo"
# - enter-current = enter the container instead of running, with C-PAC install from code
# in current branch of C-PAC repo listed in "repo"
docker_image=$1
mode=$2
# Custom args for this run
#-------------------------
# Paths
run_name="v170_preproc"
repo="/media/ebs/C-PAC"
# Data
data_config="/media/ebs/CPAC_regtest_pack/cpac_data_config_regtest.yml"
bids_dir=/home/ubuntu # keep as /home/ubuntu when providing a data_config
#bids_dir="s3://fcp-indi/data/etc."
# Pipeline
#pipe_config="/media/ebs/CPAC_regtest_pack/configs/cpac_pipeline_config_default-no-deriv.yml"
preconfig="preproc" # preconfig will override pipe_config
# Run settings
n_cpus=6
ants_cpus=3
mem_gb=30
num_subs=5
#-------------------------
if [[ -z "$data_config" ]]
then
data_map="-v /tmp:/tmp"
data_config="--pipeline_override ''"
else
data_map="-v $data_config:/configs/data_config.yml"
data_config="--data_config_file /configs/data_config.yml"
fi
if [[ -z "$pipe_config" ]]
then
pipe_map="-v /tmp:/tmp"
pipe_config="--pipeline_override ''"
else
pipe_map="-v $pipe_config:/configs/pipe_config.yml"
pipe_config="--pipeline_file /configs/pipe_config.yml"
fi
if [[ "$preconfig" ]]
then
pipe_config="--preconfig $preconfig"
fi
if [[ $mode = "enter" ]]
then
sudo docker run -it \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
--entrypoint bash \
$docker_image
elif [[ $mode = "enter-current" ]]
then
sudo docker run -it \
-v $repo/CPAC:/code/CPAC \
-v $repo/dev/docker_data/run.py:/code/run.py \
-v $repo/dev/docker_data:/cpac_resources \
-v $repo/dev/docker_data/bids_utils.py:/code/bids_utils.py \
-v $repo/dev/docker_data/default_pipeline.yml:/code/default_pipeline.yml \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
--entrypoint bash \
$docker_image
elif [[ $mode = "current" ]]
then
sudo docker run \
-v $repo/CPAC:/code/CPAC \
-v $repo/dev/docker_data/run.py:/code/run.py \
-v $repo/dev/docker_data:/cpac_resources \
-v $repo/dev/docker_data/bids_utils.py:/code/bids_utils.py \
-v $repo/dev/docker_data/default_pipeline.yml:/code/default_pipeline.yml \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
$data_map \
$pipe_map \
$docker_image $bids_dir /output participant \
--save_working_dir \
--skip_bids_validator \
$data_config \
$pipe_config \
--n_cpus $n_cpus \
--mem_gb $mem_gb \
--pipeline_override "num_ants_threads: $ants_cpus" \
--pipeline_override "numParticipantsAtOnce: $num_subs" \
--pipeline_override "maxCoresPerParticipant: $n_cpus"
else
sudo docker run \
-v /home/ubuntu:/home/ubuntu \
-v /media/ebs/CPAC_regtest_pack:/media/ebs/CPAC_regtest_pack \
-v /media/ebs/runs/$run_name:/output \
$data_map \
$pipe_map \
$docker_image $bids_dir /output participant \
--save_working_dir \
--skip_bids_validator \
$data_config \
$pipe_config \
--n_cpus $n_cpus \
--mem_gb $mem_gb \
--pipeline_override "num_ants_threads: $ants_cpus" \
--pipeline_override "numParticipantsAtOnce: $num_subs" \
--pipeline_override "maxCoresPerParticipant: $n_cpus"
fi