From 178d392d537bd6e3acff6d9a05e8493d9c1069a3 Mon Sep 17 00:00:00 2001 From: Trevor McKay Date: Tue, 17 Mar 2026 13:22:43 -0400 Subject: [PATCH 1/2] apply -UNDEBUG to coupt flags instead of global settings --- cpp/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 8225d93655..9a0d4efe79 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -111,6 +111,8 @@ endif(BUILD_MSAN) if(DEFINE_ASSERT) add_definitions(-DASSERT_MODE) + list(APPEND CUOPT_CXX_FLAGS -UNDEBUG) + list(APPEND CUOPT_CUDA_FLAGS -UNDEBUG) endif(DEFINE_ASSERT) if(DEFINE_BENCHMARK) @@ -184,11 +186,9 @@ elseif(CMAKE_CUDA_LINEINFO) set(CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE} -lineinfo") endif(CMAKE_BUILD_TYPE MATCHES Debug) -# Undefine NDEBUG if assert mode is on -if(DEFINE_ASSERT) - message(STATUS "Undefining NDEBUG with assert mode enabled") - add_definitions(-UNDEBUG) -endif() +# Note: -UNDEBUG is applied via CUOPT_CXX_FLAGS / CUOPT_CUDA_FLAGS (not add_definitions) +# to avoid leaking into dependencies that are built in-tree. +# See the DEFINE_ASSERT block near the top of this file. # ################################################################################################## From 7a33c330825b9128d50a649d0b8f5300ed292d7a Mon Sep 17 00:00:00 2001 From: Trevor McKay Date: Tue, 17 Mar 2026 13:34:12 -0400 Subject: [PATCH 2/2] re-enable cpu only tests --- cpp/CMakeLists.txt | 7 ++----- cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp | 4 ++-- .../tests/linear_programming/test_cpu_only_execution.py | 4 ---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 9a0d4efe79..1946012ca4 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -109,6 +109,8 @@ if(BUILD_MSAN) add_link_options(-fsanitize=memory) endif(BUILD_MSAN) +# Note: -UNDEBUG is applied via CUOPT_CXX_FLAGS / CUOPT_CUDA_FLAGS (not add_definitions) +# to avoid leaking into dependencies that are built in-tree. if(DEFINE_ASSERT) add_definitions(-DASSERT_MODE) list(APPEND CUOPT_CXX_FLAGS -UNDEBUG) @@ -186,11 +188,6 @@ elseif(CMAKE_CUDA_LINEINFO) set(CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE} -lineinfo") endif(CMAKE_BUILD_TYPE MATCHES Debug) -# Note: -UNDEBUG is applied via CUOPT_CXX_FLAGS / CUOPT_CUDA_FLAGS (not add_definitions) -# to avoid leaking into dependencies that are built in-tree. -# See the DEFINE_ASSERT block near the top of this file. - - # ################################################################################################## # - find CPM based dependencies ------------------------------------------------------------------ rapids_cpm_init() diff --git a/cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp b/cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp index 995b2194c4..d39a970763 100644 --- a/cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp +++ b/cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp @@ -382,7 +382,7 @@ class CPUOnlyTestEnvironment { // TODO: Add numerical assertions once gRPC remote solver replaces the stub implementation. // Currently validates that the CPU-only C API path completes without errors. -TEST(c_api_cpu_only, DISABLED_lp_solve) +TEST(c_api_cpu_only, lp_solve) { CPUOnlyTestEnvironment env; const std::string& rapidsDatasetRootDir = cuopt::test::get_rapids_dataset_root_dir(); @@ -391,7 +391,7 @@ TEST(c_api_cpu_only, DISABLED_lp_solve) } // TODO: Add numerical assertions once gRPC remote solver replaces the stub implementation. -TEST(c_api_cpu_only, DISABLED_mip_solve) +TEST(c_api_cpu_only, mip_solve) { CPUOnlyTestEnvironment env; const std::string& rapidsDatasetRootDir = cuopt::test::get_rapids_dataset_root_dir(); diff --git a/python/cuopt/cuopt/tests/linear_programming/test_cpu_only_execution.py b/python/cuopt/cuopt/tests/linear_programming/test_cpu_only_execution.py index e8dd179e05..792942aae9 100644 --- a/python/cuopt/cuopt/tests/linear_programming/test_cpu_only_execution.py +++ b/python/cuopt/cuopt/tests/linear_programming/test_cpu_only_execution.py @@ -168,8 +168,6 @@ def _impl_warmstart_cpu_only(): class TestCPUOnlyExecution: """Tests that run with CUDA_VISIBLE_DEVICES='' to simulate CPU-only hosts.""" - pytestmark = pytest.mark.skip(reason="CPU-only tests temporarily disabled") - @pytest.fixture def env(self): return _cpu_only_env() @@ -203,8 +201,6 @@ def test_warmstart_cpu_only(self, env): class TestCuoptCliCPUOnly: """Test that cuopt_cli runs without CUDA in remote-execution mode.""" - pytestmark = pytest.mark.skip(reason="CPU-only tests temporarily disabled") - @pytest.fixture def env(self): return _cpu_only_env()