Skip to content

Commit

Permalink
Merge branch 'branch-24.04' into fusedCosineNN
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoijade committed Feb 21, 2024
2 parents 0ab7a84 + c95bf6a commit 80e1358
Show file tree
Hide file tree
Showing 26 changed files with 624 additions and 442 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ concurrency:
jobs:
cpp-build:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -37,7 +37,7 @@ jobs:
python-build:
needs: [cpp-build]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -46,7 +46,7 @@ jobs:
upload-conda:
needs: [cpp-build, python-build]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -57,7 +57,7 @@ jobs:
if: github.ref_type == 'branch'
needs: python-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.04
with:
arch: "amd64"
branch: ${{ inputs.branch }}
Expand All @@ -69,7 +69,7 @@ jobs:
sha: ${{ inputs.sha }}
wheel-build-pylibraft:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -79,7 +79,7 @@ jobs:
wheel-publish-pylibraft:
needs: wheel-build-pylibraft
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -89,7 +89,7 @@ jobs:
wheel-build-raft-dask:
needs: wheel-publish-pylibraft
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -99,7 +99,7 @@ jobs:
wheel-publish-raft-dask:
needs: wheel-build-raft-dask
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,49 @@ jobs:
- wheel-tests-raft-dask
- devcontainer
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-24.04
checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.04
with:
enable_check_generated_files: false
conda-cpp-build:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.04
with:
build_type: pull-request
node_type: cpu16
conda-cpp-tests:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.04
with:
build_type: pull-request
conda-cpp-checks:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@branch-24.04
with:
build_type: pull-request
enable_check_symbols: true
symbol_exclusions: _ZN\d+raft_cutlass
conda-python-build:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.04
with:
build_type: pull-request
conda-python-tests:
needs: conda-python-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.04
with:
build_type: pull-request
docs-build:
needs: conda-python-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.04
with:
build_type: pull-request
node_type: "gpu-v100-latest-1"
Expand All @@ -77,34 +77,34 @@ jobs:
wheel-build-pylibraft:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04
with:
build_type: pull-request
script: ci/build_wheel_pylibraft.sh
wheel-tests-pylibraft:
needs: wheel-build-pylibraft
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04
with:
build_type: pull-request
script: ci/test_wheel_pylibraft.sh
wheel-build-raft-dask:
needs: wheel-tests-pylibraft
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04
with:
build_type: pull-request
script: "ci/build_wheel_raft_dask.sh"
wheel-tests-raft-dask:
needs: wheel-build-raft-dask
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04
with:
build_type: pull-request
script: ci/test_wheel_raft_dask.sh
devcontainer:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/build-in-devcontainer.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/build-in-devcontainer.yaml@branch-24.04
with:
build_command: |
sccache -z;
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
conda-cpp-checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@branch-24.04
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand All @@ -26,23 +26,23 @@ jobs:
symbol_exclusions: _ZN\d+raft_cutlass
conda-cpp-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.04
with:
build_type: nightly
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
conda-python-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.04
with:
build_type: nightly
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
wheel-tests-pylibraft:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand All @@ -51,7 +51,7 @@ jobs:
script: ci/test_wheel_pylibraft.sh
wheel-tests-raft-dask:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@test-cuda-12.2
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand Down
35 changes: 26 additions & 9 deletions cpp/bench/ann/src/common/ann_types.hpp
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 Down Expand Up @@ -74,13 +74,33 @@ struct AlgoProperty {
class AnnBase {
public:
inline AnnBase(Metric metric, int dim) : metric_(metric), dim_(dim) {}
virtual ~AnnBase() = default;
virtual ~AnnBase() noexcept = default;

protected:
Metric metric_;
int dim_;
};

/**
* The GPU-based algorithms, which do not perform CPU synchronization at the end of their build or
* search methods, must implement this interface.
*
* The `cuda_timer` / `cuda_lap` from `util.hpp` uses this stream to record GPU times with events
* and, if necessary, also synchronize (via events) between iterations.
*
* If the algo does not implement this interface, GPU timings are disabled.
*/
class AnnGPU {
public:
/**
* Return the main cuda stream for this algorithm.
* If any work is done in multiple streams, they should synchornize with the main stream at the
* end.
*/
[[nodiscard]] virtual auto get_sync_stream() const noexcept -> cudaStream_t = 0;
virtual ~AnnGPU() noexcept = default;
};

template <typename T>
class ANN : public AnnBase {
public:
Expand All @@ -91,18 +111,15 @@ class ANN : public AnnBase {
};

inline ANN(Metric metric, int dim) : AnnBase(metric, dim) {}
virtual ~ANN() noexcept override = default;

virtual void build(const T* dataset, size_t nrow, cudaStream_t stream = 0) = 0;
virtual void build(const T* dataset, size_t nrow) = 0;

virtual void set_search_param(const AnnSearchParam& param) = 0;
// TODO: this assumes that an algorithm can always return k results.
// This is not always possible.
virtual void search(const T* queries,
int batch_size,
int k,
size_t* neighbors,
float* distances,
cudaStream_t stream = 0) const = 0;
virtual void search(
const T* queries, int batch_size, int k, size_t* neighbors, float* distances) const = 0;

virtual void save(const std::string& file) const = 0;
virtual void load(const std::string& file) = 0;
Expand Down
Loading

0 comments on commit 80e1358

Please sign in to comment.