Skip to content

Commit

Permalink
Port remaining scripts to cuvs_bench (#368)
Browse files Browse the repository at this point in the history
Builds upon #367

Authors:
  - Divye Gala (https://github.com/divyegala)
  - Dante Gama Dessavre (https://github.com/dantegd)
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)
  - Bradley Dice (https://github.com/bdice)

URL: #368
  • Loading branch information
divyegala authored Oct 4, 2024
1 parent d5ca51e commit b754166
Show file tree
Hide file tree
Showing 20 changed files with 1,599 additions and 507 deletions.
25 changes: 23 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARGS=$*
# scripts, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)

VALIDARGS="clean libcuvs python rust docs tests bench-ann examples --uninstall -v -g -n --compile-static-lib --allgpuarch --no-mg --no-nvtx --show_depr_warn --incl-cache-stats --time -h"
VALIDARGS="clean libcuvs python rust docs tests bench-ann examples --uninstall -v -g -n --compile-static-lib --allgpuarch --no-mg --no-cpu --cpu-only --no-shared-libs --no-nvtx --show_depr_warn --incl-cache-stats --time -h"
HELP="$0 [<target> ...] [<flag> ...] [--cmake-args=\"<args>\"] [--cache-tool=<tool>] [--limit-tests=<targets>] [--limit-bench-ann=<targets>] [--build-metrics=<filename>]
where <target> is:
clean - remove all existing build artifacts and configuration (start over)
Expand All @@ -37,11 +37,13 @@ HELP="$0 [<target> ...] [<flag> ...] [--cmake-args=\"<args>\"] [--cache-tool=<to
-n - no install step
--uninstall - uninstall files for specified targets which were built and installed prior
--compile-static-lib - compile static library for all components
--cpu-only - build CPU only components without CUDA. Currently only applies to bench-ann.
--limit-tests - semicolon-separated list of test executables to compile (e.g. NEIGHBORS_TEST;CLUSTER_TEST)
--limit-bench-ann - semicolon-separated list of ann benchmark executables to compute (e.g. HNSWLIB_ANN_BENCH;RAFT_IVF_PQ_ANN_BENCH)
--allgpuarch - build for all supported GPU architectures
--no-mg - disable multi-GPU support
--no-nvtx - disable nvtx (profiling markers), but allow enabling it in downstream projects
--no-shared-libs - build without shared libraries
--show_depr_warn - show cmake deprecation warnings
--build-metrics - filename for generating build metrics report for libcuvs
--incl-cache-stats - include cache statistics in build metrics report
Expand Down Expand Up @@ -72,6 +74,7 @@ COMPILE_LIBRARY=OFF
INSTALL_TARGET=install
BUILD_REPORT_METRICS=""
BUILD_REPORT_INCL_CACHE_STATS=OFF
BUILD_SHARED_LIBS=ON

TEST_TARGETS="NEIGHBORS_ANN_CAGRA_TEST"
ANN_BENCH_TARGETS="CUVS_ANN_BENCH_ALL"
Expand Down Expand Up @@ -282,7 +285,20 @@ fi

if hasArg bench-ann || (( ${NUMARGS} == 0 )); then
BUILD_CUVS_BENCH=ON
if ! hasArg tests; then
BUILD_TESTS=OFF
fi
COMPILE_LIBRARY=OFF
CMAKE_TARGET="${CMAKE_TARGET};${ANN_BENCH_TARGETS}"
if hasArg --cpu-only; then
BUILD_CPU_ONLY=ON
BUILD_SHARED_LIBS=OFF
NVTX=OFF
fi
fi

if hasArg --no-shared-libs; then
BUILD_SHARED_LIBS=OFF
fi

if hasArg --no-nvtx; then
Expand Down Expand Up @@ -329,7 +345,11 @@ fi
# Configure for building all C++ targets
if (( ${NUMARGS} == 0 )) || hasArg libcuvs || hasArg docs || hasArg tests || hasArg bench-prims || hasArg bench-ann; then
COMPILE_LIBRARY=ON
CMAKE_TARGET="${CMAKE_TARGET};cuvs"
if (( ${BUILD_SHARED_LIBS} == "OFF" )); then
CMAKE_TARGET="${CMAKE_TARGET};"
else
CMAKE_TARGET="${CMAKE_TARGET};cuvs"
fi

if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
CUVS_CMAKE_CUDA_ARCHITECTURES="NATIVE"
Expand Down Expand Up @@ -361,6 +381,7 @@ if (( ${NUMARGS} == 0 )) || hasArg libcuvs || hasArg docs || hasArg tests || has
-DBUILD_CPU_ONLY=${BUILD_CPU_ONLY} \
-DBUILD_MG_ALGOS=${BUILD_MG_ALGOS} \
-DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL} \
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} \
${CACHE_ARGS} \
${EXTRA_CMAKE_ARGS}

Expand Down
18 changes: 18 additions & 0 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,22 @@ rapids-conda-retry mambabuild \
--channel "${CPP_CHANNEL}" \
conda/recipes/cuvs

# Build cuvs_bench for each cuda and python version
rapids-conda-retry mambabuild \
--no-test \
--channel "${CPP_CHANNEL}" \
--channel "${RAPIDS_CONDA_BLD_OUTPUT_DIR}" \
conda/recipes/cuvs_bench

# Build cuvs_bench_cpu only in CUDA 12 jobs since it only depends on python
# version
RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}"
if [[ ${RAPIDS_CUDA_MAJOR} == "12" ]]; then
rapids-conda-retry mambabuild \
--no-test \
--channel "${CPP_CHANNEL}" \
--channel "${RAPIDS_CONDA_BLD_OUTPUT_DIR}" \
conda/recipes/cuvs_bench_cpu
fi

rapids-upload-conda-to-s3 python
5 changes: 5 additions & 0 deletions conda/recipes/cuvs_bench/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2024, NVIDIA CORPORATION.

./build.sh bench-ann --allgpuarch --no-nvtx --build-metrics=bench_ann --incl-cache-stats
cmake --install cpp/build --component ann_bench
70 changes: 70 additions & 0 deletions conda/recipes/cuvs_bench/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
c_compiler_version:
- 11

cxx_compiler_version:
- 11

cuda_compiler:
- cuda-nvcc

cuda11_compiler:
- nvcc

c_stdlib:
- sysroot

c_stdlib_version:
- "2.17"

cmake_version:
- ">=3.26.4,!=3.30.0"

nccl_version:
- ">=2.19"

glog_version:
- ">=0.6.0"

h5py_version:
- ">=3.8.0"

nlohmann_json_version:
- ">=3.11.2"

# The CTK libraries below are missing from the conda-forge::cudatoolkit package
# for CUDA 11. The "*_host_*" version specifiers correspond to `11.8` packages
# and the "*_run_*" version specifiers correspond to `11.x` packages.

cuda11_libcublas_host_version:
- "=11.11.3.6"

cuda11_libcublas_run_version:
- ">=11.5.2.43,<12.0.0"

cuda11_libcurand_host_version:
- "=10.3.0.86"

cuda11_libcurand_run_version:
- ">=10.2.5.43,<10.3.1"

cuda11_libcusolver_host_version:
- "=11.4.1.48"

cuda11_libcusolver_run_version:
- ">=11.2.0.43,<11.4.2"

cuda11_libcusparse_host_version:
- "=11.7.5.86"

cuda11_libcusparse_run_version:
- ">=11.6.0.43,<12.0.0"

# `cuda-profiler-api` only has `11.8.0` and `12.0.0` packages for all
# architectures. The "*_host_*" version specifiers correspond to `11.8` packages and the
# "*_run_*" version specifiers correspond to `11.x` packages.

cuda11_cuda_profiler_api_host_version:
- "=11.8.86"

cuda11_cuda_profiler_api_run_version:
- ">=11.4.240,<12"
105 changes: 105 additions & 0 deletions conda/recipes/cuvs_bench/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

# Usage:
# conda build . -c rapidsai -c conda-forge -c nvidia
{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set py_version = environ['CONDA_PY'] %}
{% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %}
{% set cuda_major = cuda_version.split('.')[0] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}

package:
name: cuvs_bench
version: {{ version }}
script: build.sh

source:
path: ../../..

build:
script_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
- CMAKE_C_COMPILER_LAUNCHER
- CMAKE_CUDA_COMPILER_LAUNCHER
- CMAKE_CXX_COMPILER_LAUNCHER
- CMAKE_GENERATOR
- PARALLEL_LEVEL
- RAPIDS_ARTIFACTS_DIR
- SCCACHE_BUCKET
- SCCACHE_IDLE_TIMEOUT
- SCCACHE_REGION
- SCCACHE_S3_KEY_PREFIX=cuvs-bench-aarch64 # [aarch64]
- SCCACHE_S3_KEY_PREFIX=cuvs-bench-linux64 # [linux64]
- SCCACHE_S3_USE_SSL
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') }}
- cuda-cudart-dev
- libcublas-dev
{% endif %}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
{% if cuda_major == "11" %}
- {{ compiler('cuda11') }} ={{ cuda_version }}
{% else %}
- {{ compiler('cuda') }}
{% endif %}
- cuda-version ={{ cuda_version }}
- cmake {{ cmake_version }}
- ninja
- {{ stdlib("c") }}

host:
- benchmark
- cuda-version ={{ cuda_version }}
{% if cuda_major == "11" %}
- cuda-profiler-api {{ cuda11_cuda_profiler_api_run_version }}
- libcublas {{ cuda11_libcublas_host_version }}
- libcublas-dev {{ cuda11_libcublas_host_version }}
{% else %}
- cuda-cudart-dev
- cuda-profiler-api
- libcublas-dev
{% endif %}
- glog {{ glog_version }}
- libcuvs {{ version }}
- nlohmann_json {{ nlohmann_json_version }}
- openblas
# rmm is needed to determine if package is gpu-enabled
- python
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rmm ={{ minor_version }}

run:
- benchmark
- {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}
{% if cuda_major == "11" %}
- cudatoolkit
{% else %}
- cuda-cudart
- libcublas
{% endif %}
- glog {{ glog_version }}
- libcuvs {{ version }}
- h5py {{ h5py_version }}
- matplotlib
- pandas
- pyyaml
# rmm is needed to determine if package is gpu-enabled
- pylibraft ={{ minor_version }}
- python
- rmm ={{ minor_version }}
about:
home: https://rapids.ai/
license: Apache-2.0
summary: cuVS GPU and CPU benchmarks
5 changes: 5 additions & 0 deletions conda/recipes/cuvs_bench_cpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2024, NVIDIA CORPORATION.

./build.sh bench-ann --cpu-only --no-nvtx --build-metrics=bench_ann_cpu --incl-cache-stats
cmake --install cpp/build --component ann_bench
29 changes: 29 additions & 0 deletions conda/recipes/cuvs_bench_cpu/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
c_compiler_version:
- 11

cxx_compiler_version:
- 11

c_stdlib:
- sysroot

c_stdlib_version:
- "2.17"

cmake_version:
- ">=3.26.4,!=3.30.0"

glog_version:
- ">=0.6.0"

h5py_version:
- ">=3.8.0"

nlohmann_json_version:
- ">=3.11.2"

spdlog_version:
- ">=1.14.1,<1.15"

fmt_version:
- ">=11.0.2,<12"
67 changes: 67 additions & 0 deletions conda/recipes/cuvs_bench_cpu/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

# Usage:
# conda build . -c rapidsai -c conda-forge -c nvidia
{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}

package:
name: cuvs_bench_cpu
version: {{ version }}
script: build.sh

source:
path: ../../..

build:
script_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
- CMAKE_C_COMPILER_LAUNCHER
- CMAKE_CUDA_COMPILER_LAUNCHER
- CMAKE_CXX_COMPILER_LAUNCHER
- CMAKE_GENERATOR
- PARALLEL_LEVEL
- RAPIDS_ARTIFACTS_DIR
- SCCACHE_BUCKET
- SCCACHE_IDLE_TIMEOUT
- SCCACHE_REGION
- SCCACHE_S3_KEY_PREFIX=cuvs-bench-cpu-aarch64 # [aarch64]
- SCCACHE_S3_KEY_PREFIX=cuvs-bench-cpu-linux64 # [linux64]
- SCCACHE_S3_USE_SSL
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- cmake {{ cmake_version }}
- ninja
- {{ stdlib("c") }}

host:
- benchmark
- fmt {{ fmt_version }}
- glog {{ glog_version }}
- nlohmann_json {{ nlohmann_json_version }}
- openblas
- python
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- spdlog {{ spdlog_version }}

run:
- benchmark
- glog {{ glog_version }}
- h5py {{ h5py_version }}
- matplotlib
- pandas
- pyyaml
- python
about:
home: https://rapids.ai/
license: Apache-2.0
summary: cuVS CPU benchmarks
1 change: 1 addition & 0 deletions conda/recipes/libcuvs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ outputs:
- libcusolver
- libcusparse
{% endif %}
- libraft-headers ={{ minor_version }}
about:
home: https://rapids.ai/
license: Apache-2.0
Expand Down
Loading

0 comments on commit b754166

Please sign in to comment.