1

When I install tensorflow-gpu through Conda; it gives me the following output:

conda install tensorflow-gpu
Collecting package metadata (current_repodata.json): done
Solving environment: done


## Package Plan ##

  environment location: /home/psychotechnopath/anaconda3/envs/DeepLearning3.6

  added / updated specs:
    - tensorflow-gpu


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _tflow_select-2.1.0        |              gpu           2 KB
    cudatoolkit-10.1.243       |       h6bb024c_0       347.4 MB
    cudnn-7.6.5                |       cuda10.1_0       179.9 MB
    cupti-10.1.168             |                0         1.4 MB
    tensorflow-2.1.0           |gpu_py36h2e5cdaa_0           4 KB
    tensorflow-base-2.1.0      |gpu_py36h6c5654b_0       155.9 MB
    tensorflow-gpu-2.1.0       |       h0d30ee6_0           3 KB
    ------------------------------------------------------------
                                           Total:       684.7 MB

The following NEW packages will be INSTALLED:

  cudatoolkit        pkgs/main/linux-64::cudatoolkit-10.1.243-h6bb024c_0
  cudnn              pkgs/main/linux-64::cudnn-7.6.5-cuda10.1_0
  cupti              pkgs/main/linux-64::cupti-10.1.168-0
  tensorflow-gpu     pkgs/main/linux-64::tensorflow-gpu-2.1.0-h0d30ee6_0

I see that installing tensorflow-gpu automatically triggers the installation of the cudatoolkit and cudnn. Does this mean that I no longer need to install CUDA and CUDNN manually anymore to be able to use tensorflow-gpu? Where does this conda installation of CUDA reside?

I first installed CUDA and CuDNN the old way (e.g. by following these installation instructions: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html )

And then I noticed that tensorflow-gpu was also installing cuda and cudnn

Do i now have two versions of CUDA/CuDNN installed and how do I check this?

AMC
  • 2,642
  • 7
  • 13
  • 35
Psychotechnopath
  • 2,471
  • 5
  • 26
  • 47
  • 4
    You have one install "in" the conda env, and one "outside" it. They should not conflict. The command given in the answer will not affect the CUDA install "outside" of the conda env. Your TF in conda will use the CUDA install "in" the conda env. Just make sure you have a recent driver installed for your GPU. Impossible to tell since you didn't indicate what CUDA version you installed "outside" the conda env. I wouldn't remove the CUDA install "outside" the conda env, as that may remove the GPU driver, depending on your OS and the exact install method you used. – Robert Crovella Apr 30 '20 at 22:13
  • @RobertCrovella thanks! nvcc --version gives me 10.1.243, which seems to be the same as the cuda inside my conda env. – Psychotechnopath May 01 '20 at 06:27
  • 1
    conda doesn't install a cuda toolkit. It installs a couple of libraries from the official NVIDIA distribution runtime. You don't have two CUDA toolkits. You have one, the one you installed separately – talonmies May 01 '20 at 07:05
  • @talonmies Thanks for your response =) Is a seperate CUDA toolkit still required to use GPU-acceleration on tensorflow? Or will the libraries that tensorflow installs suffice? – Psychotechnopath May 01 '20 at 07:32
  • 1
    As for your other comment -- it is not "my" tag. It is the tag for the "people who do CUDA programming". What you really have here is a conda package management question -- "what did conda just install and do I need it for their tensorflow package". – talonmies May 01 '20 at 07:46
  • @RobertCrovella I am a data-scientist in training, and I mostly use CUDA for deep learning; what do you recommend. Stick with the old way (e.g. installing CUDA, installing CUDNN manually) or is it better to let conda take care of this? – Psychotechnopath May 02 '20 at 08:07
  • 1
    When I am using applications installed by conda, I let conda take care of this. I don't think there is anything you need to do at this point. Your two installs should not conflict. – Robert Crovella May 02 '20 at 14:33

1 Answers1

11

Do i now have two versions of CUDA installed and how do I check this?

No.

conda installs the bare minimum redistributable library components required to support the CUDA accelerated packages they offer. The package name cudatoolkit is a complete misnomer. It is nothing of the sort. Even though it is now greatly expanded in scope from what it used to be (literally 5 files -- I think at some point they must have gotten a licensing deal from NVIDIA because some of this wasn't/isn't on the official "freely redistributable" list AFAIK), it still is basically just a handful of libraries.

You can check this for yourself:

cat /opt/miniconda3/conda-meta/cudatoolkit-10.1.168-0.json 
{
  "build": "0",
  "build_number": 0,
  "channel": "https://repo.anaconda.com/pkgs/main/linux-64",
  "constrains": [],
  "depends": [],
  "extracted_package_dir": "/opt/miniconda3/pkgs/cudatoolkit-10.1.168-0",
  "features": "",
  "files": [
    "lib/cudatoolkit_config.yaml",
    "lib/libcublas.so",
    "lib/libcublas.so.10",
    "lib/libcublas.so.10.2.0.168",
    "lib/libcublasLt.so",
    "lib/libcublasLt.so.10",
    "lib/libcublasLt.so.10.2.0.168",
    "lib/libcudart.so",
    "lib/libcudart.so.10.1",
    "lib/libcudart.so.10.1.168",
    "lib/libcufft.so",
    "lib/libcufft.so.10",
    "lib/libcufft.so.10.1.168",
    "lib/libcufftw.so",
    "lib/libcufftw.so.10",
    "lib/libcufftw.so.10.1.168",
    "lib/libcurand.so",
    "lib/libcurand.so.10",
    "lib/libcurand.so.10.1.168",
    "lib/libcusolver.so",
    "lib/libcusolver.so.10",
    "lib/libcusolver.so.10.1.168",
    "lib/libcusparse.so",
    "lib/libcusparse.so.10",
    "lib/libcusparse.so.10.1.168",
    "lib/libdevice.10.bc",
    "lib/libnppc.so",
    "lib/libnppc.so.10",
    "lib/libnppc.so.10.1.168",
    "lib/libnppial.so",
    "lib/libnppial.so.10",
    "lib/libnppial.so.10.1.168",
    "lib/libnppicc.so",
    "lib/libnppicc.so.10",
    "lib/libnppicc.so.10.1.168",
    "lib/libnppicom.so",
    "lib/libnppicom.so.10",
    "lib/libnppicom.so.10.1.168",
    "lib/libnppidei.so",
    "lib/libnppidei.so.10",
    "lib/libnppidei.so.10.1.168",
    "lib/libnppif.so",
    "lib/libnppif.so.10",
    "lib/libnppif.so.10.1.168",
    "lib/libnppig.so",
    "lib/libnppig.so.10",
    "lib/libnppig.so.10.1.168",
    "lib/libnppim.so",
    "lib/libnppim.so.10",
    "lib/libnppim.so.10.1.168",
    "lib/libnppist.so",
    "lib/libnppist.so.10",
    "lib/libnppist.so.10.1.168",
    "lib/libnppisu.so",
    "lib/libnppisu.so.10",
    "lib/libnppisu.so.10.1.168",
    "lib/libnppitc.so",
    "lib/libnppitc.so.10",
    "lib/libnppitc.so.10.1.168",
    "lib/libnpps.so",
    "lib/libnpps.so.10",
    "lib/libnpps.so.10.1.168",
    "lib/libnvToolsExt.so",
    "lib/libnvToolsExt.so.1",
    "lib/libnvToolsExt.so.1.0.0",
    "lib/libnvblas.so",
    "lib/libnvblas.so.10",
    "lib/libnvblas.so.10.2.0.168",
    "lib/libnvgraph.so",
    "lib/libnvgraph.so.10",
    "lib/libnvgraph.so.10.1.168",
    "lib/libnvjpeg.so",
    "lib/libnvjpeg.so.10",
    "lib/libnvjpeg.so.10.1.168",
    "lib/libnvrtc-builtins.so",
    "lib/libnvrtc-builtins.so.10.1",
    "lib/libnvrtc-builtins.so.10.1.168",
    "lib/libnvrtc.so",
    "lib/libnvrtc.so.10.1",
    "lib/libnvrtc.so.10.1.168",
    "lib/libnvvm.so",
    "lib/libnvvm.so.3",
    "lib/libnvvm.so.3.3.0"
  ]

  .....

i.e. what you get is (keeping in mind most of those "files" above are just symlinks)

  • CUBLAS runtime
  • The CUDA runtime library
  • CUFFT runtime
  • CUrand runtime
  • CUsparse rutime
  • CUsolver runtime
  • NPP runtime
  • nvblas runtime
  • NVTX runtime
  • NVgraph runtime
  • NVjpeg runtime
  • NVRTC/NVVM runtime

The CUDNN package that conda installs is the redistributable binary distribution which is identical to what NVIDIA distribute -- which is exactly two files, a header file and a library.

You would still require a supported NVIDIA driver installation to make the tensorflow which conda installs work.

If you want to actually compile and build CUDA code, you need to install a separate CUDA toolkit which contains all the the development components which conda deliberately omits from their distribution.

talonmies
  • 70,661
  • 34
  • 192
  • 269
  • Thank you! That clears up a lot of things. I think there might be some error in this tensorflow-gpu installation of conda, which I explain [here](https://stackoverflow.com/questions/61540152/failed-to-get-convolution-algorithm-error-tensorflow-gpu-on-ubuntu-20-04). Now at least I know this has nothing to do with the CUDA-toolkit. – Psychotechnopath May 01 '20 at 09:50