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

RF: Adjust eddy tests so they can be run in a non-SGE environment

parent 4b0f4d83
No related branches found
No related tags found
1 merge request!29Make eddy tests runnable in non-SGE environments
......@@ -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//'`
......
......@@ -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=$?
......
#! /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=$?
......
......@@ -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=$?
......
#! /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
......
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