Issue
What are the steps to get tensorflow-gpu
2.x Python package working on Windows with an NVidia GPU?
I.e. how can I get rid of Could not find 'cudart64_101.dll'
and then Could not find 'cudnn64_7.dll'
?
Solution
Steps
- Requires specific versions according to the error messages you see, not latest versions!
1. Download and install latest NVidia driver
https://www.nvidia.com/Download/index.aspx
2. Install Tensorflow Python package
pip uninstall tensorflow
pip install tensorflow-gpu
(*) For newer versions, tensorflow
and tensorflow-gpu
are the same package, so just update tensorflow
using:
pip install --upgrade tensforflow
3. Test
At first the following test will fail, pay attention to version of missing file e.g. Could not find 'cudart64_101.dll'
import tensorflow
tensorflow.test.is_built_with_gpu_support() # Test install of pip package, should output True
tensorflow.test.is_gpu_available() # Should output True
tensorflow.test.gpu_device_name() # Should output something like /device:GPU:0
# update for last test:
tensorflow.config.list_physical_devices('GPU')
4. Download and install CUDA Toolkit 10.1 local setup
- The version you need is the one not found e.g. cudart64_101.dll --> version 10.1.
- You will need to unselect components because setup contains an older driver, in network setup this doesn't work right
Select custom setup and:
- Unselect
CUDA
/Visual Studio Integration
- Unselect
Driver components
5. Make sure these folders have been added to path:
- And no other versions of CUDA
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;
6. Test again
- Restart your IDE for it to receive new environment variables (including PATH)
Will fail, pay attention to version of missing file e.g. Could not find 'cudnn64_7.dll'
7. Download and manually install CUDNN 7.6.5 for CUDA 10.1
- The version you need is the one not found e.g. cudnn64_7.dll --> version 7.x for CUDA 10.1 (or the version of CUDA you needed)
https://developer.nvidia.com/rdp/cudnn-archive
- Unzip and copy content of
cuda
folder into:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\
(or the version you downloaded and installed) - If you have any conflicts, skip duplicate files
8. Test again
- Should work this time, assuming you downloaded the correct versions
Answered By - Danny Varod
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.