Linux, Ultrabooks, CUDA and eGPUs

I work mostly on my Dell XPS 9365 these days. Since I'm working with deep learning, it's often helpful to have a GPU locally for experimenting. Since I've been able to get my hands on an Titan RTX, I've decided to go ahead and give my main workhorse a boost when I'm at my desk.

Getting an external GPU working is no longer as difficult compared to several years ago when USB-C and Thunderbolt was initially introduced.

Almost plug and play, simply plug everything in and install CUDA drivers as per instructions from Nvidia.

If you were to reboot now, you will find that the graphical login manager will fail to start. Studying the logs reveals that X isn't able to find a usable display. This is due to X not allowing external GPUs by default. If you have an internal GPU, you might not face this problem. The exteral GPU is now available for CUDA, but not for running X.

To get X working, we need to add Option "AllowExternalGpus" "True" to the X configuration template /usr/share/X11/xorg.conf.d/10-nvidia.conf.

This is how the file should look like after the edit:

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "AllowExternalGpus" "True"
    ModulePath "/usr/lib/x86_64-linux-gnu/xorg"
EndSection

Important note about hot-plugging

I've not tried hot-plugging and I have no idea what will happen if I do so, but this functionality isn't required by me for now. It should work in theory and much more information can be found in the incredibly useful site at eGPU.io, where I did my research before purchasing my eGPU enclosure.


My setup

Show Comments