Skip to content

Commit

Permalink
--gpu: Fixes for automated nvidia driver installation #127
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Feb 16, 2019
1 parent 1ddff67 commit c5a1359
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -1372,15 +1372,15 @@ setup_gpu() { # option --gpu: share /dev/dri and check nvidia
done < <(find /dev/dri /dev/nvidia* /dev/vga_arbiter -maxdepth 0 2>/dev/null ||:)

# check for closed source nvidia driver on host, provide automated installation, warn about disadvantages
#Hostnvidia=yes
[ "$Hostnvidia" = "yes" ] && {
Nvidiaversion=$(head -n1 </proc/driver/nvidia/version | awk '{ print $8 }')
#Nvidiaversion="418.30"
verbose -d "Detected nvidia driver version $Nvidiaversion on host."
Nvidiadriver=$(find /usr/local/share/x11docker/NVIDIA* $Hostuserhome/.local/share/x11docker/NVIDIA* 2>/dev/null | grep $Nvidiaversion )
Nvidiadriver=$(find /usr/local/share/x11docker/NVIDIA*$Nvidiaversion*.run $Hostuserhome/.local/share/x11docker/NVIDIA*$Nvidiaversion*.run 2>/dev/null | head -n1 )
Nvidiadriver="$(realpath "$Nvidiadriver")"

[ -e "$Nvidiadriver" ] && {
store_runoption volume $Nvidiadriver:ro $Cshare/NVIDIA-$Nvidiaversion.run

verbose -d "Found proprietary closed source nvidia driver installer
$Nvidiadriver"

Expand Down Expand Up @@ -3874,6 +3874,10 @@ create_dockercommand() { # create command to run docker
--device $(convertpath --volume "$Line") \\
--volume $(convertpath --volume "$Line")"
done < <(store_runoption dump device)

# --gpu: share NVIDIDA driver installer
[ -e "$Nvidiadriver" ] && Dockercommand="$Dockercommand \\
--volume $(convertpath --volume "$Nvidiadriver:ro" "$Cshare/NVIDIA-$Nvidiaversion.run")"

# X socket will be softlinked to /tmp/.X11-unix in container.CMD.sh
[ "$Newxsocket" ] && Dockercommand="$Dockercommand \\
Expand Down

0 comments on commit c5a1359

Please sign in to comment.