免费GPU平台colab与aistudio体验对比

时间:2022-06-01 12:34:13

查看OS版本

!cat /etc/issue
Ubuntu 18.04.2 LTS n l

查看显卡配置

    !nvidia-smi
    
    Thu Aug  8 10:10:22 2019       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 418.67       Driver Version: 410.79       CUDA Version: 10.0     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
    | N/A   67C    P0    30W /  70W |    237MiB / 15079MiB |      0%      Default |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    +-----------------------------------------------------------------------------+
    

    查看cuda版本

      !nvcc -V

      nvcc: NVIDIA (R) Cuda compiler driver

      Copyright (c) 2005-2018 NVIDIA Corporation

      Built on Sat_Aug_25_21:08:01_CDT_2018

      Cuda compilation tools, release 10.0, V10.0.130

      查看cudnn版本


        !cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2

        #define CUDNN_MAJOR 7

        #define CUDNN_MINOR 6

        #define CUDNN_PATCHLEVEL 2

        --

        #define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

        #include "driver_types.h"

        • tensorflow的使用
        import tensorflow as tf
        print(tf.test.is_gpu_available())
        print(tf.__version__)
        
        True
        1.14.0
        

        百度aistudio

        查看OS版本

          !cat /etc/issue
          
          Ubuntu 16.04.6 LTS n l
          

          查看显卡

            !nvidia-smi
            
            Thu Aug  8 20:26:10 2019       
            +-----------------------------------------------------------------------------+
            | NVIDIA-SMI 396.37                 Driver Version: 396.37                    |
            |-------------------------------+----------------------+----------------------+
            | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
            | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
            |===============================+======================+======================|
            |   0  Tesla V100-SXM2...  Off  | 00000000:00:07.0 Off |                    0 |
            | N/A   34C    P0    41W / 300W |      0MiB / 16160MiB |      0%      Default |
            +-------------------------------+----------------------+----------------------+
                                                                                           
            +-----------------------------------------------------------------------------+
            | Processes:                                                       GPU Memory |
            |  GPU       PID   Type   Process name                             Usage      |
            |=============================================================================|
            |  No running processes found                                                 |
            +-----------------------------------------------------------------------------+
            

            查看cuda版本

              !nvcc -V
              
              nvcc: NVIDIA (R) Cuda compiler driver
              Copyright (c) 2005-2018 NVIDIA Corporation
              Built on Tue_Jun_12_23:07:04_CDT_2018
              Cuda compilation tools, release 9.2, V9.2.148
              

              说明

              cuda9.2这个版本对任何gpu版本的tensorflow都无法适配。。 期待百度那边早日升级cuda版本到10.0

              查看cudnn版本

                !cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
                
                #define CUDNN_MAJOR 7
                #define CUDNN_MINOR 3
                #define CUDNN_PATCHLEVEL 1
                --
                #define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
                
                #include "driver_types.h"
                

                tensorflow的使用(需手动安装)

                  !pip install tensorflow-gpu 
                  

                  说明

                  • 不指定版本的话,默认下载最新版本。import tensorflow不报错,但无可用的gpu,tensorflow检测不到相应版本的cuda包,自动切换到cpu版本
                  • !pip install tensorflow-gpu==1.12.0 后,import tensorflow 报错,提示需要cuda9.0,实际已装cuda9.2,cuda版本不匹配
                  • 高版本(1.14.0/1.13.1)的gpu需要cuda10.0,低版本(1.5.0-1.12.0)的gpu需要cuda9.0
                  import tensorflow as tf
                  print(tf.test.is_gpu_available())
                  print(tf.__version__)
                  
                  False
                  1.14.0
                  

                  总结对比

                  • colab环境较新,对tensorflow支持的较好。但是不支持数据的存储,断开重连后数据会丢失
                  • aistudio支持数据的存储,断开重连后数据还在。但运行环境只对自家的paddle适配的好,不自带tensorflow的包,每次重启需重新下载,且目前cuda的版本无法适配任何一版gpu的tensorflow

                  参考