diff --git a/ci/build_wheel_cuopt.sh b/ci/build_wheel_cuopt.sh index cd49b6ffb4..0a9a8edffd 100755 --- a/ci/build_wheel_cuopt.sh +++ b/ci/build_wheel_cuopt.sh @@ -20,6 +20,9 @@ set -euo pipefail source rapids-init-pip +# Install cudss +bash ci/utils/install_cudss.sh + package_dir="python/cuopt" export SKBUILD_CMAKE_ARGS="-DCUOPT_BUILD_WHEELS=ON;-DDISABLE_DEPRECATION_WARNINGS=ON"; diff --git a/ci/build_wheel_libcuopt.sh b/ci/build_wheel_libcuopt.sh index 7651b52f8c..88d6ebf014 100755 --- a/ci/build_wheel_libcuopt.sh +++ b/ci/build_wheel_libcuopt.sh @@ -34,6 +34,24 @@ else echo "Building in release mode" fi +# Install cudss +bash ci/utils/install_cudss.sh + +# Clean metadata & install cudss +if command -v dnf &> /dev/null; then + dnf clean all + # Adding static library just to please CMAKE requirements + dnf -y install libcudss0-static-cuda-12 libcudss0-devel-cuda-12 libcudss0-cuda-12 +elif command -v apt-get &> /dev/null; then + apt-get update + apt-get install -y libcudss-devel +else + echo "Neither dnf nor apt-get found. Cannot install cudss dependencies." + exit 1 +fi +# dnf -y install libcudss0-devel-cuda-12 + + rapids-logger "Generating build requirements" CUOPT_MPS_PARSER_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="cuopt_mps_parser" rapids-download-wheels-from-github python) @@ -62,6 +80,7 @@ EXCLUDE_ARGS=( --exclude "libraft.so" --exclude "libcublas.so.*" --exclude "libcublasLt.so.*" + --exclude "libcudss.so.*" --exclude "libcurand.so.*" --exclude "libcusolver.so.*" --exclude "libcusparse.so.*" diff --git a/ci/utils/install_cudss.sh b/ci/utils/install_cudss.sh new file mode 100755 index 0000000000..5d37396de0 --- /dev/null +++ b/ci/utils/install_cudss.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail + +# Clean metadata & install cudss +if command -v dnf &> /dev/null; then + dnf clean all + # Adding static library just to please CMAKE requirements + dnf -y install libcudss0-static-cuda-12 libcudss0-devel-cuda-12 libcudss0-cuda-12 +elif command -v apt-get &> /dev/null; then + apt-get update + apt-get install -y libcudss-devel +else + echo "Neither dnf nor apt-get found. Cannot install cudss dependencies." + exit 1 +fi + + + + + + + + + diff --git a/conda/environments/all_cuda-128_arch-aarch64.yaml b/conda/environments/all_cuda-128_arch-aarch64.yaml index ba6b6945e3..da85d2c053 100644 --- a/conda/environments/all_cuda-128_arch-aarch64.yaml +++ b/conda/environments/all_cuda-128_arch-aarch64.yaml @@ -35,6 +35,7 @@ dependencies: - httpx - ipython - jsonref==1.1.0 +- libcudss-dev - libcurand-dev - libcusolver-dev - libcusparse-dev diff --git a/conda/environments/all_cuda-128_arch-x86_64.yaml b/conda/environments/all_cuda-128_arch-x86_64.yaml index f91c229570..ec173cfa65 100644 --- a/conda/environments/all_cuda-128_arch-x86_64.yaml +++ b/conda/environments/all_cuda-128_arch-x86_64.yaml @@ -35,6 +35,7 @@ dependencies: - httpx - ipython - jsonref==1.1.0 +- libcudss-dev - libcurand-dev - libcusolver-dev - libcusparse-dev diff --git a/conda/recipes/libcuopt/recipe.yaml b/conda/recipes/libcuopt/recipe.yaml index 9924107d27..d8701f6455 100644 --- a/conda/recipes/libcuopt/recipe.yaml +++ b/conda/recipes/libcuopt/recipe.yaml @@ -66,6 +66,7 @@ cache: - librmm =${{ dep_minor_version }} - rapids-logger =0.1 - cuda-nvtx-dev + - libcudss-dev - libcurand-dev - libcusparse-dev - cuda-cudart-dev @@ -133,6 +134,7 @@ outputs: - rapids-logger =0.1 - librmm =${{ dep_minor_version }} - cuda-cudart-dev + - libcudss-dev - libcublas - libcusparse-dev run: @@ -183,6 +185,7 @@ outputs: - gmock ${{ gtest_version }} - gtest ${{ gtest_version }} - cuda-cudart-dev + - libcudss-dev - libcublas - libcusparse-dev run: diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 53071afaed..c0799614ea 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -250,6 +250,23 @@ list(PREPEND CUOPT_PRIVATE_CUDA_LIBS CUDA::cublasLt) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libmps_parser) set(CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR}/libmps_parser/) +find_package(cudss REQUIRED CONFIG) + +# Print all details of the cudss package +message(STATUS "cudss package details:") +message(STATUS " cudss_FOUND: ${cudss_FOUND}") +message(STATUS " cudss_VERSION: ${cudss_VERSION}") +message(STATUS " cudss_INCLUDE_DIRS: ${cudss_INCLUDE_DIRS}") +message(STATUS " cudss_LIBRARY_DIR: ${cudss_LIBRARY_DIR}") +message(STATUS " cudss_LIBRARIES: ${cudss_LIBRARIES}") +message(STATUS " cudss_DEFINITIONS: ${cudss_DEFINITIONS}") +message(STATUS " cudss_COMPILE_OPTIONS: ${cudss_COMPILE_OPTIONS}") +message(STATUS " cudss_LINK_OPTIONS: ${cudss_LINK_OPTIONS}") + +# Use the specific cudss library version to avoid symlink issues +set(CUDSS_LIB_FILE "${cudss_LIBRARY_DIR}/libcudss.so.0") +message(STATUS "Using cudss library: ${CUDSS_LIB_FILE}") + target_link_libraries(cuopt PUBLIC @@ -260,6 +277,7 @@ target_link_libraries(cuopt CCCL::CCCL raft::raft cuopt::mps_parser + ${CUDSS_LIB_FILE} PRIVATE ${CUOPT_PRIVATE_CUDA_LIBS} ) diff --git a/cpp/src/mip/solver.cu b/cpp/src/mip/solver.cu index 0f2117991f..44f6e8083e 100644 --- a/cpp/src/mip/solver.cu +++ b/cpp/src/mip/solver.cu @@ -33,15 +33,25 @@ #include #include +#include + #include #include #include namespace cuopt::linear_programming::detail { +void force_link_cudss() +{ + cudssHandle_t handle; + cudssCreate(&handle); + cudssDestroy(handle); +} + // This serves as both a warm up but also a mandatory initial call to setup cuSparse and cuBLAS static void init_handler(const raft::handle_t* handle_ptr) { + force_link_cudss(); // Init cuBlas / cuSparse context here to avoid having it during solving time RAFT_CUBLAS_TRY(raft::linalg::detail::cublassetpointermode( handle_ptr->get_cublas_handle(), CUBLAS_POINTER_MODE_DEVICE, handle_ptr->get_stream())); diff --git a/dependencies.yaml b/dependencies.yaml index 07de525333..1da064fed3 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -691,6 +691,7 @@ dependencies: - libcurand-dev - libcusolver-dev - libcusparse-dev + - libcudss-dev - cuda-nvtx-dev - matrix: cuda: "12.*" @@ -698,6 +699,7 @@ dependencies: - libcurand-dev - libcusolver-dev - libcusparse-dev + - libcudss-dev - cuda-nvtx-dev - cuda-nvvm - cuda-crt @@ -714,6 +716,7 @@ dependencies: - nvidia-curand-cu12 - nvidia-cusparse-cu12 - nvidia-cusolver-cu12 + - nvidia-cudss-cu12 - nvidia-nvtx-cu12 # if use_cuda_wheels=false is provided, do not add dependencies on any CUDA wheels # (e.g. for DLFW and pip devcontainers) @@ -728,6 +731,7 @@ dependencies: - nvidia-curand - nvidia-cusparse - nvidia-cusolver + - nvidia-cudss - nvidia-nvtx develop: common: diff --git a/python/libcuopt/CMakeLists.txt b/python/libcuopt/CMakeLists.txt index b997708876..5e76ce87da 100644 --- a/python/libcuopt/CMakeLists.txt +++ b/python/libcuopt/CMakeLists.txt @@ -69,6 +69,7 @@ set(rpaths "$ORIGIN/../../rapids_logger/lib64" "$ORIGIN/../../librmm/lib64" "$ORIGIN/../../nvidia/cublas/lib" + "$ORIGIN/../../nvidia/cu12/lib" "$ORIGIN/../../nvidia/curand/lib" "$ORIGIN/../../nvidia/cusolver/lib" "$ORIGIN/../../nvidia/cusparse/lib" diff --git a/python/libcuopt/pyproject.toml b/python/libcuopt/pyproject.toml index 908d9e28c1..1e9ed3c264 100644 --- a/python/libcuopt/pyproject.toml +++ b/python/libcuopt/pyproject.toml @@ -46,6 +46,7 @@ dependencies = [ "cuopt-mps-parser==25.10.*,>=0.0.0a0", "librmm==25.10.*,>=0.0.0a0", "nvidia-cublas", + "nvidia-cudss", "nvidia-curand", "nvidia-cusolver", "nvidia-cusparse", @@ -64,6 +65,7 @@ libcuopt = "libcuopt" select = [ "distro-too-large-compressed", ] + max_allowed_size_compressed = '775M' [project.scripts]