Skip to content

Commit 80f7bc7

Browse files
Improve robustness of DPCTL_TARGET_CUDA handling
1 parent 58710ed commit 80f7bc7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,22 @@ set(_dpctl_sycl_target_link_options)
5454
set(_dpctl_sycl_targets)
5555
set(_dpctl_cuda_arch)
5656
set(_dpctl_amd_targets)
57+
5758
if ("x${DPCTL_SYCL_TARGETS}" STREQUAL "x")
5859
if (NOT "x${DPCTL_TARGET_CUDA}" STREQUAL "x")
59-
if (DPCTL_TARGET_CUDA STREQUAL "ON")
60-
set(_dpctl_cuda_arch "sm_50")
61-
elseif(DPCTL_TARGET_CUDA MATCHES "^sm_")
60+
if(DPCTL_TARGET_CUDA MATCHES "^sm_")
6261
set(_dpctl_cuda_arch ${DPCTL_TARGET_CUDA})
62+
elseif(DPCTL_TARGET_CUDA MATCHES "^(ON|TRUE|YES|Y|1)$")
63+
set(_dpctl_cuda_arch "sm_50")
6364
else()
6465
message(FATAL_ERROR
6566
"Invalid value for DPCTL_TARGET_CUDA: \"${DPCTL_TARGET_CUDA}\". "
66-
"Expected 'ON' or an architecture like 'sm_80'."
67+
"Expected 'ON', 'TRUE', 'YES', 'Y', '1', or a CUDA architecture like 'sm_80'."
6768
)
6869
endif()
6970
set(_dpctl_sycl_targets "nvidia_gpu_${_dpctl_cuda_arch},spir64-unknown-unknown")
7071
endif()
72+
7173
if (NOT "x${DPCTL_TARGET_HIP}" STREQUAL "x")
7274
set(_dpctl_amd_targets ${DPCTL_TARGET_HIP})
7375
if(_dpctl_sycl_targets)

docs/doc_sources/beginners_guides/installation.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ which accepts a specific compute architecture string:
166166
167167
python scripts/build_locally.py --verbose --cmake-opts="-DDPCTL_TARGET_CUDA=sm_80"
168168
169-
To use the default architecture (``sm_50``), use:
169+
To use the default architecture (``sm_50``),
170+
set ``DPCTL_TARGET_CUDA`` to a value such as ``ON``, ``TRUE``, ``YES``, ``Y``, or ``1``:
170171

171172
.. code-block:: bash
172173

0 commit comments

Comments
 (0)