└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Install instructions for TensorFlow and Keras using CUDA 9 and cuDNN 7 with GPU enabled, on Windows 10 2 | 3 | Latest update date: 02/27/2019 4 | 5 | **Step 1:** First, let's make sure the system satisfies the hardware requirements, and let's pick the right version of tensorflow based on your hardware: 6 | 7 | 1. Make sure a compatible GPU is installed. Not all CUDA capable GPUs are supported by tensorflow. TensorFlow requires a compute compatibility of 3.0 or higher. A list of nVidia GPUs with compute compatibility can be found [here](https://developer.nvidia.com/cuda-gpus/). 8 | 2. Check if your CPU is AVX compatible (a list of CPUs can be found [here](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions)). If your CPU does not support AVX, you will need to install tensorflow 1.5 instead of tensorflow 1.10. Use tensorflow-gpu==1.5 in the tensorflow installation line in Step 4 below along with CUDS 9.0 and cuDNN v7.0.5 and that should be it. 9 | 10 | 11 | **Step 2:** Next, download and install CUDA 92 from the [archives](https://developer.nvidia.com/cuda-toolkit-archive). Note that 9.1 or later versions are NOT compatible with the current versions of tensorflow. I will update this as and when they become compatible. 12 | 13 | Also download "cuDNN v7.2.1 (August 7, 2018), for CUDA 9.2" from [here](https://developer.nvidia.com/rdp/cudnn-download). Note1: Please make sure to download the version that says "for CUDA 9.2". Note2: You will be required to make a NVIDIA Developers account for download. Note3: Please download v7.2.1 and NOT later versions. 14 | 15 | Follow the instructions for cuDNN installation [here](http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installwindows). 16 | 17 | Once CUDA 9.2 and cuDNN 7.2 are installed, you are ready to install TensorFlow. If you use conda, I suggest cloning the environment. You can skip Step 3 if you do not use conda. 18 | 19 | **Step 3:** We assume that you have anaconda installed with a current environment for use (let us call the current environment "aind"). We will first create a clone of the environment (call it "deeplearning") and activate it. Note3: Windows powershell does not work with the activate command. You must open a regular command prompt 20 | 21 | ```sh 22 | > conda create --name deeplearning --clone aind 23 | > activate deeplearning 24 | ``` 25 | 26 | Once the environment is active, we must install Tensorflow. 27 | 28 | **Step 4:** Install tensorflow-gpu as follows: 29 | ```sh 30 | > pip install tensorflow-gpu==1.12 31 | ``` 32 | 33 | Once this is installed, check if TensorFlow is properly working. 34 | ```sh 35 | > python 36 | >> import tensorflow 37 | ``` 38 | 39 | You can check the list of devices using the following: 40 | 41 | ```sh 42 | >> from tensorflow.python.client import device_lib 43 | >> device_lib.list_local_devices() 44 | ``` 45 | 46 | This should show your your CPU and GPUs listed. If it does not show the GPU, please see the troubleshooting section below. If everything appears to work. You can go ahead and install Keras. 47 | ```sh 48 | > pip install keras 49 | > python 50 | >> import keras 51 | ``` 52 | It should now say "Using TensorFlow backend". 53 | 54 | ## Troubleshooting 55 | 1. Please make sure that the right versions of CUDA and cuDNN are installed 56 | 2. You will need to install tensorflow-gpu 1.5 or above to enable CUDA 9.0 and cuDNN 7 support. Prior versions don't support this. 57 | 3. Ensure that environment variables are correctly set. The system variables must have the following in them: 58 | 59 | | Variable | Must contain Value| 60 | | --- | --- | 61 | |CUDA_PATH| C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2 | 62 | |CUDA_PATH_V9_0 | C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2| 63 | | Path | C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin | 64 | |Path | C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp| 65 | 4. Make sure a compatible GPU is installed. Not all CUDA capable GPUs are supported by tensorflow. TensorFlow requires a compute compatibility of 3.0 or higher. A list of nVidia GPUs with compute compatibility can be found [here](https://developer.nvidia.com/cuda-gpus/). 66 | 5. If you are using tensorflow-gpu 1.6 or above, make sure your CPU supports AVX (a list of CPUs can be found [here](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions)). If your CPU does not support AVX, use tensorflow-gpu==1.5 in the tensorflow installation line above and it should solve the issue. 67 | --------------------------------------------------------------------------------