Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CUDA math wheels #298

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@ rapids-generate-version > ./VERSION

cd "${package_dir}"

case "${RAPIDS_CUDA_VERSION}" in
12.*)
EXCLUDE_ARGS=(
--exclude "libcublas.so.12"
--exclude "libcublasLt.so.12"
--exclude "libcurand.so.10"
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
--exclude "libcusolver.so.11"
--exclude "libcusparse.so.12"
--exclude "libnvJitLink.so.12"
)
;;
11.*)
EXCLUDE_ARGS=()
;;
esac

# Hardcode the output dir
python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check

mkdir -p final_dist
python -m auditwheel repair -w final_dist dist/*
python -m auditwheel repair -w final_dist "${EXCLUDE_ARGS[@]}" dist/*

RAPIDS_PY_WHEEL_NAME="${underscore_package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 final_dist
11 changes: 10 additions & 1 deletion ci/build_wheel_cuvs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@

set -euo pipefail

case "${RAPIDS_CUDA_VERSION}" in
12.*)
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=ON"
;;
11.*)
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=OFF"
;;
esac

# Set up skbuild options. Enable sccache in skbuild config options
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF -DFIND_CUVS_CPP=OFF"
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUVS_CPP=OFF${EXTRA_CMAKE_ARGS}"
jameslamb marked this conversation as resolved.
Show resolved Hide resolved

ci/build_wheel.sh cuvs python/cuvs
19 changes: 19 additions & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ files:
extras:
table: project
includes:
- cuda
- run_py_cuvs
py_test_py_cuvs:
output: pyproject
Expand Down Expand Up @@ -310,6 +311,24 @@ dependencies:
- *libcusolver114
- *libcusparse_dev114
- *libcusparse114
- output_types: pyproject
matrices:
- matrix:
cuda: "12.*"
packages:
- nvidia-cublas-cu12
- nvidia-curand-cu12
- nvidia-cusolver-cu12
- nvidia-cusparse-cu12
- matrix:
cuda: "11.*"
packages:
- matrix:
packages:
- nvidia-cublas
- nvidia-curand
- nvidia-cusolver
- nvidia-cusparse

cupy:
common:
Expand Down
22 changes: 22 additions & 0 deletions python/cuvs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ project(
option(FIND_CUVS_CPP "Search for existing CUVS C++ installations before defaulting to local files"
OFF
)
option(USE_CUDA_MATH_WHEELS "Use the CUDA math wheels instead of the system libraries" OFF)

message(
"CUVS_PY: Searching for existing cuVS C/C++ installations before defaulting to local files: ${FIND_CUVS_CPP}"
Expand All @@ -62,6 +63,8 @@ else()
endif()

if(NOT cuvs_FOUND)
find_package(CUDAToolkit REQUIRED)

set(BUILD_TESTS OFF)
set(BUILD_C_LIBRARY ON)

Expand All @@ -70,8 +73,27 @@ if(NOT cuvs_FOUND)
set(CUDA_STATIC_MATH_LIBRARIES ON)
set(CUVS_USE_RAFT_STATIC ON)

if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.0)
set(CUDA_STATIC_MATH_LIBRARIES OFF)
elseif(USE_CUDA_MATH_WHEELS)
message(FATAL_ERROR "Cannot use CUDA math wheels with CUDA < 12.0")
endif()

add_subdirectory(../../cpp cuvs-cpp EXCLUDE_FROM_ALL)

if(NOT CUDA_STATIC_MATH_LIBRARIES AND USE_CUDA_MATH_WHEELS)
set(rpaths
"$ORIGIN/../nvidia/cublas/lib"
"$ORIGIN/../nvidia/cufft/lib"
"$ORIGIN/../nvidia/curand/lib"
"$ORIGIN/../nvidia/cusolver/lib"
"$ORIGIN/../nvidia/cusparse/lib"
"$ORIGIN/../nvidia/nvjitlink/lib"
)
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
set_property(TARGET cuvs PROPERTY INSTALL_RPATH ${rpaths} APPEND)
set_property(TARGET cuvs_c PROPERTY INSTALL_RPATH ${rpaths} APPEND)
endif()

set(cython_lib_dir cuvs)
install(TARGETS cuvs cuvs_c DESTINATION ${cython_lib_dir})
endif()
Expand Down
4 changes: 4 additions & 0 deletions python/cuvs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ requires-python = ">=3.9"
dependencies = [
"cuda-python",
"numpy>=1.23,<2.0a0",
"nvidia-cublas",
"nvidia-curand",
"nvidia-cusolver",
"nvidia-cusparse",
"pylibraft==24.10.*,>=0.0.0a0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
classifiers = [
Expand Down
Loading