所以我想用我的GPU在出色的文本中运行python代码,但我做不到。
如果我运行此代码:
import torch
def main():
if torch.cuda.is_available():
device = torch.device("cuda")
print("CUDA is available. Using GPU:",
torch.cuda.get_device_name(device))
else:
print("CUDA is not available. Switching to CPU.")
if __name__ == '__main__':
main()
它将输出:
CUDA is not available. Switching to CPU.
这是我在《崇高》中使用的构建系统:
"cmd": ["C:\\Users\\Edi\\miniconda3\\Scripts\\conda.exe", "run", "-n", "Env_CUDA", "python", "-u", "$file"],
"selector": "source.python",
"shell": true
}
Env_CUDA
是我执行以下命令时使用的环境:
conda install cudatoolkit=11.8`
conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch -c conda-forge
环境也是用python 3.10完成的。我有一个
gtx 1660 S
,我安装了CUDA工具包版本10安装类型exe(网络)
我真的不知道还有什么其他细节需要补充,所以可以提前询问并道歉:)