Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions ci/check_symbols.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/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)"
readelf --dyn-syms --wide "${LIBRARY}" \
| awk '$7 != "UND"' \
| c++filt \
> "${symbol_file}"

patterns=(
'cub::'
'thrust::'
'raft::'
'rmm::'
'cuopt::linear_programming::detail'
'cuopt::routing::detail'
'grpc::'
'google::protobuf'
'tbb::'
)

for pattern in "${patterns[@]}"; do
echo "Checking for '${pattern}' symbols..."
matches=$(grep -F -c "${pattern}" "${symbol_file}" || true)
if [[ "${matches}" -ne 0 ]]; then
grep -F -m 20 "${pattern}" "${symbol_file}"
echo "ERROR: Found exported symbols in ${LIBRARY} matching the pattern ${pattern}."
echo "ERROR: Total matching symbols: ${matches}"
rm "${symbol_file}"
exit 1
fi
done

rm "${symbol_file}"
echo "No symbol visibility issues found in ${LIBRARY}"
2 changes: 2 additions & 0 deletions conda/recipes/libcuopt/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ outputs:
script:
content: |
cmake --install cpp/libmps_parser/build
./ci/check_symbols.sh "$PREFIX/lib/libmps_parser.so"
dynamic_linking:
overlinking_behavior: "error"
prefix_detection:
Expand Down Expand Up @@ -159,6 +160,7 @@ outputs:
script:
content: |
cmake --install cpp/build
./ci/check_symbols.sh "$PREFIX/lib/libcuopt.so"
dynamic_linking:
overlinking_behavior: "error"
prefix_detection:
Expand Down
13 changes: 10 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ message("-- Host target architecture = '${CMAKE_SYSTEM_PROCESSOR}'")

# make the flags global in order to propagate flags to test cmake files
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr --expt-extended-lambda")
if (${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL 12.9)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -static-global-template-stub=false")
endif ()
list(APPEND CUOPT_CUDA_FLAGS -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xcompiler=-Werror --default-stream=per-thread)
if ("${CMAKE_CUDA_HOST_COMPILER}" MATCHES "clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
list(APPEND CUOPT_CUDA_FLAGS -Xcompiler=-Wall)
Expand Down Expand Up @@ -435,6 +432,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} DIRECTORY ${CMAKE_SOURCE_DIR}
APPEND PROPERTY COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:CXX>:-fvisibility=default>")
endif (NOT SKIP_GRPC_BUILD)

add_library(cuopt SHARED
Expand All @@ -448,6 +447,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}")

target_compile_options(cuopt
Expand Down
14 changes: 14 additions & 0 deletions cpp/include/cuopt/common/export.hpp
Original file line number Diff line number Diff line change
@@ -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
8 changes: 6 additions & 2 deletions cpp/include/cuopt/linear_programming/backend_selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

#pragma once

namespace cuopt::linear_programming {
#include <cuopt/common/export.hpp>

namespace cuopt {
namespace CUOPT_EXPORT linear_programming {

/**
* @brief Enum for execution mode (local vs remote solve)
Expand Down Expand Up @@ -61,4 +64,5 @@ bool use_cpu_memory_for_local();
*/
memory_backend_t get_memory_backend_type();

} // namespace cuopt::linear_programming
} // namespace CUOPT_EXPORT linear_programming
} // namespace cuopt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#pragma once

#include <cuopt/common/export.hpp>
#include <cuopt/linear_programming/optimization_problem_interface.hpp>

#include <raft/core/handle.hpp>
Expand All @@ -17,7 +18,8 @@
#include <string>
#include <vector>

namespace cuopt::linear_programming {
namespace cuopt {
namespace CUOPT_EXPORT linear_programming {

// Forward declarations
template <typename i_t, typename f_t>
Expand Down Expand Up @@ -206,4 +208,5 @@ class cpu_optimization_problem_t : public optimization_problem_interface_t<i_t,
std::vector<std::string> row_names_{};
};

} // namespace cuopt::linear_programming
} // namespace CUOPT_EXPORT linear_programming
} // namespace cuopt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#pragma once

#include <cuopt/common/export.hpp>
#include <cuopt/linear_programming/cpu_pdlp_warm_start_data.hpp>
#include <cuopt/linear_programming/mip/solver_solution.hpp>
#include <cuopt/linear_programming/mip/solver_stats.hpp>
Expand All @@ -18,7 +19,8 @@

#include <vector>

namespace cuopt::linear_programming {
namespace cuopt {
namespace CUOPT_EXPORT linear_programming {

/**
* @brief CPU-backed LP solution (uses std::vector instead of rmm::device_uvector)
Expand Down Expand Up @@ -389,4 +391,5 @@ class cpu_mip_solution_t : public mip_solution_interface_t<i_t, f_t> {
i_t num_simplex_iterations_;
};

} // namespace cuopt::linear_programming
} // namespace CUOPT_EXPORT linear_programming
} // namespace cuopt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

#pragma once

#include <cuopt/common/export.hpp>
#include <cuopt/linear_programming/pdlp/pdlp_warm_start_data.hpp>
#include <vector>

namespace cuopt::linear_programming {
namespace cuopt {
namespace CUOPT_EXPORT linear_programming {

// CPU version of pdlp_warm_start_data_t using std::vector for remote execution
template <typename i_t, typename f_t>
Expand Down Expand Up @@ -118,4 +120,5 @@ template <typename i_t, typename f_t>
pdlp_warm_start_data_t<i_t, f_t> convert_to_gpu_warmstart(
const cpu_pdlp_warm_start_data_t<i_t, f_t>& cpu_data, rmm::cuda_stream_view stream);

} // namespace cuopt::linear_programming
} // namespace CUOPT_EXPORT linear_programming
} // namespace cuopt
Loading