diff --git a/EddyHigh_b_Test/feedsRun b/EddyHigh_b_Test/feedsRun index 552c8cf106e0aba8e6a284a66711920f6eb75945..ec81bcdae0e4b75fda98cdaf6c86a2636f56e6fc 100755 --- a/EddyHigh_b_Test/feedsRun +++ b/EddyHigh_b_Test/feedsRun @@ -3,7 +3,7 @@ # This script runs eddy followed by some # tests on the output. # It uses some b=7000 data from the pilot phase -# of the HCP. The "ground truth" is simply the +# of the HCP. The "ground truth" is simply the # output from eddy at a time when it seemed to # do a good job. The tolerance is quite high. That # reflects both that the data has a quite high @@ -26,33 +26,41 @@ if [ "$#" -gt 3 ]; then echo "Directory for eddy executables set to ${exedir}" else exedir="${FSLDIR}/bin" -fi +fi +# Find all eddy_cuda* executables +cuda_exes="" +openmp_exe="" for cuda_exe in ${exedir}/eddy_cuda*; do - if [ ! -x "$cuda_exe" ]; then - echo "No executable ${exedir}/eddy_cuda* exists" - exit 1 - fi + if [ -x "${cuda_exe}" ]; then + cuda_exes="${cuda_exes} ${cuda_exe}" + fi done -if [ ! -x "${exedir}/eddy_openmp" ]; then - echo "Executable ${exedir}/eddy_openmp does not exist" - exit 1 + +# Find the eddy_openmp executable +if [ -x "${exedir}/eddy_openmp" ]; then + openmp_exe="${exedir}/eddy_openmp" +fi + +if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then + echo "Cannot find any eddy executables in ${exedir}!" + exit 1 fi - + if [ ! -d "$odir" ]; then - echo "Output directory ${odir} does not exist" + echo "Output directory ${odir} does not exist" exit 1; fi if [ ! -d "$indir" ]; then - echo "Input directory ${indir} does not exist" + echo "Input directory ${indir} does not exist" exit 1; fi # Launch both GPU and CPU versions cuda_jid="" -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -60,33 +68,35 @@ do 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` -# Ensure that slots are being reserved on the queue -qalter ${omp_jid} -R y - -# Wait until they have both finished - -while [ : ]; do - for jid in ${cuda_jid}; - do - tmp=`qstat -j ${jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -ne 0 ]; then - break - fi + +# If running on a cluster, ensure that +# slots are being reserved on the queue, +# and wait until all jobs have finished +if [ ! -z "${SGE_ROOT}" ]; then + qalter ${omp_jid} -R y + while [ : ]; do + for jid in ${cuda_jid}; + do + tmp=`qstat -j ${jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -ne 0 ]; then + break + fi + done + if [ $tmp -eq 0 ]; then + tmp=`qstat -j ${omp_jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -eq 0 ]; then + break + fi + fi + sleep 5m done - if [ $tmp -eq 0 ]; then - tmp=`qstat -j ${omp_jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -eq 0 ]; then - break - fi - fi - sleep 5m -done +fi # Check that eddy output exists -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -106,7 +116,7 @@ max_max_ima_diff=20.0 # Check the results against ground truth cuda_exit_status=0 -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` diff --git a/EddyLSRTest/feedsRun b/EddyLSRTest/feedsRun index e7672ee71da02e649e361f976ea394e0310e079c..c70abeec4bc43f110fcb8ec32ba587bbd2e7167c 100755 --- a/EddyLSRTest/feedsRun +++ b/EddyLSRTest/feedsRun @@ -4,8 +4,8 @@ # tests on the output. # It uses some data from the pilot phase # of the HCP where each diffusion direction was -# scanned twice with opposing PE-directions. -# The "ground truth" is simply the output from eddy +# scanned twice with opposing PE-directions. +# The "ground truth" is simply the output from eddy # prior to Armadillo and NewNewimage. # @@ -23,33 +23,41 @@ if [ "$#" -gt 3 ]; then echo "Directory for eddy executables set to ${exedir}" else exedir="${FSLDIR}/bin" -fi +fi +# Find all eddy_cuda* executables +cuda_exes="" +openmp_exe="" for cuda_exe in ${exedir}/eddy_cuda*; do - if [ ! -x "$cuda_exe" ]; then - echo "No executable ${exedir}/eddy_cuda* exists" - exit 1 - fi + if [ -x "${cuda_exe}" ]; then + cuda_exes="${cuda_exes} ${cuda_exe}" + fi done -if [ ! -x "${exedir}/eddy_openmp" ]; then - echo "Executable ${exedir}/eddy_openmp does not exist" - exit 1 + +# Find the eddy_openmp executable +if [ -x "${exedir}/eddy_openmp" ]; then + openmp_exe="${exedir}/eddy_openmp" +fi + +if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then + echo "Cannot find any eddy executables in ${exedir}!" + exit 1 fi - + if [ ! -d "$odir" ]; then - echo "Output directory ${odir} does not exist" + echo "Output directory ${odir} does not exist" exit 1; fi if [ ! -d "$indir" ]; then - echo "Input directory ${indir} does not exist" + echo "Input directory ${indir} does not exist" exit 1; fi # Launch both GPU and CPU versions cuda_jid="" -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -57,33 +65,36 @@ do 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` -# Ensure that slots are being reserved on the queue -qalter ${omp_jid} -R y - -# Wait until they have both finished - -while [ : ]; do - for jid in ${cuda_jid}; - do - tmp=`qstat -j ${jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -ne 0 ]; then - break - fi + +# If running on a cluster, ensure that +# slots are being reserved on the queue, +# and wait until all jobs have finished +if [ ! -z "${SGE_ROOT}" ]; then + qalter ${omp_jid} -R y + + while [ : ]; do + for jid in ${cuda_jid}; + do + tmp=`qstat -j ${jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -ne 0 ]; then + break + fi + done + if [ $tmp -eq 0 ]; then + tmp=`qstat -j ${omp_jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -eq 0 ]; then + break + fi + fi + sleep 5m done - if [ $tmp -eq 0 ]; then - tmp=`qstat -j ${omp_jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -eq 0 ]; then - break - fi - fi - sleep 5m -done +fi # Check that eddy output exists -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -103,7 +114,7 @@ max_max_ima_diff=20.0 # Check the results against ground truth cuda_exit_status=0 -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -111,7 +122,7 @@ do cuda_exit_status=$(($cuda_exit_status + $?)) 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 +./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 omp_exit_status=$? diff --git a/EddyMBSTest/feedsRun b/EddyMBSTest/feedsRun index b58157a3fa9b544294a8d65d79e32ccf305bc6c5..00fca937a74698e8bf77a2c5733bdd97a583820b 100755 --- a/EddyMBSTest/feedsRun +++ b/EddyMBSTest/feedsRun @@ -1,16 +1,16 @@ #! /bin/sh # -# This script runs eddy for testing the +# This script runs eddy for testing the # movement-by-susceptibility functionality # followed by some tests on the output. # It uses simulated data supplied by Mark # Graham, UCL. -# The data is a subset of that used for +# The data is a subset of that used for # the MBS paper. We don't have an "actual" # ground truth so instead we compare against # the results from the paper (calculated with # the Cuda version). -# The actual data used for the test is +# The actual data used for the test is # .../SecondSetOfSimulations/ap/ec-volumetric-3x/images_SNR40_1 # @@ -28,26 +28,34 @@ if [ "$#" -gt 3 ]; then echo "Directory for eddy executables set to ${exedir}" else exedir="${FSLDIR}/bin" -fi +fi +# Find all eddy_cuda* executables +cuda_exes="" +openmp_exe="" for cuda_exe in ${exedir}/eddy_cuda*; do - if [ ! -x "$cuda_exe" ]; then - echo "No executable ${exedir}/eddy_cuda* exists" - exit 1 - fi + if [ -x "${cuda_exe}" ]; then + cuda_exes="${cuda_exes} ${cuda_exe}" + fi done -if [ ! -x "${exedir}/eddy_openmp" ]; then - echo "Executable ${exedir}/eddy_openmp does not exist" - exit 1 + +# Find the eddy_openmp executable +if [ -x "${exedir}/eddy_openmp" ]; then + openmp_exe="${exedir}/eddy_openmp" +fi + +if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then + echo "Cannot find any eddy executables in ${exedir}!" + exit 1 fi - + if [ ! -d "$odir" ]; then - echo "Output directory ${odir} does not exist" + echo "Output directory ${odir} does not exist" exit 1; fi if [ ! -d "$indir" ]; then - echo "Input directory ${indir} does not exist" + echo "Input directory ${indir} does not exist" exit 1; fi @@ -61,7 +69,7 @@ max_max_ima_diff=0.6 # Launch both GPU and CPU versions cuda_jid="" -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -69,33 +77,35 @@ do 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` -# Ensure that slots are being reserved on the queue -qalter ${omp_jid} -R y - -# Wait until they have both finished - -while [ : ]; do - for jid in ${cuda_jid}; - do - tmp=`qstat -j ${jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -ne 0 ]; then - break - fi + +# If running on a cluster, ensure that +# slots are being reserved on the queue, +# and wait until all jobs have finished +if [ ! -z "${SGE_ROOT}" ]; then + qalter ${omp_jid} -R y + while [ : ]; do + for jid in ${cuda_jid}; + do + tmp=`qstat -j ${jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -ne 0 ]; then + break + fi + done + if [ $tmp -eq 0 ]; then + tmp=`qstat -j ${omp_jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -eq 0 ]; then + break + fi + fi + sleep 5m done - if [ $tmp -eq 0 ]; then - tmp=`qstat -j ${omp_jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -eq 0 ]; then - break - fi - fi - sleep 5m -done +fi # Check that eddy output exists -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -110,15 +120,15 @@ fi # Check the results against precomputed results cuda_exit_status=0 -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` - ./MoveBySuscFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` `imglob -extension ${odir}/eddyCudaOutput${version}.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} + ./MoveBySuscFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` `imglob -extension ${odir}/eddyCudaOutput${version}.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} cuda_exit_status=$(($cuda_exit_status + $?)) 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} +./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} omp_exit_status=$? diff --git a/EddyS2VTest/feedsRun b/EddyS2VTest/feedsRun index 49863ebd8dff9f091eb0de6ef62e1edadf918691..f1dc7b769feead541075182f3e3c0b9c826da7c4 100755 --- a/EddyS2VTest/feedsRun +++ b/EddyS2VTest/feedsRun @@ -24,33 +24,41 @@ if [ "$#" -gt 3 ]; then echo "Directory for eddy executables set to ${exedir}" else exedir="${FSLDIR}/bin" -fi +fi +# Find all eddy_cuda* executables +cuda_exes="" +openmp_exe="" for cuda_exe in ${exedir}/eddy_cuda*; do - if [ ! -x "$cuda_exe" ]; then - echo "No executable ${exedir}/eddy_cuda* exists" - exit 1 - fi + if [ -x "${cuda_exe}" ]; then + cuda_exes="${cuda_exes} ${cuda_exe}" + fi done -if [ ! -x "${exedir}/eddy_openmp" ]; then - echo "Executable ${exedir}/eddy_openmp does not exist" - exit 1 + +# Find the eddy_openmp executable +if [ -x "${exedir}/eddy_openmp" ]; then + openmp_exe="${exedir}/eddy_openmp" fi - + +if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then + echo "Cannot find any eddy executables in ${exedir}!" + exit 1 +fi + if [ ! -d "$odir" ]; then - echo "Output directory ${odir} does not exist" + echo "Output directory ${odir} does not exist" exit 1; fi if [ ! -d "$indir" ]; then - echo "Input directory ${odir} does not exist" + echo "Input directory ${odir} does not exist" exit 1; fi # Launch both GPU and CPU versions - + cuda_jid="" -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -58,33 +66,35 @@ do 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` -# Ensure that slots are being reserved on the queue -qalter ${omp_jid} -R y - -# Wait until they have both finished - -while [ : ]; do - for jid in ${cuda_jid}; - do - tmp=`qstat -j ${jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -ne 0 ]; then - break - fi + +# If running on a cluster, ensure that +# slots are being reserved on the queue, +# and wait until all jobs have finished +if [ ! -z "${SGE_ROOT}" ]; then + qalter ${omp_jid} -R y + while [ : ]; do + for jid in ${cuda_jid}; + do + tmp=`qstat -j ${jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -ne 0 ]; then + break + fi + done + if [ $tmp -eq 0 ]; then + tmp=`qstat -j ${omp_jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -eq 0 ]; then + break + fi + fi + sleep 5m done - if [ $tmp -eq 0 ]; then - tmp=`qstat -j ${omp_jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -eq 0 ]; then - break - fi - fi - sleep 5m -done +fi # Check that eddy output exists -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -112,19 +122,19 @@ max_false_neg=10 # Check the results against ground truth cuda_exit_status=0 -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` echo "./S2VFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension $\ {indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCudaO\ utput${version}.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}" - ./S2VFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCudaOutput${version}.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} + ./S2VFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCudaOutput${version}.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} cuda_exit_status=$(($cuda_exit_status + $?)) done omp_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} +./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=$? diff --git a/EddyTest/feedsRun b/EddyTest/feedsRun index 3fd56680cd8b57c536eb3210c97b6c03e74b85db..af955aea4e3d0507f481f9265f23b3096a728c9b 100755 --- a/EddyTest/feedsRun +++ b/EddyTest/feedsRun @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # # This script runs eddy followed by some # tests on the output. @@ -22,26 +22,34 @@ if [ "$#" -gt 3 ]; then echo "Directory for eddy executables set to ${exedir}" else exedir="${FSLDIR}/bin" -fi +fi +# Find all eddy_cuda* executables +cuda_exes="" +openmp_exe="" for cuda_exe in ${exedir}/eddy_cuda*; do - if [ ! -x "$cuda_exe" ]; then - echo "No executable ${exedir}/eddy_cuda* exists" - exit 1 - fi + if [ -x "${cuda_exe}" ]; then + cuda_exes="${cuda_exes} ${cuda_exe}" + fi done -if [ ! -x "${exedir}/eddy_openmp" ]; then - echo "Executable ${exedir}/eddy_openmp does not exist" - exit 1 + +# Find the eddy_openmp executable +if [ -x "${exedir}/eddy_openmp" ]; then + openmp_exe="${exedir}/eddy_openmp" +fi + +if [ "${cuda_exes}" == "" ] && [ "${openmp_exe}" == "" ]; then + echo "Cannot find any eddy executables in ${exedir}!" + exit 1 fi - + if [ ! -d "$odir" ]; then - echo "Output directory ${odir} does not exist" + echo "Output directory ${odir} does not exist" exit 1; fi if [ ! -d "$indir" ]; then - echo "Input directory ${indir} does not exist" + echo "Input directory ${indir} does not exist" exit 1; fi @@ -57,7 +65,7 @@ allowed_false_negatives=1 # Launch both GPU and CPU versions cuda_jid="" -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -65,34 +73,36 @@ do 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` -# Ensure that slots are being reserved on the queue -qalter ${omp_jid} -R y - -# Wait until they have both finished - -while [ : ]; do - for jid in ${cuda_jid}; - do - tmp=`qstat -j ${jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -ne 0 ]; then - break - fi + +# If running on a cluster, ensure that +# slots are being reserved on the queue, +# and wait until all jobs have finished +if [ ! -z "${SGE_ROOT}" ]; then + qalter ${omp_jid} -R y + + while [ : ]; do + for jid in ${cuda_jid}; + do + tmp=`qstat -j ${jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -ne 0 ]; then + break + fi + done + if [ $tmp -eq 0 ]; then + tmp=`qstat -j ${omp_jid} | wc` + tmp=`echo $tmp | awk '{print $1}'` + if [ $tmp -eq 0 ]; then + break + fi + fi + sleep 5m done - if [ $tmp -eq 0 ]; then - tmp=`qstat -j ${omp_jid} | wc` - tmp=`echo $tmp | awk '{print $1}'` - if [ $tmp -eq 0 ]; then - break - fi - fi - sleep 5m -done +fi # Check that eddy output exists - -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` @@ -107,15 +117,15 @@ fi # Check the results against ground truth cuda_exit_status=0 -for cuda_exe in ${exedir}/eddy_cuda*; +for cuda_exe in ${cuda_exes}; do tmp=`basename $cuda_exe` version=`echo $tmp | sed 's/eddy_cuda//'` - ./EddyFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_displacement_fields ${indir}/EddyTestData/eddyData/DisplacementFields/DisplacementField ${odir}/eddyCudaOutput${version}.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} + ./EddyFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_displacement_fields ${indir}/EddyTestData/eddyData/DisplacementFields/DisplacementField ${odir}/eddyCudaOutput${version}.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} cuda_exit_status=$(($cuda_exit_status + $?)) 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} +./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} omp_exit_status=$? if [ $cuda_exit_status -gt 0 ] || [ $omp_exit_status -gt 0 ]; then