Skip to content

Commit 25bf7b9

Browse files
Enable CUDA architecture selection via --target-cuda
1 parent b6ed7f6 commit 25bf7b9

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

scripts/build_locally.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def run(
3838
cmake_executable=None,
3939
verbose=False,
4040
cmake_opts="",
41-
target="intel",
41+
target_cuda=None,
4242
target_hip=None,
4343
onemkl_interfaces=False,
4444
onemkl_interfaces_dir=None,
@@ -98,12 +98,14 @@ def run(
9898
if "DPL_ROOT" in os.environ:
9999
os.environ["DPL_ROOT_HINT"] = os.environ["DPL_ROOT"]
100100

101-
if not target.strip():
102-
target = "intel"
103-
104-
if target == "cuda":
101+
if target_cuda is not None:
102+
if not target_cuda.strip():
103+
raise ValueError(
104+
"--target-cuda can not be an empty string. "
105+
"Use --target-cuda=<arch> or --target-cuda"
106+
)
105107
cmake_args += [
106-
"-DDPNP_TARGET_CUDA=ON",
108+
f"-DDPNP_TARGET_CUDA={target_cuda}",
107109
]
108110
# Always builds using oneMKL interfaces for the cuda target
109111
onemkl_interfaces = True
@@ -186,10 +188,12 @@ def run(
186188
type=str,
187189
)
188190
driver.add_argument(
189-
"--target",
190-
help="Target backend for build",
191-
dest="target",
192-
default="intel",
191+
"--target-cuda",
192+
nargs="?",
193+
const="ON",
194+
help="Enable CUDA target for build; "
195+
"optionally specify architecture (e.g., sm_80)",
196+
default=None,
193197
type=str,
194198
)
195199
driver.add_argument(
@@ -265,7 +269,7 @@ def run(
265269
cmake_executable=args.cmake_executable,
266270
verbose=args.verbose,
267271
cmake_opts=args.cmake_opts,
268-
target=args.target,
272+
target_cuda=args.target_cuda,
269273
target_hip=args.target_hip,
270274
onemkl_interfaces=args.onemkl_interfaces,
271275
onemkl_interfaces_dir=args.onemkl_interfaces_dir,

0 commit comments

Comments
 (0)