Skip to content
Merged
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
11 changes: 4 additions & 7 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ 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)
list(APPEND CUOPT_CUDA_FLAGS -UNDEBUG)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this turn off all assertions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is "undefine no debug", which means "leave NDEBUG (no debug) unset". So if DEFINE_ASSERT is set, we are allowing assertions guarded by NDEBUG to still work. The standard C++ assert macro checks NDEBUG to turn off assertions; cuopt_assert() delegates to assert() so this logic applies.

The only difference here is that previously if DEFINE_ASSERT was on, we set -UNDEBUG on every build under cpp, including fetched dependencies built as subdirectories. In this setup, we only set -UNDEBUG on cuopt targets so that if DEFINE_ASSERT is on we get the assertions in force.

endif(DEFINE_ASSERT)

if(DEFINE_BENCHMARK)
Expand Down Expand Up @@ -184,13 +188,6 @@ 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()


# ##################################################################################################
# - find CPM based dependencies ------------------------------------------------------------------
rapids_cpm_init()
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Loading