You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our software, we install the ROCm enabled pytorch if we detect an AMD GPU on Linux. Otherwise, we install the CUDA-enabled pytorch. If the AMD GPU is not supported by ROCm, the users get an error hipErrorNoBinaryForGpu: Unable to find code object for all current devices!.
Is there a way to fallback to CPU mode in the ROCm enabled pytorch?
Code example
>>>importtorch>>>torch.cuda.is_available()
"hipErrorNoBinaryForGpu: Unable to find code object for all current devices!"Aborted (coredumped)
The text was updated successfully, but these errors were encountered:
import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
if device.type == 'cuda':
try:
# Try to use ROCm-enabled PyTorch
model.to(device)
except RuntimeError as error:
if 'Unable to find code object for all current devices' in str(error):
# Fallback to CPU mode
device = torch.device('cpu')
else:
# Re-raise the error if it's not the one we expect
raise error
else:
# Use CPU mode
model.to(device)
Issue description
In our software, we install the ROCm enabled pytorch if we detect an AMD GPU on Linux. Otherwise, we install the CUDA-enabled pytorch. If the AMD GPU is not supported by ROCm, the users get an error
hipErrorNoBinaryForGpu: Unable to find code object for all current devices!
.Is there a way to fallback to CPU mode in the ROCm enabled pytorch?
Code example
The text was updated successfully, but these errors were encountered: