GTX_AI 发表于 2020-5-17 18:25:10

pytorch获取当前GPU信息


pytorch获取当前GPU信息:
import torch
gpu_num = torch.cuda.device_count()
print('GPU数量:%d' % (gpu_num))
for i in range(gpu_num):
    gpu_name = torch.cuda.get_device_name(i)
    print('GPU名称:%s' % (gpu_name))
    gpu_busy = torch.cuda.is_available()
    print('%s是否可用:%d' % (gpu_name, gpu_busy))
    gpu_index = torch.cuda.current_device()
    print('当前GPU索引:%d' % (gpu_index))

页: [1]
查看完整版本: pytorch获取当前GPU信息