diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36b100efb4..87c9e7949b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 repos: @@ -83,7 +83,6 @@ repos: exclude: | (?x) ^CHANGELOG[.]md$| - ^cpp/cmake/patches/cutlass/build-export[.]patch$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: diff --git a/conda/recipes/libraft/recipe.yaml b/conda/recipes/libraft/recipe.yaml index 6130eede90..5431405dec 100644 --- a/conda/recipes/libraft/recipe.yaml +++ b/conda/recipes/libraft/recipe.yaml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 schema_version: 1 @@ -90,9 +90,8 @@ outputs: build: script: content: | - # Unspecified brings in cuco and cutlass and friends + # Unspecified brings in all components cmake --install cpp/build --component Unspecified - cmake --install cpp/build --component cuco cmake --install cpp/build --component raft cmake --install cpp/build --component distributed string: cuda${{ cuda_major }}_${{ date_string }}_${{ head_rev }} diff --git a/cpp/.clang-format b/cpp/.clang-format index 5f7483007f..3d86bfd087 100644 --- a/cpp/.clang-format +++ b/cpp/.clang-format @@ -85,7 +85,7 @@ IncludeCategories: Priority: 5 - Regex: '^<(thrust|cub|cuda)/' # CCCL includes Priority: 6 - - Regex: '^<(cooperative_groups|cuco|cuda|device_types|driver_types|math_constants|nvtx3)' # CUDA includes + - Regex: '^<(cooperative_groups|cuda|device_types|driver_types|math_constants|nvtx3)' # CUDA includes Priority: 6 - Regex: '^<.*\..*' # other system includes (e.g. with a '.') Priority: 7 diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 88c6ed0245..59ff9ca88c 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,6 +1,6 @@ # ============================================================================= # cmake-format: off -# SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # cmake-format: on cmake_minimum_required(VERSION 3.30.4 FATAL_ERROR) @@ -164,13 +164,9 @@ include(${rapids-cmake-dir}/cpm/rapids_logger.cmake) rapids_cpm_rapids_logger(BUILD_EXPORT_SET raft-exports INSTALL_EXPORT_SET raft-exports) create_logger_macros(RAFT "raft::default_logger()" include/raft/core) -# CCCL before rmm/cuco so we get the right version of CCCL +# CCCL before rmm so we get the right version of CCCL include(cmake/thirdparty/get_cccl.cmake) include(cmake/thirdparty/get_rmm.cmake) -include(cmake/thirdparty/get_cutlass.cmake) - -include(${rapids-cmake-dir}/cpm/cuco.cmake) -rapids_cpm_cuco(BUILD_EXPORT_SET raft-exports INSTALL_EXPORT_SET raft-exports) if(BUILD_TESTS) include(${rapids-cmake-dir}/cpm/gtest.cmake) @@ -193,10 +189,7 @@ target_include_directories( ) # Keep RAFT as lightweight as possible. Only CUDA libs and rmm should be used in global target. -target_link_libraries( - raft INTERFACE rapids_logger::rapids_logger rmm::rmm cuco::cuco nvidia::cutlass::cutlass - CCCL::CCCL -) +target_link_libraries(raft INTERFACE rapids_logger::rapids_logger rmm::rmm CCCL::CCCL) target_compile_features(raft INTERFACE cxx_std_17 $) target_compile_options( diff --git a/cpp/cmake/patches/cutlass/Support-both-CUDA-12-and-13-cccl-header-locations.patch b/cpp/cmake/patches/cutlass/Support-both-CUDA-12-and-13-cccl-header-locations.patch deleted file mode 100644 index 489ac69f93..0000000000 --- a/cpp/cmake/patches/cutlass/Support-both-CUDA-12-and-13-cccl-header-locations.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 661c7e679ac72926d619da46834d09f52a727f5e Mon Sep 17 00:00:00 2001 -From: Robert Maynard -Date: Tue, 5 Aug 2025 15:05:57 -0400 -Subject: [PATCH] Support both CUDA 12 and 13 cccl header locations - ---- - CMakeLists.txt | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 38dcca9f..4088b71f 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -704,8 +704,14 @@ target_include_directories( - CUTLASS - SYSTEM INTERFACE - $ -- $ - ) -+if(CUDA_VERSION VERSION_GREATER_EQUAL 13.0) -+ target_include_directories( -+ CUTLASS -+ SYSTEM INTERFACE -+ $ -+ ) -+endif() - - install( - DIRECTORY --- -2.39.5 (Apple Git-154) diff --git a/cpp/cmake/patches/cutlass_override.json b/cpp/cmake/patches/cutlass_override.json deleted file mode 100644 index bf9791ebd1..0000000000 --- a/cpp/cmake/patches/cutlass_override.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "packages" : { - "cutlass" : { - "version": "4.1.0", - "git_url": "https://github.com/NVIDIA/cutlass.git", - "git_tag": "v${version}", - "patches" : [ - { - "file" : "${current_json_dir}/cutlass/Support-both-CUDA-12-and-13-cccl-header-locations.patch", - "issue" : "Support CUDA 12 CTK layout[https://github.com/NVIDIA/cutlass/pull/2543]", - "fixed_in" : "" - } - ] - } - } -} diff --git a/cpp/cmake/thirdparty/get_cutlass.cmake b/cpp/cmake/thirdparty/get_cutlass.cmake deleted file mode 100644 index ea9426d760..0000000000 --- a/cpp/cmake/thirdparty/get_cutlass.cmake +++ /dev/null @@ -1,78 +0,0 @@ -# ============================================================================= -# cmake-format: off -# SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. -# SPDX-License-Identifier: Apache-2.0 -# cmake-format: on -# ============================================================================= - -function(find_and_configure_cutlass) - set(options) - set(oneValueArgs) - set(multiValueArgs) - cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # if(RAFT_ENABLE_DIST_DEPENDENCIES OR RAFT_COMPILE_LIBRARIES) - set(CUTLASS_ENABLE_HEADERS_ONLY - ON - CACHE BOOL "Enable only the header library" - ) - set(CUTLASS_NAMESPACE - "raft_cutlass" - CACHE STRING "Top level namespace of CUTLASS" - ) - set(CUTLASS_ENABLE_CUBLAS - OFF - CACHE BOOL "Disable CUTLASS to build with cuBLAS library." - ) - - set(CUDART_LIBRARY "${CUDA_cudart_static_LIBRARY}" CACHE FILEPATH "fixing cutlass cmake code" FORCE) - - include("${rapids-cmake-dir}/cpm/package_override.cmake") - rapids_cpm_package_override("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../patches/cutlass_override.json") - - include("${rapids-cmake-dir}/cpm/detail/package_info.cmake") - rapids_cpm_package_info(cutlass VERSION_VAR version FIND_VAR find_args CPM_VAR cpm_find_info - TO_INSTALL_VAR to_install) - - rapids_cpm_find( - NvidiaCutlass ${version} ${find_args} - GLOBAL_TARGETS nvidia::cutlass::cutlass - CPM_ARGS ${cpm_find_info} - OPTIONS "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" - ) - - if(TARGET CUTLASS AND NOT TARGET nvidia::cutlass::cutlass) - add_library(nvidia::cutlass::cutlass ALIAS CUTLASS) - endif() - - if(NvidiaCutlass_ADDED) - rapids_export( - BUILD NvidiaCutlass - EXPORT_SET NvidiaCutlass - GLOBAL_TARGETS nvidia::cutlass::cutlass - NAMESPACE nvidia::cutlass:: - ) - endif() - - # We generate the cutlass-config files when we built cutlass locally, so always do - # `find_dependency` - rapids_export_package( - BUILD NvidiaCutlass raft-exports GLOBAL_TARGETS nvidia::cutlass::cutlass - ) - rapids_export_package( - INSTALL NvidiaCutlass raft-exports GLOBAL_TARGETS nvidia::cutlass::cutlass - ) - - # Tell cmake where it can find the generated NvidiaCutlass-config.cmake we wrote. - include("${rapids-cmake-dir}/export/find_package_root.cmake") - rapids_export_find_package_root( - INSTALL NvidiaCutlass [=[${CMAKE_CURRENT_LIST_DIR}/../]=] - EXPORT_SET raft-exports - ) - rapids_export_find_package_root( - BUILD NvidiaCutlass [=[${CMAKE_CURRENT_LIST_DIR}]=] - EXPORT_SET raft-exports - ) -endfunction() - -find_and_configure_cutlass() diff --git a/cpp/include/raft/util/cutlass_utils.cuh b/cpp/include/raft/util/cutlass_utils.cuh deleted file mode 100644 index 4994419c4d..0000000000 --- a/cpp/include/raft/util/cutlass_utils.cuh +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION. - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include - -#include - -namespace raft { - -/** - * @brief Exception thrown when a CUTLASS error is encountered. - */ -struct cutlass_error : public raft::exception { - explicit cutlass_error(char const* const message) : raft::exception(message) {} - explicit cutlass_error(std::string const& message) : raft::exception(message) {} -}; - -} // namespace raft - -/** - * @brief Error checking macro for CUTLASS functions. - * - * Invokes a CUTLASS function call, if the call does not return cutlass::Status::kSuccess, - * throws an exception detailing the CUTLASS error that occurred. - * - */ -#define RAFT_CUTLASS_TRY(call) \ - do { \ - cutlass::Status const status = call; \ - if (status != cutlass::Status::kSuccess) { \ - std::string msg{}; \ - SET_ERROR_MSG(msg, \ - "CUTLASS error encountered at: ", \ - "call='%s', Reason=%s", \ - #call, \ - cutlassGetStatusString(status)); \ - throw raft::cutlass_error(msg); \ - } \ - } while (0) diff --git a/docs/source/build.md b/docs/source/build.md index 18ef479534..37cd53382d 100644 --- a/docs/source/build.md +++ b/docs/source/build.md @@ -86,8 +86,6 @@ In addition to the libraries included with cudatoolkit 12.2+, there are some oth #### Required - [RMM](https://github.com/rapidsai/rmm) corresponding to RAFT version. - [Thrust](https://github.com/NVIDIA/thrust) v1.17 / [CUB](https://github.com/NVIDIA/cub) -- [cuCollections](https://github.com/NVIDIA/cuCollections) - Used in `raft::sparse::distance` API. -- [CUTLASS](https://github.com/NVIDIA/cutlass) v2.9.1 - Used in `raft::distance` API. #### Optional - [NCCL](https://github.com/NVIDIA/nccl) - Used in `raft::comms` API and needed to build `raft-dask`. @@ -110,7 +108,7 @@ The recommended way to build and install RAFT from source is to use the `build.s ### Header-only C++ -`build.sh` uses [rapids-cmake](https://github.com/rapidsai/rapids-cmake), which will automatically download any dependencies which are not already installed. It's important to note that while all the headers will be installed and available, some parts of the RAFT API depend on libraries like CUTLASS, which will need to be explicitly enabled in `build.sh`. +`build.sh` uses [rapids-cmake](https://github.com/rapidsai/rapids-cmake), which will automatically download any dependencies which are not already installed. The following example will download the needed dependencies and install the RAFT headers into `$INSTALL_PREFIX/include/raft`. ```bash @@ -288,8 +286,8 @@ PROPERTIES CXX_STANDARD 20 The `raft::raft` CMake target is made available when including RAFT into your CMake project but additional CMake targets can be made available by adding to the `COMPONENTS` option in CMake's `find_package(raft)` (refer to [CMake docs](https://cmake.org/cmake/help/latest/command/find_package.html#basic-signature) to learn more). The components should be separated by spaces. The `raft::raft` target will always be available. Note that the `distributed` component also exports additional dependencies. -| Component | Target | Description | Base Dependencies | -|-------------|---------------------|----------------------------------------------------------|----------------------------------------| -| n/a | `raft::raft` | Full RAFT header library | CUDA toolkit, RMM, NVTX, CCCL, CUTLASS | -| compiled | `raft::compiled` | Pre-compiled template instantiations and runtime library | raft::raft | -| distributed | `raft::distributed` | Dependencies for `raft::comms` APIs | raft::raft, UCX, NCCL +| Component | Target | Description | Base Dependencies | +|-------------|---------------------|----------------------------------------------------------|-------------------------------| +| n/a | `raft::raft` | Full RAFT header library | CUDA toolkit, RMM, NVTX, CCCL | +| compiled | `raft::compiled` | Pre-compiled template instantiations and runtime library | raft::raft | +| distributed | `raft::distributed` | Dependencies for `raft::comms` APIs | raft::raft, UCX, NCCL | diff --git a/python/pylibraft/CMakeLists.txt b/python/pylibraft/CMakeLists.txt index 9be0c62a2a..2aca229b39 100644 --- a/python/pylibraft/CMakeLists.txt +++ b/python/pylibraft/CMakeLists.txt @@ -1,6 +1,6 @@ # ============================================================================= # cmake-format: off -# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # cmake-format: on # ============================================================================= @@ -9,8 +9,7 @@ cmake_minimum_required(VERSION 3.30.4 FATAL_ERROR) include(../../cmake/rapids_config.cmake) -# We always need CUDA for pylibraft because the raft dependency brings in a header-only cuco -# dependency that enables CUDA unconditionally. +# We always need CUDA for pylibraft because the raft dependency enables CUDA unconditionally. include(rapids-cuda) rapids_cuda_init_architectures(pylibraft) @@ -20,7 +19,7 @@ project( LANGUAGES CXX CUDA ) -# an installed version of raft contains the other necessary targets (like CCCL and cuco) +# an installed version of raft contains the other necessary targets (like CCCL) find_package(raft "${RAPIDS_VERSION}" REQUIRED COMPONENTS raft compiled) include(rapids-cython-core)