Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass on gpu options #193

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions DiffusionPreprocessing/DiffPreprocPipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ PARAMETERs are: [ ] = optional; < > = user supplied value
eddy binary, the following sequence will work:

--extra-eddy-arg=-flag --extra-eddy-arg=value
[--no-gpu] If specified, use the non-GPU-enabled version of eddy.
Defaults to using the GPU-enabled version of eddy.
[--cuda-version=X.Y] If using the GPU-enabled version of eddy, then this
option can be used to specify which eddy_cuda binary
version to use. If specified, FSLDIR/bin/eddy_cudaX.Y
will be used.

[--combine-data-flag=<value>]
Specified value is passed as the CombineDataFlag value
Expand Down Expand Up @@ -214,12 +220,12 @@ EOF
# ${StudyFolder} Path to subject's data folder
# ${Subject} Subject ID
# ${PEdir} Phase Encoding Direction, 1=LR/RL, 2=AP/PA
# ${PosInputImages} @ symbol separated list of data with 'positive' phase
# ${PosInputImages} @ symbol separated list of data with 'positive' phase
# encoding direction
# ${NegInputImages} @ symbol separated lsit of data with 'negative' phase
# encoding direction
# ${echospacing} Echo spacing in msecs
# ${GdCoeffs} Path to file containing coefficients that describe
# ${GdCoeffs} Path to file containing coefficients that describe
# spatial variations of the scanner gradients. NONE
# if not available.
# ${DWIName} Name to give DWI output directories
Expand All @@ -230,9 +236,13 @@ EOF
# ${runcmd} Set to a user specifed command to use if user has
# requested that commands be echo'd (or printed)
# instead of actually executed. Otherwise, set to
# empty string.
# empty string.
# ${extra_eddy_args} Generic string of arguments to be passed to the
# eddy binary
# ${no_gpu} true if we should use the non-GPU-enabled version of eddy
# Anything else or unset means use the GPU-enabled version of eddy
# ${cuda_version} If using the GPU-enabled version, this value _may_ be
# given to specify the version of the CUDA libraries in use.
# ${CombineDataFlag} CombineDataFlag value to pass to
# DiffPreprocPipeline_PostEddy.sh script and
# subsequently to eddy_postproc.sh script
Expand All @@ -259,6 +269,8 @@ get_options() {
b0maxbval=${DEFAULT_B0_MAX_BVAL}
runcmd=""
extra_eddy_args=""
no_gpu=""
cuda_version=""
CombineDataFlag=1

# parse arguments
Expand Down Expand Up @@ -331,6 +343,14 @@ get_options() {
extra_eddy_args+=" ${extra_eddy_arg} "
index=$((index + 1))
;;
--no-gpu)
no_gpu="true"
index=$((index + 1))
;;
--cuda-version=*)
cuda_version=${argument#*=}
index=$((index + 1))
;;
--combine-data-flag=*)
CombineDataFlag=${argument#*=}
index=$((index + 1))
Expand Down Expand Up @@ -411,6 +431,10 @@ get_options() {
echo " SelectBestB0: ${SelectBestB0}"
fi
echo " extra_eddy_args: ${extra_eddy_args}"
if [ ! -z ${no_gpu} ]; then
echo " no_gpu: ${no_gpu}"
fi
echo " cuda-version: ${cuda_version}"
echo "-- ${g_script_name}: Specified Command-Line Parameters - End --"

if [ ! -z "${SelectBestB0}" ]; then
Expand Down Expand Up @@ -504,6 +528,14 @@ main() {
eddy_cmd+=" --dwiname=${DWIName} "
eddy_cmd+=" --printcom=${runcmd} "

if [ "${no_gpu}" == "true" ]; then
# default is to use the GPU-enabled version
eddy_cmd+=" --no-gpu "
else
if [ ! -z "${cuda_version}" ]; then
eddy_cmd+=" --cuda-version=${cuda_version}"
fi
fi
if [ ! -z "${extra_eddy_args}" ]; then
for extra_eddy_arg in ${extra_eddy_args}; do
eddy_cmd+=" --extra-eddy-arg=${extra_eddy_arg} "
Expand Down
4 changes: 3 additions & 1 deletion DiffusionPreprocessing/DiffPreprocPipeline_Eddy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ get_options() {
echo " resamp_value: ${resamp_value}"
echo " ol_nstd_value: ${ol_nstd_value}"
echo " extra_eddy_args: ${extra_eddy_args}"
echo " no_gpu: ${no_gpu}"
if [ ! -z ${no_gpu} ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our convention in other scripts is to print argument values even if they are empty or used the default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've adjusted this to print all argument values. To make the printed output more meaningful I set the default value from no_gpu (and SelectBestB0) to false rather than an empty string.

echo " no_gpu: ${no_gpu}"
fi
echo " cuda-version: ${cuda_version}"
echo "-- ${g_script_name}: Specified Command-Line Parameters - End --"
}
Expand Down