diff --git a/automotive/3d-object-detection/backend_deploy.py b/automotive/3d-object-detection/backend_deploy.py index b145b62195..2d2f42eb26 100644 --- a/automotive/3d-object-detection/backend_deploy.py +++ b/automotive/3d-object-detection/backend_deploy.py @@ -54,7 +54,7 @@ def name(self): return "python-SUT" def load(self): - device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") + device = torch.device("cuda" if torch.cuda.is_available() else "cpu") PaintArgs = namedtuple( 'PaintArgs', [ 'training_path', 'model_path', 'cam_sync']) @@ -84,7 +84,7 @@ def predict(self, inputs): ], [], [], [], [], [], [] with torch.inference_mode(): device = torch.device( - "cuda:0" if torch.cuda.is_available() else "cpu") + "cuda" if torch.cuda.is_available() else "cpu") model_input = inputs[0] batched_pts = model_input['pts'] scores_from_cam = [] diff --git a/language/bert/pytorch_SUT.py b/language/bert/pytorch_SUT.py index 89660c9d96..d980546b91 100644 --- a/language/bert/pytorch_SUT.py +++ b/language/bert/pytorch_SUT.py @@ -61,7 +61,7 @@ def __init__(self, args): self.network = args.network self.dev = ( - torch.device("cuda:0") if torch.cuda.is_available( + torch.device("cuda") if torch.cuda.is_available( ) else torch.device("cpu") ) self.version = transformers.__version__ diff --git a/language/gpt-j/backend_PyTorch.py b/language/gpt-j/backend_PyTorch.py index 49200c2096..6099777f98 100644 --- a/language/gpt-j/backend_PyTorch.py +++ b/language/gpt-j/backend_PyTorch.py @@ -81,7 +81,7 @@ def __init__( if self.use_gpu: print(f"Casting models to GPU...") assert torch.cuda.is_available(), "torch gpu is not available, exiting..." - self.device = torch.device("cuda:0") + self.device = torch.device("cuda") self.model.to(self.device) self.model.eval() diff --git a/language/llama2-70b/README.md b/language/llama2-70b/README.md index 0c0ad21952..9c73ec63e6 100644 --- a/language/llama2-70b/README.md +++ b/language/llama2-70b/README.md @@ -185,7 +185,7 @@ python3 -u main.py --scenario Offline \ --dataset-path ${DATASET_PATH} \ --output-log-dir offline-logs \ --dtype float32 \ - --device cuda:0 2>&1 | tee offline_performance_log.log + --device cuda 2>&1 | tee offline_performance_log.log ``` ### Server diff --git a/language/llama2-70b/main.py b/language/llama2-70b/main.py index 84ccf849ad..25f0fcac96 100644 --- a/language/llama2-70b/main.py +++ b/language/llama2-70b/main.py @@ -63,7 +63,7 @@ def get_args(): parser.add_argument( "--device", type=str, - choices=["cpu", "cuda:0"], + choices=["cpu", "cuda"], default="cpu", help="device to use", ) diff --git a/language/llama2-70b/run_accuracy.sh b/language/llama2-70b/run_accuracy.sh index b4f7f8ad96..83bce4ce96 100644 --- a/language/llama2-70b/run_accuracy.sh +++ b/language/llama2-70b/run_accuracy.sh @@ -12,7 +12,7 @@ python3 -u main.py --scenario Offline \ --dataset-path ${DATASET_PATH} \ --output-log-dir offline_accuracy_loadgen_logs \ --dtype float32 \ - --device cuda:0 2>&1 | tee offline_accuracy_log.log + --device cuda 2>&1 | tee offline_accuracy_log.log python3 evaluate-accuracy.py --checkpoint-path ${CHECKPOINT_PATH} \ --mlperf-accuracy-file offline_accuracy_loadgen_logs/mlperf_log_accuracy.json \ diff --git a/language/mixtral-8x7b/README.md b/language/mixtral-8x7b/README.md index 2bdcceb12c..bcdf6a58c9 100644 --- a/language/mixtral-8x7b/README.md +++ b/language/mixtral-8x7b/README.md @@ -174,7 +174,7 @@ python3 -u main.py --scenario Offline \ --dataset-path ${DATASET_PATH} \ --output-log-dir offline-logs \ --dtype float32 \ - --device cuda:0 2>&1 | tee offline_performance_log.log + --device cuda 2>&1 | tee offline_performance_log.log ``` ### Server diff --git a/language/mixtral-8x7b/main.py b/language/mixtral-8x7b/main.py index cd16e70323..45fab469f8 100644 --- a/language/mixtral-8x7b/main.py +++ b/language/mixtral-8x7b/main.py @@ -46,7 +46,7 @@ def get_args(): parser.add_argument( "--device", type=str, - choices=["cpu", "cuda:0"], + choices=["cpu", "cuda"], default="cpu", help="device to use", ) diff --git a/language/mixtral-8x7b/run_accuracy.sh b/language/mixtral-8x7b/run_accuracy.sh index 13da4e5daa..e206713598 100644 --- a/language/mixtral-8x7b/run_accuracy.sh +++ b/language/mixtral-8x7b/run_accuracy.sh @@ -11,7 +11,7 @@ python3 -u main.py --scenario Offline \ --dataset-path ${DATASET_PATH} \ --output-log-dir offline_accuracy_loadgen_logs \ --dtype float32 \ - --device cuda:0 2>&1 | tee offline_accuracy_log.log + --device cuda 2>&1 | tee offline_accuracy_log.log python3 evaluate-accuracy.py --checkpoint-path ${CHECKPOINT_PATH} \ --mlperf-accuracy-file offline_accuracy_loadgen_logs/mlperf_log_accuracy.json \ diff --git a/recommendation/dlrm_v2/pytorch/python/backend_pytorch_native.py b/recommendation/dlrm_v2/pytorch/python/backend_pytorch_native.py index 19f2b44af1..6771423abc 100755 --- a/recommendation/dlrm_v2/pytorch/python/backend_pytorch_native.py +++ b/recommendation/dlrm_v2/pytorch/python/backend_pytorch_native.py @@ -65,7 +65,7 @@ def __init__( os.environ["MASTER_ADDR"] = "localhost" os.environ["MASTER_PORT"] = "29500" if self.use_gpu: - self.device: torch.device = torch.device(f"cuda:0") + self.device: torch.device = torch.device(f"cuda") self.dist_backend = "nccl" # torch.cuda.set_device(self.device) else: diff --git a/retired_benchmarks/recommendation/dlrm/pytorch/python/backend_pytorch_native.py b/retired_benchmarks/recommendation/dlrm/pytorch/python/backend_pytorch_native.py index d861c44dc6..e864a96ef1 100755 --- a/retired_benchmarks/recommendation/dlrm/pytorch/python/backend_pytorch_native.py +++ b/retired_benchmarks/recommendation/dlrm/pytorch/python/backend_pytorch_native.py @@ -22,7 +22,7 @@ def __init__(self, m_spa, ln_emb, ln_bot, ln_top, self.ln_top = ln_top self.use_gpu = use_gpu and torch.cuda.is_available() - self.device = "cuda:0" if self.use_gpu else "cpu" + self.device = "cuda" if self.use_gpu else "cpu" ngpus = torch.cuda.device_count() if self.use_gpu else -1 self.ndevices = min(ngpus, mini_batch_size, ln_emb.size) diff --git a/retired_benchmarks/speech_recognition/rnnt/pytorch/decoders.py b/retired_benchmarks/speech_recognition/rnnt/pytorch/decoders.py index 7a6239da5f..2f4efd94c0 100644 --- a/retired_benchmarks/speech_recognition/rnnt/pytorch/decoders.py +++ b/retired_benchmarks/speech_recognition/rnnt/pytorch/decoders.py @@ -43,7 +43,7 @@ def __init__(self, blank_index, model, max_symbols_per_step=30): self._blank_id = blank_index self._SOS = -1 self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") diff --git a/retired_benchmarks/speech_recognition/rnnt/pytorch/model_separable_rnnt.py b/retired_benchmarks/speech_recognition/rnnt/pytorch/model_separable_rnnt.py index 638d115a22..be2986bc24 100644 --- a/retired_benchmarks/speech_recognition/rnnt/pytorch/model_separable_rnnt.py +++ b/retired_benchmarks/speech_recognition/rnnt/pytorch/model_separable_rnnt.py @@ -70,7 +70,7 @@ def __init__( ): super().__init__() self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") @@ -122,7 +122,7 @@ def __init__( ): super().__init__() self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") @@ -195,7 +195,7 @@ def __init__( ): super().__init__() self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") diff --git a/retired_benchmarks/speech_recognition/rnnt/pytorch/rnn.py b/retired_benchmarks/speech_recognition/rnnt/pytorch/rnn.py index 564eb9324a..f86dbaf842 100644 --- a/retired_benchmarks/speech_recognition/rnnt/pytorch/rnn.py +++ b/retired_benchmarks/speech_recognition/rnnt/pytorch/rnn.py @@ -65,7 +65,7 @@ def __init__( """ super(LstmDrop, self).__init__() self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") @@ -111,7 +111,7 @@ def __init__(self, factor): super().__init__() self.factor = int(factor) self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") diff --git a/retired_benchmarks/speech_recognition/rnnt/pytorch_SUT.py b/retired_benchmarks/speech_recognition/rnnt/pytorch_SUT.py index 2dad4c273d..f798c843e0 100644 --- a/retired_benchmarks/speech_recognition/rnnt/pytorch_SUT.py +++ b/retired_benchmarks/speech_recognition/rnnt/pytorch_SUT.py @@ -55,7 +55,7 @@ def __init__( featurizer_config = config["input_eval"] self.dev = ( - torch.device("cuda:0") + torch.device("cuda") if torch.cuda.is_available() and os.environ.get("USE_GPU", "").lower() not in ["no", "false"] else torch.device("cpu") diff --git a/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch.py b/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch.py index 02b010ac71..33295aec02 100755 --- a/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch.py +++ b/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch.py @@ -53,7 +53,7 @@ def load(self, model_path, inputs=None, outputs=None): self.outputs.append(i.name) # prepare the backend - device = "CUDA:0" if torch.cuda.is_available() else "CPU" + device = "cuda" if torch.cuda.is_available() else "CPU" self.sess = caffe2.python.onnx.backend.prepare(self.model, device) return self diff --git a/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch_native.py b/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch_native.py index ac79dee3a3..5be61b277c 100755 --- a/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch_native.py +++ b/retired_benchmarks/vision/classification_and_detection/python/backend_pytorch_native.py @@ -12,7 +12,7 @@ def __init__(self): super(BackendPytorchNative, self).__init__() self.sess = None self.model = None - self.device = "cuda:0" if torch.cuda.is_available() else "cpu" + self.device = "cuda" if torch.cuda.is_available() else "cpu" def version(self): return torch.__version__ diff --git a/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/pytorch_SUT.py b/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/pytorch_SUT.py index e27ecea62d..50b5f5a056 100644 --- a/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/pytorch_SUT.py +++ b/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/pytorch_SUT.py @@ -55,7 +55,7 @@ def __init__( ) self.trainer.load_checkpoint_ram(params[0], False) self.device = torch.device( - "cuda:0" if torch.cuda.is_available() else "cpu") + "cuda" if torch.cuda.is_available() else "cpu") print("Constructing SUT...") self.sut = lg.ConstructSUT(self.issue_queries, self.flush_queries) diff --git a/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/unet_pytorch_to_onnx.py b/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/unet_pytorch_to_onnx.py index 0bf896fa73..a55d1f167f 100644 --- a/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/unet_pytorch_to_onnx.py +++ b/retired_benchmarks/vision/medical_imaging/3d-unet-brats19/unet_pytorch_to_onnx.py @@ -77,7 +77,7 @@ def main(): width = 224 depth = 160 channels = 4 - device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") + device = torch.device("cuda" if torch.cuda.is_available() else "cpu") dummy_input = torch.rand( [1, channels, height, width, depth]).float().to(device) torch.onnx.export( diff --git a/vision/classification_and_detection/python/backend_pytorch.py b/vision/classification_and_detection/python/backend_pytorch.py index 02b010ac71..33295aec02 100644 --- a/vision/classification_and_detection/python/backend_pytorch.py +++ b/vision/classification_and_detection/python/backend_pytorch.py @@ -53,7 +53,7 @@ def load(self, model_path, inputs=None, outputs=None): self.outputs.append(i.name) # prepare the backend - device = "CUDA:0" if torch.cuda.is_available() else "CPU" + device = "cuda" if torch.cuda.is_available() else "CPU" self.sess = caffe2.python.onnx.backend.prepare(self.model, device) return self diff --git a/vision/classification_and_detection/python/backend_pytorch_native.py b/vision/classification_and_detection/python/backend_pytorch_native.py index 23a1a7f9ca..c61b65605e 100755 --- a/vision/classification_and_detection/python/backend_pytorch_native.py +++ b/vision/classification_and_detection/python/backend_pytorch_native.py @@ -13,7 +13,7 @@ def __init__(self): super(BackendPytorchNative, self).__init__() self.sess = None self.model = None - self.device = "cuda:0" if torch.cuda.is_available() else "cpu" + self.device = "cuda" if torch.cuda.is_available() else "cpu" def version(self): return torch.__version__ diff --git a/vision/medical_imaging/3d-unet-kits19/pytorch_SUT.py b/vision/medical_imaging/3d-unet-kits19/pytorch_SUT.py index cd136adf19..840d3d3c9e 100644 --- a/vision/medical_imaging/3d-unet-kits19/pytorch_SUT.py +++ b/vision/medical_imaging/3d-unet-kits19/pytorch_SUT.py @@ -71,7 +71,7 @@ def __init__(self, model_path, preprocessed_data_dir, performance_count): model_path ) self.device = torch.device( - "cuda:0" if torch.cuda.is_available() else "cpu") + "cuda" if torch.cuda.is_available() else "cpu") self.model = torch.jit.load(model_path, map_location=self.device) self.model.eval() diff --git a/vision/medical_imaging/3d-unet-kits19/pytorch_checkpoint_SUT.py b/vision/medical_imaging/3d-unet-kits19/pytorch_checkpoint_SUT.py index 1453d5cf59..ce8ddbb8f5 100644 --- a/vision/medical_imaging/3d-unet-kits19/pytorch_checkpoint_SUT.py +++ b/vision/medical_imaging/3d-unet-kits19/pytorch_checkpoint_SUT.py @@ -302,7 +302,7 @@ def __init__(self, model_path, preprocessed_data_dir, performance_count): model_path ) self.device = torch.device( - "cuda:0" if torch.cuda.is_available() else "cpu") + "cuda" if torch.cuda.is_available() else "cpu") self.model = Unet3D() self.model.to(self.device) checkpoint = torch.load(model_path, map_location=self.device) diff --git a/vision/medical_imaging/3d-unet-kits19/unet_pytorch_to_onnx.py b/vision/medical_imaging/3d-unet-kits19/unet_pytorch_to_onnx.py index 8164d7d05c..00dc078ed4 100644 --- a/vision/medical_imaging/3d-unet-kits19/unet_pytorch_to_onnx.py +++ b/vision/medical_imaging/3d-unet-kits19/unet_pytorch_to_onnx.py @@ -96,7 +96,7 @@ def main(): assert Path(model_path).is_file(), "Cannot find the model file {:}!".format( model_path ) - device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") + device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = torch.jit.load(model_path, map_location=device) model.eval()