gpu命令cuda命令

# device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
os.environ["CUDA_VISIBLE_DEVICES"]="0,1"
# test=torch.cuda.is_available()
print(torch.cuda.device_count())
print(torch.cuda.get_device_name(1))
print(torch.cuda.current_device())
torch.cuda.set_device(0)


原文地址:https://www.cnblogs.com/jfdwd/p/11468141.html