tensorflowcudagpugoogle-colaboratorynvidia

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running. Why?


I'm trying to run stylegan2 on Google Colab but with all the files on my Drive and avoiding using !git clone from the github of stylegan2. Here is my code on the specific cell:

%tensorflow_version 1.x
%cd /content/drive/My Drive/stylegan2-master/
!nvcc test_nvcc.cu -o test_nvcc -run
print('Tensorflow version: {}'.format(tf.__version__) )
!nvidia-smi -L
print('GPU Identified at: {}'.format(tf.test.gpu_device_name()))

And the result:

/content/drive/My Drive/stylegan2-master CPU says hello. cudaErrorNoDevice: no CUDA-capable device is detected Tensorflow version: 1.15.2 NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

GPU Identified at:

Why can't I get the GPU? I am new in the field so I may be missing something very simple, but still can't find out on the internet the answer.


Solution

  • You have to enable the GPU first in the Notebook settings.

    You can easily do it by clicking on Edit > Notebook settings and selecting GPU as hardware accelerator.

    That should be it.