检测torch是否能够调用cuda

import torch
#检查cuda是否可以使用
torch.cuda.is_available()
#查看当前gpu索引号
torch.cuda.current_device()
#查看当前cuda流
torch.cuda.current_stream(device=0)
#选择device
torch.cuda.device(1)
#查看有多少个GPU设备
torch.cuda.device_count()
#查看gpu的容量
torch.cuda.get_device_capability(device=0)
#查看cuda版本
print(torch.version.cuda)
#查看cudnn版本
print(torch.backends.cudnn.version())


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部