@@ -68,17 +68,21 @@ find_package(Dpctl REQUIRED)
6868message (STATUS "Dpctl_INCLUDE_DIR=" ${Dpctl_INCLUDE_DIR} )
6969message (STATUS "Dpctl_TENSOR_INCLUDE_DIR=" ${Dpctl_TENSOR_INCLUDE_DIR} )
7070
71- option (DPNP_TARGET_CUDA
72- "Build DPNP to target CUDA devices"
73- OFF
74- )
7571option (DPNP_USE_ONEMKL_INTERFACES
7672 "Build DPNP with oneMKL Interfaces"
7773 OFF
7874)
75+ set (DPNP_TARGET_CUDA
76+ ""
77+ CACHE STRING
78+ "Build DPNP to target CUDA device. \
79+ Set to a truthy value (e.g., ON, TRUE) to use default architecture (sm_50), \
80+ or to a specific architecture like sm_80."
81+ )
7982set (HIP_TARGETS "" CACHE STRING "HIP architecture for target" )
8083
8184set (_dpnp_sycl_targets)
85+ set (_dpnp_cuda_arch)
8286set (_use_onemkl_interfaces OFF )
8387set (_use_onemkl_interfaces_cuda OFF )
8488set (_use_onemkl_interfaces_hip OFF )
@@ -87,8 +91,18 @@ set(_dpnp_sycl_target_compile_options)
8791set (_dpnp_sycl_target_link_options)
8892
8993if ("x${DPNP_SYCL_TARGETS} " STREQUAL "x" )
90- if (DPNP_TARGET_CUDA)
91- set (_dpnp_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown" )
94+ if (DPNP_TARGET_CUDA)
95+ if (DPNP_TARGET_CUDA MATCHES "^sm_" )
96+ set (_dpnp_cuda_arch ${DPNP_TARGET_CUDA} )
97+ elseif (DPNP_TARGET_CUDA MATCHES "^(ON|TRUE|YES|Y|1)$" )
98+ set (_dpnp_cuda_arch "sm_50" )
99+ else ()
100+ message (FATAL_ERROR
101+ "Invalid value for DPNP_TARGET_CUDA: \" ${DPNP_TARGET_CUDA} \" . "
102+ "Expected 'ON', 'TRUE', 'YES', 'Y', '1', or a CUDA architecture like 'sm_80'."
103+ )
104+ endif ()
105+ set (_dpnp_sycl_targets "nvidia_gpu_${_dpnp_cuda_arch} ,spir64-unknown-unknown" )
92106 set (_use_onemkl_interfaces_cuda ON )
93107 endif ()
94108
@@ -104,7 +118,7 @@ if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x")
104118else ()
105119 set (_dpnp_sycl_targets ${DPNP_SYCL_TARGETS} )
106120
107- if ("${DPNP_SYCL_TARGETS} " MATCHES "nvptx64-nvidia-cuda" )
121+ if ("${DPNP_SYCL_TARGETS} " MATCHES "(nvidia_gpu_sm_| nvptx64-nvidia-cuda) " )
108122 set (_use_onemkl_interfaces_cuda ON )
109123 endif ()
110124
0 commit comments