Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
802 views
in Technique[技术] by (71.8m points)

python - How to install CUDA in Google Colab GPU's

It seems that Google Colab GPU's doesn't come with CUDA Toolkit, how can I install CUDA in Google Colab GPU's. I am getting this error in installing mxnet in Google Colab.

Installing collected packages: mxnet
Successfully installed mxnet-1.2.0

ERROR: Incomplete installation for leveraging GPUs for computations. Please make sure you have CUDA installed and run the following line in your terminal and try again:

pip uninstall -y mxnet && pip install mxnet-cu90==1.1.0

Adjust 'cu90' depending on your CUDA version ('cu75' and 'cu80' are also available). You can also disable GPU usage altogether by invoking turicreate.config.set_num_gpus(0). An exception has occurred, use %tb to see the full traceback.

SystemExit: 1
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Cuda is not showing on your notebook because you have not enabled GPU in Colab.

The Google Colab comes with both options GPU or without GPU. You can enable or disable GPU in runtime settings

Go to Menu > Runtime > Change runtime.

Change hardware acceleration to GPU.

GPU Settings Screenshot

To check if GPU is running or not, run the following command

!nvidia-smi

If the output is like the following image it means your GPU and cuda are working. You can see the CUDA version also.cuda confirmation screenshot

After that to check if PyTorch is capable of using GPU, run the following code.

import torch
torch.cuda.is_available()
# Output would be True if Pytorch is using GPU otherwise it would be False.

To check if TensorFlow is capable of using GPU, run the following code.

import tensorflow as tf
tf.test.gpu_device_name()
# Standard output is '/device:GPU:0'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...