Running an e-GPU on Fedora 32

I recently bought a new GPU and external enclosure so I can get a reasonable speed when doing blender stuff. Getting it to run under Fedora 32 is a challenge for a number of reasons.

My first challenge was to actually get the external screen to work. There is an excellent tool for this here: https://github.com/hertg/egpu-switcher which will allow you configure which GPU you want to use when the e-GPU is connect or disconnected.

Secondly, Fedora 32 comes with GCC 10 as standard. There is no prior version in the repo to revert to. CUDA however will not compile under version 10 and requires GCC 9 or less.

There are a couple of ways to get a GCC <= 9 compiler running under Fedora 32. Firstly there is a scripted build process here: https://github.com/BobSteagall/gcc-builder, but I found that I couldn’t get the toolset to compile on my laptop with 16Gb of RAM. Another alternative, and the one that succeeded for me was to download and force install a copy of the Centos devtoolset-9. This installs a standalone GCC 9 version under /opt/rh/devtoolset-9, with a script to set up all your environment variables to make this the working compiler.

You will need to download and install five RPM’s from the Centos repository, and then manually install one other library that is a dependency that is not satisfied by any of the RPM’s.

Download the following RPM files from the Centos 7 repository:


wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-gcc-9.3.1-2.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-gcc-c++-9.3.1-2.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-libstdc++-devel-9.3.1-2.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-runtime-9.1-0.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/devtoolset-9-binutils-2.32-16.el7.x86_64.rpm

And one additional RPM:


wget http://mirror.centos.org/centos/7/os/x86_64/Packages/mpfr-3.1.1-4.el7.x86_64.rpm

Now we can do an RPM install of the devtoolset-9 files. The “nodeps” parameter tells rpm to ignore any unmet dependencies – in this case the libmpfr libraries that we will manually copy in the next step.


sudo rpm -i --nodeps ./devtoolset-9-gcc-9.3.1-2.el7.x86_64.rpm \
./devtoolset-9-gcc-c++-9.3.1-2.el7.x86_64.rpm \
./devtoolset-9-libstdc++-devel-9.3.1-2.el7.x86_64.rpm \
./devtoolset-9-runtime-9.1-0.el7.x86_64.rpm \
./devtoolset-9-binutils-2.32-16.el7.x86_64.rpm

For the mpfr RPM file, we will need to extract it to a local folder and manually copy over the library files.


# extract the contents of the rpm
rpm2cpio ./mpfr-3.1.1-4.el7.x86_64.rpm | cpio -idmv

# now copy the libraries over:
sudo cp usr/lib64/libmpfr.so.4* /opt/rh/devtoolset-9/root/lib64/

This completes the installation. To use this compiler from your bash prompt, you will need to set you PATH and various library paths to point to it. This can be done by calling the /opt/rh/devtoolset-9/enable script.


source /opt/rh/devtoolset-9/enable

You can test this by running gcc –version


$ # BEFORE
$ gcc --version
gcc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ source /opt/rh/devtoolset-9/enable

$ # AFTER
$ gcc --version
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In my case, the next step was to run blender from within that shell script, and start a render (F12). Blender will successfully compile the CUDA libraries and you should get a fast render. Make sure you have enabled your GPU in the Preferences and that cycles is set to use the GPU as it’s rendering engine.

Have Fun!