diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 749a0b6ee7..5f6ce34b07 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -1,10 +1,11 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh source rapids-configure-sccache diff --git a/ci/build_docs.sh b/ci/build_docs.sh index 3bdc1e75a2..e658202592 100755 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -1,9 +1,10 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh rapids-logger "Create test conda environment" . /opt/conda/etc/profile.d/conda.sh @@ -23,6 +24,7 @@ PYTHON_CHANNEL=$(rapids-download-conda-from-github python) rapids-logger "Generating conda environment YAML" rapids-dependency-file-generator \ + "${RAPIDS_EXTRA_CONDA_CHANNEL_ARGS[@]}" \ --output conda \ --file-key docs \ --prepend-channel "${CPP_CHANNEL}" \ diff --git a/ci/build_python.sh b/ci/build_python.sh index 629b7fb5f5..0a48c041ee 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -1,9 +1,10 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh source rapids-configure-sccache diff --git a/ci/build_wheel_cuopt.sh b/ci/build_wheel_cuopt.sh index 0ba991e57f..81615600d2 100755 --- a/ci/build_wheel_cuopt.sh +++ b/ci/build_wheel_cuopt.sh @@ -5,9 +5,10 @@ set -euo pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + # Install rockylinux repo if command -v dnf &> /dev/null; then bash ci/utils/update_rockylinux_repo.sh diff --git a/ci/build_wheel_cuopt_mps_parser.sh b/ci/build_wheel_cuopt_mps_parser.sh index f87cb729fd..62653a20a4 100755 --- a/ci/build_wheel_cuopt_mps_parser.sh +++ b/ci/build_wheel_cuopt_mps_parser.sh @@ -5,9 +5,10 @@ set -euo pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + package_dir="python/cuopt/cuopt/linear_programming" export SKBUILD_CMAKE_ARGS="-DCUOPT_BUILD_WHEELS=ON;-DDISABLE_DEPRECATION_WARNINGS=ON" diff --git a/ci/build_wheel_cuopt_server.sh b/ci/build_wheel_cuopt_server.sh index 1be325303f..3d2589a278 100755 --- a/ci/build_wheel_cuopt_server.sh +++ b/ci/build_wheel_cuopt_server.sh @@ -4,9 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 set -euo pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + package_dir="python/cuopt_server" ci/build_wheel.sh cuopt_server ${package_dir} diff --git a/ci/build_wheel_cuopt_sh_client.sh b/ci/build_wheel_cuopt_sh_client.sh index f5083b5ebd..c784ce4319 100755 --- a/ci/build_wheel_cuopt_sh_client.sh +++ b/ci/build_wheel_cuopt_sh_client.sh @@ -4,9 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 set -euo pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + package_dir="python/cuopt_self_hosted" ci/build_wheel.sh cuopt_sh_client ${package_dir} diff --git a/ci/build_wheel_libcuopt.sh b/ci/build_wheel_libcuopt.sh index bad18cb798..b142177eb2 100755 --- a/ci/build_wheel_libcuopt.sh +++ b/ci/build_wheel_libcuopt.sh @@ -3,9 +3,10 @@ # SPDX-License-Identifier: Apache-2.0 set -euo pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + package_name="libcuopt" package_dir="python/libcuopt" diff --git a/ci/test_cpp.sh b/ci/test_cpp.sh index 653c44133a..b63a841cc4 100755 --- a/ci/test_cpp.sh +++ b/ci/test_cpp.sh @@ -1,9 +1,10 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh . /opt/conda/etc/profile.d/conda.sh @@ -14,6 +15,7 @@ CPP_CHANNEL=$(rapids-download-conda-from-github cpp) rapids-logger "Generate C++ testing dependencies" rapids-dependency-file-generator \ + "${RAPIDS_EXTRA_CONDA_CHANNEL_ARGS[@]}" \ --output conda \ --file-key test_cpp \ --prepend-channel "${CPP_CHANNEL}" \ diff --git a/ci/test_cpp_memcheck.sh b/ci/test_cpp_memcheck.sh index bc4bce4cbc..25412b8c79 100755 --- a/ci/test_cpp_memcheck.sh +++ b/ci/test_cpp_memcheck.sh @@ -1,6 +1,6 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 if [[ "$(date +%A)" != "Friday" ]]; then @@ -9,6 +9,7 @@ if [[ "$(date +%A)" != "Friday" ]]; then fi set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh . /opt/conda/etc/profile.d/conda.sh @@ -19,6 +20,7 @@ RAPIDS_VERSION="$(rapids-version)" rapids-logger "Generate C++ testing dependencies" rapids-dependency-file-generator \ + "${RAPIDS_EXTRA_CONDA_CHANNEL_ARGS[@]}" \ --output conda \ --file-key test_cpp \ --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" | tee env.yaml diff --git a/ci/test_notebooks.sh b/ci/test_notebooks.sh index 22c41af84c..8032d62ffc 100755 --- a/ci/test_notebooks.sh +++ b/ci/test_notebooks.sh @@ -1,9 +1,10 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh . /opt/conda/etc/profile.d/conda.sh @@ -19,6 +20,7 @@ rapids-logger "Generate notebook testing dependencies" ENV_YAML_DIR="$(mktemp -d)" rapids-dependency-file-generator \ + "${RAPIDS_EXTRA_CONDA_CHANNEL_ARGS[@]}" \ --output conda \ --file-key test_notebooks \ --prepend-channel "${CPP_CHANNEL}" \ diff --git a/ci/test_python.sh b/ci/test_python.sh index 4f91c83334..d742649833 100755 --- a/ci/test_python.sh +++ b/ci/test_python.sh @@ -4,6 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh . /opt/conda/etc/profile.d/conda.sh @@ -16,6 +17,7 @@ PYTHON_CHANNEL=$(rapids-download-conda-from-github python) rapids-logger "Generate Python testing dependencies" rapids-dependency-file-generator \ + "${RAPIDS_EXTRA_CONDA_CHANNEL_ARGS[@]}" \ --output conda \ --file-key test_python \ --prepend-channel "${CPP_CHANNEL}" \ diff --git a/ci/test_self_hosted_service.sh b/ci/test_self_hosted_service.sh index 601b45326b..385be8740e 100755 --- a/ci/test_self_hosted_service.sh +++ b/ci/test_self_hosted_service.sh @@ -4,9 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 set -euo pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + # Download the cuopt built in the previous step RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")" CUOPT_MPS_PARSER_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="cuopt_mps_parser" rapids-download-wheels-from-github python) diff --git a/ci/test_skills_assets.sh b/ci/test_skills_assets.sh index c75645cb93..25da0b5207 100755 --- a/ci/test_skills_assets.sh +++ b/ci/test_skills_assets.sh @@ -9,6 +9,7 @@ # CLI: run cuopt_cli on each sample .mps in API-CLI skill assets. set -euo pipefail +source ./ci/use_conda_packages_from_prs.sh # Use rapids-logger in CI; fall back to echo for local testing if command -v rapids-logger &>/dev/null; then diff --git a/ci/test_wheel_cuopt.sh b/ci/test_wheel_cuopt.sh index a327082e83..68133be9f2 100755 --- a/ci/test_wheel_cuopt.sh +++ b/ci/test_wheel_cuopt.sh @@ -8,6 +8,7 @@ set -euo pipefail # sets up a constraints file for 'pip' and puts its location in an exported variable PIP_EXPORT, # so those constraints will affect all future 'pip install' calls source rapids-init-pip +source ./ci/use_wheels_from_prs.sh # Download the packages built in the previous step RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")" diff --git a/ci/test_wheel_cuopt_server.sh b/ci/test_wheel_cuopt_server.sh index a76969b965..9a58722319 100755 --- a/ci/test_wheel_cuopt_server.sh +++ b/ci/test_wheel_cuopt_server.sh @@ -4,9 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 set -eou pipefail - source rapids-init-pip +source ./ci/use_wheels_from_prs.sh + # Download the packages built in the previous step RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}")" CUOPT_MPS_PARSER_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="cuopt_mps_parser" rapids-download-wheels-from-github python) diff --git a/ci/use_conda_packages_from_prs.sh b/ci/use_conda_packages_from_prs.sh new file mode 100755 index 0000000000..94c2a13c4f --- /dev/null +++ b/ci/use_conda_packages_from_prs.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +# download CI artifacts +LIBRMM_CHANNEL=$(rapids-get-pr-artifact rmm 2361 cpp conda) +RMM_CHANNEL=$(rapids-get-pr-artifact rmm 2361 python conda --stable) +LIBUCXX_CHANNEL=$(rapids-get-pr-artifact ucxx 636 cpp conda) +UCXX_CHANNEL=$(rapids-get-pr-artifact ucxx 636 python conda --stable) +LIBRAFT_CHANNEL=$(rapids-get-pr-artifact raft 2996 cpp conda) +RAFT_CHANNEL=$(rapids-get-pr-artifact raft 2996 python conda --stable) + +RAPIDS_PREPENDED_CONDA_CHANNELS=( + "${LIBRMM_CHANNEL}" + "${RMM_CHANNEL}" + "${LIBUCXX_CHANNEL}" + "${UCXX_CHANNEL}" + "${LIBRAFT_CHANNEL}" + "${RAFT_CHANNEL}" +) +export RAPIDS_PREPENDED_CONDA_CHANNELS + +RAPIDS_EXTRA_CONDA_CHANNEL_ARGS=() +for _channel in "${RAPIDS_PREPENDED_CONDA_CHANNELS[@]}" +do + conda config --system --add channels "${_channel}" + RAPIDS_EXTRA_CONDA_CHANNEL_ARGS+=(--prepend-channel "${_channel}") +done diff --git a/ci/use_wheels_from_prs.sh b/ci/use_wheels_from_prs.sh new file mode 100755 index 0000000000..932c5d07c1 --- /dev/null +++ b/ci/use_wheels_from_prs.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +RAPIDS_PY_CUDA_SUFFIX=$(rapids-wheel-ctk-name-gen "${RAPIDS_CUDA_VERSION}") + +LIBRMM_WHEELHOUSE=$( + RAPIDS_PY_WHEEL_NAME="librmm_${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-artifact rmm 2361 cpp wheel +) +RMM_WHEELHOUSE=$( + rapids-get-pr-artifact rmm 2361 python wheel --stable +) +LIBUCXX_WHEELHOUSE=$( + RAPIDS_PY_WHEEL_NAME="libucxx_${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-artifact ucxx 636 cpp wheel +) +UCXX_WHEELHOUSE=$( + rapids-get-pr-artifact ucxx 636 python wheel --stable +) +LIBRAFT_WHEELHOUSE=$( + RAPIDS_PY_WHEEL_NAME="libraft_${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-artifact raft 2996 cpp wheel +) +RAFT_WHEELHOUSE=$( + rapids-get-pr-artifact raft 2996 python wheel --stable --pkg_name pylibraft +) + +cat >> "${PIP_CONSTRAINT}" <> memory_resources; + std::vector memory_resources; if (memory_backend == cuopt::linear_programming::memory_backend_t::GPU) { const int num_gpus = settings.get_parameter(CUOPT_NUM_GPUS); + memory_resources.reserve(std::min(raft::device_setter::get_device_count(), num_gpus)); for (int i = 0; i < std::min(raft::device_setter::get_device_count(), num_gpus); ++i) { RAFT_CUDA_TRY(cudaSetDevice(i)); - memory_resources.push_back(make_async()); - rmm::mr::set_per_device_resource(rmm::cuda_device_id{i}, memory_resources.back().get()); + memory_resources.emplace_back(); + rmm::mr::set_per_device_resource(rmm::cuda_device_id{i}, memory_resources.back()); } RAFT_CUDA_TRY(cudaSetDevice(0)); } diff --git a/cpp/src/barrier/sparse_cholesky.cuh b/cpp/src/barrier/sparse_cholesky.cuh index f7938fb989..52fea89502 100644 --- a/cpp/src/barrier/sparse_cholesky.cuh +++ b/cpp/src/barrier/sparse_cholesky.cuh @@ -247,8 +247,8 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { CUDSS_CALL_AND_CHECK_EXIT(cudssSetStream(handle, stream), status, "cudaStreamCreate"); mem_handler.ctx = reinterpret_cast(handle_ptr_->get_workspace_resource()); - mem_handler.device_alloc = cudss_device_alloc; - mem_handler.device_free = cudss_device_dealloc; + mem_handler.device_alloc = cudss_device_alloc; + mem_handler.device_free = cudss_device_dealloc; CUDSS_CALL_AND_CHECK_EXIT( cudssSetDeviceMemHandler(handle, &mem_handler), status, "cudssSetDeviceMemHandler"); diff --git a/cpp/src/pdlp/termination_strategy/infeasibility_information.cu b/cpp/src/pdlp/termination_strategy/infeasibility_information.cu index 37972ba442..f795d2c4ca 100644 --- a/cpp/src/pdlp/termination_strategy/infeasibility_information.cu +++ b/cpp/src/pdlp/termination_strategy/infeasibility_information.cu @@ -15,6 +15,8 @@ #include +#include + #include #include #include diff --git a/cpp/src/routing/ges_solver.cu b/cpp/src/routing/ges_solver.cu index 194f73b99e..a660f84909 100644 --- a/cpp/src/routing/ges_solver.cu +++ b/cpp/src/routing/ges_solver.cu @@ -16,8 +16,6 @@ #include "adapters/assignment_adapter.cuh" #include "ges/guided_ejection_search.cuh" -#include - namespace cuopt { namespace routing { diff --git a/cpp/src/utilities/cuda_helpers.cuh b/cpp/src/utilities/cuda_helpers.cuh index 84c0a590be..eccf8e1538 100644 --- a/cpp/src/utilities/cuda_helpers.cuh +++ b/cpp/src/utilities/cuda_helpers.cuh @@ -16,8 +16,6 @@ #include #include #include -#include -#include #include #include @@ -242,25 +240,10 @@ DI void sorted_insert(T* array, T item, int curr_size, int max_size) inline size_t get_device_memory_size() { - // Otherwise, we need to get the free memory from the device size_t free_mem, total_mem; - cudaMemGetInfo(&free_mem, &total_mem); - - auto res = rmm::mr::get_current_device_resource(); - auto limiting_adaptor = - dynamic_cast*>(res); - // Did we specifiy an explicit memory limit? - if (limiting_adaptor) { - printf("limiting_adaptor->get_allocation_limit(): %fMiB\n", - limiting_adaptor->get_allocation_limit() / (double)1e6); - printf("used_mem: %fMiB\n", limiting_adaptor->get_allocated_bytes() / (double)1e6); - printf("free_mem: %fMiB\n", - (limiting_adaptor->get_allocation_limit() - limiting_adaptor->get_allocated_bytes()) / - (double)1e6); - return std::min(total_mem, limiting_adaptor->get_allocation_limit()); - } else { - return total_mem; - } + RAFT_CUDA_TRY(cudaMemGetInfo(&free_mem, &total_mem)); + // TODO (bdice): Restore limiting adaptor check after updating CCCL to support resource_cast + return total_mem; } } // namespace cuopt diff --git a/cpp/tests/mip/load_balancing_test.cu b/cpp/tests/mip/load_balancing_test.cu index 1f825a26f7..f9ccbb4c93 100644 --- a/cpp/tests/mip/load_balancing_test.cu +++ b/cpp/tests/mip/load_balancing_test.cu @@ -32,7 +32,7 @@ namespace cuopt::linear_programming::test { -inline auto make_async() { return std::make_shared(); } +inline auto make_async() { return rmm::mr::cuda_async_memory_resource(); } void init_handler(const raft::handle_t* handle_ptr) { @@ -119,7 +119,7 @@ bounds_probe_results(detail::bound_presolve_t& bnd_prb_0, void test_multi_probe(std::string path) { auto memory_resource = make_async(); - rmm::mr::set_current_device_resource(memory_resource.get()); + rmm::mr::set_current_device_resource(memory_resource); const raft::handle_t handle_{}; cuopt::mps_parser::mps_data_model_t mps_problem = cuopt::mps_parser::parse_mps(path, false); diff --git a/cpp/tests/mip/multi_probe_test.cu b/cpp/tests/mip/multi_probe_test.cu index 003220de9b..d72899b171 100644 --- a/cpp/tests/mip/multi_probe_test.cu +++ b/cpp/tests/mip/multi_probe_test.cu @@ -31,7 +31,7 @@ namespace cuopt::linear_programming::test { -inline auto make_async() { return std::make_shared(); } +inline auto make_async() { return rmm::mr::cuda_async_memory_resource(); } void init_handler(const raft::handle_t* handle_ptr) { @@ -141,7 +141,7 @@ multi_probe_results( void test_multi_probe(std::string path) { auto memory_resource = make_async(); - rmm::mr::set_current_device_resource(memory_resource.get()); + rmm::mr::set_current_device_resource(memory_resource); const raft::handle_t handle_{}; cuopt::mps_parser::mps_data_model_t mps_problem = cuopt::mps_parser::parse_mps(path, false); diff --git a/cpp/tests/utilities/base_fixture.hpp b/cpp/tests/utilities/base_fixture.hpp index abc69627df..31d7923dfa 100644 --- a/cpp/tests/utilities/base_fixture.hpp +++ b/cpp/tests/utilities/base_fixture.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ @@ -13,11 +13,12 @@ #include +#include + #include #include #include #include -#include #include #include @@ -25,18 +26,17 @@ namespace cuopt { namespace test { /// MR factory functions -inline auto make_cuda() { return std::make_shared(); } +inline auto make_cuda() { return rmm::mr::cuda_memory_resource(); } -inline auto make_async() { return std::make_shared(); } +inline auto make_async() { return rmm::mr::cuda_async_memory_resource(); } -inline auto make_managed() { return std::make_shared(); } +inline auto make_managed() { return rmm::mr::managed_memory_resource(); } inline auto make_pool() { // 1GB of initial pool size const size_t initial_pool_size = 1024 * 1024 * 1024; - return rmm::mr::make_owning_wrapper(make_async(), - initial_pool_size); + return rmm::mr::pool_memory_resource(make_async(), initial_pool_size); } inline auto make_binning() @@ -44,8 +44,7 @@ inline auto make_binning() auto pool = make_pool(); // Add a fixed_size_memory_resource for bins of size 256, 512, 1024, 2048 and // 4096KiB Larger allocations will use the pool resource - auto mr = rmm::mr::make_owning_wrapper(pool, 18, 22); - return mr; + return rmm::mr::binning_memory_resource(pool, 18, 22); } /** @@ -62,7 +61,7 @@ inline auto make_binning() * Accepted types are "pool", "cuda", and "managed" only. * @return Memory resource instance */ -inline std::shared_ptr create_memory_resource( +inline cuda::mr::any_resource create_memory_resource( std::string const& allocation_mode) { if (allocation_mode == "binning") return make_binning(); @@ -120,6 +119,6 @@ inline auto parse_test_options(int argc, char** argv) auto const cmd_opts = parse_test_options(argc, argv); \ auto const rmm_mode = cmd_opts["rmm_mode"].as(); \ auto resource = cuopt::test::create_memory_resource(rmm_mode); \ - rmm::mr::set_current_device_resource(resource.get()); \ + rmm::mr::set_current_device_resource(resource); \ return RUN_ALL_TESTS(); \ }