Skip to content

Commit

Permalink
Merge remote-tracking branch 'rapidsai/branch-24.02' into add-ivf_fla…
Browse files Browse the repository at this point in the history
…t-and-ivf_pq
  • Loading branch information
viclafargue committed Mar 18, 2024
2 parents 58dc152 + fb08679 commit 8c0d46f
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 46 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
cuVS contains state-of-the-art implementations of several algorithms for running approximate nearest neighbors and clustering on the GPU. It can be used directly or through the various databases and other libraries that have integrated it. The primary goal of cuVS is to simplify the use of GPUs for vector similarity search and clustering.

**Please note** that cuVS is a new library mostly derived from the approximate nearest neighbors and clustering algorithms in the [RAPIDS RAFT](https://github.com/rapidsai) library of data mining primitives. RAPIDS RAFT currently contains the most fully-featured versions of the approximate nearest neighbors and clustering algorithms in cuVS. We are in the process of migrating the algorithms from RAFT to cuVS, but if you are unsure of which to use, please consider the following:
<<<<<<< HEAD
1. RAFT contains C++ and Python APIs for all of the approximate nearest neighbors and clustering algorithms.
=======
1. RAFT contains C++ and Python APIs for all of the approximate nearest neighbors and clustering algorithms.
>>>>>>> rapidsai/branch-24.02
2. cuVS contains a growing support for different languages, including C, C++, Python, and Rust. We will be adding more language support to cuVS in the future but will not be improving the language support for RAFT.
3. Once all of RAFT's approximate nearest neighbors and clustering algorithms are moved to cuVS, the RAFT APIs will be deprecated and eventually removed altogether. Once removed, RAFT will become a lightweight header-only library. In the meantime, there's no harm in using RAFT if support for additional languages is not needed.

Expand All @@ -46,14 +50,22 @@ mamba install -c conda-forge -c nvidia -c rapidsai pycuvs
### Nightlies
If installing a version that has not yet been released, the `rapidsai` channel can be replaced with `rapidsai-nightly`:
```bash
<<<<<<< HEAD
mamba install -c conda-forge -c nvidia -c rapidsai-nightly pycuvs=24.04*
=======
mamba install -c conda-forge -c nvidia -c rapidsai-nightly pycuvs=24.02*
>>>>>>> rapidsai/branch-24.02
```

Please see the [Build and Install Guide](docs/source/build.md) for more information on installing cuVS and building from source.

## Getting Started

<<<<<<< HEAD
The following code snippets train an approximate nearest neighbors index for the CAGRA algorithm.
=======
The following code snippets train an approximate nearest neighbors index for the CAGRA algorithm.
>>>>>>> rapidsai/branch-24.02
### Python API

Expand Down Expand Up @@ -106,6 +118,7 @@ cuvsCagraIndexParamsDestroy(index_params);
cuvsResourcesDestroy(res);
```

<<<<<<< HEAD
### Rust API

```rust
Expand Down Expand Up @@ -167,6 +180,8 @@ fn cagra_example() -> Result<()> {
}
```

=======
>>>>>>> rapidsai/branch-24.02

## Contributing

Expand Down Expand Up @@ -230,4 +245,8 @@ If citing the nearest neighbors descent API, please consider the following bibte
location = {Virtual Event, Queensland, Australia},
series = {CIKM '21}
}
<<<<<<< HEAD
```
=======
```
>>>>>>> rapidsai/branch-24.02
29 changes: 14 additions & 15 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ rapids-print-env

rapids-logger "Begin py build"

package_name="cuvs"
package_dir="python"
#CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)

CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
#version=$(rapids-generate-version)
#git_commit=$(git rev-parse HEAD)
#export RAPIDS_PACKAGE_VERSION=${version}
#echo "${version}" > VERSION

version=$(rapids-generate-version)
git_commit=$(git rev-parse HEAD)
export RAPIDS_PACKAGE_VERSION=${version}
echo "${version}" > VERSION

sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/${package_name}/_version.py"
#package_dir="python"
#for package_name in cuvs; do
# underscore_package_name=$(echo "${package_name}" | tr "-" "_")
# sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/${underscore_package_name}/_version.py"
#done

# TODO: Remove `--no-test` flags once importing on a CPU
# node works correctly
rapids-conda-retry mambabuild \
--no-test \
--channel "${CPP_CHANNEL}" \
conda/recipes/cuvs

rapids-upload-conda-to-s3 python
#rapids-conda-retry mambabuild \
# --no-test \
# --channel "${CPP_CHANNEL}" \
# conda/recipes/cuvs
4 changes: 2 additions & 2 deletions ci/build_wheel_cuvs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
set -euo pipefail

# Set up skbuild options. Enable sccache in skbuild config options
export SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DFIND_CUVS_CPP=OFF"
export SKBUILD_CONFIGURE_OPTIONS="-DCUVS_BUILD_WHEELS=ON -DDETECT_CONDA_ENV=OFF -DFIND_CUVS_CPP=OFF"

ci/build_wheel.sh cuvs python/cuvs
#ci/build_wheel.sh cuvs python/cuvs
31 changes: 16 additions & 15 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ set -u

rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)
#PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)

RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"}
RAPIDS_COVERAGE_DIR=${RAPIDS_COVERAGE_DIR:-"${PWD}/coverage-results"}
mkdir -p "${RAPIDS_TESTS_DIR}" "${RAPIDS_COVERAGE_DIR}"

rapids-print-env

rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
libcuvs cuvs
#rapids-mamba-retry install \
# --channel "${CPP_CHANNEL}" \
## --channel "${PYTHON_CHANNEL}" \
# libcuvs #cuvs

rapids-logger "Check GPU usage"
nvidia-smi
Expand All @@ -40,16 +40,17 @@ EXITCODE=0
trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest cuvs"
pushd python/cuvs/cuvs
pytest \
--cache-clear \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuvs.xml" \
--cov-config=../.coveragerc \
--cov=cuvs \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cuvs-coverage.xml" \
--cov-report=term \
test
#rapids-logger "pytest cuvs"
#pushd python/cuvs/cuvs
#pytest \
# --cache-clear \
# --junitxml="${RAPIDS_TESTS_DIR}/junit-cuvs.xml" \
# --cov-config=../.coveragerc \
# --cov=cuvs \
# --cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cuvs-coverage.xml" \
# --cov-report=term \
# test
#popd

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
22 changes: 11 additions & 11 deletions ci/test_wheel_cuvs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
set -euo pipefail

mkdir -p ./dist
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
RAPIDS_PY_WHEEL_NAME="cuvs_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist
#RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
#RAPIDS_PY_WHEEL_NAME="cuvs_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist

# echo to expand wildcard before adding `[extra]` requires for pip
python -m pip install $(echo ./dist/cuvs*.whl)[test]

# Run smoke tests for aarch64 pull requests
if [[ "$(arch)" == "aarch64" && "${RAPIDS_BUILD_TYPE}" == "pull-request" ]]; then
python ./ci/wheel_smoke_test_cuvs.py
else
python -m pytest ./python/cuvs/cuvs/test
fi
## echo to expand wildcard before adding `[extra]` requires for pip
#python -m pip install $(echo ./dist/cuvs*.whl)[test]
#
## Run smoke tests for aarch64 pull requests
#if [[ "$(arch)" == "aarch64" && "${RAPIDS_BUILD_TYPE}" == "pull-request" ]]; then
# python ./ci/wheel_smoke_test_cuvs.py
#else
# python -m pytest ./python/cuvs/cuvs/test
#fi
6 changes: 3 additions & 3 deletions fetch_rapids.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
# =============================================================================
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CUVS_RAPIDS.cmake)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.04/RAPIDS.cmake
${CMAKE_CURRENT_BINARY_DIR}/CUVS_RAPIDS.cmake
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/RAFT_RAPIDS.cmake)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.02/RAPIDS.cmake
${CMAKE_CURRENT_BINARY_DIR}/RAFT_RAPIDS.cmake
)
endif()

Expand Down

0 comments on commit 8c0d46f

Please sign in to comment.