Skip to content

Commit 93f3d42

Browse files
authored
Find cusolvermp using standard CMake approach (nv-legate#891)
This PR updates the existing CUSOLVERMP integration to use a more modern CMake approach. This change introduces a rapids-based approach that follows current CMake best practices, making the build configuration more robust and maintainable.
1 parent 5cdd5f8 commit 93f3d42

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

conda/conda-build/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ if [ -z "$CPU_ONLY" ]; then
2222
# cutensor, relying on the conda cutensor package
2323
CMAKE_ARGS+="
2424
-Dcutensor_DIR=$PREFIX
25-
-DCUSOLVERMP_DIR=$PREFIX"
25+
-DCMAKE_CUDA_ARCHITECTURES=all-major
26+
-DCUPYNUMERIC_USE_CUSOLVERMP=ON"
2627
else
2728
# When we build without cuda, we need to provide the location of curand
2829
CMAKE_ARGS+="

cupynumeric_cpp.cmake

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,18 @@ if(NOT Legion_USE_CUDA AND cupynumeric_cuRAND_INCLUDE_DIR)
430430
target_include_directories(cupynumeric PRIVATE ${cupynumeric_cuRAND_INCLUDE_DIR})
431431
endif()
432432

433-
if(Legion_USE_CUDA AND CUSOLVERMP_DIR)
434-
message(VERBOSE "cupynumeric: CUSOLVERMP_DIR ${CUSOLVERMP_DIR}")
435-
target_compile_definitions(cupynumeric PUBLIC "$<$<COMPILE_LANGUAGE:CXX,CUDA>:CUPYNUMERIC_USE_CUSOLVERMP>")
436-
target_include_directories(cupynumeric PRIVATE ${CUSOLVERMP_DIR}/include)
437-
target_link_libraries(cupynumeric PRIVATE ${CUSOLVERMP_DIR}/lib/libcusolverMp.so)
433+
option(CUPYNUMERIC_USE_CUSOLVERMP "Build with CUSOLVERMP" OFF)
434+
435+
if(Legion_USE_CUDA AND CUPYNUMERIC_USE_CUSOLVERMP)
436+
rapids_find_generate_module(CUSOLVERMP HEADER_NAMES cusolverMp.h LIBRARY_NAMES cusolverMp)
437+
rapids_find_package(CUSOLVERMP REQUIRED)
438+
if(TARGET CUSOLVERMP::CUSOLVERMP)
439+
message(VERBOSE "cupynumeric: CUSOLVERMP found")
440+
target_compile_definitions(cupynumeric PUBLIC "$<$<COMPILE_LANGUAGE:CXX,CUDA>:CUPYNUMERIC_USE_CUSOLVERMP>")
441+
target_link_libraries(cupynumeric PRIVATE CUSOLVERMP::CUSOLVERMP)
442+
else()
443+
message(FATAL_ERROR "CUSOLVERMP not found. Please ensure CUSOLVERMP is installed and available in the CMAKE_PREFIX_PATH.")
444+
endif()
438445
endif()
439446

440447
target_compile_options(cupynumeric

0 commit comments

Comments
 (0)