Skip to content

Commit

Permalink
Add CUDA_STATIC_MATH_LIBRARIES (#2376)
Browse files Browse the repository at this point in the history
Usage of the CUDA math libraries is independent of the CUDA runtime. Make their static/shared status separately controllable.

Contributes to rapidsai/build-planning#35

Authors:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Robert Maynard (https://github.com/robertmaynard)

URL: #2376
  • Loading branch information
KyleFromNVIDIA authored Jul 8, 2024
1 parent 4d7a39c commit 7aebe87
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
10 changes: 7 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ option(CUDA_ENABLE_KERNELINFO "Enable kernel resource usage info" OFF)
option(CUDA_ENABLE_LINEINFO
"Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler)" OFF
)
option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF)
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)
option(CUDA_STATIC_MATH_LIBRARIES "Statically link the CUDA math libraries" OFF)
option(CUDA_LOG_COMPILE_TIME "Write a log of compilation times to nvcc_compile_log.csv" OFF)
option(DETECT_CONDA_ENV "Enable detection of conda environment for dependencies" ON)
option(DISABLE_DEPRECATION_WARNINGS "Disable deprecaction warnings " ON)
Expand Down Expand Up @@ -105,7 +106,10 @@ message(VERBOSE "RAFT: Enable kernel resource usage info: ${CUDA_ENABLE_KERNELIN
message(VERBOSE "RAFT: Enable lineinfo in nvcc: ${CUDA_ENABLE_LINEINFO}")
message(VERBOSE "RAFT: Enable nvtx markers: ${RAFT_NVTX}")
message(VERBOSE
"RAFT: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}"
"RAFT: Statically link the CUDA runtime: ${CUDA_STATIC_RUNTIME}"
)
message(VERBOSE
"RAFT: Statically link the CUDA math libraries: ${CUDA_STATIC_MATH_LIBRARIES}"
)

# Set RMM logging level
Expand Down Expand Up @@ -135,7 +139,7 @@ endif()
# * compiler options ----------------------------------------------------------

set(_ctk_static_suffix "")
if(CUDA_STATIC_RUNTIME)
if(CUDA_STATIC_MATH_LIBRARIES)
set(_ctk_static_suffix "_static")
endif()

Expand Down
17 changes: 9 additions & 8 deletions docs/source/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,20 @@ RAFT's CMake has the following configurable flags available:

| Flag | Possible Values | Default Value | Behavior |
|---------------------------------|----------------------| --- |------------------------------------------------------------------------------|
| BUILD_TESTS | ON, OFF | ON | Compile Googletests |
| BUILD_TESTS | ON, OFF | ON | Compile Googletests |
| BUILD_PRIMS_BENCH | ON, OFF | OFF | Compile benchmarks |
| BUILD_ANN_BENCH | ON, OFF | OFF | Compile end-to-end ANN benchmarks |
| BUILD_ANN_BENCH | ON, OFF | OFF | Compile end-to-end ANN benchmarks |
| CUDA_ENABLE_KERNELINFO | ON, OFF | OFF | Enables `kernelinfo` in nvcc. This is useful for `compute-sanitizer` |
| CUDA_ENABLE_LINEINFO | ON, OFF | OFF | Enable the -lineinfo option for nvcc |
| CUDA_STATIC_RUNTIME | ON, OFF | OFF | Statically link the CUDA runtime |
| DETECT_CONDA_ENV | ON, OFF | ON | Enable detection of conda environment for dependencies |
| raft_FIND_COMPONENTS | compiled distributed | | Configures the optional components as a space-separated list |
| CUDA_STATIC_MATH_LIBRARIES | ON, OFF | OFF | Statically link the CUDA math libraries |
| DETECT_CONDA_ENV | ON, OFF | ON | Enable detection of conda environment for dependencies |
| raft_FIND_COMPONENTS | compiled distributed | | Configures the optional components as a space-separated list |
| RAFT_COMPILE_LIBRARY | ON, OFF | ON if either BUILD_TESTS or BUILD_PRIMS_BENCH is ON; otherwise OFF | Compiles all `libraft` shared libraries (these are required for Googletests) |
| RAFT_ENABLE_CUBLAS_DEPENDENCY | ON, OFF | ON | Link against cublas library in `raft::raft` |
| RAFT_ENABLE_CUSOLVER_DEPENDENCY | ON, OFF | ON | Link against cusolver library in `raft::raft` |
| RAFT_ENABLE_CUSPARSE_DEPENDENCY | ON, OFF | ON | Link against cusparse library in `raft::raft` |
| RAFT_ENABLE_CUSOLVER_DEPENDENCY | ON, OFF | ON | Link against curand library in `raft::raft` |
| RAFT_ENABLE_CUBLAS_DEPENDENCY | ON, OFF | ON | Link against cublas library in `raft::raft` |
| RAFT_ENABLE_CUSOLVER_DEPENDENCY | ON, OFF | ON | Link against cusolver library in `raft::raft` |
| RAFT_ENABLE_CUSPARSE_DEPENDENCY | ON, OFF | ON | Link against cusparse library in `raft::raft` |
| RAFT_ENABLE_CUSOLVER_DEPENDENCY | ON, OFF | ON | Link against curand library in `raft::raft` |
| RAFT_NVTX | ON, OFF | OFF | Enable NVTX Markers |

### Build documentation
Expand Down
1 change: 1 addition & 0 deletions python/pylibraft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ if(NOT raft_FOUND)
set(BUILD_ANN_BENCH OFF)
set(RAFT_COMPILE_LIBRARY ON)
set(CUDA_STATIC_RUNTIME ON)
set(CUDA_STATIC_MATH_LIBRARIES ON)

add_subdirectory(../../cpp raft-cpp EXCLUDE_FROM_ALL)

Expand Down
1 change: 1 addition & 0 deletions python/raft-dask/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ if(NOT raft_FOUND)
set(RAFT_COMPILE_DIST_LIBRARY OFF)
set(RAFT_COMPILE_NN_LIBRARY OFF)
set(CUDA_STATIC_RUNTIME ON)
set(CUDA_STATIC_MATH_LIBRARIES ON)
set(RAFT_DASK_UCXX_STATIC ON)

add_subdirectory(../../cpp raft-cpp EXCLUDE_FROM_ALL)
Expand Down

0 comments on commit 7aebe87

Please sign in to comment.