Is it still necessary to install CUDA before using the conda tensorflow-gpu package?

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?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x