Skip to content
Open
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
40 changes: 28 additions & 12 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ rapids_find_package(CUDAToolkit REQUIRED
set(CUOPT_CXX_FLAGS "")
set(CUOPT_CUDA_FLAGS "")

list(APPEND CUOPT_CXX_FLAGS -Werror=unused-parameter -Werror=unused-variable)

if (CMAKE_COMPILER_IS_GNUCXX)
list(APPEND CUOPT_CXX_FLAGS -Werror -Wno-error=deprecated-declarations)
endif (CMAKE_COMPILER_IS_GNUCXX)
Expand Down Expand Up @@ -180,11 +182,11 @@ message("-- Host target architecture = '${CMAKE_SYSTEM_PROCESSOR}'")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr --expt-extended-lambda")
list(APPEND CUOPT_CUDA_FLAGS
--Werror=all-warnings
# Unused declarations are handled in a follow-up change.
--diag-suppress=177
-Werror=cross-execution-space-call
-Wno-deprecated-declarations
-Xcompiler=-Werror
-Xcompiler=-Werror=unused-parameter
-Xcompiler=-Werror=unused-variable
--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 @@ -895,11 +897,19 @@ target_include_directories(cuopt_mathopt PRIVATE
$<$<BOOL:${CUOPT_PARSER_WITH_BZIP2}>:${BZIP2_INCLUDE_DIRS}>
$<$<BOOL:${CUOPT_PARSER_WITH_ZLIB}>:${ZLIB_INCLUDE_DIRS}>
)
# 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_mathopt PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
)
# Clang must keep Papilo ahead of a possible conda installation. GNU can treat the fetched headers
# as system headers so project warning errors do not apply to third-party templates.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_include_directories(cuopt_mathopt PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
)
else ()
target_include_directories(cuopt_mathopt SYSTEM PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
)
endif ()
target_include_directories(cuopt_mathopt SYSTEM PRIVATE
"${pslp_SOURCE_DIR}/include"
"${dejavu_SOURCE_DIR}"
Expand Down Expand Up @@ -970,11 +980,17 @@ target_compile_options(cuopt_objs
# - 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_objs PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_include_directories(cuopt_objs PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
)
else ()
target_include_directories(cuopt_objs SYSTEM PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
)
endif ()

target_include_directories(cuopt_objs SYSTEM PRIVATE
"${pslp_SOURCE_DIR}/include"
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barrier/barrier.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1960,11 +1960,11 @@ class iteration_data_t {

// v = alpha * A * Dinv * A^T * y + beta * v
void gpu_adat_multiply(f_t alpha,
const rmm::device_uvector<f_t>& y,
[[maybe_unused]] const rmm::device_uvector<f_t>& y,
pdlp::cusparse_dn_vec_descr_view cusparse_y,

f_t beta,
rmm::device_uvector<f_t>& v,
[[maybe_unused]] rmm::device_uvector<f_t>& v,
pdlp::cusparse_dn_vec_descr_view cusparse_v,
rmm::device_uvector<f_t>& u,
pdlp::cusparse_dn_vec_descr_view cusparse_u,
Expand Down
7 changes: 5 additions & 2 deletions cpp/src/barrier/sparse_cholesky.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,18 @@ class sparse_cholesky_base_t {
// Use cudaMallocAsync instead of the RMM pool until we reduce our memory footprint/fragmentation.
// TODO: Still use RMM for smaller problems to benefit from their allocation optimizations.
template <typename mem_pool_t>
int cudss_device_alloc(void* ctx, void** ptr, size_t size, cudaStream_t stream)
int cudss_device_alloc([[maybe_unused]] void* ctx, void** ptr, size_t size, cudaStream_t stream)
{
int status = cudaMallocAsync(ptr, size, stream);
if (status != cudaSuccess) { throw raft::cuda_error("Cuda error in cudss_device_alloc"); }
return status;
}

template <typename mem_pool_t>
int cudss_device_dealloc(void* ctx, void* ptr, size_t size, cudaStream_t stream)
int cudss_device_dealloc([[maybe_unused]] void* ctx,
void* ptr,
[[maybe_unused]] size_t size,
cudaStream_t stream)
{
int status = cudaFreeAsync(ptr, stream);
if (status != cudaSuccess) { throw raft::cuda_error("Cuda error in cudss_device_dealloc"); }
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/barrier/sparse_matrix_kernels.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ void initialize_cusparse_data(raft::handle_t const* handle,

template <typename i_t, typename f_t>
void multiply_kernels(raft::handle_t const* handle,
device_csr_matrix_t<i_t, f_t>& A,
device_csc_matrix_t<i_t, f_t>& DAT,
[[maybe_unused]] device_csr_matrix_t<i_t, f_t>& A,
[[maybe_unused]] device_csc_matrix_t<i_t, f_t>& DAT,
device_csr_matrix_t<i_t, f_t>& ADAT,
cusparse_info_t<i_t, f_t>& cusparse_data)
{
Expand Down
50 changes: 22 additions & 28 deletions cpp/src/branch_and_bound/branch_and_bound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,11 +868,10 @@ void branch_and_bound_t<i_t, f_t>::set_final_solution(mip_solution_t<i_t, f_t>&
settings_.heuristic_preemption_callback();
}

f_t user_obj = compute_user_objective(original_lp_, upper_bound_.load());
f_t user_bound = compute_user_objective(original_lp_, lower_bound);
f_t gap = std::abs(user_obj - user_bound);
f_t gap_rel = user_relative_gap(user_obj, user_bound);
bool is_maximization = original_lp_.obj_scale < 0.0;
f_t user_obj = compute_user_objective(original_lp_, upper_bound_.load());
f_t user_bound = compute_user_objective(original_lp_, lower_bound);
f_t gap = std::abs(user_obj - user_bound);
f_t gap_rel = user_relative_gap(user_obj, user_bound);

settings_.log.print_format("Explored {} nodes ({} simplex iterations) in {:.2f}s.",
exploration_stats_.nodes_explored.load(),
Expand Down Expand Up @@ -1137,9 +1136,9 @@ struct nondeterministic_policy_t : tree_update_policy_t<i_t, f_t> {
return bnb.variable_selection(node, fractional, worker);
}

void update_objective_estimate(mip_node_t<i_t, f_t>* node,
const std::vector<i_t>& fractional,
const std::vector<f_t>& x) override
void update_objective_estimate([[maybe_unused]] mip_node_t<i_t, f_t>* node,
[[maybe_unused]] const std::vector<i_t>& fractional,
[[maybe_unused]] const std::vector<f_t>& x) override
{
if (worker->search_strategy == search_strategy_t::BEST_FIRST) {
node->objective_estimate =
Expand Down Expand Up @@ -1342,9 +1341,9 @@ struct deterministic_diving_policy_t
}
}

void update_objective_estimate(mip_node_t<i_t, f_t>* node,
const std::vector<i_t>& fractional,
const std::vector<f_t>& x) override
void update_objective_estimate([[maybe_unused]] mip_node_t<i_t, f_t>* node,
[[maybe_unused]] const std::vector<i_t>& fractional,
[[maybe_unused]] const std::vector<f_t>& x) override
{ /* no-op */
}

Expand Down Expand Up @@ -2375,7 +2374,7 @@ void branch_and_bound_t<i_t, f_t>::solve_submip(diving_worker_t<i_t, f_t>* worke
third_party_presolve_status_t presolver_status =
presolver.apply_to_subproblem(submip_problem, submip_settings, presolve_time_limit, 1);

double presolve_time = toc(start_time);
[[maybe_unused]] double presolve_time = toc(start_time);

if (presolver_status == third_party_presolve_status_t::INFEASIBLE ||
presolver_status == third_party_presolve_status_t::UNBNDORINFEAS ||
Expand Down Expand Up @@ -2410,7 +2409,7 @@ void branch_and_bound_t<i_t, f_t>::solve_submip(diving_worker_t<i_t, f_t>* worke
submip_settings.set_simplex_solution_callback = nullptr;
submip_settings.solution_callback =
[this, &presolver, fixrate, &submip_stats, log_prefix, worker](const std::vector<f_t>& solution,
f_t obj) {
[[maybe_unused]] f_t obj) {
this->set_solution_from_submip(
worker->leaf_problem, solution, presolver, submip_stats, fixrate, log_prefix);
};
Expand Down Expand Up @@ -2498,8 +2497,8 @@ void branch_and_bound_t<i_t, f_t>::solve_submip(diving_worker_t<i_t, f_t>* worke
submip_fj_cpu_worker.run_async(time_limit, work_limit);
}

mip_status_t submip_status = submip_bnb.solve(submip_solution);
f_t submip_time = toc(start_time);
mip_status_t submip_status = submip_bnb.solve(submip_solution);
[[maybe_unused]] f_t submip_time = toc(start_time);

DEBUG_SUBMIP(
"{}Sub-MIP: status={}, iterations={} (total={}), presolve_time={:.2f}, total_time={:.2f} \n",
Expand Down Expand Up @@ -3196,13 +3195,13 @@ lp_status_t branch_and_bound_t<i_t, f_t>::solve_root_relaxation(
std::vector<f_t> crushed_root_y;
std::vector<f_t> crushed_root_z;

f_t dual_res_inf = simplex::crush_dual_solution(original_problem_,
original_lp_,
new_slacks_,
root_crossover_soln_.y,
root_crossover_soln_.z,
crushed_root_y,
crushed_root_z);
[[maybe_unused]] f_t dual_res_inf = simplex::crush_dual_solution(original_problem_,
original_lp_,
new_slacks_,
root_crossover_soln_.y,
root_crossover_soln_.z,
crushed_root_y,
crushed_root_z);

root_crossover_soln_.x = crushed_root_x;
root_crossover_soln_.y = crushed_root_y;
Expand Down Expand Up @@ -4494,7 +4493,7 @@ void branch_and_bound_t<i_t, f_t>::run_deterministic_bfs_loop(
bool is_child = (node->parent == worker.last_solved_node);
worker.recompute_bounds_and_basis = !is_child;

node_status_t status = solve_node_deterministic(worker, node, search_tree);
solve_node_deterministic(worker, node, search_tree);
worker.last_solved_node = node;

worker.current_node = nullptr;
Expand Down Expand Up @@ -4793,11 +4792,6 @@ void branch_and_bound_t<i_t, f_t>::deterministic_process_worker_solutions(

for (const auto* sol : all_solutions) {
if (sol->objective < current_upper) {
f_t user_obj = compute_user_objective(original_lp_, sol->objective);
f_t user_lower = compute_user_objective(original_lp_, deterministic_lower);
i_t nodes_explored = exploration_stats_.nodes_explored.load();
i_t nodes_unexplored = exploration_stats_.nodes_unexplored.load();

search_strategy_t worker_type = get_worker_type(pool, sol->worker_id);
report(original_lp_,
feasible_solution_symbol(worker_type, settings_.diving_settings.show_type),
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/branch_and_bound/pseudo_costs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void strong_branch_helper(i_t start,
f_t start_time,
const lp_problem_t<i_t, f_t>& original_lp,
const simplex_solver_settings_t<i_t, f_t>& settings,
const std::vector<variable_type_t>& var_types,
[[maybe_unused]] const std::vector<variable_type_t>& var_types,
const std::vector<i_t>& fractional,
const std::vector<f_t>& root_soln,
const std::vector<variable_status_t>& root_vstatus,
Expand Down Expand Up @@ -466,21 +466,22 @@ void strong_branch_helper(i_t start,
}

template <typename i_t, typename f_t>
std::pair<f_t, dual_status_t> trial_branching(const lp_problem_t<i_t, f_t>& original_lp,
const simplex_solver_settings_t<i_t, f_t>& settings,
const std::vector<variable_type_t>& var_types,
const std::vector<variable_status_t>& vstatus,
const std::vector<f_t>& edge_norms,
const basis_update_mpf_t<i_t, f_t>& basis_factors,
const std::vector<i_t>& basic_list,
const std::vector<i_t>& nonbasic_list,
i_t branch_var,
f_t branch_var_lower,
f_t branch_var_upper,
f_t upper_bound,
f_t start_time,
i_t iter_limit,
i_t& iter)
std::pair<f_t, dual_status_t> trial_branching(
const lp_problem_t<i_t, f_t>& original_lp,
const simplex_solver_settings_t<i_t, f_t>& settings,
[[maybe_unused]] const std::vector<variable_type_t>& var_types,
const std::vector<variable_status_t>& vstatus,
const std::vector<f_t>& edge_norms,
const basis_update_mpf_t<i_t, f_t>& basis_factors,
const std::vector<i_t>& basic_list,
const std::vector<i_t>& nonbasic_list,
i_t branch_var,
f_t branch_var_lower,
f_t branch_var_upper,
f_t upper_bound,
f_t start_time,
i_t iter_limit,
i_t& iter)
{
lp_problem_t child_problem = original_lp;
child_problem.lower[branch_var] = branch_var_lower;
Expand Down Expand Up @@ -1568,7 +1569,6 @@ i_t pseudo_costs_t<i_t, f_t>::reliable_variable_selection(
const i_t max_threshold = reliability_branching_settings.max_reliable_threshold;
const i_t min_threshold = reliability_branching_settings.min_reliable_threshold;
const f_t iter_factor = reliability_branching_settings.bnb_lp_factor;
const i_t iter_offset = reliability_branching_settings.bnb_lp_offset;
const int64_t alpha = iter_factor * branch_and_bound_lp_iters;
const int64_t max_reliability_iter = alpha + reliability_branching_settings.bnb_lp_offset;

Expand Down Expand Up @@ -1930,7 +1930,7 @@ i_t pseudo_costs_t<i_t, f_t>::reliable_variable_selection(
concurrent_halt.store(1);
}

f_t dual_simplex_elapsed = toc(dual_simplex_start_time);
[[maybe_unused]] f_t dual_simplex_elapsed = toc(dual_simplex_start_time);

if (use_pdlp) {
#pragma omp taskwait // Wait for the batch PDLP task to finish
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/branch_and_bound/symmetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class orbital_fixing_t {
// Returns the number of free variables in conflicting orbits (orbits with
// both zero and one sources).
i_t orbital_fixing(mip_symmetry_t<i_t, f_t>* symmetry,
const simplex::simplex_solver_settings_t<i_t, f_t>& settings,
[[maybe_unused]] const simplex::simplex_solver_settings_t<i_t, f_t>& settings,
mip_node_t<i_t, f_t>* node_ptr,
simplex::lp_problem_t<i_t, f_t>& problem,
const std::vector<f_t>& start_lower,
Expand Down Expand Up @@ -1002,7 +1002,7 @@ std::unique_ptr<mip_symmetry_t<i_t, f_t>> detect_symmetry(
&result,
&projected_count,
&skipped_non_binary,
&max_generators](int n, const int* p, int nsupp, const int* supp) {
&max_generators](int, const int* p, int nsupp, const int* supp) {
// Check if any support element is an original variable
bool moves_variable = false;
for (int s = 0; s < nsupp; s++) {
Expand Down
Loading
Loading