Skip to content
Snippets Groups Projects

Update runEddy script to work with new multi-threaded version.

Merged Paul McCarthy requested to merge mnt/eddy-nthr into master
Files
20
+ 23
10
@@ -10,8 +10,10 @@
# output as the final line of output. Thne script returns
# an exit code of non-0 if something goes wrong.
#
# The eddy_cpu executable is executed twice - once with
# --nthr=1, and again with --nthr=8.
# If called from pyfeeds, the eddy_cpu executable is
# executed twice - once with --nthr=1, and again with
# --nthr=6. If not called from pyfeeds, the eddy_cpu
# executable is executed only once, with --nthr=6.
#
# Outputs of each eddy_<variant> executable is saved with
# prefix ${outdir}/eddyOutput_<variant>. For example, the
@@ -30,7 +32,7 @@ set -e
# added by this script.
exedir="$1"; shift;
outdir="$1"; shift;
eddy_args="$@"
eddy_args=("$@")
# Find all eddy_cuda* executables
cuda_exes=""
@@ -46,10 +48,19 @@ done
# "eddy_cpu_nthr_X" to the list of
# executables to run. The name is unpacked
# in the loop below.
#
# We're using 6 threads here for the multi-
# threaded test, as it is the best option on
# the FMRIB cluster
cpu_exes=""
if [ -x "${exedir}/eddy_cpu" ]; then
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu_nthr_1"
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu_nthr_8"
# Only run single-threaded when running
# through pyfeeds
if [ "$PYFEEDS_TESTING" = "1" ]; then
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu_nthr_1"
fi
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu_nthr_6"
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exes}" == "" ]; then
@@ -71,21 +82,23 @@ do
if [[ "${exe_name}" == *"cuda"* ]]; then
fsl_sub="fsl_sub -l ${outdir} --coprocessor=cuda"
exe="${exe_name}"
extra_args=""
else
fsl_sub="fsl_sub -l ${outdir} -q long.q -s openmp,6"
# unpack eddy_cpu_nthr_N
# into eddy_cpu --nthr=N
fsl_sub="fsl_sub -l ${outdir} -q long.q"
exe="${exe_name%_nthr*}"
extra_ars="--nthr=${exe_name#eddy_cpu_nthr_}"
nthr="${variant#cpu_nthr_}"
eddy_args+=("--nthr=${nthr}")
if [ "${nthr}" != "1" ]; then
fsl_sub="${fsl_sub} -s openmp,${nthr}"
fi
fi
# fsl_sub will return an error (and not
# output a job id) if we try to run a
# cuda exe on a non-cuda-capable machine
# or queue. So we allow it to fail.
jid=$(${fsl_sub} ${exe} --out=${outdir}/eddyOutput_${variant} ${extra_args} ${eddy_args} || true)
jid=$(${fsl_sub} ${exe} --out=${outdir}/eddyOutput_${variant} ${eddy_args[@]} || true)
if [ "${jid}" == "" ]; then
echo "Error submitting ${exe_name} - skipping"
continue
Loading