Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaisa committed Dec 1, 2023
1 parent 3d0c3dd commit 480d356
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
18 changes: 7 additions & 11 deletions gpu_support/nvidia/install_cuda_host_injections.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ while [[ $# -gt 0 ]]; do
esac
done

# Make sure EESSI is initialised
check_eessi_initialised

# Make sure the CUDA version supplied is a semantic version
is_semantic_version() {
local version=$1
Expand All @@ -89,7 +92,7 @@ if ! is_semantic_version "$install_cuda_version"; then
show_help
error="\nYou must provide a semantic version for CUDA (e.g., 12.1.1) via the appropriate\n"
error="${error}command line option. This script is intended for use with EESSI so the 'correct'\n"
error="${error}version to provide is probably the one that is available under\n"
error="${error}version to provide is probably one of those available under\n"
error="${error}$EESSI_SOFTWARE_PATH/software/CUDA\n"
fatal_error "${error}"
fi
Expand All @@ -101,16 +104,9 @@ if [ "$eula_accepted" -ne 1 ]; then
fatal_error "${error}"
fi

# Make sure EESSI is initialised
check_eessi_initialised

if [[ -z "${EESSI_SOFTWARE_PATH}" ]]; then
fatal_error "This script cannot be used without having first defined EESSI_SOFTWARE_PATH"
else
# As an installation location just use $EESSI_SOFTWARE_PATH but replacing `versions` with `host_injections`
# (CUDA is a binary installation so no need to worry too much about the EasyBuild setup)
cuda_install_parent=${EESSI_SOFTWARE_PATH/versions/host_injections}
fi
# As an installation location just use $EESSI_SOFTWARE_PATH but replacing `versions` with `host_injections`
# (CUDA is a binary installation so no need to worry too much about the EasyBuild setup)
cuda_install_parent=${EESSI_SOFTWARE_PATH/versions/host_injections}

# Only install CUDA if specified version is not found.
# (existence of easybuild subdir implies a successful install)
Expand Down
13 changes: 8 additions & 5 deletions gpu_support/nvidia/link_nvidia_host_libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ if [ -x "/sbin/$command_name" ]; then
fi
IFS=':' read -ra path_dirs <<< "$PATH"
for dir in "${path_dirs[@]}"; do
if [[ ! "$dir" =~ ^$exclude_prefix ]]; then
if [ -x "$dir/$command_name" ]; then
found_paths+=("$dir/$command_name")
fi
fi
if [ "$dir" = "/sbin" ]; then
continue # we've already checked for $command_name in /sbin, don't need to do it twice
fi
if [[ ! "$dir" =~ ^$exclude_prefix ]]; then
if [ -x "$dir/$command_name" ]; then
found_paths+=("$dir/$command_name")
fi
fi
done

if [ ${#found_paths[@]} -gt 0 ]; then
Expand Down

0 comments on commit 480d356

Please sign in to comment.