2 min read
Thinkpad t480s Linux eGPU (Nvidia) and Tensorflow-gpu

Long story short, I’m running Xorg with nvidia proprietary (nouveau sucks in performance) driver, the thing you need to know is noted here that you need to

Option "AllowExternalGpus"

For my setup, I have Intel onboard GPU (kernel module i915), and I’m connecting through a Razer Core X + GTX 1070.

You first install and do minimal configuration as described in Arch wiki Nvidia page then adding that allow external GPU option, I have:

#/etc/X11/xorg.conf.d/20-nvidia.conf
Section "Module"
 Load "modesetting"
EndSection

Section "Device"
 Identifier "nvidia"
 Driver "nvidia"
 BusID "PCI:9:0:0"
 Option "TripleBuffer" "True"
 Option "ForceFullCompositionPipeline" "True"
 Option "AllowIndirectGLXProtocol" "off"
 Option "AllowEmptyInitialConfiguration"
 Option "AllowExternalGpus"
EndSection

Where 9:0:0 notation is translated from results of lspci | grep VGA then X11 should just work:

# ~/.xinitrc
export GDK_BACKEND=x11
exec gnome-session

EDIT: As a side note, here’s the additional package for running tensorflow-gpu

  • nccl
  • cuda
  • cudnn

Some extra steps:

  • https://wiki.archlinux.org/index.php/NVIDIA#Pacman_hook

  • https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Configuring_VA-API

    #/etc/pacman.d/hooks/nvidia.hook [Trigger] Operation=Install Operation=Upgrade Operation=Remove Type=Package Target=nvidia Target=linux

    Change the linux part above and in the Exec line if a different kernel is used

    [Action] Description=Update Nvidia module in initcpio Depends=mkinitcpio When=PostTransaction NeedsTargets Exec=/bin/sh -c ‘while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P’

    #/etc/default/grub … GRUB_CMDLINE_LINUX_DEFAULT=“quiet nvidia-drm.modeset=1” …

    ~/.xprofile

    export GDK_BACKEND=x11 export LIBVA_DRIVER_NAME=vdpau export VDPAU_DRIVER=nvidia exec gnome-session