## Just use Negativo’s Repo…

Since Nvidia totally screwed up the gcc versioning/ABI on Fedora 24, I decided to take the easy option and use someone else’s pre-packaged Nvidia installation.

I had tried this method before (on previous Fedoras), but the choices of paths had left me unconvinced (particularly since during the ‘teething’ phase of getting the installation working, error messages can come from all sorts of sources/reasons).

Here’s a quick run-down of what has worked for me :

Running :

### Add the Negativo Nvidia Repo

The negativo Nvidia repo should now be added :

And then install the nvidia driver, and the necessary libraries for cuda operations.

Note that if you want X11 to run on the graphics card, you’ll obviously need a monitor attached. However, since I didn’t attach a monitor to the machine while doing this, it’s not proven that the video card ends up capable of doing anything but cuda operations :: But that’s fine with me, because this is a machine that won’t ever have a monitor attached to it (much to the disappointment of the gamers in the office).

The following will each pull in a load more dependencies (the Negativo repo is intentionally modular / fragmented) :

In my case, I also added an intel driver for the internal on-board video subsystem (just so that X11 might be tempted to run if there’s a monitor plugged in - but check out the companion post on how to get the X11 configuration working properly if you do want to add a monitor, and also enable the Nvidia card for CUDA without it having a display attached) :

Now after rebooting :

The key thing here are the references to nvidia and nvidia_uvm.

If you’ve got references to nouveau appearing in lsmod, something didn’t work correctly.

### Install TensorFlow for the GPU

Looking within the TensorFlow installation instructions for “Download and install cuDNN” shows that TensorFlow v1.2 expects CUDA toolkit v8.0, which is good, because that is what the Negativo packing supplies, but also cuDNN v5.1, which is no longer the main cuDNN supplied by Negativo, but there’s a back-ported package still there :

This back-port package is not needed for TensorFlow 1.3, which is compatible with cuDNN v6 - so the standard cuda-cudnn package works fine (this should have been installed already as as dependency of cuda-cudnn-devel above).

Now install TensorFlow (this assumes python 3.x, which should be the obvious choice by now):

### Test TensorFlow with the GPU

The following can be executed (the second line onwards will be within the Python REPL) :

This is what will appear if the installation DIDN’T WORK :

### Fixing the /dev/nvidia0 problem

This should not happen if you’re running on the Nvidia card as a display adapter, or have installed the nvidia-modprobe package above. If there’s still a problem, have a look at the solution previously found.

### When it finally works…

Then the python REPL code :

Produces the following happy messages :

or the relevant device lines on another machine :

### Install PyTorch for the GPU

Looking within the PyTorch installation instructions we see that there’s an option for CUDA toolkit v8.0, which is good, and Python 3.6 is supported (also good).

Hmm - a quick test shows that there’s a numpy ABI version incompatibility…
Fedora 26’s default for python3 is numpy 1.12.1, but PyTorch for Python-3.6 wants numpy 1.13.1, fix this just inside the virtualenv:

Then finally test it with the same Hello World calculation as we did for TensorFlow :

All done.