撸羊毛-免费使用谷歌T4 GPU - Colab使用

2019-06-12  本文已影响0人  _龙雀

截止到目前2019.6.12 可免费使用的gpu显存为15g,内存空间为12g,gpu型号为Tesla T4

from google.colab import drive
drive.mount('/content/drive') 

运行之后会出现一个验证框


image.png

点击蓝色链接,复制显示的验证码进行验证

path  = '/content/drive/My Drive/Colab Notebooks/'
import os
os.chdir(path) 
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi
!pip install gputil
!pip install psutil
!pip install humanize
import psutil
import humanize
import os
import GPUtil as GPU
GPUs = GPU.getGPUs()
gpu = GPUs[0]
def printm():
 process = psutil.Process(os.getpid())
 print("Gen RAM Free: " + humanize.naturalsize( psutil.virtual_memory().available ), " | Proc size: " + humanize.naturalsize( process.memory_info().rss))
 print("GPU RAM Free: {0:.0f}MB | Used: {1:.0f}MB | Util {2:3.0f}% | Total {3:.0f}MB".format(gpu.memoryFree, gpu.memoryUsed, gpu.memoryUtil*100, gpu.memoryTotal))
printm()
!/opt/bin/nvidia-smi
image.png
上一篇下一篇

猜你喜欢

热点阅读