Skip to content
Snippets Groups Projects
Commit f8cda2a3 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: Allow eddy tests to run if eddy_openmp(/eddy_cpu) is not installed.

parent 1ab61048
No related branches found
No related tags found
1 merge request!36RF: Allow eddy tests to run if eddy_openmp(/eddy_cpu) is not installed.
Pipeline #11632 passed
...@@ -30,7 +30,7 @@ fi ...@@ -30,7 +30,7 @@ fi
# Find all eddy_cuda* executables # Find all eddy_cuda* executables
cuda_exes="" cuda_exes=""
openmp_exe="" cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*; for cuda_exe in ${exedir}/eddy_cuda*;
do do
if [ -x "${cuda_exe}" ]; then if [ -x "${cuda_exe}" ]; then
...@@ -38,12 +38,12 @@ do ...@@ -38,12 +38,12 @@ do
fi fi
done done
# Find the eddy_openmp executable # Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then if [ -x "${exedir}/eddy_openmp" ]; then
openmp_exe="${exedir}/eddy_openmp" cpu_exe="${exedir}/eddy_openmp"
fi fi
if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!" echo "Cannot find any eddy executables in ${exedir}!"
exit 1 exit 1
fi fi
...@@ -67,31 +67,37 @@ do ...@@ -67,31 +67,37 @@ do
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyHigh_b_TestData/eddyData/testData --mask=${indir}/EddyHigh_b_TestData/eddyData/testMask --bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals --bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs --index=${indir}/EddyHigh_b_TestData/eddyData/testIndex --acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams --topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --out=${odir}/eddyCudaOutput${version} --very_verbose`" cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyHigh_b_TestData/eddyData/testData --mask=${indir}/EddyHigh_b_TestData/eddyData/testMask --bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals --bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs --index=${indir}/EddyHigh_b_TestData/eddyData/testIndex --acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams --topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --out=${odir}/eddyCudaOutput${version} --very_verbose`"
done done
omp_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/EddyHigh_b_TestData/eddyData/testData --mask=${indir}/EddyHigh_b_TestData/eddyData/testMask --bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals --bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs --index=${indir}/EddyHigh_b_TestData/eddyData/testIndex --acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams --topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --out=${odir}/eddyOmpOutput --very_verbose` if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyHigh_b_TestData/eddyData/testData --mask=${indir}/EddyHigh_b_TestData/eddyData/testMask --bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals --bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs --index=${indir}/EddyHigh_b_TestData/eddyData/testIndex --acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams --topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --out=${odir}/eddyCpuOutput --very_verbose`
fi
# If running on a cluster, ensure that # If running on a cluster, ensure that
# slots are being reserved on the queue, # slots are being reserved on the queue,
# and wait until all jobs have finished # and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then if [ ! -z "${SGE_ROOT}" ]; then
qalter ${omp_jid} -R y if [ "${cpu_exe}" != "" ]; then
while [ : ]; do qalter ${cpu_jid} -R y
for jid in ${cuda_jid}; fi
do while [ : ]; do
tmp=`qstat -j ${jid} | wc` for jid in ${cuda_jid};
tmp=`echo $tmp | awk '{print $1}'` do
if [ $tmp -ne 0 ]; then tmp=`qstat -j ${jid} | wc`
break tmp=`echo $tmp | awk '{print $1}'`
fi if [ $tmp -ne 0 ]; then
done break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${omp_jid} | wc` break
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi fi
sleep 5m fi
done fi
sleep 5m
done
fi fi
# Check that eddy output exists # Check that eddy output exists
...@@ -104,8 +110,11 @@ do ...@@ -104,8 +110,11 @@ do
exit 1 exit 1
fi fi
done done
if [ ! -f ${odir}/eddyOmpOutput.nii* ]; then if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1 exit 1
fi
fi fi
# Define some constants # Define some constants
...@@ -124,11 +133,13 @@ do ...@@ -124,11 +133,13 @@ do
cuda_exit_status=$(($cuda_exit_status + $?)) cuda_exit_status=$(($cuda_exit_status + $?))
done done
./EddyHigh_b_Feeds.py ${odir} Omp `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/testMask` `imglob -extension ${odir}/eddyOmpOutput` `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/Precomputed/eddy_openmp_output` $max_mean_ima_diff $max_max_ima_diff cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
omp_exit_status=$? ./EddyHigh_b_Feeds.py ${odir} Cpu `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/testMask` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/Precomputed/eddy_openmp_output` $max_mean_ima_diff $max_max_ima_diff
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $omp_exit_status -gt 0 ]; then if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed" echo "Test failed"
exit 1 exit 1
else else
......
...@@ -27,7 +27,7 @@ fi ...@@ -27,7 +27,7 @@ fi
# Find all eddy_cuda* executables # Find all eddy_cuda* executables
cuda_exes="" cuda_exes=""
openmp_exe="" cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*; for cuda_exe in ${exedir}/eddy_cuda*;
do do
if [ -x "${cuda_exe}" ]; then if [ -x "${cuda_exe}" ]; then
...@@ -35,12 +35,12 @@ do ...@@ -35,12 +35,12 @@ do
fi fi
done done
# Find the eddy_openmp executable # Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then if [ -x "${exedir}/eddy_openmp" ]; then
openmp_exe="${exedir}/eddy_openmp" cpu_exe="${exedir}/eddy_openmp"
fi fi
if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!" echo "Cannot find any eddy executables in ${exedir}!"
exit 1 exit 1
fi fi
...@@ -64,32 +64,38 @@ do ...@@ -64,32 +64,38 @@ do
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyLSRTestData/eddyData/testData --mask=${indir}/EddyLSRTestData/eddyData/testMask --bvals=${indir}/EddyLSRTestData/eddyData/testBvals --bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs --index=${indir}/EddyLSRTestData/eddyData/testIndex --acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams --topup=${indir}/EddyLSRTestData/eddyData/testTopup --out=${odir}/eddyCudaOutput${version} --resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose`" cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyLSRTestData/eddyData/testData --mask=${indir}/EddyLSRTestData/eddyData/testMask --bvals=${indir}/EddyLSRTestData/eddyData/testBvals --bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs --index=${indir}/EddyLSRTestData/eddyData/testIndex --acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams --topup=${indir}/EddyLSRTestData/eddyData/testTopup --out=${odir}/eddyCudaOutput${version} --resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose`"
done done
omp_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/EddyLSRTestData/eddyData/testData --mask=${indir}/EddyLSRTestData/eddyData/testMask --bvals=${indir}/EddyLSRTestData/eddyData/testBvals --bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs --index=${indir}/EddyLSRTestData/eddyData/testIndex --acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams --topup=${indir}/EddyLSRTestData/eddyData/testTopup --out=${odir}/eddyOmpOutput --resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose` if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyLSRTestData/eddyData/testData --mask=${indir}/EddyLSRTestData/eddyData/testMask --bvals=${indir}/EddyLSRTestData/eddyData/testBvals --bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs --index=${indir}/EddyLSRTestData/eddyData/testIndex --acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams --topup=${indir}/EddyLSRTestData/eddyData/testTopup --out=${odir}/eddyCpuOutput --resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose`
fi
# If running on a cluster, ensure that # If running on a cluster, ensure that
# slots are being reserved on the queue, # slots are being reserved on the queue,
# and wait until all jobs have finished # and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then if [ ! -z "${SGE_ROOT}" ]; then
qalter ${omp_jid} -R y if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
while [ : ]; do fi
for jid in ${cuda_jid};
do while [ : ]; do
tmp=`qstat -j ${jid} | wc` for jid in ${cuda_jid};
tmp=`echo $tmp | awk '{print $1}'` do
if [ $tmp -ne 0 ]; then tmp=`qstat -j ${jid} | wc`
break tmp=`echo $tmp | awk '{print $1}'`
fi if [ $tmp -ne 0 ]; then
done break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${omp_jid} | wc` break
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi fi
sleep 5m fi
done fi
sleep 5m
done
fi fi
# Check that eddy output exists # Check that eddy output exists
...@@ -102,8 +108,11 @@ do ...@@ -102,8 +108,11 @@ do
exit 1 exit 1
fi fi
done done
if [ ! -f ${odir}/eddyOmpOutput.nii* ]; then if [ "${cpu_exe}" != "" ]; then
exit 1 if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1
fi
fi fi
# Define some constants # Define some constants
...@@ -122,11 +131,13 @@ do ...@@ -122,11 +131,13 @@ do
cuda_exit_status=$(($cuda_exit_status + $?)) cuda_exit_status=$(($cuda_exit_status + $?))
done done
./EddyLSRFeeds.py ${odir} Omp `imglob -extension ${indir}/EddyLSRTestData/eddyData/testMask` `imglob -extension ${odir}/eddyOmpOutput` `imglob -extension ${indir}/EddyLSRTestData/eddyData/Precomputed/eddy_openmp_output` $max_mean_ima_diff $max_max_ima_diff cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
omp_exit_status=$? ./EddyLSRFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyLSRTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyLSRTestData/eddyData/Precomputed/eddy_openmp_output` $max_mean_ima_diff $max_max_ima_diff
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $omp_exit_status -gt 0 ]; then if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed" echo "Test failed"
exit 1 exit 1
else else
......
...@@ -32,7 +32,7 @@ fi ...@@ -32,7 +32,7 @@ fi
# Find all eddy_cuda* executables # Find all eddy_cuda* executables
cuda_exes="" cuda_exes=""
openmp_exe="" cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*; for cuda_exe in ${exedir}/eddy_cuda*;
do do
if [ -x "${cuda_exe}" ]; then if [ -x "${cuda_exe}" ]; then
...@@ -40,12 +40,12 @@ do ...@@ -40,12 +40,12 @@ do
fi fi
done done
# Find the eddy_openmp executable # Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then if [ -x "${exedir}/eddy_openmp" ]; then
openmp_exe="${exedir}/eddy_openmp" cpu_exe="${exedir}/eddy_openmp"
fi fi
if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!" echo "Cannot find any eddy executables in ${exedir}!"
exit 1 exit 1
fi fi
...@@ -76,31 +76,37 @@ do ...@@ -76,31 +76,37 @@ do
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyMBSTestData/eddyData/testData --acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams --mask=${indir}/EddyMBSTestData/eddyData/testMask --index=${indir}/EddyMBSTestData/eddyData/testIndex --bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs --bvals=${indir}/EddyMBSTestData/eddyData/testBvals --topup=${indir}/EddyMBSTestData/eddyData/testTopup --fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 --flm=quadratic --dont_peas --estimate_move_by_susceptibility --mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --out=${odir}/eddyCudaOutput${version} --very_verbose`" cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyMBSTestData/eddyData/testData --acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams --mask=${indir}/EddyMBSTestData/eddyData/testMask --index=${indir}/EddyMBSTestData/eddyData/testIndex --bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs --bvals=${indir}/EddyMBSTestData/eddyData/testBvals --topup=${indir}/EddyMBSTestData/eddyData/testTopup --fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 --flm=quadratic --dont_peas --estimate_move_by_susceptibility --mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --out=${odir}/eddyCudaOutput${version} --very_verbose`"
done done
omp_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/EddyMBSTestData/eddyData/testData --acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams --mask=${indir}/EddyMBSTestData/eddyData/testMask --index=${indir}/EddyMBSTestData/eddyData/testIndex --bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs --bvals=${indir}/EddyMBSTestData/eddyData/testBvals --topup=${indir}/EddyMBSTestData/eddyData/testTopup --fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 --flm=quadratic --dont_peas --estimate_move_by_susceptibility --mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --out=${odir}/eddyOmpOutput --very_verbose` if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyMBSTestData/eddyData/testData --acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams --mask=${indir}/EddyMBSTestData/eddyData/testMask --index=${indir}/EddyMBSTestData/eddyData/testIndex --bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs --bvals=${indir}/EddyMBSTestData/eddyData/testBvals --topup=${indir}/EddyMBSTestData/eddyData/testTopup --fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 --flm=quadratic --dont_peas --estimate_move_by_susceptibility --mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --out=${odir}/eddyCpuOutput --very_verbose`
fi
# If running on a cluster, ensure that # If running on a cluster, ensure that
# slots are being reserved on the queue, # slots are being reserved on the queue,
# and wait until all jobs have finished # and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then if [ ! -z "${SGE_ROOT}" ]; then
qalter ${omp_jid} -R y if [ "${cpu_exe}" != "" ]; then
while [ : ]; do qalter ${cpu_jid} -R y
for jid in ${cuda_jid}; fi
do while [ : ]; do
tmp=`qstat -j ${jid} | wc` for jid in ${cuda_jid};
tmp=`echo $tmp | awk '{print $1}'` do
if [ $tmp -ne 0 ]; then tmp=`qstat -j ${jid} | wc`
break tmp=`echo $tmp | awk '{print $1}'`
fi if [ $tmp -ne 0 ]; then
done break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${omp_jid} | wc` break
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi fi
sleep 5m fi
done fi
sleep 5m
done
fi fi
# Check that eddy output exists # Check that eddy output exists
...@@ -113,8 +119,10 @@ do ...@@ -113,8 +119,10 @@ do
exit 1 exit 1
fi fi
done done
if [ ! -f ${odir}/eddyOmpOutput.nii* ]; then if [ "${cpu_exe}" != "" ]; then
exit 1 if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
exit 1
fi
fi fi
# Check the results against precomputed results # Check the results against precomputed results
...@@ -128,11 +136,13 @@ do ...@@ -128,11 +136,13 @@ do
cuda_exit_status=$(($cuda_exit_status + $?)) cuda_exit_status=$(($cuda_exit_status + $?))
done done
./MoveBySuscFeeds.py ${odir} Omp `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` `imglob -extension ${odir}/eddyOmpOutput` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` `imglob -extension ${odir}/eddyOmpOutput.eddy_mbs_first_order_fields` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults.eddy_mbs_first_order_fields` ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff} cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
omp_exit_status=$? ./MoveBySuscFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` `imglob -extension ${odir}/eddyCpuOutput.eddy_mbs_first_order_fields` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults.eddy_mbs_first_order_fields` ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff}
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $omp_exit_status -gt 0 ]; then if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed" echo "Test failed"
exit 1 exit 1
else else
......
...@@ -28,7 +28,7 @@ fi ...@@ -28,7 +28,7 @@ fi
# Find all eddy_cuda* executables # Find all eddy_cuda* executables
cuda_exes="" cuda_exes=""
openmp_exe="" cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*; for cuda_exe in ${exedir}/eddy_cuda*;
do do
if [ -x "${cuda_exe}" ]; then if [ -x "${cuda_exe}" ]; then
...@@ -36,12 +36,12 @@ do ...@@ -36,12 +36,12 @@ do
fi fi
done done
# Find the eddy_openmp executable # Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then if [ -x "${exedir}/eddy_openmp" ]; then
openmp_exe="${exedir}/eddy_openmp" cpu_exe="${exedir}/eddy_openmp"
fi fi
if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!" echo "Cannot find any eddy executables in ${exedir}!"
exit 1 exit 1
fi fi
...@@ -65,31 +65,37 @@ do ...@@ -65,31 +65,37 @@ do
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --ol_nstd=6 --ol_nvox=500 --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/eddyCudaOutput${version} --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose`" cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --ol_nstd=6 --ol_nvox=500 --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/eddyCudaOutput${version} --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose`"
done done
omp_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --ol_nstd=6 --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/eddyOmpOutput --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose` if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --ol_nstd=6 --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/eddyCpuOutput --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose`
fi
# If running on a cluster, ensure that # If running on a cluster, ensure that
# slots are being reserved on the queue, # slots are being reserved on the queue,
# and wait until all jobs have finished # and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then if [ ! -z "${SGE_ROOT}" ]; then
qalter ${omp_jid} -R y if [ "${cpu_exe}" != "" ]; then
while [ : ]; do qalter ${cpu_jid} -R y
for jid in ${cuda_jid}; fi
do while [ : ]; do
tmp=`qstat -j ${jid} | wc` for jid in ${cuda_jid};
tmp=`echo $tmp | awk '{print $1}'` do
if [ $tmp -ne 0 ]; then tmp=`qstat -j ${jid} | wc`
break tmp=`echo $tmp | awk '{print $1}'`
fi if [ $tmp -ne 0 ]; then
done break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${omp_jid} | wc` break
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi fi
sleep 5m fi
done fi
sleep 5m
done
fi fi
# Check that eddy output exists # Check that eddy output exists
...@@ -103,9 +109,11 @@ do ...@@ -103,9 +109,11 @@ do
exit 1 exit 1
fi fi
done done
if [ ! -f ${odir}/eddyOmpOutput.nii* ]; then if [ "${cpu_exe}" != "" ]; then
echo "Omp output eddyOmpOutput missing" if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1 exit 1
fi
fi fi
# Define some constants # Define some constants
...@@ -133,12 +141,15 @@ utput${version}.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/ ...@@ -133,12 +141,15 @@ utput${version}.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/
cuda_exit_status=$(($cuda_exit_status + $?)) cuda_exit_status=$(($cuda_exit_status + $?))
done done
omp_exit_status=0 cpu_exit_status=0
./S2VFeeds.py ${odir} Omp `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyOmpOutput` `imglob -extension ${indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyOmpOutput.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyOmpOutput.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_ima_diff} ${max_false_pos} ${max_false_neg} ${max_trans_diff} ${max_rot_diff}
omp_exit_status=$? if [ "${cpu_exe}" != "" ]; then
./S2VFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCpuOutput.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCpuOutput.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_ima_diff} ${max_false_pos} ${max_false_neg} ${max_trans_diff} ${max_rot_diff}
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $omp_exit_status -gt 0 ]; then if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed" echo "Test failed"
exit 1 exit 1
else else
......
...@@ -26,7 +26,7 @@ fi ...@@ -26,7 +26,7 @@ fi
# Find all eddy_cuda* executables # Find all eddy_cuda* executables
cuda_exes="" cuda_exes=""
openmp_exe="" cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*; for cuda_exe in ${exedir}/eddy_cuda*;
do do
if [ -x "${cuda_exe}" ]; then if [ -x "${cuda_exe}" ]; then
...@@ -34,12 +34,12 @@ do ...@@ -34,12 +34,12 @@ do
fi fi
done done
# Find the eddy_openmp executable # Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then if [ -x "${exedir}/eddy_openmp" ]; then
openmp_exe="${exedir}/eddy_openmp" cpu_exe="${exedir}/eddy_openmp"
fi fi
if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!" echo "Cannot find any eddy executables in ${exedir}!"
exit 1 exit 1
fi fi
...@@ -72,32 +72,38 @@ do ...@@ -72,32 +72,38 @@ do
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyTestData/eddyData/testData --mask=${indir}/EddyTestData/eddyData/testMask --bvals=${indir}/EddyTestData/eddyData/testBvals --bvecs=${indir}/EddyTestData/eddyData/testBvecs --index=${indir}/EddyTestData/eddyData/testIndex --acqp=${indir}/EddyTestData/eddyData/testAcqparams --repol --fwhm=10,0,0,0,0 --out=${odir}/eddyCudaOutput${version} --dfields -v`" cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyTestData/eddyData/testData --mask=${indir}/EddyTestData/eddyData/testMask --bvals=${indir}/EddyTestData/eddyData/testBvals --bvecs=${indir}/EddyTestData/eddyData/testBvecs --index=${indir}/EddyTestData/eddyData/testIndex --acqp=${indir}/EddyTestData/eddyData/testAcqparams --repol --fwhm=10,0,0,0,0 --out=${odir}/eddyCudaOutput${version} --dfields -v`"
done done
omp_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/EddyTestData/eddyData/testData --mask=${indir}/EddyTestData/eddyData/testMask --bvals=${indir}/EddyTestData/eddyData/testBvals --bvecs=${indir}/EddyTestData/eddyData/testBvecs --index=${indir}/EddyTestData/eddyData/testIndex --acqp=${indir}/EddyTestData/eddyData/testAcqparams --repol --fwhm=10,0,0,0,0 --out=${odir}/eddyOmpOutput --dfields -v` if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyTestData/eddyData/testData --mask=${indir}/EddyTestData/eddyData/testMask --bvals=${indir}/EddyTestData/eddyData/testBvals --bvecs=${indir}/EddyTestData/eddyData/testBvecs --index=${indir}/EddyTestData/eddyData/testIndex --acqp=${indir}/EddyTestData/eddyData/testAcqparams --repol --fwhm=10,0,0,0,0 --out=${odir}/eddyCpuOutput --dfields -v`
fi
# If running on a cluster, ensure that # If running on a cluster, ensure that
# slots are being reserved on the queue, # slots are being reserved on the queue,
# and wait until all jobs have finished # and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then if [ ! -z "${SGE_ROOT}" ]; then
qalter ${omp_jid} -R y if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
while [ : ]; do fi
for jid in ${cuda_jid};
do while [ : ]; do
tmp=`qstat -j ${jid} | wc` for jid in ${cuda_jid};
tmp=`echo $tmp | awk '{print $1}'` do
if [ $tmp -ne 0 ]; then tmp=`qstat -j ${jid} | wc`
break tmp=`echo $tmp | awk '{print $1}'`
fi if [ $tmp -ne 0 ]; then
done break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${omp_jid} | wc` break
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi fi
sleep 5m fi
done fi
sleep 5m
done
fi fi
# Check that eddy output exists # Check that eddy output exists
...@@ -110,8 +116,12 @@ do ...@@ -110,8 +116,12 @@ do
exit 1 exit 1
fi fi
done done
if [ ! -f ${odir}/eddyOmpOutput.nii* ]; then
exit 1 if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1
fi
fi fi
# Check the results against ground truth # Check the results against ground truth
...@@ -125,10 +135,14 @@ do ...@@ -125,10 +135,14 @@ do
cuda_exit_status=$(($cuda_exit_status + $?)) cuda_exit_status=$(($cuda_exit_status + $?))
done done
./EddyFeeds.py ${odir} Omp `imglob -extension ${indir}/EddyTestData/eddyData/testMask` `imglob -extension ${odir}/eddyOmpOutput` `imglob -extension ${indir}/EddyTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyOmpOutput.eddy_displacement_fields ${indir}/EddyTestData/eddyData/DisplacementFields/DisplacementField ${odir}/eddyOmpOutput.eddy_outlier_map ${indir}/EddyTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff} ${allowed_false_positives} ${allowed_false_negatives} cpu_exit_status=0
omp_exit_status=$?
if [ "${cpu_exe}" != "" ]; then
./EddyFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCpuOutput.eddy_displacement_fields ${indir}/EddyTestData/eddyData/DisplacementFields/DisplacementField ${odir}/eddyCpuOutput.eddy_outlier_map ${indir}/EddyTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff} ${allowed_false_positives} ${allowed_false_negatives}
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $omp_exit_status -gt 0 ]; then if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed" echo "Test failed"
exit 1 exit 1
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment