Skip to content

Commit

Permalink
Merge branch 'branch-24.04' into knn1024
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeher committed Mar 17, 2024
2 parents 04269c7 + 7335267 commit c246765
Show file tree
Hide file tree
Showing 663 changed files with 4,719 additions and 3,044 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# <div align="left"><img src="https://rapids.ai/assets/images/rapids_logo.png" width="90px"/>&nbsp;RAFT: Reusable Accelerated Functions and Tools for Vector Search and More</div>

> [!IMPORTANT]
> The vector search and clustering algorithms in RAFT are being migrated to a new library dedicated to vector search called [cuVS](https://github.com/rapidsai/cuvs). We will continue to support the vector search algorithms in RAFT during this move, but will no longer update them after the RAPIDS 24.06 (June) release. We plan to complete the migration by RAPIDS 24.08 (August) release.
![RAFT tech stack](img/raft-tech-stack-vss.png)



## Contents
<hr>

Expand Down Expand Up @@ -77,6 +81,8 @@ Projects that use the RAFT ANNS algorithms for accelerating vector search includ

Please see the example [Jupyter notebook](https://github.com/rapidsai/raft/blob/HEAD/notebooks/VectorSearch_QuestionRetrieval.ipynb) to get started RAFT for vector search in Python.



### Information Retrieval

RAFT contains a catalog of reusable primitives for composing algorithms that require fast neighborhood computations, such as
Expand Down
8 changes: 5 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

# raft build scripts

Expand Down Expand Up @@ -305,7 +305,7 @@ if hasArg --allgpuarch; then
BUILD_ALL_GPU_ARCH=1
fi

if hasArg --compile-lib || (( ${NUMARGS} == 0 )); then
if hasArg --compile-lib || hasArg pylibraft || (( ${NUMARGS} == 0 )); then
COMPILE_LIBRARY=ON
CMAKE_TARGET="${CMAKE_TARGET};raft_lib"
fi
Expand Down Expand Up @@ -405,7 +405,7 @@ fi

################################################################################
# Configure for building all C++ targets
if (( ${NUMARGS} == 0 )) || hasArg libraft || hasArg docs || hasArg tests || hasArg bench-prims || hasArg bench-ann; then
if (( ${NUMARGS} == 0 )) || hasArg libraft || hasArg docs || hasArg tests || hasArg bench-prims || hasArg bench-ann || ((${COMPILE_LIBRARY} == ON )); then
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
RAFT_CMAKE_CUDA_ARCHITECTURES="NATIVE"
echo "Building for the architecture of the GPU in the system..."
Expand Down Expand Up @@ -512,6 +512,8 @@ fi

if hasArg docs; then
set -x
export RAPIDS_VERSION="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2.\3/' "${REPODIR}/VERSION")"
export RAPIDS_VERSION_MAJOR_MINOR="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2/' "${REPODIR}/VERSION")"
cd ${DOXYGEN_BUILD_DIR}
doxygen Doxyfile
cd ${SPHINX_BUILD_DIR}
Expand Down
6 changes: 4 additions & 2 deletions ci/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

set -euo pipefail

Expand Down Expand Up @@ -28,7 +28,9 @@ rapids-mamba-retry install \
pylibraft \
raft-dask

export RAPIDS_VERSION_NUMBER="24.04"
export RAPIDS_VERSION="$(rapids-version)"
export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)"
export RAPIDS_VERSION_NUMBER="$RAPIDS_VERSION_MAJOR_MINOR"
export RAPIDS_DOCS_DIR="$(mktemp -d)"

rapids-logger "Build CPP docs"
Expand Down
17 changes: 1 addition & 16 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
########################
# RAFT Version Updater #
########################
Expand Down Expand Up @@ -36,23 +36,11 @@ function sed_runner() {
sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak
}

sed_runner "s/set(RAPIDS_VERSION .*)/set(RAPIDS_VERSION \"${NEXT_SHORT_TAG}\")/g" cpp/CMakeLists.txt
sed_runner "s/set(RAPIDS_VERSION .*)/set(RAPIDS_VERSION \"${NEXT_SHORT_TAG}\")/g" cpp/template/cmake/thirdparty/fetch_rapids.cmake
sed_runner "s/set(RAFT_VERSION .*)/set(RAFT_VERSION \"${NEXT_FULL_TAG}\")/g" cpp/CMakeLists.txt
sed_runner 's/'"pylibraft_version .*)"'/'"pylibraft_version ${NEXT_FULL_TAG})"'/g' python/pylibraft/CMakeLists.txt
sed_runner 's/'"raft_dask_version .*)"'/'"raft_dask_version ${NEXT_FULL_TAG})"'/g' python/raft-dask/CMakeLists.txt
sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' fetch_rapids.cmake

# Centralized version file update
echo "${NEXT_FULL_TAG}" > VERSION

# Wheel testing script
sed_runner "s/branch-.*/branch-${NEXT_SHORT_TAG}/g" ci/test_wheel_raft_dask.sh

# Docs update
sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/source/conf.py
sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/source/conf.py

DEPENDENCIES=(
dask-cuda
pylibraft
Expand Down Expand Up @@ -84,9 +72,6 @@ sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}\"/}" conda/
for FILE in .github/workflows/*.yaml; do
sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}"
done
sed_runner "s/RAPIDS_VERSION_NUMBER=\".*/RAPIDS_VERSION_NUMBER=\"${NEXT_SHORT_TAG}\"/g" ci/build_docs.sh

sed_runner "/^PROJECT_NUMBER/ s|\".*\"|\"${NEXT_SHORT_TAG}\"|g" cpp/doxygen/Doxyfile

sed_runner "/^set(RAFT_VERSION/ s|\".*\"|\"${NEXT_SHORT_TAG}\"|g" docs/source/build.md
sed_runner "s|branch-[0-9][0-9].[0-9][0-9]|branch-${NEXT_SHORT_TAG}|g" docs/source/build.md
Expand Down
2 changes: 1 addition & 1 deletion ci/run_ctests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ set -euo pipefail
# Support customizing the ctests' install location
cd "${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libraft/"

ctest --output-on-failure "$@"
ctest --output-on-failure --no-tests=error "$@"
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-118_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies:
- nccl>=2.9.9
- ninja
- numba>=0.57
- numpy>=1.23
- numpy>=1.23,<2.0a0
- numpydoc
- nvcc_linux-aarch64=11.8
- pre-commit
Expand All @@ -57,5 +57,5 @@ dependencies:
- sysroot_linux-aarch64==2.17
- ucx-proc=*=gpu
- ucx-py==0.37.*
- ucx>=1.13.0
- ucx>=1.15.0,<1.16.0
name: all_cuda-118_arch-aarch64
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies:
- nccl>=2.9.9
- ninja
- numba>=0.57
- numpy>=1.23
- numpy>=1.23,<2.0a0
- numpydoc
- nvcc_linux-64=11.8
- pre-commit
Expand All @@ -57,5 +57,5 @@ dependencies:
- sysroot_linux-64==2.17
- ucx-proc=*=gpu
- ucx-py==0.37.*
- ucx>=1.13.0
- ucx>=1.15.0,<1.16.0
name: all_cuda-118_arch-x86_64
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-122_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies:
- nccl>=2.9.9
- ninja
- numba>=0.57
- numpy>=1.23
- numpy>=1.23,<2.0a0
- numpydoc
- pre-commit
- pydata-sphinx-theme
Expand All @@ -53,5 +53,5 @@ dependencies:
- sysroot_linux-aarch64==2.17
- ucx-proc=*=gpu
- ucx-py==0.37.*
- ucx>=1.13.0
- ucx>=1.15.0,<1.16.0
name: all_cuda-122_arch-aarch64
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies:
- nccl>=2.9.9
- ninja
- numba>=0.57
- numpy>=1.23
- numpy>=1.23,<2.0a0
- numpydoc
- pre-commit
- pydata-sphinx-theme
Expand All @@ -53,5 +53,5 @@ dependencies:
- sysroot_linux-64==2.17
- ucx-proc=*=gpu
- ucx-py==0.37.*
- ucx>=1.13.0
- ucx>=1.15.0,<1.16.0
name: all_cuda-122_arch-x86_64
5 changes: 3 additions & 2 deletions conda/recipes/libraft/build_libraft.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

./build.sh libraft --allgpuarch --compile-lib --build-metrics=compile_lib --incl-cache-stats --no-nvtx
./build.sh libraft --allgpuarch --compile-lib --build-metrics=compile_lib --incl-cache-stats --no-nvtx -n
cmake --install cpp/build --component compiled
5 changes: 4 additions & 1 deletion conda/recipes/libraft/build_libraft_headers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

# We must install everything (not just the "raft" component) because some
# dependencies like cuCollections and cutlass place their install rules in the
# "all" component.
./build.sh libraft --allgpuarch --no-nvtx
4 changes: 2 additions & 2 deletions conda/recipes/libraft/build_libraft_template.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

# Just building template so we verify it uses libraft.so and fail if it doesn't build
./build.sh template
./build.sh template --no-nvtx
2 changes: 1 addition & 1 deletion conda/recipes/libraft/build_libraft_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

./build.sh tests bench-prims --allgpuarch --no-nvtx --build-metrics=tests_bench_prims --incl-cache-stats
cmake --install cpp/build --component testing
3 changes: 3 additions & 0 deletions conda/recipes/libraft/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cmake_version:
nccl_version:
- ">=2.9.9"

gbench_version:
- "==1.8.0"

gtest_version:
- ">=1.13.0"

Expand Down
6 changes: 6 additions & 0 deletions conda/recipes/libraft/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ outputs:
- ninja
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
# We must include both libraft and libraft-static to prevent the test
# builds from packaging those libraries. However, tests only depend on
# the shared library in libraft.
- {{ pin_subpackage('libraft', exact=True) }}
- {{ pin_subpackage('libraft-static', exact=True) }}
- cuda-version ={{ cuda_version }}
{% if cuda_major == "11" %}
- cuda-profiler-api {{ cuda11_cuda_profiler_api_run_version }}
Expand All @@ -300,6 +304,7 @@ outputs:
- libcusolver-dev
- libcusparse-dev
{% endif %}
- benchmark {{ gbench_version }}
- gmock {{ gtest_version }}
- gtest {{ gtest_version }}
run:
Expand All @@ -314,6 +319,7 @@ outputs:
- libcusparse
{% endif %}
- {{ pin_subpackage('libraft', exact=True) }}
- benchmark {{ gbench_version }}
- gmock {{ gtest_version }}
- gtest {{ gtest_version }}
about:
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/pylibraft/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ requirements:
{% endif %}
- libraft {{ version }}
- libraft-headers {{ version }}
- numpy >=1.23
- numpy >=1.23,<2.0a0
- python x.x
- rmm ={{ minor_version }}

Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/raft-dask/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sysroot_version:
- "2.17"

ucx_version:
- ">=1.14.1,<1.16.0"
- ">=1.15.0,<1.16.0"

ucx_py_version:
- "0.37.*"
Expand Down
26 changes: 23 additions & 3 deletions cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
Expand Down Expand Up @@ -71,8 +71,28 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"' # quoted includes
Priority: 1
- Regex: '^<(common|benchmarks|tests)/' # benchmark/test includes
Priority: 2
#- Regex: '^<(cuspatial_test|cuproj_test)/' # cuSpatial/cuProj test includes
# Priority: 3
- Regex: '^<raft/' # RAFT includes
Priority: 3
- Regex: '^<(cudf|cuml|raft|kvikio)' # Other RAPIDS includes
Priority: 4
- Regex: '^<rmm/' # RMM includes
Priority: 5
- Regex: '^<(thrust|cub|cuda)/' # CCCL includes
Priority: 6
- Regex: '^<(cooperative_groups|cuco|cuda|device_types|driver_types|math_constants|nvtx3)' # CUDA includes
Priority: 6
- Regex: '^<.*\..*' # other system includes (e.g. with a '.')
Priority: 7
- Regex: '^<[^.]+' # STL includes (no '.')
Priority: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
Expand Down
7 changes: 2 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
set(RAPIDS_VERSION "24.04")
set(RAFT_VERSION "24.04.00")

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)
include(../fetch_rapids.cmake)
include(../rapids_config.cmake)
include(rapids-cmake)
include(rapids-cpm)
include(rapids-export)
Expand All @@ -34,7 +31,7 @@ endif()

project(
RAFT
VERSION ${RAFT_VERSION}
VERSION "${RAPIDS_VERSION}"
LANGUAGES ${lang_list}
)

Expand Down
10 changes: 6 additions & 4 deletions cpp/bench/ann/src/common/benchmark.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,19 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// clang-format off
#include "cuda_stub.hpp" // must go first
// clang-format on

#include "ann_types.hpp"

#include <dlfcn.h>
#define JSON_DIAGNOSTICS 1
#include <nlohmann/json.hpp>

#include <filesystem>
#include <memory>
#include <unordered_map>

#include <dlfcn.h>
#include <filesystem>

namespace raft::bench::ann {

struct lib_handle {
Expand Down
5 changes: 3 additions & 2 deletions cpp/bench/ann/src/common/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
#include "dataset.hpp"
#include "util.hpp"

#include <benchmark/benchmark.h>
#include <raft/core/logger.hpp>

#include <benchmark/benchmark.h>
#include <unistd.h>

#include <algorithm>
#include <chrono>
#include <cmath>
Expand All @@ -34,7 +36,6 @@
#include <numeric>
#include <sstream>
#include <string>
#include <unistd.h>
#include <vector>

namespace raft::bench::ann {
Expand Down
Loading

0 comments on commit c246765

Please sign in to comment.