运行时
为什么gpu计算测试失败?
2025-08-18 19:53:55
88

python -c "

import torch
device = torch.device('cuda:0')
print(f'使用设备: {device}')

创建测试张量

x = torch.randn(3, 3).to(device)
y = torch.randn(3, 3).to(device)
z = torch.mm(x, y)

print(f'张量 x: {x}')
print(f'张量 y: {y}')
print(f'结果 z: {z}')
print('GPU 计算测试成功!')
"

使用设备: cuda:0
Segmentation fault (core dumped)

全部评论(1)
只看楼主
Z
zc
1楼
可能使用的torch与驱动版本不兼容,可以尝试“python -c "import torch; print(torch.cuda.is_available())"”,或者可以寻找适合DTK版本的torch包重新安装
2025/8/20
没有更多内容了
--
楼主
Level.1
0 帖子
楼主热帖
暂无数据