From deb3e6cdbf2710089cadecfa80ce6c9f399c6258 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Wed, 1 Jul 2026 15:33:58 -0700 Subject: [PATCH 01/13] symbol visibility is hidden by default Signed-off-by: Arha Gatram --- cpp/CMakeLists.txt | 10 +++ cpp/include/cuopt/error.hpp | 5 +- cpp/include/cuopt/export.hpp | 14 ++++ .../backend_selection.hpp | 8 ++- .../cpu_optimization_problem.hpp | 7 +- .../cpu_optimization_problem_solution.hpp | 7 +- .../cpu_pdlp_warm_start_data.hpp | 8 ++- .../cuopt/mathematical_optimization/cuopt_c.h | 9 +++ .../io/data_model_view.hpp | 9 ++- .../io/mps_data_model.hpp | 10 ++- .../io/mps_writer.hpp | 9 ++- .../mathematical_optimization/io/parser.hpp | 9 ++- .../mathematical_optimization/io/writer.hpp | 9 ++- .../mip/solver_settings.hpp | 7 +- .../mip/solver_solution.hpp | 7 +- .../optimization_problem.hpp | 7 +- .../optimization_problem_solution.hpp | 7 +- .../pdlp/pdlp_warm_start_data.hpp | 8 ++- .../pdlp/solver_settings.hpp | 7 +- .../pdlp/solver_solution.hpp | 7 +- .../cuopt/mathematical_optimization/solve.hpp | 7 +- .../solve_remote.hpp | 7 +- .../solver_settings.hpp | 7 +- cpp/include/cuopt/routing/assignment.hpp | 7 +- cpp/include/cuopt/routing/data_model_view.hpp | 5 +- .../cuopt/routing/routing_structures.hpp | 4 +- cpp/include/cuopt/routing/solve.hpp | 7 +- cpp/include/cuopt/routing/solver_settings.hpp | 7 +- cpp/src/grpc/client/solve_remote.cpp | 5 +- cpp/src/grpc/grpc_problem_mapper.cpp | 50 ++++++++------- cpp/src/grpc/grpc_settings_mapper.cpp | 42 +++++++----- cpp/src/grpc/grpc_solution_mapper.cpp | 64 ++++++++++--------- cpp/src/io/data_model_view.cpp | 5 +- cpp/src/io/lp_parser.cpp | 11 ++-- cpp/src/io/mps_data_model.cpp | 9 +-- cpp/src/io/mps_writer.cpp | 5 +- cpp/src/io/parser.cpp | 13 ++-- cpp/src/io/writer.cpp | 9 +-- cpp/src/math_optimization/solution_reader.hpp | 9 ++- cpp/src/math_optimization/solver_settings.cu | 47 +++++++++----- cpp/src/mip_heuristics/solve.cu | 9 +-- cpp/src/mip_heuristics/solver_settings.cu | 5 +- cpp/src/mip_heuristics/solver_solution.cu | 5 +- cpp/src/pdlp/cpu_optimization_problem.cpp | 5 +- cpp/src/pdlp/cpu_pdlp_warm_start_data.cu | 9 +-- cpp/src/pdlp/optimization_problem.cu | 7 +- cpp/src/pdlp/pdlp_warm_start_data.cu | 5 +- cpp/src/pdlp/solution_conversion.cu | 9 +-- cpp/src/pdlp/solve.cu | 9 +-- cpp/src/pdlp/solver_settings.cu | 5 +- cpp/src/pdlp/solver_solution.cu | 5 +- cpp/src/routing/assignment.cu | 5 +- cpp/src/routing/data_model_view.cu | 3 +- .../distance_engine/waypoint_matrix.cpp | 5 +- cpp/src/routing/solve.cu | 7 +- cpp/src/routing/solver_settings.cu | 5 +- cpp/src/utilities/logger.hpp | 11 ++-- 57 files changed, 386 insertions(+), 207 deletions(-) create mode 100644 cpp/include/cuopt/export.hpp diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 61f6eb91df..daa905868d 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -510,6 +510,8 @@ if (NOT SKIP_GRPC_BUILD) # at runtime with "undefined symbol: absl::…::Mutex::Dtor". set_property(SOURCE ${GRPC_INFRA_FILES} DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} APPEND PROPERTY COMPILE_OPTIONS "-DNDEBUG") + set_property(SOURCE ${PROTO_SRCS} ${GRPC_PROTO_SRCS} ${GRPC_SERVICE_SRCS} ${DATA_PROTO_SRCS} DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + APPEND PROPERTY COMPILE_OPTIONS "$<$:-fvisibility=default>") endif (NOT SKIP_GRPC_BUILD) add_library(cuopt SHARED @@ -523,6 +525,14 @@ set_target_properties(cuopt CXX_SCAN_FOR_MODULES OFF ) +if (NOT BUILD_TESTS) + set_target_properties(cuopt + PROPERTIES CXX_VISIBILITY_PRESET hidden + CUDA_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON + ) +endif () + target_compile_definitions(cuopt PUBLIC "CUOPT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_${LIBCUOPT_LOGGING_LEVEL}" PUBLIC CUSPARSE_ENABLE_EXPERIMENTAL_API diff --git a/cpp/include/cuopt/error.hpp b/cpp/include/cuopt/error.hpp index 95179c5ec4..40be060c5b 100644 --- a/cpp/include/cuopt/error.hpp +++ b/cpp/include/cuopt/error.hpp @@ -6,13 +6,14 @@ /* clang-format on */ #pragma once +#include #include "cuopt/mathematical_optimization/constants.h" #include #include -namespace cuopt { +namespace CUOPT_EXPORT cuopt { /** * @brief Indicates different type of exceptions which cuOpt might throw @@ -168,4 +169,4 @@ void execute_cuopt_fail(Args... args) throw cuopt::logic_error(msg, error_type_t::RuntimeError); } -} // namespace cuopt +} // namespace CUOPT_EXPORT cuopt diff --git a/cpp/include/cuopt/export.hpp b/cpp/include/cuopt/export.hpp new file mode 100644 index 0000000000..5f7209c5f5 --- /dev/null +++ b/cpp/include/cuopt/export.hpp @@ -0,0 +1,14 @@ +/* clang-format off */ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +/* clang-format on */ + +#pragma once + +#if defined(__GNUC__) || defined(__clang__) +#define CUOPT_EXPORT __attribute__((visibility("default"))) +#else +#define CUOPT_EXPORT +#endif diff --git a/cpp/include/cuopt/mathematical_optimization/backend_selection.hpp b/cpp/include/cuopt/mathematical_optimization/backend_selection.hpp index f36b1d2bff..8c6bfeb73f 100644 --- a/cpp/include/cuopt/mathematical_optimization/backend_selection.hpp +++ b/cpp/include/cuopt/mathematical_optimization/backend_selection.hpp @@ -7,7 +7,10 @@ #pragma once -namespace cuopt::mathematical_optimization { +#include + +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { /** * @brief Enum for execution mode (local vs remote solve) @@ -51,4 +54,5 @@ execution_mode_t get_execution_mode(); */ memory_backend_t get_memory_backend_type(); -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem.hpp b/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem.hpp index e4ebcc35b8..28aa91a82f 100644 --- a/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem.hpp +++ b/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -18,7 +19,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { namespace io { template @@ -238,4 +240,5 @@ class cpu_optimization_problem_t : public optimization_problem_interface_t row_names_{}; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem_solution.hpp b/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem_solution.hpp index b4e5edec44..5e04e3bbd4 100644 --- a/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem_solution.hpp +++ b/cpp/include/cuopt/mathematical_optimization/cpu_optimization_problem_solution.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -18,7 +19,8 @@ #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { /** * @brief CPU-backed LP solution (uses std::vector instead of rmm::device_uvector) @@ -389,4 +391,5 @@ class cpu_mip_solution_t : public mip_solution_interface_t { i_t num_simplex_iterations_; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/cpu_pdlp_warm_start_data.hpp b/cpp/include/cuopt/mathematical_optimization/cpu_pdlp_warm_start_data.hpp index 9cf4740c96..1a76da0fa3 100644 --- a/cpp/include/cuopt/mathematical_optimization/cpu_pdlp_warm_start_data.hpp +++ b/cpp/include/cuopt/mathematical_optimization/cpu_pdlp_warm_start_data.hpp @@ -7,10 +7,13 @@ #pragma once +#include #include + #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { // CPU version of pdlp_warm_start_data_t using std::vector for remote execution template @@ -118,4 +121,5 @@ template pdlp_warm_start_data_t convert_to_gpu_warmstart( const cpu_pdlp_warm_start_data_t& cpu_data, rmm::cuda_stream_view stream); -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/cuopt_c.h b/cpp/include/cuopt/mathematical_optimization/cuopt_c.h index 218402a7ef..7efa160924 100644 --- a/cpp/include/cuopt/mathematical_optimization/cuopt_c.h +++ b/cpp/include/cuopt/mathematical_optimization/cuopt_c.h @@ -9,6 +9,7 @@ #define CUOPT_C_API_H #include +#include #include @@ -17,6 +18,10 @@ extern "C" { #endif +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC visibility push(default) +#endif + /** * @brief A ``cuOptOptimizationProblem`` object contains a representation of * an LP, MIP, QP, or QCQP. It is created by ``cuOptCreateProblem``, @@ -1055,6 +1060,10 @@ cuopt_int_t cuOptGetDualObjectiveValue(cuOptSolution solution, */ cuopt_int_t cuOptGetReducedCosts(cuOptSolution solution, cuopt_float_t* reduced_cost_ptr); +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC visibility pop +#endif + #ifdef __cplusplus } #endif diff --git a/cpp/include/cuopt/mathematical_optimization/io/data_model_view.hpp b/cpp/include/cuopt/mathematical_optimization/io/data_model_view.hpp index 7cf4511eb9..41e1a98920 100644 --- a/cpp/include/cuopt/mathematical_optimization/io/data_model_view.hpp +++ b/cpp/include/cuopt/mathematical_optimization/io/data_model_view.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -15,7 +16,9 @@ #include #include -namespace cuopt::mathematical_optimization::io { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { +namespace io { /** * @brief A representation of a linear programming (LP) optimization problem @@ -482,4 +485,6 @@ class data_model_view_t { std::vector::quadratic_constraint_t> quadratic_constraints_; }; // class data_model_view_t -} // namespace cuopt::mathematical_optimization::io +} // namespace io +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/io/mps_data_model.hpp b/cpp/include/cuopt/mathematical_optimization/io/mps_data_model.hpp index 4ed1d7244f..7557327c29 100644 --- a/cpp/include/cuopt/mathematical_optimization/io/mps_data_model.hpp +++ b/cpp/include/cuopt/mathematical_optimization/io/mps_data_model.hpp @@ -7,13 +7,17 @@ #pragma once +#include + #include #include #include #include #include -namespace cuopt::mathematical_optimization::io { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { +namespace io { /** * @brief A representation of a linear programming (LP) optimization problem @@ -401,4 +405,6 @@ template void canonicalize_quadratic_constraints( std::vector::quadratic_constraint_t>& constraints); -} // namespace cuopt::mathematical_optimization::io +} // namespace io +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/io/mps_writer.hpp b/cpp/include/cuopt/mathematical_optimization/io/mps_writer.hpp index 6184ce56b6..9de061bbc9 100644 --- a/cpp/include/cuopt/mathematical_optimization/io/mps_writer.hpp +++ b/cpp/include/cuopt/mathematical_optimization/io/mps_writer.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -18,7 +19,9 @@ #include #include -namespace cuopt::mathematical_optimization::io { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { +namespace io { /** * @brief Main writer class for MPS files @@ -60,4 +63,6 @@ class mps_writer_t { static data_model_view_t create_view(const mps_data_model_t& model); }; // class mps_writer_t -} // namespace cuopt::mathematical_optimization::io +} // namespace io +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/io/parser.hpp b/cpp/include/cuopt/mathematical_optimization/io/parser.hpp index e3944c97e2..210cba0adc 100644 --- a/cpp/include/cuopt/mathematical_optimization/io/parser.hpp +++ b/cpp/include/cuopt/mathematical_optimization/io/parser.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -16,7 +17,9 @@ #include #include -namespace cuopt::mathematical_optimization::io { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { +namespace io { /** * @brief Selects which MPS reader implementation should be used by dispatching entry points. @@ -201,4 +204,6 @@ inline mps_data_model_t read(const std::string& path, bool fixed_mps_f return read(path, mps_reader_type_t::default_reader, fixed_mps_format); } -} // namespace cuopt::mathematical_optimization::io +} // namespace io +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/io/writer.hpp b/cpp/include/cuopt/mathematical_optimization/io/writer.hpp index 032865220e..f1a9514d5a 100644 --- a/cpp/include/cuopt/mathematical_optimization/io/writer.hpp +++ b/cpp/include/cuopt/mathematical_optimization/io/writer.hpp @@ -7,9 +7,12 @@ #pragma once +#include #include -namespace cuopt::mathematical_optimization::io { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { +namespace io { /** * @brief Writes the problem to an MPS formatted file @@ -23,4 +26,6 @@ namespace cuopt::mathematical_optimization::io { template void write_mps(const data_model_view_t& problem, const std::string& mps_file_path); -} // namespace cuopt::mathematical_optimization::io +} // namespace io +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/mip/solver_settings.hpp b/cpp/include/cuopt/mathematical_optimization/mip/solver_settings.hpp index 8ddcdbbb8a..8bb676cb94 100644 --- a/cpp/include/cuopt/mathematical_optimization/mip/solver_settings.hpp +++ b/cpp/include/cuopt/mathematical_optimization/mip/solver_settings.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,8 @@ #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { struct benchmark_info_t { double last_improvement_of_best_feasible = 0; @@ -231,4 +233,5 @@ struct mip_solver_settings_accessor { } }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/mip/solver_solution.hpp b/cpp/include/cuopt/mathematical_optimization/mip/solver_solution.hpp index 19a8e5e531..1ad58b9e10 100644 --- a/cpp/include/cuopt/mathematical_optimization/mip/solver_solution.hpp +++ b/cpp/include/cuopt/mathematical_optimization/mip/solver_solution.hpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -21,7 +22,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { enum class mip_termination_status_t : int8_t { NoTermination = CUOPT_TERMINATION_STATUS_NO_TERMINATION, @@ -92,4 +94,5 @@ class mip_solution_t : public base_solution_t { std::vector> solution_pool_; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/optimization_problem.hpp b/cpp/include/cuopt/mathematical_optimization/optimization_problem.hpp index 5c755281ca..bdfc2ffbd4 100644 --- a/cpp/include/cuopt/mathematical_optimization/optimization_problem.hpp +++ b/cpp/include/cuopt/mathematical_optimization/optimization_problem.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -20,7 +21,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { // Forward declarations template @@ -425,4 +427,5 @@ class optimization_problem_t : public optimization_problem_interface_t std::vector row_names_{}; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/optimization_problem_solution.hpp b/cpp/include/cuopt/mathematical_optimization/optimization_problem_solution.hpp index 822bd54de3..577d5727ec 100644 --- a/cpp/include/cuopt/mathematical_optimization/optimization_problem_solution.hpp +++ b/cpp/include/cuopt/mathematical_optimization/optimization_problem_solution.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -16,7 +17,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { /** * @brief GPU-backed LP solution (wraps optimization_problem_solution_t) @@ -476,4 +478,5 @@ class gpu_mip_solution_t : public mip_solution_interface_t { mip_solution_t solution_; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/pdlp/pdlp_warm_start_data.hpp b/cpp/include/cuopt/mathematical_optimization/pdlp/pdlp_warm_start_data.hpp index 07f54672f2..52a800c3c2 100644 --- a/cpp/include/cuopt/mathematical_optimization/pdlp/pdlp_warm_start_data.hpp +++ b/cpp/include/cuopt/mathematical_optimization/pdlp/pdlp_warm_start_data.hpp @@ -7,11 +7,14 @@ #pragma once +#include + #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { template struct pdlp_warm_start_data_view_t; @@ -99,4 +102,5 @@ struct pdlp_warm_start_data_view_t { i_t iterations_since_last_restart_{-1}; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/pdlp/solver_settings.hpp b/cpp/include/cuopt/mathematical_optimization/pdlp/solver_settings.hpp index 96f548ec32..c6558369ab 100644 --- a/cpp/include/cuopt/mathematical_optimization/pdlp/solver_settings.hpp +++ b/cpp/include/cuopt/mathematical_optimization/pdlp/solver_settings.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include @@ -21,7 +22,8 @@ #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { // Forward declare solver_settings_t for friend class template @@ -351,4 +353,5 @@ class pdlp_solver_settings_t { friend class solver_settings_t; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/pdlp/solver_solution.hpp b/cpp/include/cuopt/mathematical_optimization/pdlp/solver_solution.hpp index 5bacff1101..be48ea4baf 100644 --- a/cpp/include/cuopt/mathematical_optimization/pdlp/solver_solution.hpp +++ b/cpp/include/cuopt/mathematical_optimization/pdlp/solver_solution.hpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { // Possible reasons for terminating enum class pdlp_termination_status_t : int8_t { @@ -310,4 +312,5 @@ class optimization_problem_solution_t : public base_solution_t { /** error struct */ cuopt::logic_error error_status_; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/solve.hpp b/cpp/include/cuopt/mathematical_optimization/solve.hpp index 961fcd29b6..abc30aa0d7 100644 --- a/cpp/include/cuopt/mathematical_optimization/solve.hpp +++ b/cpp/include/cuopt/mathematical_optimization/solve.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -23,7 +24,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { /** * @brief Linear programming solve function. @@ -213,4 +215,5 @@ std::unique_ptr> solve_mip( // Remote execution functions are declared in solve_remote.hpp (included above) -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/solve_remote.hpp b/cpp/include/cuopt/mathematical_optimization/solve_remote.hpp index 3636195660..bdb19f9c9d 100644 --- a/cpp/include/cuopt/mathematical_optimization/solve_remote.hpp +++ b/cpp/include/cuopt/mathematical_optimization/solve_remote.hpp @@ -7,12 +7,14 @@ #pragma once +#include // Include the solution interface definitions so unique_ptr can properly delete them #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { // Forward declarations (only declaration needed, not definition) template @@ -44,4 +46,5 @@ std::unique_ptr> solve_mip_remote( cpu_optimization_problem_t const& cpu_problem, mip_solver_settings_t const& settings); -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/solver_settings.hpp b/cpp/include/cuopt/mathematical_optimization/solver_settings.hpp index df373b209d..6b47805702 100644 --- a/cpp/include/cuopt/mathematical_optimization/solver_settings.hpp +++ b/cpp/include/cuopt/mathematical_optimization/solver_settings.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -22,7 +23,8 @@ #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { template class solver_settings_t { @@ -109,4 +111,5 @@ class solver_settings_t { std::vector> string_parameters; }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/include/cuopt/routing/assignment.hpp b/cpp/include/cuopt/routing/assignment.hpp index f6fcc3d7b4..b138382d6d 100644 --- a/cpp/include/cuopt/routing/assignment.hpp +++ b/cpp/include/cuopt/routing/assignment.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 */ @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include @@ -16,7 +17,7 @@ #include namespace cuopt { -namespace routing { +namespace CUOPT_EXPORT routing { /*! Routing assignment default strings */ class solution_string_t { @@ -264,5 +265,5 @@ struct host_assignment_t { std::vector accepted{}; }; -} // namespace routing +} // namespace CUOPT_EXPORT routing } // namespace cuopt diff --git a/cpp/include/cuopt/routing/data_model_view.hpp b/cpp/include/cuopt/routing/data_model_view.hpp index fa7aec73ec..b025469144 100644 --- a/cpp/include/cuopt/routing/data_model_view.hpp +++ b/cpp/include/cuopt/routing/data_model_view.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -14,7 +15,7 @@ #include namespace cuopt { -namespace routing { +namespace CUOPT_EXPORT routing { /** * @brief A container of vehicle routing solver input @@ -663,5 +664,5 @@ class data_model_view_t { raft::device_span initial_sol_offsets_{}; std::map>> vehicle_breaks_{}; }; -} // namespace routing +} // namespace CUOPT_EXPORT routing } // namespace cuopt diff --git a/cpp/include/cuopt/routing/routing_structures.hpp b/cpp/include/cuopt/routing/routing_structures.hpp index 807ef6d880..64bcc22ce5 100644 --- a/cpp/include/cuopt/routing/routing_structures.hpp +++ b/cpp/include/cuopt/routing/routing_structures.hpp @@ -1,12 +1,14 @@ /* 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 */ #pragma once +#include + #include #include diff --git a/cpp/include/cuopt/routing/solve.hpp b/cpp/include/cuopt/routing/solve.hpp index 82b36dd483..41a8cf932a 100644 --- a/cpp/include/cuopt/routing/solve.hpp +++ b/cpp/include/cuopt/routing/solve.hpp @@ -1,17 +1,18 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ #pragma once +#include #include #include #include namespace cuopt { -namespace routing { +namespace CUOPT_EXPORT routing { /** * @brief Routing solve function @@ -26,5 +27,5 @@ template assignment_t solve( data_model_view_t const& data_model, solver_settings_t const& settings = solver_settings_t{}); -} // namespace routing +} // namespace CUOPT_EXPORT routing } // namespace cuopt diff --git a/cpp/include/cuopt/routing/solver_settings.hpp b/cpp/include/cuopt/routing/solver_settings.hpp index 36f301276d..3aae7ff0ef 100644 --- a/cpp/include/cuopt/routing/solver_settings.hpp +++ b/cpp/include/cuopt/routing/solver_settings.hpp @@ -1,19 +1,20 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ #pragma once +#include #include #include #include #include namespace cuopt { -namespace routing { +namespace CUOPT_EXPORT routing { template class solver_settings_t { @@ -94,5 +95,5 @@ class solver_settings_t { std::string best_result_file_name_; }; -} // namespace routing +} // namespace CUOPT_EXPORT routing } // namespace cuopt diff --git a/cpp/src/grpc/client/solve_remote.cpp b/cpp/src/grpc/client/solve_remote.cpp index e8fbdf7139..eabea39e05 100644 --- a/cpp/src/grpc/client/solve_remote.cpp +++ b/cpp/src/grpc/client/solve_remote.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -218,10 +219,10 @@ std::unique_ptr> solve_mip_remote( } // Explicit template instantiations for remote execution stubs -template std::unique_ptr> solve_lp_remote( +template CUOPT_EXPORT std::unique_ptr> solve_lp_remote( cpu_optimization_problem_t const&, pdlp_solver_settings_t const&); -template std::unique_ptr> solve_mip_remote( +template CUOPT_EXPORT std::unique_ptr> solve_mip_remote( cpu_optimization_problem_t const&, mip_solver_settings_t const&); } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/grpc/grpc_problem_mapper.cpp b/cpp/src/grpc/grpc_problem_mapper.cpp index c9698b7976..e330bca6f6 100644 --- a/cpp/src/grpc/grpc_problem_mapper.cpp +++ b/cpp/src/grpc/grpc_problem_mapper.cpp @@ -5,6 +5,8 @@ #include "grpc_problem_mapper.hpp" +#include + #include #include #include @@ -214,60 +216,64 @@ std::vector build_array_chunk_requests( // Explicit template instantiations #if CUOPT_INSTANTIATE_FLOAT -template void map_problem_to_proto(const cpu_optimization_problem_t& cpu_problem, - cuopt::remote::OptimizationProblem* pb_problem); -template void map_proto_to_problem(const cuopt::remote::OptimizationProblem& pb_problem, - cpu_optimization_problem_t& cpu_problem); -template size_t estimate_problem_proto_size( - const cpu_optimization_problem_t& cpu_problem); -template void populate_chunked_header_lp( +template CUOPT_EXPORT void map_problem_to_proto( + const cpu_optimization_problem_t& cpu_problem, + cuopt::remote::OptimizationProblem* pb_problem); +template CUOPT_EXPORT void map_proto_to_problem( + const cuopt::remote::OptimizationProblem& pb_problem, + cpu_optimization_problem_t& cpu_problem); +template CUOPT_EXPORT size_t +estimate_problem_proto_size(const cpu_optimization_problem_t& cpu_problem); +template CUOPT_EXPORT void populate_chunked_header_lp( const cpu_optimization_problem_t& cpu_problem, const pdlp_solver_settings_t& settings, cuopt::remote::ChunkedProblemHeader* header); -template void populate_chunked_header_mip( +template CUOPT_EXPORT void populate_chunked_header_mip( const cpu_optimization_problem_t& cpu_problem, const mip_solver_settings_t& settings, bool enable_incumbents, cuopt::remote::ChunkedProblemHeader* header); -template void map_chunked_header_to_problem( +template CUOPT_EXPORT void map_chunked_header_to_problem( const cuopt::remote::ChunkedProblemHeader& header, cpu_optimization_problem_t& cpu_problem); -template void map_chunked_arrays_to_problem( +template CUOPT_EXPORT void map_chunked_arrays_to_problem( const cuopt::remote::ChunkedProblemHeader& header, const std::map>& arrays, const std::map>& container_arrays, cpu_optimization_problem_t& cpu_problem); -template std::vector build_array_chunk_requests( +template CUOPT_EXPORT std::vector build_array_chunk_requests( const cpu_optimization_problem_t& problem, const std::string& upload_id, int64_t chunk_size_bytes); #endif #if CUOPT_INSTANTIATE_DOUBLE -template void map_problem_to_proto(const cpu_optimization_problem_t& cpu_problem, - cuopt::remote::OptimizationProblem* pb_problem); -template void map_proto_to_problem(const cuopt::remote::OptimizationProblem& pb_problem, - cpu_optimization_problem_t& cpu_problem); -template size_t estimate_problem_proto_size( - const cpu_optimization_problem_t& cpu_problem); -template void populate_chunked_header_lp( +template CUOPT_EXPORT void map_problem_to_proto( + const cpu_optimization_problem_t& cpu_problem, + cuopt::remote::OptimizationProblem* pb_problem); +template CUOPT_EXPORT void map_proto_to_problem( + const cuopt::remote::OptimizationProblem& pb_problem, + cpu_optimization_problem_t& cpu_problem); +template CUOPT_EXPORT size_t +estimate_problem_proto_size(const cpu_optimization_problem_t& cpu_problem); +template CUOPT_EXPORT void populate_chunked_header_lp( const cpu_optimization_problem_t& cpu_problem, const pdlp_solver_settings_t& settings, cuopt::remote::ChunkedProblemHeader* header); -template void populate_chunked_header_mip( +template CUOPT_EXPORT void populate_chunked_header_mip( const cpu_optimization_problem_t& cpu_problem, const mip_solver_settings_t& settings, bool enable_incumbents, cuopt::remote::ChunkedProblemHeader* header); -template void map_chunked_header_to_problem( +template CUOPT_EXPORT void map_chunked_header_to_problem( const cuopt::remote::ChunkedProblemHeader& header, cpu_optimization_problem_t& cpu_problem); -template void map_chunked_arrays_to_problem( +template CUOPT_EXPORT void map_chunked_arrays_to_problem( const cuopt::remote::ChunkedProblemHeader& header, const std::map>& arrays, const std::map>& container_arrays, cpu_optimization_problem_t& cpu_problem); -template std::vector build_array_chunk_requests( +template CUOPT_EXPORT std::vector build_array_chunk_requests( const cpu_optimization_problem_t& problem, const std::string& upload_id, int64_t chunk_size_bytes); diff --git a/cpp/src/grpc/grpc_settings_mapper.cpp b/cpp/src/grpc/grpc_settings_mapper.cpp index 34926f89e2..5c076c5e3d 100644 --- a/cpp/src/grpc/grpc_settings_mapper.cpp +++ b/cpp/src/grpc/grpc_settings_mapper.cpp @@ -5,6 +5,8 @@ #include "grpc_settings_mapper.hpp" +#include + #include #include #include @@ -92,25 +94,33 @@ void map_proto_to_mip_settings(const cuopt::remote::MIPSolverSettings& pb_settin // Explicit template instantiations #if CUOPT_INSTANTIATE_FLOAT -template void map_pdlp_settings_to_proto(const pdlp_solver_settings_t& settings, - cuopt::remote::PDLPSolverSettings* pb_settings); -template void map_proto_to_pdlp_settings(const cuopt::remote::PDLPSolverSettings& pb_settings, - pdlp_solver_settings_t& settings); -template void map_mip_settings_to_proto(const mip_solver_settings_t& settings, - cuopt::remote::MIPSolverSettings* pb_settings); -template void map_proto_to_mip_settings(const cuopt::remote::MIPSolverSettings& pb_settings, - mip_solver_settings_t& settings); +template CUOPT_EXPORT void map_pdlp_settings_to_proto( + const pdlp_solver_settings_t& settings, + cuopt::remote::PDLPSolverSettings* pb_settings); +template CUOPT_EXPORT void map_proto_to_pdlp_settings( + const cuopt::remote::PDLPSolverSettings& pb_settings, + pdlp_solver_settings_t& settings); +template CUOPT_EXPORT void map_mip_settings_to_proto( + const mip_solver_settings_t& settings, + cuopt::remote::MIPSolverSettings* pb_settings); +template CUOPT_EXPORT void map_proto_to_mip_settings( + const cuopt::remote::MIPSolverSettings& pb_settings, + mip_solver_settings_t& settings); #endif #if CUOPT_INSTANTIATE_DOUBLE -template void map_pdlp_settings_to_proto(const pdlp_solver_settings_t& settings, - cuopt::remote::PDLPSolverSettings* pb_settings); -template void map_proto_to_pdlp_settings(const cuopt::remote::PDLPSolverSettings& pb_settings, - pdlp_solver_settings_t& settings); -template void map_mip_settings_to_proto(const mip_solver_settings_t& settings, - cuopt::remote::MIPSolverSettings* pb_settings); -template void map_proto_to_mip_settings(const cuopt::remote::MIPSolverSettings& pb_settings, - mip_solver_settings_t& settings); +template CUOPT_EXPORT void map_pdlp_settings_to_proto( + const pdlp_solver_settings_t& settings, + cuopt::remote::PDLPSolverSettings* pb_settings); +template CUOPT_EXPORT void map_proto_to_pdlp_settings( + const cuopt::remote::PDLPSolverSettings& pb_settings, + pdlp_solver_settings_t& settings); +template CUOPT_EXPORT void map_mip_settings_to_proto( + const mip_solver_settings_t& settings, + cuopt::remote::MIPSolverSettings* pb_settings); +template CUOPT_EXPORT void map_proto_to_mip_settings( + const cuopt::remote::MIPSolverSettings& pb_settings, + mip_solver_settings_t& settings); #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/grpc/grpc_solution_mapper.cpp b/cpp/src/grpc/grpc_solution_mapper.cpp index 5a823986d6..7b71614628 100644 --- a/cpp/src/grpc/grpc_solution_mapper.cpp +++ b/cpp/src/grpc/grpc_solution_mapper.cpp @@ -5,6 +5,8 @@ #include "grpc_solution_mapper.hpp" +#include + #include #include #include @@ -193,66 +195,66 @@ void build_mip_solution_proto(const cuopt::remote::ChunkedResultHeader& header, // Explicit template instantiations #if CUOPT_INSTANTIATE_FLOAT -template void map_lp_solution_to_proto(const cpu_lp_solution_t& solution, - cuopt::remote::LPSolution* pb_solution); -template cpu_lp_solution_t map_proto_to_lp_solution( +template CUOPT_EXPORT void map_lp_solution_to_proto( + const cpu_lp_solution_t& solution, cuopt::remote::LPSolution* pb_solution); +template CUOPT_EXPORT cpu_lp_solution_t map_proto_to_lp_solution( const cuopt::remote::LPSolution& pb_solution); -template void map_mip_solution_to_proto(const cpu_mip_solution_t& solution, - cuopt::remote::MIPSolution* pb_solution); -template cpu_mip_solution_t map_proto_to_mip_solution( +template CUOPT_EXPORT void map_mip_solution_to_proto( + const cpu_mip_solution_t& solution, cuopt::remote::MIPSolution* pb_solution); +template CUOPT_EXPORT cpu_mip_solution_t map_proto_to_mip_solution( const cuopt::remote::MIPSolution& pb_solution); -template void populate_chunked_result_header_lp(const cpu_lp_solution_t& solution, - cuopt::remote::ChunkedResultHeader* header); -template void populate_chunked_result_header_mip(const cpu_mip_solution_t& solution, - cuopt::remote::ChunkedResultHeader* header); -template std::map> collect_lp_solution_arrays( +template CUOPT_EXPORT void populate_chunked_result_header_lp( + const cpu_lp_solution_t& solution, cuopt::remote::ChunkedResultHeader* header); +template CUOPT_EXPORT void populate_chunked_result_header_mip( + const cpu_mip_solution_t& solution, cuopt::remote::ChunkedResultHeader* header); +template CUOPT_EXPORT std::map> collect_lp_solution_arrays( const cpu_lp_solution_t& solution); -template std::map> collect_mip_solution_arrays( +template CUOPT_EXPORT std::map> collect_mip_solution_arrays( const cpu_mip_solution_t& solution); -template cpu_lp_solution_t chunked_result_to_lp_solution( +template CUOPT_EXPORT cpu_lp_solution_t chunked_result_to_lp_solution( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays); -template cpu_mip_solution_t chunked_result_to_mip_solution( +template CUOPT_EXPORT cpu_mip_solution_t chunked_result_to_mip_solution( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays); -template void build_lp_solution_proto( +template CUOPT_EXPORT void build_lp_solution_proto( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays, cuopt::remote::LPSolution* proto); -template void build_mip_solution_proto( +template CUOPT_EXPORT void build_mip_solution_proto( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays, cuopt::remote::MIPSolution* proto); #endif #if CUOPT_INSTANTIATE_DOUBLE -template void map_lp_solution_to_proto(const cpu_lp_solution_t& solution, - cuopt::remote::LPSolution* pb_solution); -template cpu_lp_solution_t map_proto_to_lp_solution( +template CUOPT_EXPORT void map_lp_solution_to_proto( + const cpu_lp_solution_t& solution, cuopt::remote::LPSolution* pb_solution); +template CUOPT_EXPORT cpu_lp_solution_t map_proto_to_lp_solution( const cuopt::remote::LPSolution& pb_solution); -template void map_mip_solution_to_proto(const cpu_mip_solution_t& solution, - cuopt::remote::MIPSolution* pb_solution); -template cpu_mip_solution_t map_proto_to_mip_solution( +template CUOPT_EXPORT void map_mip_solution_to_proto( + const cpu_mip_solution_t& solution, cuopt::remote::MIPSolution* pb_solution); +template CUOPT_EXPORT cpu_mip_solution_t map_proto_to_mip_solution( const cuopt::remote::MIPSolution& pb_solution); -template void populate_chunked_result_header_lp(const cpu_lp_solution_t& solution, - cuopt::remote::ChunkedResultHeader* header); -template void populate_chunked_result_header_mip( +template CUOPT_EXPORT void populate_chunked_result_header_lp( + const cpu_lp_solution_t& solution, cuopt::remote::ChunkedResultHeader* header); +template CUOPT_EXPORT void populate_chunked_result_header_mip( const cpu_mip_solution_t& solution, cuopt::remote::ChunkedResultHeader* header); -template std::map> collect_lp_solution_arrays( +template CUOPT_EXPORT std::map> collect_lp_solution_arrays( const cpu_lp_solution_t& solution); -template std::map> collect_mip_solution_arrays( +template CUOPT_EXPORT std::map> collect_mip_solution_arrays( const cpu_mip_solution_t& solution); -template cpu_lp_solution_t chunked_result_to_lp_solution( +template CUOPT_EXPORT cpu_lp_solution_t chunked_result_to_lp_solution( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays); -template cpu_mip_solution_t chunked_result_to_mip_solution( +template CUOPT_EXPORT cpu_mip_solution_t chunked_result_to_mip_solution( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays); -template void build_lp_solution_proto( +template CUOPT_EXPORT void build_lp_solution_proto( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays, cuopt::remote::LPSolution* proto); -template void build_mip_solution_proto( +template CUOPT_EXPORT void build_mip_solution_proto( const cuopt::remote::ChunkedResultHeader& header, const std::map>& arrays, cuopt::remote::MIPSolution* proto); diff --git a/cpp/src/io/data_model_view.cpp b/cpp/src/io/data_model_view.cpp index 132d87b866..df1efcd52f 100644 --- a/cpp/src/io/data_model_view.cpp +++ b/cpp/src/io/data_model_view.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -377,8 +378,8 @@ data_model_view_t::get_quadratic_constraints() const noexcept } // NOTE: Explicitly instantiate all types here in order to avoid linker error -template class data_model_view_t; +template class CUOPT_EXPORT data_model_view_t; -template class data_model_view_t; +template class CUOPT_EXPORT data_model_view_t; } // namespace cuopt::mathematical_optimization::io diff --git a/cpp/src/io/lp_parser.cpp b/cpp/src/io/lp_parser.cpp index cf9d8d6538..5de0565801 100644 --- a/cpp/src/io/lp_parser.cpp +++ b/cpp/src/io/lp_parser.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -1526,9 +1527,11 @@ mps_data_model_t read_lp_from_string(std::string_view lp_contents) return problem; } -template mps_data_model_t read_lp(const std::string&); -template mps_data_model_t read_lp(const std::string&); -template mps_data_model_t read_lp_from_string(std::string_view); -template mps_data_model_t read_lp_from_string(std::string_view); +template CUOPT_EXPORT mps_data_model_t read_lp(const std::string&); +template CUOPT_EXPORT mps_data_model_t read_lp(const std::string&); +template CUOPT_EXPORT mps_data_model_t read_lp_from_string( + std::string_view); +template CUOPT_EXPORT mps_data_model_t read_lp_from_string( + std::string_view); } // namespace cuopt::mathematical_optimization::io diff --git a/cpp/src/io/mps_data_model.cpp b/cpp/src/io/mps_data_model.cpp index 941f16a96a..f3444fe12f 100644 --- a/cpp/src/io/mps_data_model.cpp +++ b/cpp/src/io/mps_data_model.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -469,13 +470,13 @@ void canonicalize_quadratic_constraints( } // NOTE: Explicitly instantiate all types here in order to avoid linker error -template class mps_data_model_t; +template class CUOPT_EXPORT mps_data_model_t; -template class mps_data_model_t; +template class CUOPT_EXPORT mps_data_model_t; -template void canonicalize_quadratic_constraints( +template CUOPT_EXPORT void canonicalize_quadratic_constraints( std::vector::quadratic_constraint_t>&); -template void canonicalize_quadratic_constraints( +template CUOPT_EXPORT void canonicalize_quadratic_constraints( std::vector::quadratic_constraint_t>&); // TODO current raft to cusparse wrappers only support int64_t // can be CUSPARSE_INDEX_16U, CUSPARSE_INDEX_32I, CUSPARSE_INDEX_64I diff --git a/cpp/src/io/mps_writer.cpp b/cpp/src/io/mps_writer.cpp index d269d6ec8a..31a0bbc25c 100644 --- a/cpp/src/io/mps_writer.cpp +++ b/cpp/src/io/mps_writer.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -530,7 +531,7 @@ void mps_writer_t::write(const std::string& mps_file_path) mps_file.close(); } -template class mps_writer_t; -template class mps_writer_t; +template class CUOPT_EXPORT mps_writer_t; +template class CUOPT_EXPORT mps_writer_t; } // namespace cuopt::mathematical_optimization::io diff --git a/cpp/src/io/parser.cpp b/cpp/src/io/parser.cpp index 0a626bd26c..03cdb689c2 100644 --- a/cpp/src/io/parser.cpp +++ b/cpp/src/io/parser.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -33,12 +34,14 @@ mps_data_model_t read_mps_from_string(std::string_view mps_contents, return problem; } -template mps_data_model_t read_mps(const std::string& mps_file, bool fixed_mps_format); -template mps_data_model_t read_mps(const std::string& mps_file, bool fixed_mps_format); -template mps_data_model_t read_mps_from_string(std::string_view mps_contents, - bool fixed_mps_format); -template mps_data_model_t read_mps_from_string(std::string_view mps_contents, +template CUOPT_EXPORT mps_data_model_t read_mps(const std::string& mps_file, bool fixed_mps_format); +template CUOPT_EXPORT mps_data_model_t read_mps(const std::string& mps_file, + bool fixed_mps_format); +template CUOPT_EXPORT mps_data_model_t read_mps_from_string( + std::string_view mps_contents, bool fixed_mps_format); +template CUOPT_EXPORT mps_data_model_t read_mps_from_string( + std::string_view mps_contents, bool fixed_mps_format); template mps_data_model_t read_mps_fast_experimental(const std::string& mps_file_path) diff --git a/cpp/src/io/writer.cpp b/cpp/src/io/writer.cpp index c67a1aac4b..eeb11b7dc0 100644 --- a/cpp/src/io/writer.cpp +++ b/cpp/src/io/writer.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -18,9 +19,9 @@ void write_mps(const data_model_view_t& problem, const std::string& mp writer.write(mps_file_path); } -template void write_mps(const data_model_view_t& problem, - const std::string& mps_file_path); -template void write_mps(const data_model_view_t& problem, - const std::string& mps_file_path); +template CUOPT_EXPORT void write_mps(const data_model_view_t& problem, + const std::string& mps_file_path); +template CUOPT_EXPORT void write_mps(const data_model_view_t& problem, + const std::string& mps_file_path); } // namespace cuopt::mathematical_optimization::io diff --git a/cpp/src/math_optimization/solution_reader.hpp b/cpp/src/math_optimization/solution_reader.hpp index dd0976028a..18d065dc9b 100644 --- a/cpp/src/math_optimization/solution_reader.hpp +++ b/cpp/src/math_optimization/solution_reader.hpp @@ -7,10 +7,14 @@ #pragma once +#include + #include #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +// Ideally internal symbol should not be exported, but cuopt_cli uses it +namespace CUOPT_EXPORT mathematical_optimization { /** * @brief Reads a solution file and returns the values of specified variables @@ -24,4 +28,5 @@ class solution_reader_t { static std::vector get_variable_values_from_sol_file( const std::string& sol_file_path, const std::vector& variable_names); }; -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt diff --git a/cpp/src/math_optimization/solver_settings.cu b/cpp/src/math_optimization/solver_settings.cu index 9193112d71..be24b4c283 100644 --- a/cpp/src/math_optimization/solver_settings.cu +++ b/cpp/src/math_optimization/solver_settings.cu @@ -6,6 +6,7 @@ /* clang-format on */ #include +#include #include #include #include @@ -664,25 +665,39 @@ bool solver_settings_t::dump_parameters_to_file(const std::string& pat } #if MIP_INSTANTIATE_FLOAT -template class solver_settings_t; -template void solver_settings_t::set_parameter(const std::string& name, int value); -template void solver_settings_t::set_parameter(const std::string& name, float value); -template void solver_settings_t::set_parameter(const std::string& name, bool value); -template int solver_settings_t::get_parameter(const std::string& name) const; -template float solver_settings_t::get_parameter(const std::string& name) const; -template bool solver_settings_t::get_parameter(const std::string& name) const; -template std::string solver_settings_t::get_parameter(const std::string& name) const; +template class CUOPT_EXPORT solver_settings_t; +template CUOPT_EXPORT void solver_settings_t::set_parameter(const std::string& name, + int value); +template CUOPT_EXPORT void solver_settings_t::set_parameter(const std::string& name, + float value); +template CUOPT_EXPORT void solver_settings_t::set_parameter(const std::string& name, + bool value); +template CUOPT_EXPORT int solver_settings_t::get_parameter( + const std::string& name) const; +template CUOPT_EXPORT float solver_settings_t::get_parameter( + const std::string& name) const; +template CUOPT_EXPORT bool solver_settings_t::get_parameter( + const std::string& name) const; +template CUOPT_EXPORT std::string solver_settings_t::get_parameter( + const std::string& name) const; #endif #if MIP_INSTANTIATE_DOUBLE -template class solver_settings_t; -template void solver_settings_t::set_parameter(const std::string& name, int value); -template void solver_settings_t::set_parameter(const std::string& name, double value); -template void solver_settings_t::set_parameter(const std::string& name, bool value); -template int solver_settings_t::get_parameter(const std::string& name) const; -template double solver_settings_t::get_parameter(const std::string& name) const; -template bool solver_settings_t::get_parameter(const std::string& name) const; -template std::string solver_settings_t::get_parameter(const std::string& name) const; +template class CUOPT_EXPORT solver_settings_t; +template CUOPT_EXPORT void solver_settings_t::set_parameter(const std::string& name, + int value); +template CUOPT_EXPORT void solver_settings_t::set_parameter(const std::string& name, + double value); +template CUOPT_EXPORT void solver_settings_t::set_parameter(const std::string& name, + bool value); +template CUOPT_EXPORT int solver_settings_t::get_parameter( + const std::string& name) const; +template CUOPT_EXPORT double solver_settings_t::get_parameter( + const std::string& name) const; +template CUOPT_EXPORT bool solver_settings_t::get_parameter( + const std::string& name) const; +template CUOPT_EXPORT std::string solver_settings_t::get_parameter( + const std::string& name) const; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/mip_heuristics/solve.cu b/cpp/src/mip_heuristics/solve.cu index 59b582188f..27242e7f0c 100644 --- a/cpp/src/mip_heuristics/solve.cu +++ b/cpp/src/mip_heuristics/solve.cu @@ -6,6 +6,7 @@ /* clang-format on */ #include +#include #include #include @@ -945,19 +946,19 @@ std::unique_ptr> solve_mip( } #define INSTANTIATE(F_TYPE) \ - template mip_solution_t solve_mip( \ + template CUOPT_EXPORT mip_solution_t solve_mip( \ optimization_problem_t& op_problem, \ mip_solver_settings_t const& settings); \ \ - template mip_solution_t solve_mip( \ + template CUOPT_EXPORT mip_solution_t solve_mip( \ raft::handle_t const* handle_ptr, \ const cuopt::mathematical_optimization::io::mps_data_model_t& mps_data_model, \ mip_solver_settings_t const& settings); \ \ - template std::unique_ptr> solve_mip( \ + template CUOPT_EXPORT std::unique_ptr> solve_mip( \ cpu_optimization_problem_t&, mip_solver_settings_t const&); \ \ - template std::unique_ptr> solve_mip( \ + template CUOPT_EXPORT std::unique_ptr> solve_mip( \ optimization_problem_interface_t*, mip_solver_settings_t const&); #if MIP_INSTANTIATE_FLOAT diff --git a/cpp/src/mip_heuristics/solver_settings.cu b/cpp/src/mip_heuristics/solver_settings.cu index 645b8c8b6e..8b454c949b 100644 --- a/cpp/src/mip_heuristics/solver_settings.cu +++ b/cpp/src/mip_heuristics/solver_settings.cu @@ -6,6 +6,7 @@ /* clang-format on */ #include +#include #include #include #include @@ -48,11 +49,11 @@ mip_solver_settings_t::get_tolerances() const noexcept // Explicit template instantiations for common types #if MIP_INSTANTIATE_FLOAT -template class mip_solver_settings_t; +template class CUOPT_EXPORT mip_solver_settings_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class mip_solver_settings_t; +template class CUOPT_EXPORT mip_solver_settings_t; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/mip_heuristics/solver_solution.cu b/cpp/src/mip_heuristics/solver_solution.cu index 5b59e9a0fa..1997d684dc 100644 --- a/cpp/src/mip_heuristics/solver_solution.cu +++ b/cpp/src/mip_heuristics/solver_solution.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -274,10 +275,10 @@ void mip_solution_t::log_detailed_summary() const } #if MIP_INSTANTIATE_FLOAT || PDLP_INSTANTIATE_FLOAT -template class mip_solution_t; +template class CUOPT_EXPORT mip_solution_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class mip_solution_t; +template class CUOPT_EXPORT mip_solution_t; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/pdlp/cpu_optimization_problem.cpp b/cpp/src/pdlp/cpu_optimization_problem.cpp index 725424bf6b..4b970eb6ec 100644 --- a/cpp/src/pdlp/cpu_optimization_problem.cpp +++ b/cpp/src/pdlp/cpu_optimization_problem.cpp @@ -6,6 +6,7 @@ /* clang-format on */ #include +#include #include #include #include @@ -1187,10 +1188,10 @@ void cpu_optimization_problem_t::adopt_from_mps_data_model( // ============================================================================== #if MIP_INSTANTIATE_FLOAT -template class cpu_optimization_problem_t; +template class CUOPT_EXPORT cpu_optimization_problem_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class cpu_optimization_problem_t; +template class CUOPT_EXPORT cpu_optimization_problem_t; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/pdlp/cpu_pdlp_warm_start_data.cu b/cpp/src/pdlp/cpu_pdlp_warm_start_data.cu index 94c8ed5466..f2af28ba51 100644 --- a/cpp/src/pdlp/cpu_pdlp_warm_start_data.cu +++ b/cpp/src/pdlp/cpu_pdlp_warm_start_data.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -109,17 +110,17 @@ pdlp_warm_start_data_t convert_to_gpu_warmstart( } #if MIP_INSTANTIATE_DOUBLE -template cpu_pdlp_warm_start_data_t convert_to_cpu_warmstart( +template CUOPT_EXPORT cpu_pdlp_warm_start_data_t convert_to_cpu_warmstart( const pdlp_warm_start_data_t&, rmm::cuda_stream_view); -template pdlp_warm_start_data_t convert_to_gpu_warmstart( +template CUOPT_EXPORT pdlp_warm_start_data_t convert_to_gpu_warmstart( const cpu_pdlp_warm_start_data_t&, rmm::cuda_stream_view); #endif #if MIP_INSTANTIATE_FLOAT || PDLP_INSTANTIATE_FLOAT -template cpu_pdlp_warm_start_data_t convert_to_cpu_warmstart( +template CUOPT_EXPORT cpu_pdlp_warm_start_data_t convert_to_cpu_warmstart( const pdlp_warm_start_data_t&, rmm::cuda_stream_view); -template pdlp_warm_start_data_t convert_to_gpu_warmstart( +template CUOPT_EXPORT pdlp_warm_start_data_t convert_to_gpu_warmstart( const cpu_pdlp_warm_start_data_t&, rmm::cuda_stream_view); #endif diff --git a/cpp/src/pdlp/optimization_problem.cu b/cpp/src/pdlp/optimization_problem.cu index 85d3ef4df4..95457e2556 100644 --- a/cpp/src/pdlp/optimization_problem.cu +++ b/cpp/src/pdlp/optimization_problem.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -1632,14 +1633,14 @@ optimization_problem_t optimization_problem_t::convert // ============================================================================== // Explicit template instantiations matching MIP constants #if MIP_INSTANTIATE_FLOAT || PDLP_INSTANTIATE_FLOAT -template class optimization_problem_t; +template class CUOPT_EXPORT optimization_problem_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class optimization_problem_t; +template class CUOPT_EXPORT optimization_problem_t; #endif #if PDLP_INSTANTIATE_FLOAT || MIP_INSTANTIATE_FLOAT -template optimization_problem_t +template CUOPT_EXPORT optimization_problem_t optimization_problem_t::convert_to_other_prec( rmm::cuda_stream_view) const; #endif diff --git a/cpp/src/pdlp/pdlp_warm_start_data.cu b/cpp/src/pdlp/pdlp_warm_start_data.cu index 6039710423..a214f1a165 100644 --- a/cpp/src/pdlp/pdlp_warm_start_data.cu +++ b/cpp/src/pdlp/pdlp_warm_start_data.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -179,10 +180,10 @@ void pdlp_warm_start_data_t::check_sizes() } #if MIP_INSTANTIATE_FLOAT || PDLP_INSTANTIATE_FLOAT -template class pdlp_warm_start_data_t; +template class CUOPT_EXPORT pdlp_warm_start_data_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class pdlp_warm_start_data_t; +template class CUOPT_EXPORT pdlp_warm_start_data_t; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/pdlp/solution_conversion.cu b/cpp/src/pdlp/solution_conversion.cu index 4e7336ea93..8293629e6f 100644 --- a/cpp/src/pdlp/solution_conversion.cu +++ b/cpp/src/pdlp/solution_conversion.cu @@ -10,6 +10,7 @@ * @brief Implementations of conversion methods from solution classes to Cython ret structs */ +#include #include #include #include @@ -215,11 +216,11 @@ cuopt::cython::mip_ret_t cpu_mip_solution_t::to_cpu_mip_ret_t() } // Explicit template instantiations -template cuopt::cython::linear_programming_ret_t +template CUOPT_EXPORT cuopt::cython::linear_programming_ret_t gpu_lp_solution_t::to_linear_programming_ret_t(); -template cuopt::cython::mip_ret_t gpu_mip_solution_t::to_mip_ret_t(); -template cuopt::cython::linear_programming_ret_t +template CUOPT_EXPORT cuopt::cython::mip_ret_t gpu_mip_solution_t::to_mip_ret_t(); +template CUOPT_EXPORT cuopt::cython::linear_programming_ret_t cpu_lp_solution_t::to_cpu_linear_programming_ret_t(); -template cuopt::cython::mip_ret_t cpu_mip_solution_t::to_cpu_mip_ret_t(); +template CUOPT_EXPORT cuopt::cython::mip_ret_t cpu_mip_solution_t::to_cpu_mip_ret_t(); } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/pdlp/solve.cu b/cpp/src/pdlp/solve.cu index 25b427fa9a..dd22f59b9a 100644 --- a/cpp/src/pdlp/solve.cu +++ b/cpp/src/pdlp/solve.cu @@ -6,6 +6,7 @@ /* clang-format on */ #include +#include #include #include #include @@ -2306,28 +2307,28 @@ std::unique_ptr> solve_lp( } #define INSTANTIATE(F_TYPE) \ - template optimization_problem_solution_t solve_lp( \ + template CUOPT_EXPORT optimization_problem_solution_t solve_lp( \ optimization_problem_t& op_problem, \ pdlp_solver_settings_t const& settings, \ bool problem_checking, \ bool use_pdlp_solver_mode, \ bool is_batch_mode); \ \ - template optimization_problem_solution_t solve_lp( \ + template CUOPT_EXPORT optimization_problem_solution_t solve_lp( \ raft::handle_t const* handle_ptr, \ const cuopt::mathematical_optimization::io::mps_data_model_t& mps_data_model, \ pdlp_solver_settings_t const& settings, \ bool problem_checking, \ bool use_pdlp_solver_mode); \ \ - template std::unique_ptr> solve_lp( \ + template CUOPT_EXPORT std::unique_ptr> solve_lp( \ cpu_optimization_problem_t&, \ pdlp_solver_settings_t const&, \ bool, \ bool, \ bool); \ \ - template std::unique_ptr> solve_lp( \ + template CUOPT_EXPORT std::unique_ptr> solve_lp( \ optimization_problem_interface_t*, \ pdlp_solver_settings_t const&, \ bool, \ diff --git a/cpp/src/pdlp/solver_settings.cu b/cpp/src/pdlp/solver_settings.cu index 3b8e34ce5b..33d8f1a64b 100644 --- a/cpp/src/pdlp/solver_settings.cu +++ b/cpp/src/pdlp/solver_settings.cu @@ -6,6 +6,7 @@ /* clang-format on */ #include +#include #include #include #include @@ -415,11 +416,11 @@ pdlp_solver_settings_t::get_pdlp_warm_start_data_view() const noexcept } #if MIP_INSTANTIATE_FLOAT || PDLP_INSTANTIATE_FLOAT -template class pdlp_solver_settings_t; +template class CUOPT_EXPORT pdlp_solver_settings_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class pdlp_solver_settings_t; +template class CUOPT_EXPORT pdlp_solver_settings_t; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/pdlp/solver_solution.cu b/cpp/src/pdlp/solver_solution.cu index 0da8649dc4..08e5ee00a8 100644 --- a/cpp/src/pdlp/solver_solution.cu +++ b/cpp/src/pdlp/solver_solution.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -453,10 +454,10 @@ void optimization_problem_solution_t::write_to_sol_file( } #if MIP_INSTANTIATE_FLOAT || PDLP_INSTANTIATE_FLOAT -template class optimization_problem_solution_t; +template class CUOPT_EXPORT optimization_problem_solution_t; #endif #if MIP_INSTANTIATE_DOUBLE -template class optimization_problem_solution_t; +template class CUOPT_EXPORT optimization_problem_solution_t; #endif } // namespace cuopt::mathematical_optimization diff --git a/cpp/src/routing/assignment.cu b/cpp/src/routing/assignment.cu index 4636fa7359..be40bda183 100644 --- a/cpp/src/routing/assignment.cu +++ b/cpp/src/routing/assignment.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -272,8 +273,8 @@ void host_assignment_t::print() const noexcept } } -template class assignment_t; -template class host_assignment_t; +template class CUOPT_EXPORT assignment_t; +template class CUOPT_EXPORT host_assignment_t; } // namespace routing } // namespace cuopt diff --git a/cpp/src/routing/data_model_view.cu b/cpp/src/routing/data_model_view.cu index f5865cdad6..392c7a10fb 100644 --- a/cpp/src/routing/data_model_view.cu +++ b/cpp/src/routing/data_model_view.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -743,6 +744,6 @@ raft::handle_t const* data_model_view_t::get_handle_ptr() const noexce return handle_ptr_; } -template class data_model_view_t; +template class CUOPT_EXPORT data_model_view_t; } // namespace routing } // namespace cuopt diff --git a/cpp/src/routing/distance_engine/waypoint_matrix.cpp b/cpp/src/routing/distance_engine/waypoint_matrix.cpp index f31d1130d3..030c8790ea 100644 --- a/cpp/src/routing/distance_engine/waypoint_matrix.cpp +++ b/cpp/src/routing/distance_engine/waypoint_matrix.cpp @@ -1,11 +1,12 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ #include +#include #include #include @@ -408,7 +409,7 @@ void waypoint_matrix_t::compute_shortest_path_costs(f_t* d_custom_matr stream_view_.synchronize(); } -template class waypoint_matrix_t; +template class CUOPT_EXPORT waypoint_matrix_t; } // namespace distance_engine } // namespace cuopt diff --git a/cpp/src/routing/solve.cu b/cpp/src/routing/solve.cu index abac614633..a7caf88ad9 100644 --- a/cpp/src/routing/solve.cu +++ b/cpp/src/routing/solve.cu @@ -1,10 +1,11 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ +#include #include #include #include @@ -29,7 +30,7 @@ assignment_t solve(data_model_view_t const& data_model, } } -template assignment_t solve(data_model_view_t const& data_model, - solver_settings_t const& settings); +template CUOPT_EXPORT assignment_t solve(data_model_view_t const& data_model, + solver_settings_t const& settings); } // namespace routing } // namespace cuopt diff --git a/cpp/src/routing/solver_settings.cu b/cpp/src/routing/solver_settings.cu index a9025cc08f..6267f39698 100644 --- a/cpp/src/routing/solver_settings.cu +++ b/cpp/src/routing/solver_settings.cu @@ -1,11 +1,12 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ #include +#include #include namespace cuopt { @@ -62,6 +63,6 @@ std::tuple solver_settings_t::get_dump_best_re return std::make_tuple(dump_interval_, dump_best_results_, best_result_file_name_); } -template class solver_settings_t; +template class CUOPT_EXPORT solver_settings_t; } // namespace routing } // namespace cuopt diff --git a/cpp/src/utilities/logger.hpp b/cpp/src/utilities/logger.hpp index f3a5bf6f2f..cc166da3a7 100644 --- a/cpp/src/utilities/logger.hpp +++ b/cpp/src/utilities/logger.hpp @@ -7,6 +7,8 @@ #pragma once +#include + #include #include @@ -20,7 +22,7 @@ #include #include -namespace cuopt { +namespace CUOPT_EXPORT cuopt { /** * @brief Get the default logger. @@ -45,7 +47,9 @@ class init_logger_t { init_logger_t(std::string log_file, bool log_to_console); }; -namespace detail { +} // namespace CUOPT_EXPORT cuopt + +namespace cuopt::detail { // Returns true for the first N calls sharing this counter. template @@ -69,9 +73,8 @@ inline bool log_every_n_should_emit(std::atomic& counter) return counter.fetch_add(1, std::memory_order_relaxed) % (uint64_t)N == 0; } -} // namespace detail +} // namespace cuopt::detail -} // namespace cuopt // Rate-limited logging built on the generated CUOPT_LOG_ macros. `level` is one of // TRACE/DEBUG/INFO/WARN/ERROR/CRITICAL; `n` must be a positive compile-time constant. Each From 890b149dfeb0d1d1aa0b23b7eeccd99225399f8a Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 7 Jul 2026 12:17:05 -0700 Subject: [PATCH 02/13] Check symbols script for CI, cython exports, and proper testing with static archive Signed-off-by: Arha Gatram --- ci/check_symbols.sh | 79 +++++++++ conda/recipes/libcuopt/recipe.yaml | 1 + cpp/CMakeLists.txt | 163 +++++++++++++----- .../io/utilities/cython_parser.hpp | 5 +- .../utilities/cython_solve.hpp | 5 +- .../utilities/cython_types.hpp | 5 +- cpp/include/cuopt/routing/cython/cython.hpp | 5 +- cpp/src/routing/utilities/cython.cu | 3 +- cpp/tests/CMakeLists.txt | 5 +- cpp/tests/examples/routing/CMakeLists.txt | 2 +- cpp/tests/linear_programming/CMakeLists.txt | 2 +- .../linear_programming/grpc/CMakeLists.txt | 6 +- 12 files changed, 220 insertions(+), 61 deletions(-) create mode 100755 ci/check_symbols.sh diff --git a/ci/check_symbols.sh b/ci/check_symbols.sh new file mode 100755 index 0000000000..a44865ba33 --- /dev/null +++ b/ci/check_symbols.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +set -eEuo pipefail + +echo "checking for symbol visibility issues" + +LIBRARY="${1}" + +echo "" +echo "Checking exported symbols in '${LIBRARY}'" +symbol_file="$(mktemp)" +match_file="$(mktemp)" +trap 'rm -f "${symbol_file}" "${match_file}"' EXIT + +# Ignore WEAK and UNIQUE symbols since UNIQUE symbols should be exported and +# WEAK symbols may come from template instantiations. +# Ignore symbols containing "_error" since these are likely exception types +# and should be exported. + +readelf --dyn-syms --wide "${LIBRARY}" \ + | awk '$7 != "UND" && $5 != "WEAK" && $5 != "UNIQUE"' \ + | c++filt --no-params \ + | awk '$0 !~ /_error/' \ + > "${symbol_file}" + +patterns=( + 'cub::' + 'thrust::' + 'raft::' + 'rmm::' + 'cuopt::linear_programming::detail' + 'cuopt::routing::detail' + 'grpc::' + 'google::protobuf' + 'tbb::' +) + +failed=0 + +for pattern in "${patterns[@]}"; do + echo "Checking for '${pattern}' symbols..." + + awk -v pattern="${pattern}" ' + BEGIN { has_trailing_scope = (substr(pattern, length(pattern) - 1) == "::") } + $1 ~ /^[0-9]+:/ { + symbol = "" + for (i = 8; i <= NF; ++i) { + symbol = symbol (i == 8 ? "" : " ") $i + } + + sub(/<.*/, "", symbol) + sub(/^.*[[:space:]](for|to)[[:space:]]+/, "", symbol) + + if (has_trailing_scope) { + matched = (index(symbol, pattern) == 1) + } else { + matched = (symbol == pattern || index(symbol, pattern "::") == 1) + } + + if (matched) { print } + } + ' "${symbol_file}" > "${match_file}" + + matches=$(awk 'END { print NR }' "${match_file}") + if [[ "${matches}" -ne 0 ]]; then + sed -n '1,20p' "${match_file}" + echo "ERROR: Found exported symbols in ${LIBRARY} matching the pattern ${pattern}." + echo "ERROR: Total matching symbols: ${matches}" + failed=1 + fi +done + +if [[ "${failed}" -ne 0 ]]; then + exit 1 +fi + +echo "No symbol visibility issues found in ${LIBRARY}" diff --git a/conda/recipes/libcuopt/recipe.yaml b/conda/recipes/libcuopt/recipe.yaml index 77c957eade..54b2013105 100644 --- a/conda/recipes/libcuopt/recipe.yaml +++ b/conda/recipes/libcuopt/recipe.yaml @@ -107,6 +107,7 @@ outputs: script: content: | cmake --install cpp/build + ./ci/check_symbols.sh cpp/build/libcuopt.so dynamic_linking: overlinking_behavior: "error" prefix_detection: diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index daa905868d..44c12c7911 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -514,64 +514,44 @@ if (NOT SKIP_GRPC_BUILD) APPEND PROPERTY COMPILE_OPTIONS "$<$:-fvisibility=default>") endif (NOT SKIP_GRPC_BUILD) -add_library(cuopt SHARED +add_library(cuopt_objs OBJECT ${CUOPT_SRC_FILES} ) -set_target_properties(cuopt - PROPERTIES BUILD_RPATH "\$ORIGIN" - INSTALL_RPATH "\$ORIGIN" - INTERFACE_POSITION_INDEPENDENT_CODE ON +set_target_properties(cuopt_objs + PROPERTIES POSITION_INDEPENDENT_CODE ON + CXX_VISIBILITY_PRESET hidden + CUDA_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON CXX_SCAN_FOR_MODULES OFF ) -if (NOT BUILD_TESTS) - set_target_properties(cuopt - PROPERTIES CXX_VISIBILITY_PRESET hidden - CUDA_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN ON - ) -endif () - -target_compile_definitions(cuopt - PUBLIC "CUOPT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_${LIBCUOPT_LOGGING_LEVEL}" - PUBLIC CUSPARSE_ENABLE_EXPERIMENTAL_API +target_compile_definitions(cuopt_objs + PUBLIC "CUOPT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_${LIBCUOPT_LOGGING_LEVEL}" + PUBLIC CUSPARSE_ENABLE_EXPERIMENTAL_API ) -target_compile_options(cuopt +target_compile_options(cuopt_objs PRIVATE "$<$:${CUOPT_CXX_FLAGS}>" "$<$:${CUOPT_CUDA_FLAGS}>" ) -if (WRITE_FATBIN) - file(WRITE "${CUOPT_BINARY_DIR}/fatbin.ld" - [=[ - SECTIONS - { - .nvFatBinSegment : { *(.nvFatBinSegment) } - .nv_fatbin : { *(.nv_fatbin) } - } - ]=]) - target_link_options(cuopt PRIVATE "${CUOPT_BINARY_DIR}/fatbin.ld") -endif () - -add_library(cuopt::cuopt ALIAS cuopt) # ################################################################################################## # - include paths --------------------------------------------------------------------------------- message(STATUS "target include directories CUDSS_INCLUDES = ${CUDSS_INCLUDE}") # Adding Papilo as a system include messes up clang's include resolution if papilo is already installed as a conda package -target_include_directories(cuopt PRIVATE +target_include_directories(cuopt_objs PRIVATE "${papilo_SOURCE_DIR}/src" "${papilo_BINARY_DIR}" ) -target_include_directories(cuopt SYSTEM PRIVATE - "${pslp_SOURCE_DIR}/include" - "${dejavu_SOURCE_DIR}" +target_include_directories(cuopt_objs SYSTEM PRIVATE + "${pslp_SOURCE_DIR}/include" + "${dejavu_SOURCE_DIR}" ) -target_include_directories(cuopt +target_include_directories(cuopt_objs PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty" "${CMAKE_CURRENT_SOURCE_DIR}/src" @@ -583,16 +563,11 @@ target_include_directories(cuopt "${CUDSS_INCLUDE}" $<$:${BZIP2_INCLUDE_DIRS}> $<$:${ZLIB_INCLUDE_DIRS}> - PUBLIC - "$" - "$" - INTERFACE - "$" ) # Link PSLP by file to avoid export dependency tracking -target_link_libraries(cuopt PRIVATE $) -add_dependencies(cuopt PSLP) +target_link_libraries(cuopt_objs PRIVATE $) +add_dependencies(cuopt_objs PSLP) # ################################################################################################## # - link libraries -------------------------------------------------------------------------------- @@ -607,7 +582,7 @@ list(PREPEND CUOPT_PRIVATE_CUDA_LIBS CUDA::cublasLt) # Pass CUDSS_MT_LIB_FILE_NAME as a compile definition get_filename_component(CUDSS_MT_LIB_FILE_NAME "${CUDSS_MT_LIB_FILE}" NAME) -target_compile_definitions(cuopt PRIVATE CUDSS_MT_LIB_FILE_NAME="${CUDSS_MT_LIB_FILE_NAME}") +target_compile_definitions(cuopt_objs PRIVATE CUDSS_MT_LIB_FILE_NAME="${CUDSS_MT_LIB_FILE_NAME}") execute_process( COMMAND git rev-parse --short HEAD @@ -626,13 +601,95 @@ configure_file( ) # Add the generated include directory -target_include_directories(cuopt PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include) +target_include_directories(cuopt_objs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include) list(JOIN CMAKE_CUDA_ARCHITECTURES "," JOINED_CUDA_ARCHITECTURES) -target_compile_definitions(cuopt PUBLIC +target_compile_definitions(cuopt_objs PUBLIC CUOPT_CUDA_ARCHITECTURES="${JOINED_CUDA_ARCHITECTURES}" CUOPT_CPU_ARCHITECTURE="${CMAKE_SYSTEM_PROCESSOR}") +target_link_libraries(cuopt_objs + PUBLIC + CUDA::cublas + CUDA::cusparse + rmm::rmm + rapids_logger::rapids_logger + CCCL::CCCL + raft::raft + ${CUDSS_LIB_FILE} + PRIVATE + ${CUOPT_PRIVATE_CUDA_LIBS} + $<$:protobuf::libprotobuf> + $<$:gRPC::grpc++> +) + +if (BUILD_TESTS) + add_library(cuopt_static STATIC $) + + target_link_libraries(cuopt_static + PUBLIC + CUDA::cublas + CUDA::cusparse + rmm::rmm + rapids_logger::rapids_logger + CCCL::CCCL + raft::raft + ${CUDSS_LIB_FILE} + PRIVATE + ${CUOPT_PRIVATE_CUDA_LIBS} + $<$:protobuf::libprotobuf> + $<$:gRPC::grpc++> + ) + + target_include_directories(cuopt_static + PUBLIC + "$" + "$" + "$" + ) + + target_compile_options(cuopt_static + PRIVATE "$<$:${CUOPT_CXX_FLAGS}>" + "$<$:${CUOPT_CUDA_FLAGS}>" + ) + + target_compile_definitions(cuopt_static PUBLIC + CUOPT_CUDA_ARCHITECTURES="${JOINED_CUDA_ARCHITECTURES}" + CUOPT_CPU_ARCHITECTURE="${CMAKE_SYSTEM_PROCESSOR}" + ) + + target_link_libraries(cuopt_static PRIVATE $) + add_dependencies(cuopt_static PSLP) +endif () + +add_library(cuopt SHARED $) +add_library(cuopt::cuopt ALIAS cuopt) + +set_target_properties(cuopt + PROPERTIES BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" + INTERFACE_POSITION_INDEPENDENT_CODE ON + CXX_SCAN_FOR_MODULES OFF + LINKER_LANGUAGE CUDA +) + +target_include_directories(cuopt + PUBLIC + "$" + "$" + "$" +) + +target_compile_options(cuopt + PRIVATE "$<$:${CUOPT_CXX_FLAGS}>" + "$<$:${CUOPT_CUDA_FLAGS}>" +) + +target_compile_definitions(cuopt PUBLIC + CUOPT_CUDA_ARCHITECTURES="${JOINED_CUDA_ARCHITECTURES}" + CUOPT_CPU_ARCHITECTURE="${CMAKE_SYSTEM_PROCESSOR}" +) + target_link_libraries(cuopt PUBLIC CUDA::cublas @@ -651,6 +708,22 @@ target_link_libraries(cuopt $<$:gRPC::grpc++> ) +target_link_libraries(cuopt PRIVATE $) +add_dependencies(cuopt PSLP) + +if (WRITE_FATBIN) + file(WRITE "${CUOPT_BINARY_DIR}/fatbin.ld" + [=[ + SECTIONS + { + .nvFatBinSegment : { *(.nvFatBinSegment) } + .nv_fatbin : { *(.nv_fatbin) } + } + ]=]) + target_link_options(cuopt PRIVATE "${CUOPT_BINARY_DIR}/fatbin.ld") +endif () + + # ################################################################################################## # - generate tests -------------------------------------------------------------------------------- if (BUILD_TESTS) diff --git a/cpp/include/cuopt/mathematical_optimization/io/utilities/cython_parser.hpp b/cpp/include/cuopt/mathematical_optimization/io/utilities/cython_parser.hpp index a7863199df..e561325456 100644 --- a/cpp/include/cuopt/mathematical_optimization/io/utilities/cython_parser.hpp +++ b/cpp/include/cuopt/mathematical_optimization/io/utilities/cython_parser.hpp @@ -7,12 +7,13 @@ #pragma once +#include #include #include namespace cuopt { -namespace cython { +namespace CUOPT_EXPORT cython { std::unique_ptr> call_read( const std::string& file_path, bool fixed_mps_format); @@ -20,5 +21,5 @@ std::unique_ptr> call_parse_mps( const std::string& mps_file_path, bool fixed_mps_format); -} // namespace cython +} // namespace CUOPT_EXPORT cython } // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/utilities/cython_solve.hpp b/cpp/include/cuopt/mathematical_optimization/utilities/cython_solve.hpp index 79ef572d9c..f84119a8dc 100644 --- a/cpp/include/cuopt/mathematical_optimization/utilities/cython_solve.hpp +++ b/cpp/include/cuopt/mathematical_optimization/utilities/cython_solve.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -20,7 +21,7 @@ #include namespace cuopt { -namespace cython { +namespace CUOPT_EXPORT cython { // Type definitions moved to cython_types.hpp to avoid circular dependencies // The types linear_programming_ret_t and mip_ret_t are defined in cython_types.hpp. @@ -65,5 +66,5 @@ std::pair>, double> call_batch_solve( std::vector*>, mathematical_optimization::solver_settings_t*); -} // namespace cython +} // namespace CUOPT_EXPORT cython } // namespace cuopt diff --git a/cpp/include/cuopt/mathematical_optimization/utilities/cython_types.hpp b/cpp/include/cuopt/mathematical_optimization/utilities/cython_types.hpp index 966018bd9f..69d6f91604 100644 --- a/cpp/include/cuopt/mathematical_optimization/utilities/cython_types.hpp +++ b/cpp/include/cuopt/mathematical_optimization/utilities/cython_types.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -19,7 +20,7 @@ #include namespace cuopt { -namespace cython { +namespace CUOPT_EXPORT cython { using gpu_buffer = std::unique_ptr; using cpu_buffer = std::vector; @@ -112,5 +113,5 @@ struct mip_ret_t { bool is_gpu() const { return std::holds_alternative(solution_); } }; -} // namespace cython +} // namespace CUOPT_EXPORT cython } // namespace cuopt diff --git a/cpp/include/cuopt/routing/cython/cython.hpp b/cpp/include/cuopt/routing/cython/cython.hpp index c1ac4e1dd6..76b0de7d2e 100644 --- a/cpp/include/cuopt/routing/cython/cython.hpp +++ b/cpp/include/cuopt/routing/cython/cython.hpp @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -19,7 +20,7 @@ #include namespace cuopt { -namespace cython { +namespace CUOPT_EXPORT cython { template void populate_dataset_params(routing::generator::dataset_params_t& params, @@ -91,5 +92,5 @@ std::vector> call_batch_solve( std::unique_ptr call_generate_dataset( raft::handle_t& handle, routing::generator::dataset_params_t const& params); -} // namespace cython +} // namespace CUOPT_EXPORT cython } // namespace cuopt diff --git a/cpp/src/routing/utilities/cython.cu b/cpp/src/routing/utilities/cython.cu index cf9e8ab73b..5a0b9bf6b2 100644 --- a/cpp/src/routing/utilities/cython.cu +++ b/cpp/src/routing/utilities/cython.cu @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include #include @@ -187,7 +188,7 @@ std::unique_ptr call_generate_dataset( return std::make_unique(std::move(gen_ret)); } -template void populate_dataset_params( +template CUOPT_EXPORT void populate_dataset_params( routing::generator::dataset_params_t& params, int n_locations, bool asymmetric, diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 27f6c94983..ccb5501c19 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -22,11 +22,12 @@ if(BUILD_TESTS) target_link_libraries(cuopttestutils PUBLIC - cuopt OpenMP::OpenMP_CXX OpenMP::OpenMP_CUDA GTest::gmock GTest::gtest + PRIVATE + cuopt_static ) if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "") target_link_options(cuopttestutils PRIVATE -Wl,--enable-new-dtags) @@ -56,7 +57,7 @@ function(ConfigureTest CMAKE_TEST_NAME) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE - cuopt + cuopt_static cuopttestutils OpenMP::OpenMP_CXX OpenMP::OpenMP_CUDA diff --git a/cpp/tests/examples/routing/CMakeLists.txt b/cpp/tests/examples/routing/CMakeLists.txt index deeaadc50d..5b9d2b377c 100644 --- a/cpp/tests/examples/routing/CMakeLists.txt +++ b/cpp/tests/examples/routing/CMakeLists.txt @@ -25,7 +25,7 @@ foreach(target ) target_link_libraries(${target} PRIVATE - cuopt + cuopt # examples should work with the shared library cuopttestutils OpenMP::OpenMP_CXX ) diff --git a/cpp/tests/linear_programming/CMakeLists.txt b/cpp/tests/linear_programming/CMakeLists.txt index 6db30755c3..809c8f6b3b 100644 --- a/cpp/tests/linear_programming/CMakeLists.txt +++ b/cpp/tests/linear_programming/CMakeLists.txt @@ -65,7 +65,7 @@ if (NOT SKIP_C_PYTHON_ADAPTERS) target_link_libraries(C_API_TEST PRIVATE - cuopt + cuopt # link against the shared library to verify that the public C API is properly exported cuopttestutils c_api_tester GTest::gmock diff --git a/cpp/tests/linear_programming/grpc/CMakeLists.txt b/cpp/tests/linear_programming/grpc/CMakeLists.txt index aadbf23df3..93fd4f4014 100644 --- a/cpp/tests/linear_programming/grpc/CMakeLists.txt +++ b/cpp/tests/linear_programming/grpc/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories(GRPC_CLIENT_TEST target_link_libraries(GRPC_CLIENT_TEST PRIVATE - cuopt + cuopt_static GTest::gmock GTest::gmock_main gRPC::grpc++ @@ -67,7 +67,7 @@ target_include_directories(GRPC_PIPE_SERIALIZATION_TEST target_link_libraries(GRPC_PIPE_SERIALIZATION_TEST PRIVATE - cuopt + cuopt_static GTest::gtest GTest::gtest_main protobuf::libprotobuf @@ -106,7 +106,7 @@ target_include_directories(GRPC_INTEGRATION_TEST target_link_libraries(GRPC_INTEGRATION_TEST PRIVATE - cuopt + cuopt_static GTest::gmock GTest::gmock_main gRPC::grpc++ From c6eddb703c689293048ed72b38ccfc41d45d8efe Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 7 Jul 2026 13:59:54 -0700 Subject: [PATCH 03/13] include all files and add exports to rebased files Signed-off-by: Arha Gatram --- cpp/CMakeLists.txt | 4 ++++ cpp/include/cuopt/grpc/cython_grpc_client.hpp | 7 +++++-- cpp/include/cuopt/grpc/grpc_client_env.hpp | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 44c12c7911..cc412ee15c 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -563,6 +563,10 @@ target_include_directories(cuopt_objs "${CUDSS_INCLUDE}" $<$:${BZIP2_INCLUDE_DIRS}> $<$:${ZLIB_INCLUDE_DIRS}> + PUBLIC + "$" + "$" + "$" ) # Link PSLP by file to avoid export dependency tracking diff --git a/cpp/include/cuopt/grpc/cython_grpc_client.hpp b/cpp/include/cuopt/grpc/cython_grpc_client.hpp index 593014cedc..3f6db62269 100644 --- a/cpp/include/cuopt/grpc/cython_grpc_client.hpp +++ b/cpp/include/cuopt/grpc/cython_grpc_client.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include #include @@ -22,7 +23,8 @@ class data_model_view_t; } // namespace io } // namespace cuopt::mathematical_optimization -namespace cuopt::cython { +namespace cuopt { +namespace CUOPT_EXPORT cython { /** Mirrors cuopt::mathematical_optimization::job_status_t for the Python bindings. */ enum class grpc_job_status_t : int { @@ -166,4 +168,5 @@ class grpc_python_client_t { std::unique_ptr impl_; }; -} // namespace cuopt::cython +} // namespace CUOPT_EXPORT cython +} // namespace cuopt diff --git a/cpp/include/cuopt/grpc/grpc_client_env.hpp b/cpp/include/cuopt/grpc/grpc_client_env.hpp index dab3dbe531..d8f88b7273 100644 --- a/cpp/include/cuopt/grpc/grpc_client_env.hpp +++ b/cpp/include/cuopt/grpc/grpc_client_env.hpp @@ -5,9 +5,11 @@ #pragma once +#include #include "grpc_client.hpp" -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { /** How TLS is chosen when building a grpc_client_config_t. */ enum class grpc_tls_mode_t { @@ -49,4 +51,5 @@ grpc_client_config_t make_grpc_client_config(const std::string& host, grpc_tls_mode_t tls_mode, const grpc_explicit_tls_t* explicit_tls = nullptr); -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt From bf8bbf4cb2c8c19623f8d0384b571816ab86179d Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 7 Jul 2026 15:21:44 -0700 Subject: [PATCH 04/13] add binutils to conda recipe Signed-off-by: Arha Gatram --- conda/recipes/libcuopt/recipe.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda/recipes/libcuopt/recipe.yaml b/conda/recipes/libcuopt/recipe.yaml index 54b2013105..42860b82da 100644 --- a/conda/recipes/libcuopt/recipe.yaml +++ b/conda/recipes/libcuopt/recipe.yaml @@ -119,6 +119,7 @@ outputs: build: - cmake ${{ cmake_version }} - ${{ stdlib("c") }} + - binutils host: - libboost-devel - cuda-version =${{ cuda_version }} From b6a38eecbe1c96448a0c784f8a11a8dd6a03af49 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Wed, 8 Jul 2026 10:27:54 -0700 Subject: [PATCH 05/13] missing compile definitions added to static/shared lib --- cpp/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index cc412ee15c..f00b3dc392 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -660,6 +660,8 @@ if (BUILD_TESTS) target_compile_definitions(cuopt_static PUBLIC CUOPT_CUDA_ARCHITECTURES="${JOINED_CUDA_ARCHITECTURES}" CUOPT_CPU_ARCHITECTURE="${CMAKE_SYSTEM_PROCESSOR}" + "CUOPT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_${LIBCUOPT_LOGGING_LEVEL}" + CUSPARSE_ENABLE_EXPERIMENTAL_API ) target_link_libraries(cuopt_static PRIVATE $) @@ -692,6 +694,8 @@ target_compile_options(cuopt target_compile_definitions(cuopt PUBLIC CUOPT_CUDA_ARCHITECTURES="${JOINED_CUDA_ARCHITECTURES}" CUOPT_CPU_ARCHITECTURE="${CMAKE_SYSTEM_PROCESSOR}" + "CUOPT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_${LIBCUOPT_LOGGING_LEVEL}" + CUSPARSE_ENABLE_EXPERIMENTAL_API ) target_link_libraries(cuopt From 35325bee0375147c35abe28f8756f1f5f59d7a45 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Fri, 10 Jul 2026 12:01:42 -0700 Subject: [PATCH 06/13] More CI checks, don't export static lib symbols, and export more template instantiations --- ci/check_symbols.sh | 7 ++++++- cpp/CMakeLists.txt | 2 ++ cpp/src/pdlp/solve.cu | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ci/check_symbols.sh b/ci/check_symbols.sh index a44865ba33..d482f08eaf 100755 --- a/ci/check_symbols.sh +++ b/ci/check_symbols.sh @@ -30,11 +30,16 @@ patterns=( 'thrust::' 'raft::' 'rmm::' - 'cuopt::linear_programming::detail' + 'cuopt::mathematical_optimization::detail' 'cuopt::routing::detail' 'grpc::' 'google::protobuf' 'tbb::' + 'absl::' + 'dejavu::' + 'papilo::' + 'boost::' + 'pslp_' ) failed=0 diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f00b3dc392..5e0018ce47 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -698,6 +698,8 @@ target_compile_definitions(cuopt PUBLIC CUSPARSE_ENABLE_EXPERIMENTAL_API ) +target_link_options(cuopt PRIVATE "LINKER:--exclude-libs=ALL") + target_link_libraries(cuopt PUBLIC CUDA::cublas diff --git a/cpp/src/pdlp/solve.cu b/cpp/src/pdlp/solve.cu index dd22f59b9a..c68707c7c0 100644 --- a/cpp/src/pdlp/solve.cu +++ b/cpp/src/pdlp/solve.cu @@ -2341,7 +2341,7 @@ std::unique_ptr> solve_lp( const timer_t& timer, \ bool is_batch_mode); \ \ - template optimization_problem_solution_t batch_pdlp_solve( \ + template CUOPT_EXPORT optimization_problem_solution_t batch_pdlp_solve( \ raft::handle_t const* handle_ptr, \ const cuopt::mathematical_optimization::io::mps_data_model_t& mps_data_model, \ const std::vector& fractional, \ @@ -2357,7 +2357,8 @@ std::unique_ptr> solve_lp( bool per_climber_constraint_bounds, \ bool collect_solutions); \ \ - template optimization_problem_t mps_data_model_to_optimization_problem( \ + template CUOPT_EXPORT optimization_problem_t \ + mps_data_model_to_optimization_problem( \ raft::handle_t const* handle_ptr, \ const cuopt::mathematical_optimization::io::mps_data_model_t& data_model); \ template void set_pdlp_solver_mode(pdlp_solver_settings_t& settings); From ca9620d77d23216c2fb8e2b1ea2da3c232111d1d Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 13 Jul 2026 16:37:06 -0500 Subject: [PATCH 07/13] Minimize cuopt_static linkage in tests to avoid package size explosion PR #1526 switched all tests to link cuopt_static, which inflates libcuopt-tests from ~75 MB to ~5 GB (confirmed from CI artifacts) because each of ~36 test executables embeds the full cuopt object graph. This commit introduces ConfigureInternalTest for tests that genuinely need access to hidden symbols, and keeps ConfigureTest on the shared library for tests that only use the public API. Only routing tests are switched to ConfigureInternalTest: they all include routing_test.cuh which pulls in cuopt::routing::detail types (solution_t, problem_t, fleet_order_constraints_t, md_utils, etc.). MIP, LP, QP, SOCP, dual_simplex, distance engine, CLI, and utility tests use only public cuopt API or raft::detail inline headers (which are compiled into the TU, not linked from cuopt.so), so they stay on the shared library. GRPC tests are left unchanged as they have explicit target_link_libraries and grpc_client.cpp symbols lack CUOPT_EXPORT. Co-Authored-By: Claude Sonnet 4.6 --- cpp/tests/CMakeLists.txt | 48 +++++++++++++++++++++++++++++++- cpp/tests/routing/CMakeLists.txt | 19 +++++++------ 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index ccb5501c19..9cc72ea9d2 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -57,7 +57,7 @@ function(ConfigureTest CMAKE_TEST_NAME) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE - cuopt_static + cuopt cuopttestutils OpenMP::OpenMP_CXX OpenMP::OpenMP_CUDA @@ -85,6 +85,52 @@ function(ConfigureTest CMAKE_TEST_NAME) ) endfunction() +# ConfigureInternalTest(NAME source1.cu ... [LABELS ...]) +# +# Like ConfigureTest but links cuopt_static instead of the shared library. +# Use only for tests that access symbols in cuopt::*::detail namespaces or +# include headers from cpp/src/ that are not part of the public API. +function(ConfigureInternalTest CMAKE_TEST_NAME) + cmake_parse_arguments(CT "" "" "LABELS" ${ARGN}) + add_executable(${CMAKE_TEST_NAME} ${CT_UNPARSED_ARGUMENTS}) + target_include_directories(${CMAKE_TEST_NAME} + PRIVATE + "${CUOPT_TEST_DIR}/../src" + "${CUOPT_TEST_DIR}/../src/io" + "${CUOPT_TEST_DIR}" + "${papilo_SOURCE_DIR}/src" + "${papilo_BINARY_DIR}" + "${pslp_SOURCE_DIR}/include" + "${dejavu_SOURCE_DIR}" + ) + + target_link_libraries(${CMAKE_TEST_NAME} + PRIVATE + cuopt_static + cuopttestutils + GTest::gmock + GTest::gmock_main + GTest::gtest + GTest::gtest_main + ${CUOPT_PRIVATE_CUDA_LIBS} + ) + if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "") + target_link_options(${CMAKE_TEST_NAME} PRIVATE -Wl,--enable-new-dtags) + endif() + + add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) + + if(CT_LABELS) + set_tests_properties(${CMAKE_TEST_NAME} PROPERTIES LABELS "${CT_LABELS}") + endif() + + install( + TARGETS ${CMAKE_TEST_NAME} + COMPONENT testing + DESTINATION bin/gtests/libcuopt + EXCLUDE_FROM_ALL + ) +endfunction() # #################################################################### # - set rapids dataset path ---------------------------------------------------------------------- diff --git a/cpp/tests/routing/CMakeLists.txt b/cpp/tests/routing/CMakeLists.txt index 569f84beb7..29acd86a65 100644 --- a/cpp/tests/routing/CMakeLists.txt +++ b/cpp/tests/routing/CMakeLists.txt @@ -3,33 +3,36 @@ # SPDX-License-Identifier: Apache-2.0 # cmake-format: on -ConfigureTest(ROUTING_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_routing_test.cu +# All routing tests include routing_test.cuh which pulls in cuopt::routing::detail +# types (solution_t, problem_t, fleet_order_constraints_t, md_utils, etc.). +# They must link against cuopt_static to access those hidden symbols. +ConfigureInternalTest(ROUTING_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_routing_test.cu LABELS routing) -ConfigureTest(ROUTING_GES_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_ges_test.cu +ConfigureInternalTest(ROUTING_GES_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_ges_test.cu LABELS routing) -ConfigureTest(VEHICLE_ORDER_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_vehicle_order_match.cu +ConfigureInternalTest(VEHICLE_ORDER_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_vehicle_order_match.cu LABELS routing) -ConfigureTest(VEHICLE_TYPES_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_vehicle_types_test.cu +ConfigureInternalTest(VEHICLE_TYPES_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_vehicle_types_test.cu LABELS routing) -ConfigureTest(OBJECTIVE_FUNCTION_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_objective_function_test.cu +ConfigureInternalTest(OBJECTIVE_FUNCTION_TEST ${CMAKE_CURRENT_SOURCE_DIR}/level0/l0_objective_function_test.cu LABELS routing) # ################################################################################################## # - L1 advanced retail tests -------------------------------------------------------------------------- -ConfigureTest(RETAIL_L1TEST ${CMAKE_CURRENT_SOURCE_DIR}/level1/l1_retail_test.cu +ConfigureInternalTest(RETAIL_L1TEST ${CMAKE_CURRENT_SOURCE_DIR}/level1/l1_retail_test.cu LABELS routing) # ################################################################################################## # - L1 tests for quick regression check -------------------------------------------------------------------------- -ConfigureTest(ROUTING_L1TEST ${CMAKE_CURRENT_SOURCE_DIR}/level1/l1_routing_test.cu +ConfigureInternalTest(ROUTING_L1TEST ${CMAKE_CURRENT_SOURCE_DIR}/level1/l1_routing_test.cu LABELS routing) # Disabled: both tests are slow and known to be broken. set_tests_properties(RETAIL_L1TEST ROUTING_L1TEST PROPERTIES DISABLED TRUE) # # - ${CMAKE_CURRENT_SOURCE_DIR} unit tests ---------------------------------------------------------------------------- -ConfigureTest(ROUTING_UNIT_TEST +ConfigureInternalTest(ROUTING_UNIT_TEST ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/vehicle_types.cu ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/breaks.cu ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/heterogenous_breaks.cu From 966fd0f49d72c3e9fdc140cc29789a45fa19c4af Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 13 Jul 2026 17:01:20 -0500 Subject: [PATCH 08/13] fix(copyright): add AFFILIATES and rights reserved to SPDX headers ci/check_symbols.sh and conda/recipes/libcuopt/recipe.yaml were missing the canonical suffix required by verify-copyright pre-commit hook. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Ramakrishna Prabhu --- ci/check_symbols.sh | 2 +- conda/recipes/libcuopt/recipe.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/check_symbols.sh b/ci/check_symbols.sh index d482f08eaf..ba3da7429b 100755 --- a/ci/check_symbols.sh +++ b/ci/check_symbols.sh @@ -1,5 +1,5 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -eEuo pipefail diff --git a/conda/recipes/libcuopt/recipe.yaml b/conda/recipes/libcuopt/recipe.yaml index 42860b82da..ab89215e13 100644 --- a/conda/recipes/libcuopt/recipe.yaml +++ b/conda/recipes/libcuopt/recipe.yaml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 schema_version: 1 From 69336f7a3a636b2459201cd9d510d526ee46a5c3 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 21 Jul 2026 14:11:02 -0700 Subject: [PATCH 09/13] Add missing library dependencies --- ci/check_symbols.sh | 2 +- cpp/CMakeLists.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/check_symbols.sh b/ci/check_symbols.sh index ba3da7429b..ed17b27213 100755 --- a/ci/check_symbols.sh +++ b/ci/check_symbols.sh @@ -32,6 +32,7 @@ patterns=( 'rmm::' 'cuopt::mathematical_optimization::detail' 'cuopt::routing::detail' + 'cuopt::detail' 'grpc::' 'google::protobuf' 'tbb::' @@ -39,7 +40,6 @@ patterns=( 'dejavu::' 'papilo::' 'boost::' - 'pslp_' ) failed=0 diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5e0018ce47..2e319a23d9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -623,6 +623,9 @@ target_link_libraries(cuopt_objs ${CUDSS_LIB_FILE} PRIVATE ${CUOPT_PRIVATE_CUDA_LIBS} + simde::simde + OpenMP::OpenMP_CXX + OpenMP::OpenMP_CUDA $<$:protobuf::libprotobuf> $<$:gRPC::grpc++> ) From a96bce683515a9c4d10d40026946636c0983a83a Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 21 Jul 2026 15:27:40 -0700 Subject: [PATCH 10/13] Export experimental parser --- cpp/src/io/parser.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpp/src/io/parser.cpp b/cpp/src/io/parser.cpp index 03cdb689c2..eb574fd38a 100644 --- a/cpp/src/io/parser.cpp +++ b/cpp/src/io/parser.cpp @@ -50,11 +50,13 @@ mps_data_model_t read_mps_fast_experimental(const std::string& mps_fil return detail::parse_mps_fast_file(mps_file_path); } -template mps_data_model_t read_mps_fast_experimental(const std::string& mps_file_path); -template mps_data_model_t read_mps_fast_experimental(const std::string& mps_file_path); -template mps_data_model_t read_mps_fast_experimental( +template CUOPT_EXPORT mps_data_model_t read_mps_fast_experimental( const std::string& mps_file_path); -template mps_data_model_t read_mps_fast_experimental( +template CUOPT_EXPORT mps_data_model_t read_mps_fast_experimental( + const std::string& mps_file_path); +template CUOPT_EXPORT mps_data_model_t read_mps_fast_experimental( + const std::string& mps_file_path); +template CUOPT_EXPORT mps_data_model_t read_mps_fast_experimental( const std::string& mps_file_path); } // namespace cuopt::mathematical_optimization::io From 7bff7df6663a7e0d4afa632933e26a2c8f7e54ab Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 21 Jul 2026 15:32:42 -0700 Subject: [PATCH 11/13] Fix logger style --- cpp/src/utilities/logger.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/src/utilities/logger.hpp b/cpp/src/utilities/logger.hpp index cc166da3a7..2f9053b05f 100644 --- a/cpp/src/utilities/logger.hpp +++ b/cpp/src/utilities/logger.hpp @@ -75,7 +75,6 @@ inline bool log_every_n_should_emit(std::atomic& counter) } // namespace cuopt::detail - // Rate-limited logging built on the generated CUOPT_LOG_ macros. `level` is one of // TRACE/DEBUG/INFO/WARN/ERROR/CRITICAL; `n` must be a positive compile-time constant. Each // call site owns its own counter, so throttling is independent per use. From a4da5090c119d0c33a42944d415e2bf4220df63c Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Wed, 22 Jul 2026 11:27:02 -0700 Subject: [PATCH 12/13] Make testutils shared so that cuopt_static isn't propgated as a link dependency --- cpp/tests/CMakeLists.txt | 2 +- cpp/tests/dual_simplex/CMakeLists.txt | 2 +- cpp/tests/linear_programming/CMakeLists.txt | 10 +++++----- cpp/tests/mip/CMakeLists.txt | 16 ++++++++-------- cpp/tests/socp/CMakeLists.txt | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 9cc72ea9d2..4487d9a009 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -4,7 +4,7 @@ # cmake-format: on if(BUILD_TESTS) - add_library(cuopttestutils STATIC + add_library(cuopttestutils SHARED routing/utilities/check_constraints.cu ) diff --git a/cpp/tests/dual_simplex/CMakeLists.txt b/cpp/tests/dual_simplex/CMakeLists.txt index 1f6740378f..b22b0af6f3 100644 --- a/cpp/tests/dual_simplex/CMakeLists.txt +++ b/cpp/tests/dual_simplex/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # cmake-format: on -ConfigureTest(DUAL_SIMPLEX_TEST +ConfigureInternalTest(DUAL_SIMPLEX_TEST ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/solve.cpp ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/solve_barrier.cu ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/right_looking_ldlt.cpp diff --git a/cpp/tests/linear_programming/CMakeLists.txt b/cpp/tests/linear_programming/CMakeLists.txt index 809c8f6b3b..8d43f5a3d0 100644 --- a/cpp/tests/linear_programming/CMakeLists.txt +++ b/cpp/tests/linear_programming/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # cmake-format: on -ConfigureTest(LP_UNIT_TEST +ConfigureInternalTest(LP_UNIT_TEST ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/optimization_problem_test.cu ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/solver_settings_test.cu ${CMAKE_CURRENT_SOURCE_DIR}/unit_tests/presolve_test.cu @@ -11,17 +11,17 @@ ConfigureTest(LP_UNIT_TEST LABELS numopt) # ################################################################################################## # - Linear programming PDLP tests ---------------------------------------------------------------------- -ConfigureTest(PDLP_TEST +ConfigureInternalTest(PDLP_TEST ${CMAKE_CURRENT_SOURCE_DIR}/pdlp_test.cu LABELS numopt) # ################################################################################################## # - MPS / LP parser tests -------------------------------------------------------------------------- -ConfigureTest(MPS_PARSER_TEST +ConfigureInternalTest(MPS_PARSER_TEST ${CMAKE_CURRENT_SOURCE_DIR}/parser_test.cpp LABELS numopt) -ConfigureTest(MPS_FAST_PARSER_TEST +ConfigureInternalTest(MPS_FAST_PARSER_TEST ${CMAKE_CURRENT_SOURCE_DIR}/experimental_mps_fast/fast_fp64_parser_test.cpp ${CMAKE_CURRENT_SOURCE_DIR}/experimental_mps_fast/fast_parser_edge_test.cpp LABELS numopt) @@ -65,7 +65,7 @@ if (NOT SKIP_C_PYTHON_ADAPTERS) target_link_libraries(C_API_TEST PRIVATE - cuopt # link against the shared library to verify that the public C API is properly exported + cuopt_static # TODO: Change this to link against the shared library to verify that the public C API is properly exported cuopttestutils c_api_tester GTest::gmock diff --git a/cpp/tests/mip/CMakeLists.txt b/cpp/tests/mip/CMakeLists.txt index d533f09c2d..f2d6f650f2 100644 --- a/cpp/tests/mip/CMakeLists.txt +++ b/cpp/tests/mip/CMakeLists.txt @@ -11,16 +11,16 @@ ConfigureTest(MIP_TEST ConfigureTest(SEMI_CONTINUOUS_TEST ${CMAKE_CURRENT_SOURCE_DIR}/semi_continuous_test.cu LABELS numopt) -ConfigureTest(PROBLEM_TEST +ConfigureInternalTest(PROBLEM_TEST ${CMAKE_CURRENT_SOURCE_DIR}/problem_test.cu LABELS numopt) -ConfigureTest(ELIM_VAR_REMAP_TEST +ConfigureInternalTest(ELIM_VAR_REMAP_TEST ${CMAKE_CURRENT_SOURCE_DIR}/elim_var_remap_test.cu LABELS numopt) -ConfigureTest(STANDARDIZATION_TEST +ConfigureInternalTest(STANDARDIZATION_TEST ${CMAKE_CURRENT_SOURCE_DIR}/bounds_standardization_test.cu LABELS numopt) -ConfigureTest(MULTI_PROBE_TEST +ConfigureInternalTest(MULTI_PROBE_TEST ${CMAKE_CURRENT_SOURCE_DIR}/multi_probe_test.cu LABELS numopt) ConfigureTest(INCUMBENT_CALLBACK_TEST @@ -29,17 +29,17 @@ ConfigureTest(INCUMBENT_CALLBACK_TEST ConfigureTest(DOC_EXAMPLE_TEST ${CMAKE_CURRENT_SOURCE_DIR}/doc_example_test.cu LABELS numopt) -ConfigureTest(CUTS_TEST +ConfigureInternalTest(CUTS_TEST ${CMAKE_CURRENT_SOURCE_DIR}/cuts_test.cu LABELS numopt) -ConfigureTest(UNIT_TEST +ConfigureInternalTest(UNIT_TEST ${CMAKE_CURRENT_SOURCE_DIR}/unit_test.cu ${CMAKE_CURRENT_SOURCE_DIR}/integer_with_real_bounds.cu LABELS numopt) ConfigureTest(EMPTY_FIXED_PROBLEMS_TEST ${CMAKE_CURRENT_SOURCE_DIR}/empty_fixed_problems_test.cu LABELS numopt) -ConfigureTest(PRESOLVE_TEST +ConfigureInternalTest(PRESOLVE_TEST ${CMAKE_CURRENT_SOURCE_DIR}/presolve_test.cu LABELS numopt) # Disable for now @@ -49,7 +49,7 @@ ConfigureTest(PRESOLVE_TEST ConfigureTest(MIP_TERMINATION_STATUS_TEST ${CMAKE_CURRENT_SOURCE_DIR}/termination_test.cu LABELS numopt) -ConfigureTest(DETERMINISM_TEST +ConfigureInternalTest(DETERMINISM_TEST ${CMAKE_CURRENT_SOURCE_DIR}/determinism_test.cu LABELS numopt) ConfigureTest(HEURISTICS_HYPER_PARAMS_TEST diff --git a/cpp/tests/socp/CMakeLists.txt b/cpp/tests/socp/CMakeLists.txt index f380984225..ba98eeeb28 100644 --- a/cpp/tests/socp/CMakeLists.txt +++ b/cpp/tests/socp/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # cmake-format: on -ConfigureTest(SOCP_TEST +ConfigureInternalTest(SOCP_TEST ${CMAKE_CURRENT_SOURCE_DIR}/second_order_cone_kernels.cu ${CMAKE_CURRENT_SOURCE_DIR}/solve_barrier_socp.cu ${CMAKE_CURRENT_SOURCE_DIR}/general_quadratic_test.cu From 3b7f0b9fdd6404041070c046b7d710f0eb83d5dd Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Wed, 22 Jul 2026 14:01:00 -0700 Subject: [PATCH 13/13] Try to fix overlinking --- cpp/tests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 4487d9a009..584aaceae4 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -4,7 +4,7 @@ # cmake-format: on if(BUILD_TESTS) - add_library(cuopttestutils SHARED + add_library(cuopttestutils STATIC routing/utilities/check_constraints.cu ) @@ -27,7 +27,7 @@ if(BUILD_TESTS) GTest::gmock GTest::gtest PRIVATE - cuopt_static + cuopt ) if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "") target_link_options(cuopttestutils PRIVATE -Wl,--enable-new-dtags)