Skip to content

Commit f0c7c42

Browse files
Add validation --target-cuda/--target-hip to avoid ambiguity with CMake options
1 parent 00ce83c commit f0c7c42

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scripts/build_locally.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ def run(
7373
"--target-cuda can not be an empty string. "
7474
"Use --target-cuda=<arch> or --target-cuda"
7575
)
76+
if any(opt.startswith("-DDPCTL_TARGET_CUDA=") for opt in cmake_args):
77+
raise ValueError(
78+
"Both --target-cuda and -DDPCTL_TARGET_CUDA in --cmake-opts "
79+
"were specified. Please use only one method "
80+
"to avoid ambiguity"
81+
)
7682
cmake_args += [
7783
f"-DDPCTL_TARGET_CUDA={target_cuda}",
7884
]
@@ -81,6 +87,12 @@ def run(
8187
raise ValueError(
8288
"--target-hip requires an architecture (e.g., gfx90a)"
8389
)
90+
if any(opt.startswith("-DDPCTL_TARGET_HIP=") for opt in cmake_args):
91+
raise ValueError(
92+
"Both --target-hip and -DDPCTL_TARGET_HIP in --cmake-opts "
93+
"were specified. Please use only one method "
94+
"to avoid ambiguity"
95+
)
8496
cmake_args += [
8597
f"-DDPCTL_TARGET_HIP={target_hip}",
8698
]

0 commit comments

Comments
 (0)