Setup Tensorflow environment with CUDA, GPU Support for NVIDIA GPU
- Create conda environment and activate the environment: Ref — https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-environments
2. Go to this page, and find which tensorflow latest version is supported by GPU and CUDA — https://www.tensorflow.org/install/source#gpu and install that specific version of tensorflow :
pip install tensorflow==2.9.0
3. Go to developer.nvidia.com/cuda-toolkit-archive and download the respective version of Cuda toolkit and install
4. Go to developer.nvidia.com/cudnn and download respective cuddn version mentioned in step 2 which will be zip file and extract the zip contents
5. The extracted folder will have three folders → 1)bin 2)include 3) lib
Copy the folders and paste it in C:\Program Files \ NVIDIA GPU Computing Toolkit\Cuda\{version}\ and overrite the existing files and folders
6. Copy the “bin” path and add a new entry in Environment Variables — “Path”
(Ref: https://www.java.com/en/download/help/path.html)
7. Similarly copy the “libnvp” folder path and add new entry in Environment Variables “Path”
8. Restart the machine
9. To test the usage of GPU/Cuda, Open Jupyter notebook in the environment which we setup and execute the below and see if it returns true for both.
import tensorflow as tf
print(‘GPU Availability ‘,tf.test.is_gpu_available());
print(‘Cuda Usage ‘,tf.test.is_built_with_cuda())