首先,建议更新ROCm和amdgpu-pro驱动程序。如果问题仍然存在,请尝试使用以下命令:
export HSA_OVERRIDE_GFX_VERSION=1010 # or 1011/1012
export HIP_VISIBLE_DEVICES=0 # (0/1/2/3 etc corresponding to gpu ids)
这将在环境变量中设置正确的GFX版本,并将可见设备设置为您要使用的GPU。然后,在Pytorch代码中,确保在初始化GPU时使用hip包而不是torch。例如:
import torch
# Replace this line
device = torch.device('cuda')
# with this
device = torch.device('hip')
# The rest of the code should work as expected
这应该解决问题并让您顺利运行您的Pytorch代码。
上一篇:amdrezenubuntu
下一篇:amd深度学习主机