CUDA_HOME path for Tensorflow

128.3k views Asked by At

The Tensorflow linux installation instructions say:

Ensure that you create the CUDA_HOME environment variable as described in the NVIDIA documentation.

I cannot find any mention of CUDA_HOME in the NVIDIA instructions for cuDNN v6 or in the NVIDIA CUDA Toolkit install instructions. Does anyone know how this variable should be set on linux?

4

There are 4 answers

7
Dmitry On

Run the following command in the terminal:

export CUDA_HOME=/usr/local/cuda-X.X

Where you replace X.X by the first two digits of your version number (can be found out e.g. via nvcc --version).

0
Andrew S On

If using anaconda to install, the following would apply:

export CUDA_HOME=$CONDA_PREFIX

You can add this to ~/.bashrc or ~/.bash_profile to have this environment variable persist between sessions. To apply this change in the bash file to your current session run: source ~/.bashrc or source ~/.bash_profile

Verify this by issuing an echo $CUDA_HOME command.

0
NatiCog On

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions

or for the latest version of cuda put export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}} at the end of your bashrc.

It should work

0
qwertyuiop On

Just had this issue whilst trying to install NVIDIAs Kaolin. As @user2023370 said the nvidia-cuda-toolkit creates a bunch of folders and I can confirm that it will set CUDA_HOME. This circumvents the need to set the variable with export CUDA_HOME=/usr/local/cuda-X.X

tldr; install nvidia-cuda-toolkit to set CUDA_HOME