How to install CUDA in Google Colab GPU's

前端 未结 7 1668
悲哀的现实
悲哀的现实 2020-12-05 13:31

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 Cola

7条回答
  •  执笔经年
    2020-12-05 14:01

    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.

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

    !nvidia-smi
    

    If output is like following image it means your GPU and cuda is working. You can see cuda version also.

    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'
    

提交回复
热议问题