Skip to content

Commit

Permalink
Also export CUDA version to the links directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaisa committed Nov 30, 2023
1 parent b2664a3 commit 9854e79
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gpu_support/nvidia/link_nvidia_host_libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ check_eessi_initialised
# (making sure that this can still work inside prefix environment inside a container)
export LD_LIBRARY_PATH=/.singularity.d/libs:$LD_LIBRARY_PATH
nvidia_smi_command="nvidia-smi --query-gpu=driver_version --format=csv,noheader"
if $nvidia_smi_command; then
host_cuda_version=$($nvidia_smi_command | tail -n1)
if $nvidia_smi_command > /dev/null; then
host_driver_version=$($nvidia_smi_command | tail -n1)
host_cuda_version=$(nvidia-smi -q --display=COMPUTE | grep CUDA | awk 'NF>1{print $NF}')
else
error="Failed to successfully execute\n $nvidia_smi_command\n"
fatal_error $error
Expand All @@ -57,7 +58,7 @@ host_injections_nvidia_dir="/cvmfs/pilot.eessi-hpc.org/host_injections/nvidia/${
host_injection_driver_dir="${host_injections_nvidia_dir}/host"
host_injection_driver_version_file="$host_injection_driver_dir/version.txt"
if [ -e "$host_injection_driver_version_file" ]; then
if grep -q "$host_cuda_version" "$host_injection_driver_version_file"; then
if grep -q "$host_driver_version" "$host_injection_driver_version_file"; then
echo_green "The host CUDA driver libraries have already been linked!"
link_drivers=0
else
Expand Down Expand Up @@ -91,8 +92,9 @@ if [ "$link_drivers" -eq 1 ]; then
# Make symlinks to all the interesting libraries
grep '.so$' "$temp_dir"/nvliblist.conf | xargs -i grep {} "$temp_dir"/libs.txt | xargs -i ln -s {}

# Inject CUDA version into dir
echo $host_cuda_version > version.txt
# Inject driver and CUDA versions into dir
echo $host_driver_version > version.txt
echo $host_cuda_version > cuda_version.txt
drivers_linked=1

# Remove the temporary directory when done
Expand Down

0 comments on commit 9854e79

Please sign in to comment.