Issue
Till date, I have been using Tensorflow-GPU by installing it using pip and the Cuda related software and Nvidia softwares/drivers from Nvidia's website. Recently, I found that using conda install tensorflow-gpu
also installs cudatoolkit and cudnn.
So, how are these(the ones provided by conda) different from the ones that I downloaded from Nvidia's website?
In my first (previous) environment, conda list
showed that I have installed only TensorFlow(from PyPi) and no cudnn/cudatoolkit, but still everything worked.
Also, in a new environment in which I ran conda install tensorflow-gpu
, conda list
showed me tensorflow-gpu has been installed along with cudatoolkit and cudnn by Anaconda. And in this environment also, everything worked fine.
So does this mean, that downloading and installing Cuda from Nvidia's website is only necessary if I use pip to install TensorFlow?
Solution
If using anaconda to install tensorflow-gpu, yes it will install cuda and cudnn for you in same conda environment as tensorflow-gpu. All you need to install yourself is the latest nvidia-driver (so that it works with the latest CUDA level and all older CUDA levels you use.)
This has many advantages over the pip install tensorflow-gpu method:
- Anaconda will always install the CUDA and CuDNN version that the TensorFlow code was compiled to use.
- You can have multiple conda environments with different levels of TensorFlow, CUDA, and CuDNN and just use conda activate to switch between them.
- You don't have to deal with installing CUDA and cuDNN manaually at the system wide level.
The disadvantage when compared to pip install tensorflow-gpu, is the latest version of tensorflow is added to pypi weeks before Anaconda is able to update the conda recipe and publish their builds of the latest TensorFlow version.
Answered By - William D. Irons
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.