Windows下,pycharm中使用GPU,torch.cuda.is

您所在的位置:网站首页 索尼wh900N真假 Windows下,pycharm中使用GPU,torch.cuda.is

Windows下,pycharm中使用GPU,torch.cuda.is

2022-05-31 08:17| 来源: 网络整理| 查看: 265

晕死我了。看了好多方法,说为什么正常安装anaconda + cuda + pytorch后,gpu还是不可用。试了好多方法,重下在了好几个版本的cuda,

结果在pycharm中运行下面的代码:

import torch torch.device('cpu'), torch.device('cuda'), torch.device('cuda:1') # 分别是访问CPU,访问第0个GPU,访问第1个GPU。第 𝑖 块GPU( 𝑖 从0开始) print(torch.cuda.device_count()) # 查询可用gpu的数量。 print(torch.cuda.is_available())# 查询gpu是否可用。

结果还是

torch.cuda.is_available()输出是false,说明没有gpu版本的torch.

终于,我发现了我一个非常蠢的操作:(我把python控制台里的解释器interpreter options设置成了默认的python3.9)

(在这里:File -> Settings -> Environment)

然后,我改了一下:

就成了:

 ε=(´ο`*)))唉!!!



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3