I installed CUDA and NVIDIA driver using the following two commands.

$ sudo ubuntu-drivers install $ sudo apt install nvidia-cuda-toolkit 

However, now cuda is not available from within torch. Do you know how I could fix it?

$ python Python 3.7.6 (default, Jan 8 2020, 19:59:22) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> torch.__version__ '1.6.0' >>> torch.version.cuda '10.1' >>> torch.cuda.is_available() False 

I am also not sure why after installing the drivers still nvidia-smi is not working:

$ nvidia-smi NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running. $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal $ lspci | grep -i nvidia 01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2070 Mobile] (rev a1) 01:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1) 01:00.2 USB controller: NVIDIA Corporation TU106 USB 3.1 Host Controller (rev a1) 01:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU106 USB Type-C UCSI Controller (rev a1) 

1 Answer

The problem was fixed after I did a reboot:

(base) mona@mona:~$ nvidia-smi Thu Sep 24 13:04:12 2020 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 450.51.06 Driver Version: 450.51.06 CUDA Version: 11.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 GeForce RTX 2070 Off | 00000000:01:00.0 Off | N/A | | N/A 54C P8 8W / N/A | 428MiB / 7982MiB | 3% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 1256 G /usr/lib/xorg/Xorg 275MiB | | 0 N/A N/A 2422 G /usr/bin/gnome-shell 151MiB | +-----------------------------------------------------------------------------+ (base) mona@mona:~$ python Python 3.7.6 (default, Jan 8 2020, 19:59:22) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> torch.__version__ '1.6.0' >>> torch.version.cuda '10.1' >>> torch.cuda.is_ torch.cuda.is_available( torch.cuda.is_initialized( >>> torch.cuda.is_available() True 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy