Skip to content

Commit 1c81edf

Browse files
committed
CUDA variables -> HIP variables
Signed-off-by: Steven Hahn <hahnse@ornl.gov>
1 parent f7a12af commit 1c81edf

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

bin/wfbench

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,20 @@ class GPUBenchmark:
272272

273273
if self.duration is not None:
274274
log_debug(f"Running GPU benchmark for {self.duration} seconds")
275-
gpu_prog = [
276-
f"CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES={self.device} {this_dir.joinpath('./gpu_benchmark')} {self.work} {self.duration}"]
275+
if shutil.which("nvidia-smi") is not None:
276+
gpu_prog = [
277+
f"CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES={self.device} {this_dir.joinpath('./gpu_benchmark')} {self.work} {self.duration}"]
278+
else:
279+
gpu_prog = [
280+
f"HIP_DEVICE_ORDER=PCI_BUS_ID HIP_VISIBLE_DEVICES={self.device} {this_dir.joinpath('./gpu_benchmark')} {self.work} {self.duration}"]
277281
else:
278282
log_debug(f"Running GPU benchmark for {self.work} units of work")
279-
gpu_prog = [
280-
f"CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES={self.device} {this_dir.joinpath('./gpu_benchmark')} {self.work}"]
281-
283+
if shutil.which("nvidia-smi") is not None:
284+
gpu_prog = [
285+
f"CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES={self.device} {this_dir.joinpath('./gpu_benchmark')} {self.work}"]
286+
else:
287+
gpu_prog = [
288+
f"HIP_DEVICE_ORDER=PCI_BUS_ID HIP_VISIBLE_DEVICES={self.device} {this_dir.joinpath('./gpu_benchmark')} {self.work}"]
282289
p = subprocess.Popen(gpu_prog, shell=True)
283290
return ProcessHandle(p)
284291

0 commit comments

Comments
 (0)