Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nvidia Cudatoolkit vs Conda Cudatoolkit

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.  This is my base environment where I installed Tensorflow-GPU using pip

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.This is a new environment where I used conda to install tensorflow-gpu

So does this mean, that downloading and installing Cuda from Nvidia's website is only necessary if I use pip to install TensorFlow?

like image 848
Rajdeep Dutta Avatar asked Dec 30 '19 11:12

Rajdeep Dutta


People also ask

What is conda Cudatoolkit?

The CUDA Toolkit from NVIDIA provides everything you need to develop GPU-accelerated applications. This CUDA Toolkit includes GPU-accelerated libraries, and the CUDA runtime for the Conda ecosystem. For the full CUDA Toolkit with a compiler and development tools visit https://developer.nvidia.com/cuda-downloads.

Does Cudatoolkit need CUDA?

Cuda needs to be installed in addition to the display driver unless you use conda with cudatoolkit or pip with cudatoolkit. Tensorflow and Pytorch need the CUDA system install if you install them with pip without cudatoolkit or from source.

Is Cudatoolkit backwards compatible?

The CUDA driver maintains backward compatibility to continue support of applications built on older toolkits. Using a compatible minor driver version, applications build on CUDA Toolkit 11 and newer are supported on any driver from within the corresponding major release.

Where is CUDA Toolkit in conda?

Building applications The various CUDA Toolkit components are installed in the conda environment at: $CONDA_PREFIX/bin - CUDA executables: nvcc, cuda-memcheck, cuda-gdb, etc.


Video Answer


2 Answers

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:

  1. Anaconda will always install the CUDA and CuDNN version that the TensorFlow code was compiled to use.
  2. You can have multiple conda environments with different levels of TensorFlow, CUDA, and CuDNN and just use conda activate to switch between them.
  3. 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.

like image 159
William D. Irons Avatar answered Oct 11 '22 13:10

William D. Irons


Nvidia now has official channel for conda. the package name is nvidia/cuda. I prefer conda for easier managing different cuda enviroment.

What I found to be missing in conda-forge/cudatoolkit is nvcc and I guess some other utils for compiling but not running enviroment is also missing.

this post say conda-forge/cudatoolkit-dev will install nvcc, but I haven't tried.

like image 3
tothedistance Avatar answered Oct 11 '22 13:10

tothedistance