Skip to content

Commit

Permalink
add special device mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
FindHao committed Jul 6, 2023
1 parent ae3534a commit 290d702
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions torchbenchmark/util/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
save_deterministic_dict, load_deterministic_dict, check_accuracy
from torchbenchmark.util.fx_int8 import get_sub_module, prepare_sub_module, convert_sub_module

SPECIAL_DEVICE_MAPPING = {
"AMD Instinct MI210": "NVIDIA A100-SXM4-40GB"
}

class PostInitProcessor(type):
def __call__(cls, *args, **kwargs):
obj = type.__call__(cls, *args, **kwargs)
Expand Down Expand Up @@ -158,6 +162,8 @@ def determine_batch_size(self, batch_size=None):
if self.device == "cuda":
current_device_name = torch.cuda.get_device_name()
assert current_device_name, f"torch.cuda.get_device_name() returns None when device is set to cuda, please double check."
if current_device_name in SPECIAL_DEVICE_MAPPING:
current_device_name = SPECIAL_DEVICE_MAPPING[current_device_name]
elif self.device == "cpu":
current_device_name = "cpu"
elif self.device == "mps":
Expand Down

0 comments on commit 290d702

Please sign in to comment.