From 48d5bc4522a5cd403d91012cf47fa1cd50ef7af3 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Wed, 1 Jul 2026 15:33:58 -0700 Subject: [PATCH 1/6] 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 | 8 ++- 57 files changed, 384 insertions(+), 206 deletions(-) create mode 100644 cpp/include/cuopt/export.hpp diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 67412162c2..49febce744 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -481,6 +481,8 @@ if (NOT SKIP_GRPC_BUILD) # at runtime with "undefined symbol: absl::…::Mutex::Dtor". set_property(SOURCE ${GRPC_INFRA_FILES} DIRECTORY ${CMAKE_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 @@ -494,6 +496,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 4f684e3756..b1ce6d01ac 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) @@ -61,4 +64,5 @@ bool use_cpu_memory_for_local(); */ 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 fd4c50fa75..ff410480a9 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 { // Forward declarations template @@ -226,4 +228,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 bbfe3e8c38..8647a4852f 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 @@ -15,7 +16,9 @@ #include #include -namespace cuopt::mathematical_optimization::io { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { +namespace io { /** * @brief Reads the equation from an MPS or QPS file. @@ -145,4 +148,6 @@ inline mps_data_model_t read(const std::string& path, bool fixed_mps_f path); } -} // 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 6d2dc8e694..dd65cbae74 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 @@ -21,7 +22,8 @@ #include -namespace cuopt::mathematical_optimization { +namespace cuopt { +namespace CUOPT_EXPORT mathematical_optimization { struct benchmark_info_t { double last_improvement_of_best_feasible = 0; @@ -230,4 +232,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 63a935d169..4db5872e62 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 58bcedf3b2..d61e48e83f 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 042ad2c4de..358095fa15 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 20e80185b3..b0d3833c4c 100644 --- a/cpp/src/io/parser.cpp +++ b/cpp/src/io/parser.cpp @@ -5,6 +5,7 @@ */ /* clang-format on */ +#include #include #include @@ -28,11 +29,13 @@ 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); } // namespace cuopt::mathematical_optimization::io 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 8bfd7cd8ba..4164e634b2 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 @@ -652,25 +653,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 6e6daf7a56..4d48c9031d 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 @@ -939,19 +940,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 84f03b5e85..28d1ce1032 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 @@ -1100,10 +1101,10 @@ void cpu_optimization_problem_t::copy_variable_types_to_host(var_t* ou // ============================================================================== #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 83cb082981..bae3060cc2 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 @@ -2302,28 +2303,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 08556a4c78..80353f044a 100644 --- a/cpp/src/utilities/logger.hpp +++ b/cpp/src/utilities/logger.hpp @@ -1,12 +1,14 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ #pragma once +#include + #include #include @@ -17,7 +19,7 @@ #include #include -namespace cuopt { +namespace CUOPT_EXPORT cuopt { /** * @brief Get the default logger. @@ -42,4 +44,4 @@ class init_logger_t { init_logger_t(std::string log_file, bool log_to_console); }; -} // namespace cuopt +} // namespace CUOPT_EXPORT cuopt From 87b567c3fba7bdd37c257c6a823612e2c69fae0b Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 7 Jul 2026 12:17:05 -0700 Subject: [PATCH 2/6] 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 | 154 +++++++++++++----- .../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, 215 insertions(+), 57 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 49febce744..d24f17372b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -485,64 +485,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 +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 +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" @@ -554,16 +534,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 -------------------------------------------------------------------------------- @@ -578,7 +553,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 @@ -597,13 +572,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 @@ -619,6 +676,21 @@ 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 -------------------------------------------------------------------------------- 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 19bb27d593..86b8a4df03 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -22,9 +22,10 @@ if(BUILD_TESTS) target_link_libraries(cuopttestutils PUBLIC - cuopt 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) @@ -54,7 +55,7 @@ function(ConfigureTest CMAKE_TEST_NAME) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE - cuopt + cuopt_static cuopttestutils GTest::gmock GTest::gmock_main 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 bc057db1e2..c3440dab0c 100644 --- a/cpp/tests/linear_programming/CMakeLists.txt +++ b/cpp/tests/linear_programming/CMakeLists.txt @@ -55,7 +55,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 75bb9b444b23f7c2826ac44fe114afd815b6c538 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 7 Jul 2026 13:59:54 -0700 Subject: [PATCH 3/6] 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 d24f17372b..4e16a7e2a7 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -534,6 +534,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 11f14451ce..276e00f385 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 { @@ -149,4 +151,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 e99d6f774b..23a02ab3bb 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 { /** * @brief Apply CUOPT_GRPC_* / CUOPT_TLS_* / CUOPT_CHUNK_SIZE env overrides. @@ -19,4 +21,5 @@ void apply_grpc_client_env_overrides(grpc_client_config_t& config); */ grpc_client_config_t make_grpc_client_config(const std::string& host, int port); -} // namespace cuopt::mathematical_optimization +} // namespace CUOPT_EXPORT mathematical_optimization +} // namespace cuopt From 6ecc56a25a09a9ec605bee76618b6ae811f4b9a5 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Tue, 7 Jul 2026 15:21:44 -0700 Subject: [PATCH 4/6] 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 9a23ba50f7a747719a006f96a1d6fc837799cc39 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Wed, 8 Jul 2026 10:27:54 -0700 Subject: [PATCH 5/6] 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 4e16a7e2a7..580397f39e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -631,6 +631,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 $) @@ -663,6 +665,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 75773da4f76c717ddd93aa6ea1d6bda041697bb8 Mon Sep 17 00:00:00 2001 From: Arha Gatram Date: Fri, 10 Jul 2026 12:01:42 -0700 Subject: [PATCH 6/6] 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 580397f39e..79b5a0e6eb 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -669,6 +669,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 bae3060cc2..ed014d35a0 100644 --- a/cpp/src/pdlp/solve.cu +++ b/cpp/src/pdlp/solve.cu @@ -2337,7 +2337,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, \ @@ -2353,7 +2353,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);