Installing Tensorflow and Keras with CUDA GPU acceleration
On Fedora 27 using the Anaconda Python distribution
Last week I was setting up my workstation for deep learning and found the process less than user friendly than I would have liked so I have compiled the steps I took here in the hope that it saves others some aggravation. If you are not using Fedora simply install the Nvidia drivers with your distribution's preferred method and skip to the Setting up Anaconda section.
Installing the Nvidia DriversAs Fedora does not ship propriety code we will need to add Negativo's excellent Nvidia repository.
dnf install kernel-devel dkms-nvidia nvidia-driver-cuda
dnf install cuda-devel cuda-cudnn-devel
After all packages are installed reboot the system so that it may use the new driver.
Setting up AnacondaDownload and install the Anaconda python distribution. You can find the latest version here. Pay attention to the prompts, most users will want to let the installer modify their dotfiles.
Finally install Tensorflow and Keras. Note the order of the commands, if tensorflow-gpu is installed before Keras then Keras will not use the GPU for unknown reasons.
conda update conda
conda update anaconda
conda install keras-gpu
conda install tensorflow-gpu
You should now have Keras and Tensorflow installed with GPU support. Please feel free to contact me if you encounter any issues or have suggestions on how to improve the guide.