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
1 file
+ 26
13
Compare changes
  • Side-by-side
  • Inline
+ 26
13
@@ -10,12 +10,16 @@
@@ -10,12 +10,16 @@
# output as the final line of output. Thne script returns
# output as the final line of output. Thne script returns
# an exit code of non-0 if something goes wrong.
# 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.
 
#
# Outputs of each eddy_<variant> executable is saved with
# Outputs of each eddy_<variant> executable is saved with
# prefix ${outdir}/eddyOutput_<variant>. For example, the
# prefix ${outdir}/eddyOutput_<variant>. For example, the
# output of eddy_cuda9.2 will be saved with prefix
# output of eddy_cuda9.2 will be saved with prefix
# ${outdir}/eddyOutput_cuda9.2, and the output of
# ${outdir}/eddyOutput_cuda9.2, and the output of
# eddy_openmp will be saved with prefix
# eddy_cpu --nthr=1 will be saved with prefix
# ${outdir}/eddyOutput_openmp.
# ${outdir}/eddyOutput_cpu_nthr_1.
 
#
set -e
set -e
@@ -37,13 +41,15 @@ do
@@ -37,13 +41,15 @@ do
fi
fi
done
done
# Find all eddy_cpu/eddy_openmp executables
# Find all eddy_cpu executables. We run
 
# eddy_cpu twice - here, we add
 
# "eddy_cpu_nthr_X" to the list of
 
# executables to run. The name is unpacked
 
# in the loop below.
cpu_exes=""
cpu_exes=""
if [ -x "${exedir}/eddy_openmp" ]; then
cpu_exes="${exedir}/eddy_openmp"
fi
if [ -x "${exedir}/eddy_cpu" ]; then
if [ -x "${exedir}/eddy_cpu" ]; then
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu"
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu_nthr_1"
 
cpu_exes="${cpu_exes} ${exedir}/eddy_cpu_nthr_8"
fi
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exes}" == "" ]; then
if [ "${cuda_exes}" == "" ] && [ "${cpu_exes}" == "" ]; then
@@ -57,28 +63,35 @@ fi
@@ -57,28 +63,35 @@ fi
cuda_jids=""
cuda_jids=""
cpu_jids=""
cpu_jids=""
submitted=""
submitted=""
for exe in ${cuda_exes} ${cpu_exes};
for exe_name in ${cuda_exes} ${cpu_exes};
do
do
variant=`basename ${exe}`
variant=`basename ${exe_name}`
variant=`echo ${variant} | sed 's/eddy_//'`
variant=`echo ${variant} | sed 's/eddy_//'`
if [[ "${exe}" == *"cuda"* ]]; then
if [[ "${exe_name}" == *"cuda"* ]]; then
fsl_sub="fsl_sub -l ${outdir} --coprocessor=cuda"
fsl_sub="fsl_sub -l ${outdir} --coprocessor=cuda"
 
exe="${exe_name}"
 
extra_args=""
 
else
else
fsl_sub="fsl_sub -l ${outdir} -q long.q -s openmp,6"
fsl_sub="fsl_sub -l ${outdir} -q long.q -s openmp,6"
 
# unpack eddy_cpu_nthr_N
 
# into eddy_cpu --nthr=N
 
exe="${exe_name%_nthr*}"
 
extra_ars="--nthr=${exe_name#eddy_cpu_nthr_}"
fi
fi
# fsl_sub will return an error (and not
# fsl_sub will return an error (and not
# output a job id) if we try to run a
# output a job id) if we try to run a
# cuda exe on a non-cuda-capable machine
# cuda exe on a non-cuda-capable machine
# or queue. So we allow it to fail.
# or queue. So we allow it to fail.
jid=$(${fsl_sub} ${exe} --out=${outdir}/eddyOutput_${variant} ${eddy_args} || true)
jid=$(${fsl_sub} ${exe} --out=${outdir}/eddyOutput_${variant} ${extra_args} ${eddy_args} || true)
if [ "${jid}" == "" ]; then
if [ "${jid}" == "" ]; then
echo "Error submitting ${exe} - skipping"
echo "Error submitting ${exe_name} - skipping"
continue
continue
fi
fi
submitted="${submitted} ${exe}"
submitted="${submitted} ${exe_name}"
if [[ "${exe}" == *"cuda"* ]]; then
if [[ "${exe}" == *"cuda"* ]]; then
cuda_jids="${cuda_jids} ${jid}"
cuda_jids="${cuda_jids} ${jid}"
Loading