forked from james-cole/brainageR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit_condor.sh
executable file
·62 lines (50 loc) · 1.14 KB
/
submit_condor.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
#!/usr/bin/bash
if [ ! -f ${1} ]; then
echo "the first argument must be a file"
exit 1
fi
file=${1}
if [ -z "$2" ]; then
echo "need outdir"
exit 1
fi
outdir=${2}
mkdir -p $outdir
mkdir -p $outdir/log
nproc=1
if [ ! -z "$3" ]; then
nproc=$3
fi
nproc=$(( nproc + 0 ))
ram=$(( nproc * 4 ))
disk=$(( nproc * 2 ))
if [ "$nproc" -le 0 ]; then
echo "number of processes must be > 0"
exit 1
fi
datalad="false"
if [ -n "$4" ]; then
datalad=${4}
fi
CPUS=${nproc}
RAM="${ram}G"
DISK="${disk}G"
LOGS_DIR=$outdir/log
[ ! -d "${LOGS_DIR}" ] && mkdir -p "${LOGS_DIR}"
[ ! -d "${outdir}" ] && mkdir -p "${outdir}"
# print the .submit header
printf "# The environment
universe = vanilla
getenv = True
request_cpus = ${CPUS}
request_memory = ${RAM}
request_disk = ${DISK}
# Execution
initial_dir = $(pwd)
executable = $(pwd)/brainageR_juseless
\n"
printf "arguments = ${file} ${outdir} ${nproc} ${datalad}\n"
printf "log = ${LOGS_DIR}/\$(Cluster).\$(Process).log\n"
printf "output = ${LOGS_DIR}/\$(Cluster).\$(Process).out\n"
printf "error = ${LOGS_DIR}/\$(Cluster).\$(Process).err\n"
printf "Queue\n\n"