Skip to content

Commit

Permalink
Merge branch 'branch-25.02' into extend-c-api
Browse files Browse the repository at this point in the history
  • Loading branch information
ajit283 authored Jan 22, 2025
2 parents 8645aa3 + 43969ca commit 11a09c2
Show file tree
Hide file tree
Showing 36 changed files with 269 additions and 311 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ There are several benefits to using cuVS and GPUs for vector search, including
6. Multiple language support
7. Building blocks for composing new or accelerating existing algorithms

In addition to the items above, cuVS takes on the burden of keeping non-trivial accelerated code up to date as new NVIDIA architectures and CUDA versions are released. This provides a deslightful development experimence, guaranteeing that any libraries, databases, or applications built on top of it will always be getting the best performance and scale.
In addition to the items above, cuVS takes on the burden of keeping non-trivial accelerated code up to date as new NVIDIA architectures and CUDA versions are released. This provides a delightful development experience, guaranteeing that any libraries, databases, or applications built on top of it will always be getting the best performance and scale.

## cuVS Technology Stack

Expand Down
2 changes: 1 addition & 1 deletion ci/run_cuvs_pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ set -euo pipefail
# Support invoking run_pytests.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/cuvs/cuvs

pytest --cache-clear --verbose "$@" tests
pytest --cache-clear --verbose "$@" test
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies:
- sphinx-copybutton
- sphinx-markdown-tables
- sphinx>=8.0.0
- sysroot_linux-aarch64==2.17
- sysroot_linux-aarch64==2.28
- pip:
- nvidia-sphinx-theme
name: all_cuda-118_arch-aarch64
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies:
- sphinx-copybutton
- sphinx-markdown-tables
- sphinx>=8.0.0
- sysroot_linux-64==2.17
- sysroot_linux-64==2.28
- pip:
- nvidia-sphinx-theme
name: all_cuda-118_arch-x86_64
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-125_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- cython>=3.0.0
- dlpack>=0.8,<1.0
- doxygen>=1.8.20
- gcc_linux-aarch64=11.*
- gcc_linux-aarch64=13.*
- graphviz
- ipython
- libclang
Expand All @@ -51,7 +51,7 @@ dependencies:
- sphinx-copybutton
- sphinx-markdown-tables
- sphinx>=8.0.0
- sysroot_linux-aarch64==2.17
- sysroot_linux-aarch64==2.28
- pip:
- nvidia-sphinx-theme
name: all_cuda-125_arch-aarch64
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- cython>=3.0.0
- dlpack>=0.8,<1.0
- doxygen>=1.8.20
- gcc_linux-64=11.*
- gcc_linux-64=13.*
- graphviz
- ipython
- libclang
Expand All @@ -51,7 +51,7 @@ dependencies:
- sphinx-copybutton
- sphinx-markdown-tables
- sphinx>=8.0.0
- sysroot_linux-64==2.17
- sysroot_linux-64==2.28
- pip:
- nvidia-sphinx-theme
name: all_cuda-125_arch-x86_64
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-118_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ dependencies:
- pyyaml
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- setuptools
- sysroot_linux-aarch64==2.17
- sysroot_linux-aarch64==2.28
- wheel
name: bench_ann_cuda-118_arch-aarch64
2 changes: 1 addition & 1 deletion conda/environments/bench_ann_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ dependencies:
- pyyaml
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- setuptools
- sysroot_linux-64==2.17
- sysroot_linux-64==2.28
- wheel
name: bench_ann_cuda-118_arch-x86_64
4 changes: 2 additions & 2 deletions conda/environments/bench_ann_cuda-125_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- cxx-compiler
- cython>=3.0.0
- dlpack>=0.8,<1.0
- gcc_linux-aarch64=11.*
- gcc_linux-aarch64=13.*
- glog>=0.6.0
- h5py>=3.8.0
- libcublas-dev
Expand All @@ -43,6 +43,6 @@ dependencies:
- pyyaml
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- setuptools
- sysroot_linux-aarch64==2.17
- sysroot_linux-aarch64==2.28
- wheel
name: bench_ann_cuda-125_arch-aarch64
4 changes: 2 additions & 2 deletions conda/environments/bench_ann_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- cxx-compiler
- cython>=3.0.0
- dlpack>=0.8,<1.0
- gcc_linux-64=11.*
- gcc_linux-64=13.*
- glog>=0.6.0
- h5py>=3.8.0
- libcublas-dev
Expand All @@ -43,6 +43,6 @@ dependencies:
- pyyaml
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- setuptools
- sysroot_linux-64==2.17
- sysroot_linux-64==2.28
- wheel
name: bench_ann_cuda-125_arch-x86_64
8 changes: 5 additions & 3 deletions conda/recipes/cuvs-bench-cpu/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
c_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cxx_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

c_stdlib:
- sysroot

c_stdlib_version:
- "2.17"
- "2.28"

cmake_version:
- ">=3.26.4,!=3.30.0"
Expand Down
14 changes: 7 additions & 7 deletions conda/recipes/cuvs-bench/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
c_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cxx_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cuda_compiler:
- cuda-nvcc

cuda11_compiler:
- nvcc
- cuda-nvcc # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- nvcc # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

c_stdlib:
- sysroot

c_stdlib_version:
- "2.17"
- "2.28"

cmake_version:
- ">=3.26.4,!=3.30.0"
Expand Down
6 changes: 2 additions & 4 deletions conda/recipes/cuvs-bench/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
{% else %}
- {{ compiler('cuda') }}
{% if cuda_major != "11" %}
- cuda-cudart-dev
- libcublas-dev
{% endif %}
Expand All @@ -50,7 +48,7 @@ requirements:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
- {{ compiler('cuda') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
Expand Down
14 changes: 7 additions & 7 deletions conda/recipes/cuvs/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
c_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cxx_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cuda_compiler:
- cuda-nvcc

cuda11_compiler:
- nvcc
- cuda-nvcc # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- nvcc # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

c_stdlib:
- sysroot

c_stdlib_version:
- "2.17"
- "2.28"

cmake_version:
- ">=3.26.4,!=3.30.0"
6 changes: 2 additions & 4 deletions conda/recipes/cuvs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
{% else %}
- {{ compiler('cuda') }}
{% if cuda_major != "11" %}
- cuda-cudart-dev
{% endif %}
- cuda-python
Expand All @@ -33,7 +31,7 @@ requirements:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
- {{ compiler('cuda') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
Expand Down
14 changes: 7 additions & 7 deletions conda/recipes/libcuvs/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
c_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cxx_compiler_version:
- 11
- 13 # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- 11 # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

cuda_compiler:
- cuda-nvcc

cuda11_compiler:
- nvcc
- cuda-nvcc # [not os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]
- nvcc # [os.environ.get("RAPIDS_CUDA_VERSION", "").startswith("11")]

c_stdlib:
- sysroot

c_stdlib_version:
- "2.17"
- "2.28"

cmake_version:
- ">=3.26.4,!=3.30.0"
Expand Down
24 changes: 8 additions & 16 deletions conda/recipes/libcuvs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ outputs:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
{% else %}
- {{ compiler('cuda') }}
{% if cuda_major != "11" %}
- cuda-cudart-dev
- libcublas-dev
- libcurand-dev
Expand All @@ -54,7 +52,7 @@ outputs:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
- {{ compiler('cuda') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
Expand Down Expand Up @@ -106,10 +104,8 @@ outputs:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
{% else %}
- {{ compiler('cuda') }}
{% if cuda_major != "11" %}
- cuda-cudart-dev
- libcublas-dev
- libcurand-dev
Expand All @@ -121,7 +117,7 @@ outputs:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
- {{ compiler('cuda') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
Expand Down Expand Up @@ -174,10 +170,8 @@ outputs:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
{% else %}
- {{ compiler('cuda') }}
{% if cuda_major != "11" %}
- cuda-cudart-dev
- libcublas-dev
- libcurand-dev
Expand All @@ -189,7 +183,7 @@ outputs:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
- {{ compiler('cuda') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
Expand Down Expand Up @@ -246,10 +240,8 @@ outputs:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }}
{% else %}
- {{ compiler('cuda') }}
{% if cuda_major != "11" %}
- cuda-cudart-dev
- libcublas-dev
- libcurand-dev
Expand All @@ -261,7 +253,7 @@ outputs:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
- {{ compiler('cuda') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
Expand Down
33 changes: 32 additions & 1 deletion cpp/include/cuvs/core/detail/interop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ inline MdspanType from_dlpack(DLManagedTensor* managed_tensor)
RAFT_EXPECTS(to_data_type.lanes == tensor.dtype.lanes,
"lanes mismatch between return mdspan and DLTensor");
RAFT_EXPECTS(tensor.dtype.lanes == 1, "More than 1 DLTensor lanes not supported");
RAFT_EXPECTS(tensor.strides == nullptr, "Strided memory layout for DLTensor not supported");

auto to_device = accessor_type_to_DLDevice<typename MdspanType::accessor_type>();
if (to_device.device_type == kDLCUDA) {
Expand All @@ -110,4 +109,36 @@ inline MdspanType from_dlpack(DLManagedTensor* managed_tensor)
return MdspanType{reinterpret_cast<typename MdspanType::data_handle_type>(tensor.data), exts};
}

inline bool is_f_contiguous(DLManagedTensor* managed_tensor)
{
auto tensor = managed_tensor->dl_tensor;

if (!tensor.strides) { return false; }
int64_t expected_stride = 1;
for (int64_t i = 0; i < tensor.ndim; ++i) {
if (tensor.strides[i] != expected_stride) { return false; }
expected_stride *= tensor.shape[i];
}

return true;
}

inline bool is_c_contiguous(DLManagedTensor* managed_tensor)
{
auto tensor = managed_tensor->dl_tensor;

if (!tensor.strides) {
// no stride information indicates a row-major tensor according to the dlpack spec
return true;
}

int64_t expected_stride = 1;
for (int64_t i = tensor.ndim - 1; i >= 0; --i) {
if (tensor.strides[i] != expected_stride) { return false; }
expected_stride *= tensor.shape[i];
}

return true;
}

} // namespace cuvs::core::detail
Loading

0 comments on commit 11a09c2

Please sign in to comment.