因为电脑太卡了,重装了win10系统,傻瓜式安装直接点setup的那种,最后的最后,显示正在重启之后黑屏就没再亮屏,最后解决方法:把主机上的显示器插头换到另一个vga接口上去。
先上成功结果图:
测试代码:
import torch
# 以下代码只有在PyTorch GPU版本上才会执行
import time
print(torch.__version__)
print(torch.cuda.is_available())
a = torch.randn(10000, 1000)
b = torch.randn(1000, 2000)
t0 = time.time()
c = torch.matmul(a, b)
t1 = time.time()
print(a.device, t1 - t0, c.norm(2))
device = torch.device('cuda')
a = a.to(device)
b = b.to(device)
t0 = time.time()
c = torch.matmul(a, b)
t1 = time.time()
print(a.device, t1 - t0, c.norm(2))
t0 = time.time()
c = torch.matmul(a, b)
t1 = time.time()
print(a.device, t1 - t0, c.norm(2))
测试结果:
下面简单总结一下:
1.重装系统-----用的学长的iso映像文件,解压到文件夹后,点setup傻瓜式安装 ,黑屏换了vga接口就能正常显示了。
2.安装cuda10.1和cudnn,(老师给我发的我的电脑是个GT730,居然cuda版本到了11.1???我还去torch官网下了支持cuda11.1的版本....查过之后发现挺垃圾的,不过据说也好几千买的电脑,阿哲,也不能换,将就用了。)
查过资料后发现cuda可以向下兼容,于是选择安装了cuda10.1,具体安装可以看这篇博客很清楚:(感谢博主!)windows10+nvidia驱动+cuda10.1+cudnn安装教程_fengxinzioo的博客-优快云博客
安装完成cuda10.1和cudnn之后,安装torch,最开始看官网的支持cuda10.1的版本,然后起初我的python是anaconda3里带的python3.8,就想着v1.6.0应该能抗,最后测试上边的代码,不行。
换低版本torch-----v1.5.0 不行
最后在这个官网找不到适配cuda10.1的了Previous PyTorch Versions | PyTorchhttps://pytorch.org/get-started/previous-versions/
但是下边这个链接有:hhh
https://download.pytorch.org/whl/torch_stable.html
找到对应的版本(torch和torchvision):
因为安装的cuda10.1对应cu101/ cp37对应python3.7(需要降级安装python)
降级安装方法:
% 打开anaconda prompt,输入以下代码
conda install python=3.7
我安装的两个包:
cu101/torch-1.3.0-cp37-cp37m-win_amd64.whl
torchvision-0.4.1-cp37-cp37m-win_amd64.whl
因为GT730挺拉的,显然,高版本的用不了(好像是算力太低了),所以机子比较辣鸡的同学尽量下低版本的torch吧。
等待安装完成,终于可以了。希望对有困惑地同学有帮助。