From 3fdfaf84d837a982b2468bd0bc3a6e7416d64edf Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Fri, 18 Sep 2026 15:20:58 -0400 Subject: [PATCH 1/5] Enable compilation errors on unused-parameter and unused-variable --- cpp/CMakeLists.txt | 40 +++-- cpp/src/barrier/barrier.cu | 153 +++++++++--------- cpp/src/barrier/csr_kkt_build.cuh | 8 +- cpp/src/barrier/sparse_cholesky.cuh | 19 ++- cpp/src/barrier/sparse_matrix_kernels.cuh | 4 +- cpp/src/branch_and_bound/branch_and_bound.cpp | 78 +++++---- cpp/src/branch_and_bound/mip_node.hpp | 2 +- cpp/src/branch_and_bound/pseudo_costs.cpp | 44 ++--- cpp/src/branch_and_bound/symmetry.hpp | 4 +- cpp/src/cuts/cuts.cpp | 113 +++++++------ cpp/src/dual_simplex/basis_solves.cpp | 20 +-- cpp/src/dual_simplex/basis_updates.cpp | 74 ++++----- .../bound_flipping_ratio_test.cpp | 30 ++-- cpp/src/dual_simplex/bounds_strengthening.cpp | 8 +- cpp/src/dual_simplex/crossover.cpp | 38 ++--- cpp/src/dual_simplex/folding.cpp | 12 +- cpp/src/dual_simplex/initial_basis.cpp | 2 +- cpp/src/dual_simplex/phase2.cpp | 124 +++++++------- cpp/src/dual_simplex/phase2.hpp | 2 +- cpp/src/dual_simplex/presolve.cpp | 28 ++-- cpp/src/dual_simplex/primal.cpp | 36 ++--- cpp/src/dual_simplex/right_looking_lu.cpp | 14 +- cpp/src/dual_simplex/singletons.cpp | 5 +- cpp/src/dual_simplex/solve.cpp | 13 +- cpp/src/dual_simplex/solve.hpp | 2 +- cpp/src/grpc/client/grpc_client.cpp | 10 +- cpp/src/grpc/client/solve_remote.cpp | 6 +- cpp/src/grpc/server/grpc_job_management.cpp | 26 +-- cpp/src/grpc/server/grpc_server_main.cpp | 2 +- cpp/src/grpc/server/grpc_server_threads.cpp | 26 +-- cpp/src/grpc/server/grpc_service_impl.cpp | 38 ++--- cpp/src/grpc/server/grpc_worker_infra.cpp | 22 +-- .../io/experimental_mps_fast/fast_parser.cpp | 6 +- .../io/experimental_mps_fast/file_reader.hpp | 2 +- .../hash_table_smallstr.hpp | 2 +- .../experimental_mps_fast/lz4_file_reader.cpp | 16 +- .../mps_section_scanner.cpp | 14 +- cpp/src/io/mps_writer.cpp | 1 - cpp/src/io/utilities/error.hpp | 1 - cpp/src/linear_algebra/sort_csr.cuh | 2 +- cpp/src/linear_algebra/sparse_matrix.cpp | 20 ++- cpp/src/linear_algebra/sparse_matrix.hpp | 4 +- cpp/src/linear_algebra/sparse_vector.cpp | 3 +- cpp/src/math_optimization/solution_writer.cu | 2 +- .../diversity/diversity_manager.cu | 25 ++- .../mip_heuristics/diversity/population.cu | 38 ++--- .../recombiners/bound_prop_recombiner.cuh | 10 +- .../diversity/recombiners/fp_recombiner.cuh | 2 +- .../recombiners/line_segment_recombiner.cuh | 4 +- .../diversity/recombiners/sub_mip.cuh | 6 +- .../feasibility_jump/early_gpufj.cu | 2 +- .../feasibility_jump/feasibility_jump.cu | 6 +- .../feasibility_jump/feasibility_jump.cuh | 6 +- .../feasibility_jump_kernels.cu | 6 +- .../mip_heuristics/feasibility_jump/fj_cpu.cu | 76 ++++----- .../feasibility_jump/fj_cpu.cuh | 6 +- .../feasibility_jump/fj_cpu_binary.cu | 8 +- .../fj_cpu_binary_preprocess.cu | 14 +- .../feasibility_jump/load_balancing.cuh | 2 +- .../feasibility_pump/feasibility_pump.cu | 16 +- .../local_search/local_search.cu | 54 +++---- .../local_search/local_search.cuh | 3 - .../local_search/rounding/constraint_prop.cu | 5 +- .../local_search/rounding/constraint_prop.cuh | 2 +- .../rounding/lb_constraint_prop.cu | 2 +- .../local_search/rounding/simple_rounding.cu | 2 +- .../mip_heuristics/mip_scaling_strategy.cu | 2 +- .../presolve/bhw_coeff_reduce.cpp | 2 +- .../presolve/bhw_coeff_reduce.hpp | 3 +- cpp/src/mip_heuristics/presolve/block_bve.cu | 4 +- .../presolve/bounds_presolve.cu | 1 - .../conditional_bound_strengthening.cu | 4 +- .../presolve/conflict_graph/clique_table.cu | 4 +- .../mip_heuristics/presolve/gf2_presolve.cpp | 13 +- .../mip_heuristics/presolve/gf2_presolve.hpp | 7 +- .../presolve/load_balanced_bounds_presolve.cu | 6 +- .../presolve/presolve_budget_policy.hpp | 6 +- .../mip_heuristics/presolve/probing_cache.cu | 9 +- .../presolve/semi_continuous.cu | 7 +- .../presolve/single_lock_dual_aggregation.cpp | 2 +- .../presolve/single_lock_dual_aggregation.hpp | 3 +- .../presolve/third_party_presolve.cpp | 59 +++---- .../mip_heuristics/problem/presolve_data.cu | 6 +- .../mip_heuristics/problem/presolve_data.cuh | 2 +- cpp/src/mip_heuristics/problem/problem.cu | 72 +++++---- .../problem/problem_helpers.cuh | 10 +- .../mip_heuristics/relaxed_lp/relaxed_lp.cu | 2 +- cpp/src/mip_heuristics/root_heuristics.hpp | 6 +- .../mip_heuristics/solution_publication.cuh | 4 +- cpp/src/mip_heuristics/solve.cu | 10 +- .../structural/early_structural.cu | 4 +- .../utilities/work_unit_ordered_queue.cuh | 16 +- cpp/src/pdlp/cpu_optimization_problem.cpp | 2 +- cpp/src/pdlp/cusparse_view.cu | 2 +- .../distributed_algorithms.cu | 25 ++- .../distributed_pdlp/distributed_utils.cu | 6 +- .../distributed_pdlp/distributed_utils.hpp | 3 +- .../pdlp/distributed_pdlp/multi_gpu_engine.cu | 6 +- .../distributed_pdlp/multi_gpu_engine.hpp | 6 +- cpp/src/pdlp/distributed_pdlp/partitioner.cpp | 6 +- cpp/src/pdlp/distributed_pdlp/shard.hpp | 2 +- .../initial_scaling.cu | 10 +- cpp/src/pdlp/optimization_problem.cu | 4 +- cpp/src/pdlp/pdhg.cu | 9 +- cpp/src/pdlp/pdlp.cu | 33 ++-- .../restart_strategy/pdlp_restart_strategy.cu | 37 +++-- cpp/src/pdlp/solve.cu | 33 ++-- cpp/src/pdlp/solver_solution.cu | 2 +- .../adaptive_step_size_strategy.cu | 2 +- .../convergence_information.cu | 21 +-- .../infeasibility_information.cu | 2 +- .../termination_strategy.cu | 2 +- cpp/src/pdlp/translate.hpp | 3 +- cpp/src/pdlp/utilities/cython_solve.cu | 20 +-- cpp/src/routing/adapters/adapted_generator.cu | 4 +- cpp/src/routing/adapters/adapted_modifier.cu | 16 +- cpp/src/routing/adapters/adapted_sol.cuh | 40 ++--- cpp/src/routing/crossovers/dispose.hpp | 2 +- cpp/src/routing/crossovers/eax_recombiner.hpp | 2 +- .../crossovers/inversion_recombiner.hpp | 2 +- .../routing/crossovers/optimal_eax_cycles.cu | 10 +- cpp/src/routing/crossovers/ox_recombiner.cuh | 27 ++-- .../routing/crossovers/srex_recombiner.hpp | 3 +- cpp/src/routing/diversity/diverse_solver.hpp | 32 ++-- cpp/src/routing/diversity/population.hpp | 24 +-- cpp/src/routing/ges/eject_until_feasible.cu | 6 +- cpp/src/routing/ges/execute_insertion.cu | 8 +- cpp/src/routing/ges/execute_insertion.cuh | 1 - cpp/src/routing/ges/guided_ejection_search.cu | 14 +- .../lexicographic_search.cu | 4 +- cpp/src/routing/ges/squeeze.cu | 14 +- cpp/src/routing/ges/squeeze.cuh | 7 +- .../local_search/compute_compatible.cu | 6 +- .../local_search/compute_insertions.cu | 6 +- .../local_search/cycle_finder/cycle_finder.cu | 14 +- .../routing/local_search/fill_gpu_graph.cu | 9 +- .../local_search/hvrp/vehicle_assignment.cu | 2 +- cpp/src/routing/local_search/local_search.cu | 16 +- .../move_candidates/move_candidates.cuh | 9 +- cpp/src/routing/local_search/perform_moves.cu | 6 +- .../routing/local_search/prize_collection.cu | 1 - cpp/src/routing/local_search/random_cross.cu | 2 +- cpp/src/routing/local_search/sliding_tsp.cu | 5 +- .../routing/local_search/sliding_window.cu | 7 +- cpp/src/routing/local_search/two_opt.cu | 2 +- .../local_search/vrp/nodes_to_search.cu | 8 +- .../routing/local_search/vrp/vrp_execute.cu | 6 +- .../routing/local_search/vrp/vrp_search.cu | 6 +- cpp/src/routing/route/break_route.cuh | 4 +- cpp/src/routing/route/capacity_route.cuh | 4 +- cpp/src/routing/route/cost_route.cuh | 4 +- cpp/src/routing/route/dimensions_route.cuh | 4 +- cpp/src/routing/route/pdp_route.cuh | 8 +- cpp/src/routing/route/prize_route.cuh | 4 +- cpp/src/routing/route/route.cuh | 4 +- cpp/src/routing/route/time_route.cuh | 4 +- cpp/src/routing/route/tsp_route.cuh | 4 +- cpp/src/routing/solution/pool_allocator.cuh | 4 +- cpp/src/routing/solution/solution.cu | 60 +++---- cpp/src/routing/solution/solution.cuh | 6 +- cpp/src/routing/solution/solution_handle.cuh | 2 +- cpp/src/routing/solve.cu | 2 +- .../util_kernels/compute_backward_forward.cu | 4 +- .../routing/util_kernels/set_nodes_data.cuh | 2 - cpp/src/routing/utilities/cython.cu | 2 +- cpp/src/utilities/cuda_helpers.cuh | 4 +- cpp/src/utilities/logger.hpp | 12 +- cpp/src/utilities/producer_sync.hpp | 12 +- cpp/tests/CMakeLists.txt | 15 +- .../dual_simplex/unit_tests/solve_barrier.cu | 4 +- cpp/tests/linear_programming/pdlp_test.cu | 65 ++++---- .../unit_tests/presolve_test.cu | 44 ++--- .../utilities/pdlp_test_utilities.cuh | 14 +- cpp/tests/mip/block_bve_test.cu | 4 +- cpp/tests/mip/incumbent_callback_test.cu | 8 +- cpp/tests/mip/mip_utils.cuh | 14 +- cpp/tests/mip/multi_probe_test.cu | 2 +- cpp/tests/mip/unit_test.cu | 16 +- cpp/tests/routing/unit_tests/top_k.cu | 4 +- cpp/tests/routing/utilities/data_model.hpp | 10 +- .../routing/utilities/test_utilities.hpp | 1 - cpp/tests/utilities/base_fixture.hpp | 2 +- 182 files changed, 1243 insertions(+), 1302 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b168df7240..9f8c1fb7a9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -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) @@ -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) @@ -895,11 +897,19 @@ target_include_directories(cuopt_mathopt PRIVATE $<$:${BZIP2_INCLUDE_DIRS}> $<$:${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}" @@ -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" diff --git a/cpp/src/barrier/barrier.cu b/cpp/src/barrier/barrier.cu index f17e53ab98..28d3359003 100644 --- a/cpp/src/barrier/barrier.cu +++ b/cpp/src/barrier/barrier.cu @@ -574,10 +574,10 @@ class iteration_data_t { cone_combined_step_(false), cone_sigma_mu_(f_t(0)) { - raft::common::nvtx::range fun_scope("Barrier: LP Data Creation"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: LP Data Creation"); { - raft::common::nvtx::range scope("Barrier: LP Data: direct free linear"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: direct free linear"); // Setup tracking of direct free variables (linear columns only j < cone_start) n_direct_free_linear = direct_free_variables.size(); std::vector is_direct_free_linear_host(lp.num_cols, 0); @@ -599,7 +599,7 @@ class iteration_data_t { bool has_Q = Q.x.size() > 0; indefinite_Q = false; { - raft::common::nvtx::range scope("Barrier: LP Data: Q setup"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: Q setup"); if (has_Q) { Qdiag.resize(lp.num_cols, 0.0); @@ -640,7 +640,7 @@ class iteration_data_t { } if (!lp.second_order_cone_dims.empty()) { - raft::common::nvtx::range scope("Barrier: LP Data: SOC setup"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: SOC setup"); cone_var_start_ = lp.cone_var_start; i_t total_cone_dim = std::accumulate(lp.second_order_cone_dims.begin(), lp.second_order_cone_dims.end(), i_t(0)); @@ -660,7 +660,7 @@ class iteration_data_t { } { - raft::common::nvtx::range scope("Barrier: LP Data: complementarity buffers"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: complementarity buffers"); const i_t linear_xz_rhs_size = linear_xz_size(lp.num_cols); d_complementarity_xz_rhs_.resize(linear_xz_rhs_size, stream_view_); @@ -679,7 +679,7 @@ class iteration_data_t { } { - raft::common::nvtx::range scope("Barrier: LP Data: upper bounds"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: upper bounds"); // Create the upper bounds vector n_upper_bounds = 0; for (i_t j = 0; j < lp.num_cols; j++) { @@ -692,7 +692,8 @@ class iteration_data_t { std::vector dense_columns_unordered; { - raft::common::nvtx::range scope("Barrier: LP Data: dense columns and augmented"); + [[maybe_unused]] raft::common::nvtx::range scope( + "Barrier: LP Data: dense columns and augmented"); // Decide if we are going to use the augmented system or not n_dense_columns = 0; i_t n_dense_rows = 0; @@ -770,7 +771,7 @@ class iteration_data_t { } { - raft::common::nvtx::range scope("Barrier: LP Data: diag and inv_diag"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: diag and inv_diag"); // D = I + EET diag.set_scalar(1.0); if (n_upper_bounds > 0) { @@ -801,7 +802,7 @@ class iteration_data_t { if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } { - raft::common::nvtx::range scope("Barrier: LP Data: AD matrix setup"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: AD matrix setup"); // Copy A into AD AD = lp.A; if (!use_augmented && n_dense_columns > 0) { @@ -835,7 +836,7 @@ class iteration_data_t { } if (use_augmented) { - raft::common::nvtx::range scope("Barrier: augmented: device CSC upload"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSC upload"); device_A_csc_.copy(A, handle_ptr->get_stream()); device_AT_csc_.copy(AT, handle_ptr->get_stream()); if (Q.n > 0 && Q.col_start[Q.n] > 0) { @@ -848,7 +849,7 @@ class iteration_data_t { // device_AD / device_A / ADAT path is only used when forming ADAT (!use_augmented). if (!use_augmented) { - raft::common::nvtx::range scope("Barrier: LP Data: device AD path"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: device AD path"); device_AD.copy(AD, handle_ptr->get_stream()); d_original_A_values.resize(device_AD.x.size(), handle_ptr->get_stream()); raft::copy(d_original_A_values.data(), @@ -863,7 +864,7 @@ class iteration_data_t { if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } { - raft::common::nvtx::range scope("Barrier: LP Data: Cholesky init"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: Cholesky init"); i_t factorization_size = use_augmented ? augmented_system_size(lp.num_cols, lp.num_rows) : lp.num_rows; chol = std::make_unique>( @@ -872,12 +873,12 @@ class iteration_data_t { } if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } { - raft::common::nvtx::range scope("Barrier: LP Data: symbolic analysis"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: symbolic analysis"); // Perform symbolic analysis symbolic_status = 0; if (use_augmented) { { - raft::common::nvtx::range form_scope("Barrier: LP Data: form augmented"); + [[maybe_unused]] raft::common::nvtx::range form_scope("Barrier: LP Data: form augmented"); // Build the sparsity pattern of the augmented system form_augmented(true); } @@ -885,7 +886,7 @@ class iteration_data_t { symbolic_status = chol->analyze(device_augmented); } else { { - raft::common::nvtx::range form_scope("Barrier: LP Data: form ADAT"); + [[maybe_unused]] raft::common::nvtx::range form_scope("Barrier: LP Data: form ADAT"); form_adat(true); } if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } @@ -904,7 +905,7 @@ class iteration_data_t { settings_ = settings; { - raft::common::nvtx::range fun_scope("Barrier: reset diagonal scaling"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: reset diagonal scaling"); const bool has_Q = Q.n > 0; const bool has_soc = has_cones(); const bool adaptive_reg = should_use_adaptive_regularization(settings, has_soc); @@ -1022,7 +1023,7 @@ class iteration_data_t { i_t factorization_size = augmented_system_size(n, m); if (first_call) { - raft::common::nvtx::range scope("Barrier: augmented: device CSR build"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR build"); const size_t n_sparse_cone_entries = has_soc && p > 0 ? cones().n_sparse_cone_entries : size_t{0}; @@ -1148,19 +1149,19 @@ class iteration_data_t { void form_adat(bool first_call = false) { handle_ptr->sync_stream(); - raft::common::nvtx::range fun_scope("Barrier: Form ADAT"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: Form ADAT"); float64_t start_form_adat = tic(); const i_t m = AD.m; { - raft::common::nvtx::range scope("Barrier: Form ADAT: restore A"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: restore A"); raft::copy(device_AD.x.data(), d_original_A_values.data(), d_original_A_values.size(), handle_ptr->get_stream()); } { - raft::common::nvtx::range scope("Barrier: Form ADAT: inv_diag prime"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: inv_diag prime"); if (n_dense_columns > 0) { // Adjust inv_diag d_inv_diag_prime.resize(AD.n, stream_view_); @@ -1185,7 +1186,7 @@ class iteration_data_t { "inv_diag_prime.size() != AD.n"); { - raft::common::nvtx::range scope("Barrier: Form ADAT: scale AD"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: scale AD"); thrust::for_each_n(rmm::exec_policy(stream_view_), thrust::make_counting_iterator(0), i_t(device_AD.x.size()), @@ -1198,7 +1199,7 @@ class iteration_data_t { } if (settings_.concurrent_halt != nullptr && *settings_.concurrent_halt == 1) { return; } if (first_call) { - raft::common::nvtx::range scope("Barrier: Form ADAT: cusparse init"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: cusparse init"); try { if (!cusparse_info_) { cusparse_info_ = std::make_unique>(handle_ptr); @@ -1213,7 +1214,7 @@ class iteration_data_t { if (settings_.concurrent_halt != nullptr && *settings_.concurrent_halt == 1) { return; } { - raft::common::nvtx::range scope("Barrier: Form ADAT: ADAT multiply"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: ADAT multiply"); multiply_kernels(handle_ptr, device_A, device_AD, device_ADAT, spgemm_info()); handle_ptr->sync_stream(); } @@ -1960,18 +1961,18 @@ class iteration_data_t { // v = alpha * A * Dinv * A^T * y + beta * v void gpu_adat_multiply(f_t alpha, - const rmm::device_uvector& y, + [[maybe_unused]] const rmm::device_uvector& y, pdlp::cusparse_dn_vec_descr_view cusparse_y, f_t beta, - rmm::device_uvector& v, + [[maybe_unused]] rmm::device_uvector& v, pdlp::cusparse_dn_vec_descr_view cusparse_v, rmm::device_uvector& u, pdlp::cusparse_dn_vec_descr_view cusparse_u, cusparse_view_t& cusparse_view, const rmm::device_uvector& d_inv_diag) const { - raft::common::nvtx::range fun_scope("Barrier: gpu_adat_multiply"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: gpu_adat_multiply"); const i_t m = A.m; const i_t n = A.n; @@ -2064,7 +2065,7 @@ class iteration_data_t { f_t beta, rmm::device_uvector& y) { - raft::common::nvtx::range fun_scope("Barrier: augmented_multiply"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: augmented_multiply"); const i_t m = A.m; const i_t n = A.n; const bool has_soc = has_cones(); @@ -2089,7 +2090,8 @@ class iteration_data_t { // r1 <- D * x_1 on linear indices; barrier D is zero on direct free variables const i_t linear_n = has_soc ? cone_start() : n; { - raft::common::nvtx::range scope("Barrier: augmented_multiply: D * x1 (linear)"); + [[maybe_unused]] raft::common::nvtx::range scope( + "Barrier: augmented_multiply: D * x1 (linear)"); pairwise_multiply_skip_direct_free_linear(d_aug_x1_.data(), d_diag_.data(), d_is_direct_free_linear_.data(), @@ -2103,7 +2105,8 @@ class iteration_data_t { // (dense cones: explicit dense H block; sparse cones: rank-2 expansion, which adds // Hs_diag .* x_cone to r1 here and writes the expansion rows into d_aug_y_exp_) if (has_soc) { - raft::common::nvtx::range scope("Barrier: augmented_multiply: cone Hessian (H * x1)"); + [[maybe_unused]] raft::common::nvtx::range scope( + "Barrier: augmented_multiply: cone Hessian (H * x1)"); const i_t m_c = cone_entry_count(); if (cones().has_sparse_cones()) { launch_sparse_augmented_matvec( @@ -2131,13 +2134,14 @@ class iteration_data_t { // r1 <- Q x1 + D x1 + H x1 (cone: same H as above) if (Q.n > 0) { - raft::common::nvtx::range scope("Barrier: augmented_multiply: Q * x1"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented_multiply: Q * x1"); // matrix_vector_multiply(Q, 1.0, x1, 1.0, r1); cusparse_Q_view_.spmv(1.0, d_aug_x1_, 1.0, d_r1_); } { - raft::common::nvtx::range scope("Barrier: augmented_multiply: A products (A^T x2, A x1)"); + [[maybe_unused]] raft::common::nvtx::range scope( + "Barrier: augmented_multiply: A products (A^T x2, A x1)"); // y1 <- - alpha * r1 + beta * y1 // flip the sign of r1 = (Q x1 + D x1 + H x1) axpy(-alpha, d_r1_.data(), beta, d_aug_y1_.data(), d_aug_y1_.data(), n, stream_view_); @@ -2461,7 +2465,7 @@ void barrier_solver_t::create_Q(const lp_problem_t& lp, template int barrier_solver_t::initial_point(iteration_data_t& data) { - raft::common::nvtx::range fun_scope("Barrier: initial_point"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: initial_point"); const bool use_augmented = data.use_augmented; const bool has_direct_free_linear = data.n_direct_free_linear > 0; @@ -2804,7 +2808,7 @@ void barrier_solver_t::gpu_compute_residuals(const rmm::device_uvector const rmm::device_uvector& d_z, iteration_data_t& data) { - raft::common::nvtx::range fun_scope("Barrier: GPU compute_residuals"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: GPU compute_residuals"); data.d_primal_residual_.resize(lp.num_rows, stream_view_); raft::copy(data.d_primal_residual_.data(), data.d_b_.data(), data.d_b_.size(), stream_view_); @@ -2907,7 +2911,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t(data.d_x_.data() + cone_var_start, m_c); cones.z = raft::device_span(data.d_z_.data() + cone_var_start, m_c); @@ -2959,7 +2963,8 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_tfactorize(data.device_augmented); } @@ -3070,7 +3075,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_tfactorize(data.device_ADAT); } } @@ -3101,7 +3106,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t 0) { @@ -3136,7 +3141,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t( op, data.d_augmented_rhs_, data.d_augmented_soln_, ir_tol); @@ -3209,7 +3214,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t( @@ -3369,7 +3374,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t d_dx_residual_5(lp.num_cols, stream_view_); @@ -3401,7 +3406,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t d_dx_residual_3(lp.num_cols, stream_view_); @@ -3449,7 +3454,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t d_dx_residual_7(data.d_h_, stream_view_); @@ -3478,7 +3483,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t(data.d_dz_.size()); @@ -3502,7 +3507,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t out, @@ -3537,7 +3542,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t d_dv_residual(data.n_upper_bounds, stream_view_); @@ -3586,7 +3591,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t& data template void barrier_solver_t::compute_affine_rhs(iteration_data_t& data) { - raft::common::nvtx::range fun_scope("Barrier: compute_affine_rhs"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_affine_rhs"); const bool has_soc = data.has_cones(); const i_t linear_size = data.linear_xz_size(lp.num_cols); const i_t cone_var_start = data.cone_start(); @@ -3803,7 +3808,7 @@ template void barrier_solver_t::compute_target_mu( iteration_data_t& data, f_t mu, f_t& mu_aff, f_t& sigma, f_t& new_mu) { - raft::common::nvtx::range fun_scope("Barrier: compute_target_mu"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_target_mu"); const bool has_soc = data.has_cones(); const auto [primal_w, dual_v] = @@ -3907,7 +3912,7 @@ void barrier_solver_t::compute_target_mu( template void barrier_solver_t::compute_cc_rhs(iteration_data_t& data, f_t& new_mu) { - raft::common::nvtx::range fun_scope("Barrier: compute_cc_rhs"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_cc_rhs"); const bool has_soc = data.has_cones(); const i_t linear_size = data.linear_xz_size(lp.num_cols); @@ -3959,7 +3964,7 @@ void barrier_solver_t::compute_cc_rhs(iteration_data_t& data template void barrier_solver_t::compute_final_direction(iteration_data_t& data) { - raft::common::nvtx::range fun_scope("Barrier: compute_final_direction"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_final_direction"); // dw = dw_aff + dw_cc // dx = dx_aff + dx_cc @@ -4010,7 +4015,7 @@ void barrier_solver_t::compute_primal_dual_step_length(iteration_data_ f_t& step_primal, f_t& step_dual) { - raft::common::nvtx::range fun_scope("Barrier: compute_primal_dual_step_length"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_primal_dual_step_length"); const bool has_soc = data.has_cones(); f_t max_step_primal = 0.0; @@ -4048,7 +4053,7 @@ void barrier_solver_t::compute_next_iterate(iteration_data_t f_t step_primal, f_t step_dual) { - raft::common::nvtx::range fun_scope("Barrier: compute_next_iterate"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_next_iterate"); cub::DeviceTransform::Transform( cuda::std::make_tuple(data.d_w_.data(), data.d_v_.data(), data.d_dw_.data(), data.d_dv_.data()), @@ -4109,7 +4114,8 @@ void barrier_solver_t::compute_residual_norms_mu_and_objective( f_t& primal_objective, f_t& dual_objective) { - raft::common::nvtx::range fun_scope("Barrier: compute_residual_norms_mu_and_objective"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "Barrier: compute_residual_norms_mu_and_objective"); gpu_compute_residuals(data.d_w_, data.d_x_, data.d_y_, data.d_v_, data.d_z_, data); @@ -4271,7 +4277,7 @@ lp_status_t barrier_solver_t::check_for_suboptimal_solution( f_t& relative_complementarity_residual, lp_solution_t& solution) { - raft::common::nvtx::range fun_scope("Barrier: check_for_suboptimal_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: check_for_suboptimal_solution"); if (relative_primal_residual < settings.barrier_relaxed_feasibility_tol && relative_dual_residual < settings.barrier_relaxed_optimality_tol && relative_complementarity_residual < settings.barrier_relaxed_complementarity_tol && @@ -4499,7 +4505,7 @@ lp_status_t barrier_solver_t::barrier_advanced_solve(f_t start_time, : (data.has_cones() ? 1e-8 : 1e-6); while (iter < iteration_limit) { - raft::common::nvtx::range fun_scope("Barrier: iteration"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: iteration"); if (toc(start_time) > settings.time_limit) { settings.log.printf("Barrier time limit exceeded\n"); @@ -4518,7 +4524,7 @@ lp_status_t barrier_solver_t::barrier_advanced_solve(f_t start_time, i_t status; { - raft::common::nvtx::range fun_scope("Barrier: search_direction (affine)"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: search_direction (affine)"); status = gpu_compute_search_direction(data, dual_perturb, primal_perturb, max_affine_residual); } @@ -4559,7 +4565,8 @@ lp_status_t barrier_solver_t::barrier_advanced_solve(f_t start_time, f_t max_corrector_residual = 0.0; { - raft::common::nvtx::range fun_scope("Barrier: search_direction (corrector)"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "Barrier: search_direction (corrector)"); status = gpu_compute_search_direction(data, dual_perturb, primal_perturb, max_corrector_residual); } @@ -4766,7 +4773,7 @@ lp_status_t barrier_solver_t::solve_with_cache( { settings.log.printf("Barrier solver started at %.2f seconds\n", toc(start_time)); try { - raft::common::nvtx::range fun_scope("Barrier: solve_with_cache"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: solve_with_cache"); i_t n = lp.num_cols; i_t m = lp.num_rows; @@ -4823,7 +4830,7 @@ lp_status_t barrier_solver_t::solve( { settings.log.printf("Barrier solver started at %.2f seconds\n", toc(start_time)); try { - raft::common::nvtx::range fun_scope("Barrier: solve"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: solve"); i_t n = lp.num_cols; i_t m = lp.num_rows; diff --git a/cpp/src/barrier/csr_kkt_build.cuh b/cpp/src/barrier/csr_kkt_build.cuh index 6ade663c2e..f88c0a2661 100644 --- a/cpp/src/barrier/csr_kkt_build.cuh +++ b/cpp/src/barrier/csr_kkt_build.cuh @@ -512,7 +512,7 @@ void build_augmented_csr_metadata(const cone_data_t& cones, cone_kkt_data_t& metadata, cuda::stream_ref stream) { - raft::common::nvtx::range scope("Barrier: augmented: device CSR metadata"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR metadata"); const i_t n_cones = cones.n_cones; const i_t n_dense = cones.n_dense_cones(); const i_t n_sparse = cones.n_sparse_cones; @@ -648,7 +648,7 @@ i_t build_augmented_csr_on_device(i_t n, rmm::device_uvector row_nnz(factorization_size, stream); { - raft::common::nvtx::range scope("Barrier: augmented: device CSR count"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR count"); const size_t grid = raft::ceildiv(factorization_size, augmented_csr_block_size); count_augmented_row_nnz_kernel<<>>( factorization_size, @@ -668,7 +668,7 @@ i_t build_augmented_csr_on_device(i_t n, i_t total_nnz = 0; { - raft::common::nvtx::range scope("Barrier: augmented: device CSR scan"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR scan"); device_augmented.m = factorization_size; device_augmented.n = factorization_size; device_augmented.row_start.resize(static_cast(factorization_size) + 1, stream); @@ -712,7 +712,7 @@ i_t build_augmented_csr_on_device(i_t n, cone_data.dense_cone_diag_csr_indices, std::max(0, n_dense_entries), i_t(-1)); { - raft::common::nvtx::range scope("Barrier: augmented: device CSR fill"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR fill"); auto views = make_cone_kkt_views(cone_data, augmented_diagonal_indices); const size_t grid = raft::ceildiv(factorization_size, augmented_csr_block_size); fill_augmented_csr_row_kernel<<>>( diff --git a/cpp/src/barrier/sparse_cholesky.cuh b/cpp/src/barrier/sparse_cholesky.cuh index 71ba3c0e01..160805698d 100644 --- a/cpp/src/barrier/sparse_cholesky.cuh +++ b/cpp/src/barrier/sparse_cholesky.cuh @@ -116,7 +116,7 @@ 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 -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"); } @@ -124,7 +124,10 @@ int cudss_device_alloc(void* ctx, void** ptr, size_t size, cudaStream_t stream) } template -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"); } @@ -434,7 +437,7 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { i_t analyze(device_csr_matrix_t& Arow) override { - raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze"); #ifdef WRITE_MATRIX_MARKET { @@ -475,12 +478,13 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { } if (!first_factor) { - raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : Destroy"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : Destroy"); CUDSS_CALL_AND_CHECK(cudssMatrixDestroy(A), status, "cudssMatrixDestroy for A"); } { - raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : cudssMatrixCreateCsr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "Barrier: cuDSS Analyze : cudssMatrixCreateCsr"); #if CUDSS_VERSION_MAJOR > 0 || (CUDSS_VERSION_MAJOR == 0 && CUDSS_VERSION_MINOR >= 8) CUDSS_CALL_AND_CHECK( cudssMatrixCreateCsr(&A, @@ -525,7 +529,8 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { f_t start_symbolic_factor; { - raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : CUDSS_PHASE_ANALYSIS"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "Barrier: cuDSS Analyze : CUDSS_PHASE_ANALYSIS"); status = cudssExecute(handle, CUDSS_PHASE_REORDERING, solverConfig, solverData, A, cudss_x, cudss_b); if (settings_.concurrent_halt != nullptr && *settings_.concurrent_halt == 1) { @@ -579,7 +584,7 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { } i_t factorize(device_csr_matrix_t& Arow) override { - raft::common::nvtx::range fun_scope("Factorize: cuDSS"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Factorize: cuDSS"); if (!symbolic_done_ || !A_created) { settings_.log.printf( diff --git a/cpp/src/barrier/sparse_matrix_kernels.cuh b/cpp/src/barrier/sparse_matrix_kernels.cuh index c736e67aa4..1b98c4e9e4 100644 --- a/cpp/src/barrier/sparse_matrix_kernels.cuh +++ b/cpp/src/barrier/sparse_matrix_kernels.cuh @@ -115,8 +115,8 @@ void initialize_cusparse_data(raft::handle_t const* handle, template void multiply_kernels(raft::handle_t const* handle, - device_csr_matrix_t& A, - device_csc_matrix_t& DAT, + [[maybe_unused]] device_csr_matrix_t& A, + [[maybe_unused]] device_csc_matrix_t& DAT, device_csr_matrix_t& ADAT, cusparse_info_t& cusparse_data) { diff --git a/cpp/src/branch_and_bound/branch_and_bound.cpp b/cpp/src/branch_and_bound/branch_and_bound.cpp index a320cc0602..891bfd7270 100644 --- a/cpp/src/branch_and_bound/branch_and_bound.cpp +++ b/cpp/src/branch_and_bound/branch_and_bound.cpp @@ -768,7 +768,7 @@ bool branch_and_bound_t::repair_solution(const std::vector& edge_ template void branch_and_bound_t::repair_heuristic_solutions() { - raft::common::nvtx::range scope("BB::repair_heuristics"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::repair_heuristics"); // Check if there are any solutions to repair std::vector> to_repair; mutex_repair_.lock(); @@ -868,11 +868,10 @@ void branch_and_bound_t::set_final_solution(mip_solution_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(), @@ -1137,9 +1136,9 @@ struct nondeterministic_policy_t : tree_update_policy_t { return bnb.variable_selection(node, fractional, worker); } - void update_objective_estimate(mip_node_t* node, - const std::vector& fractional, - const std::vector& x) override + void update_objective_estimate([[maybe_unused]] mip_node_t* node, + [[maybe_unused]] const std::vector& fractional, + [[maybe_unused]] const std::vector& x) override { if (worker->search_strategy == search_strategy_t::BEST_FIRST) { node->objective_estimate = @@ -1342,9 +1341,9 @@ struct deterministic_diving_policy_t } } - void update_objective_estimate(mip_node_t* node, - const std::vector& fractional, - const std::vector& x) override + void update_objective_estimate([[maybe_unused]] mip_node_t* node, + [[maybe_unused]] const std::vector& fractional, + [[maybe_unused]] const std::vector& x) override { /* no-op */ } @@ -1567,7 +1566,7 @@ dual_status_t branch_and_bound_t::solve_node_lp( logger_t& log, int64_t iter_limit) { - raft::common::nvtx::range scope("BB::solve_node"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::solve_node"); #ifdef DEBUG_BRANCHING i_t num_integer_variables = 0; for (i_t j = 0; j < original_lp_.num_cols; j++) { @@ -2101,7 +2100,7 @@ template void branch_and_bound_t::dive_with(diving_worker_t* worker, const simplex_solver_settings_t& settings) { - raft::common::nvtx::range scope("BB::diving_thread"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::diving_thread"); if (worker->orbital_fixing) { worker->orbital_fixing->disable(); } logger_t log; log.log = false; @@ -2375,7 +2374,7 @@ void branch_and_bound_t::solve_submip(diving_worker_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 || @@ -2410,7 +2409,7 @@ void branch_and_bound_t::solve_submip(diving_worker_t* worke submip_settings.set_simplex_solution_callback = nullptr; submip_settings.solution_callback = [this, &presolver, fixrate, &submip_stats, log_prefix, worker](const std::vector& solution, - f_t obj) { + [[maybe_unused]] f_t obj) { this->set_solution_from_submip( worker->leaf_problem, solution, presolver, submip_stats, fixrate, log_prefix); }; @@ -2498,8 +2497,8 @@ void branch_and_bound_t::solve_submip(diving_worker_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", @@ -2707,7 +2706,7 @@ template void branch_and_bound_t::recursive_submip( diving_worker_t* worker, simplex_solver_settings_t submip_settings) { - raft::common::nvtx::range scope("BB::submip_thread"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::submip_thread"); if (worker->orbital_fixing) { worker->orbital_fixing->disable(); } i_t submip_level = settings_.submip_settings.level + 1; @@ -3196,13 +3195,13 @@ lp_status_t branch_and_bound_t::solve_root_relaxation( std::vector crushed_root_y; std::vector 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; @@ -3624,7 +3623,7 @@ auto branch_and_bound_t::do_cut_pass( template mip_status_t branch_and_bound_t::solve(mip_solution_t& solution) { - raft::common::nvtx::range scope("BB::solve"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::solve"); logger_t log; log.log = false; @@ -3643,7 +3642,7 @@ mip_status_t branch_and_bound_t::solve(mip_solution_t& solut original_lp_, settings_, var_types_, Arow_, new_slacks_); if (guess_.size() != 0) { - raft::common::nvtx::range scope_guess("BB::check_initial_guess"); + [[maybe_unused]] raft::common::nvtx::range scope_guess("BB::check_initial_guess"); std::vector crushed_guess; crush_primal_solution(original_problem_, original_lp_, guess_, new_slacks_, crushed_guess); f_t primal_err; @@ -3973,7 +3972,7 @@ mip_status_t branch_and_bound_t::solve(mip_solution_t& solut pc_.Arow = Arow_; if (!has_initial_pseudocost_) { - raft::common::nvtx::range scope_sb("BB::strong_branching"); + [[maybe_unused]] raft::common::nvtx::range scope_sb("BB::strong_branching"); strong_branching(original_lp_, settings_, exploration_stats_.start_time, @@ -4303,7 +4302,7 @@ global pseudocosts are broadcast to the worker's pseudocost snapshots for the co template void branch_and_bound_t::run_deterministic_coordinator(const csr_matrix_t& Arow) { - raft::common::nvtx::range scope("BB::deterministic_coordinator"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::deterministic_coordinator"); deterministic_horizon_step_ = 0.50; @@ -4473,7 +4472,7 @@ template void branch_and_bound_t::run_deterministic_bfs_loop( deterministic_bfs_worker_t& worker, search_tree_t& search_tree) { - raft::common::nvtx::range scope("BB::worker_loop"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::worker_loop"); while (deterministic_global_termination_status_ == mip_status_t::UNSET) { if (worker.has_work()) { @@ -4494,7 +4493,7 @@ void branch_and_bound_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; @@ -4511,7 +4510,7 @@ void branch_and_bound_t::run_deterministic_bfs_loop( template void branch_and_bound_t::deterministic_sync_callback() { - raft::common::nvtx::range scope("BB::deterministic_sync_callback"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::deterministic_sync_callback"); ++deterministic_horizon_number_; double horizon_end = deterministic_current_horizon_; @@ -4668,7 +4667,7 @@ node_status_t branch_and_bound_t::solve_node_deterministic( mip_node_t* node_ptr, search_tree_t& search_tree) { - raft::common::nvtx::range scope("BB::solve_node_deterministic"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::solve_node_deterministic"); double work_units_at_start = worker.work_context.global_work_units_elapsed; @@ -4697,7 +4696,7 @@ node_status_t branch_and_bound_t::solve_node_deterministic( bool feasible = true; #ifndef DETERMINISM_DISABLE_BOUNDS_STRENGTHENING - raft::common::nvtx::range scope_bs("BB::bound_strengthening"); + [[maybe_unused]] raft::common::nvtx::range scope_bs("BB::bound_strengthening"); feasible = worker.node_presolver.bounds_strengthening( lp_settings, worker.bounds_changed, worker.leaf_problem.lower, worker.leaf_problem.upper); @@ -4793,11 +4792,6 @@ void branch_and_bound_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), @@ -5237,7 +5231,7 @@ template void branch_and_bound_t::run_deterministic_diving_loop( deterministic_diving_worker_t& worker) { - raft::common::nvtx::range scope("BB::diving_worker_loop"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::diving_worker_loop"); while (deterministic_global_termination_status_ == mip_status_t::UNSET) { // Process dives from queue until empty or horizon exhausted @@ -5259,7 +5253,7 @@ template void branch_and_bound_t::deterministic_dive( deterministic_diving_worker_t& worker, dive_queue_entry_t entry) { - raft::common::nvtx::range scope("BB::deterministic_dive"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::deterministic_dive"); worker.dive_lower = std::move(entry.resolved_lower); worker.dive_upper = std::move(entry.resolved_upper); diff --git a/cpp/src/branch_and_bound/mip_node.hpp b/cpp/src/branch_and_bound/mip_node.hpp index 3e291124c3..be5a47c8aa 100644 --- a/cpp/src/branch_and_bound/mip_node.hpp +++ b/cpp/src/branch_and_bound/mip_node.hpp @@ -376,7 +376,7 @@ class search_tree_t { void update(mip_node_t* node_ptr, node_status_t status) { - std::lock_guard lock(mutex); + [[maybe_unused]] std::lock_guard lock(mutex); std::vector*> stack; node_ptr->set_status(status, stack); remove_fathomed_nodes(stack); diff --git a/cpp/src/branch_and_bound/pseudo_costs.cpp b/cpp/src/branch_and_bound/pseudo_costs.cpp index c4071bf3b8..362f874a51 100644 --- a/cpp/src/branch_and_bound/pseudo_costs.cpp +++ b/cpp/src/branch_and_bound/pseudo_costs.cpp @@ -305,7 +305,7 @@ void strong_branch_helper(i_t start, f_t start_time, const lp_problem_t& original_lp, const simplex_solver_settings_t& settings, - const std::vector& var_types, + [[maybe_unused]] const std::vector& var_types, const std::vector& fractional, const std::vector& root_soln, const std::vector& root_vstatus, @@ -322,7 +322,7 @@ void strong_branch_helper(i_t start, shared_strong_branching_context_view_t& sb_view, omp_atomic_t& num_strong_branches_completed) { - raft::common::nvtx::range scope("BB::strong_branch_helper"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::strong_branch_helper"); lp_problem_t child_problem = original_lp; constexpr bool verbose = false; @@ -466,21 +466,22 @@ void strong_branch_helper(i_t start, } template -std::pair trial_branching(const lp_problem_t& original_lp, - const simplex_solver_settings_t& settings, - const std::vector& var_types, - const std::vector& vstatus, - const std::vector& edge_norms, - const basis_update_mpf_t& basis_factors, - const std::vector& basic_list, - const std::vector& 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 trial_branching( + const lp_problem_t& original_lp, + const simplex_solver_settings_t& settings, + [[maybe_unused]] const std::vector& var_types, + const std::vector& vstatus, + const std::vector& edge_norms, + const basis_update_mpf_t& basis_factors, + const std::vector& basic_list, + const std::vector& 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; @@ -1026,7 +1027,7 @@ void strong_branching_reduced(const lp_problem_t& original_lp, std::vector& strong_branch_up, pseudo_costs_t& pc) { - raft::common::nvtx::range scope("BB::strong_branching"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::strong_branching"); pc.resize(original_lp.num_cols); strong_branch_down.assign(fractional.size(), std::numeric_limits::quiet_NaN()); @@ -1508,7 +1509,7 @@ template i_t pseudo_costs_t::variable_selection(const std::vector& fractional, const std::vector& solution) { - raft::common::nvtx::range scope("BB::pseudocost_branching"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::pseudocost_branching"); i_t branch_var = fractional[0]; f_t max_score = -1; @@ -1546,7 +1547,7 @@ i_t pseudo_costs_t::reliable_variable_selection( const std::vector& new_slacks, const lp_problem_t& original_lp) { - raft::common::nvtx::range scope("BB::reliability_branching"); + [[maybe_unused]] raft::common::nvtx::range scope("BB::reliability_branching"); constexpr f_t eps = 1e-6; f_t start_time = bnb_stats.start_time; @@ -1568,7 +1569,6 @@ i_t pseudo_costs_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; @@ -1930,7 +1930,7 @@ i_t pseudo_costs_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 diff --git a/cpp/src/branch_and_bound/symmetry.hpp b/cpp/src/branch_and_bound/symmetry.hpp index 64ecbd6fd6..ec765baa52 100644 --- a/cpp/src/branch_and_bound/symmetry.hpp +++ b/cpp/src/branch_and_bound/symmetry.hpp @@ -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* symmetry, - const simplex::simplex_solver_settings_t& settings, + [[maybe_unused]] const simplex::simplex_solver_settings_t& settings, mip_node_t* node_ptr, simplex::lp_problem_t& problem, const std::vector& start_lower, @@ -1002,7 +1002,7 @@ std::unique_ptr> 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++) { diff --git a/cpp/src/cuts/cuts.cpp b/cpp/src/cuts/cuts.cpp index e9f51666dc..f71a906515 100644 --- a/cpp/src/cuts/cuts.cpp +++ b/cpp/src/cuts/cuts.cpp @@ -77,18 +77,19 @@ enum class clique_cut_build_status_t : int8_t { NO_CUT = 0, CUT_ADDED = 1, INFEA #endif template -clique_cut_build_status_t build_clique_cut(const std::vector& clique_vertices, - i_t num_vars, - const std::vector& var_types, - [[maybe_unused]] const std::vector& lower_bounds, - [[maybe_unused]] const std::vector& upper_bounds, - const std::vector& xstar, - f_t bound_tol, - f_t min_violation, - sparse_vector_t& cut, - f_t& cut_rhs, - f_t* work_estimate, - f_t max_work_estimate) +clique_cut_build_status_t build_clique_cut( + const std::vector& clique_vertices, + i_t num_vars, + [[maybe_unused]] const std::vector& var_types, + [[maybe_unused]] const std::vector& lower_bounds, + [[maybe_unused]] const std::vector& upper_bounds, + const std::vector& xstar, + [[maybe_unused]] f_t bound_tol, + f_t min_violation, + sparse_vector_t& cut, + f_t& cut_rhs, + f_t* work_estimate, + f_t max_work_estimate) { if (clique_vertices.size() < 2) { return clique_cut_build_status_t::NO_CUT; } const f_t clique_size = static_cast(clique_vertices.size()); @@ -545,19 +546,20 @@ void extend_clique_vertices(std::vector& clique_vertices, // are extra vertices each adjacent to every vertex in cycle_vertices. The // resulting cut is stored in the form a^T x >= rhs to match cut_pool_t. template -clique_cut_build_status_t build_zero_half_cut(const std::vector& cycle_vertices, - const std::vector& wheel_centers, - i_t num_vars, - const std::vector& var_types, - const std::vector& lower_bounds, - const std::vector& upper_bounds, - const std::vector& xstar, - f_t bound_tol, - f_t min_violation, - sparse_vector_t& cut, - f_t& cut_rhs, - f_t* work_estimate, - f_t max_work_estimate) +clique_cut_build_status_t build_zero_half_cut( + const std::vector& cycle_vertices, + const std::vector& wheel_centers, + i_t num_vars, + [[maybe_unused]] const std::vector& var_types, + const std::vector& lower_bounds, + const std::vector& upper_bounds, + const std::vector& xstar, + [[maybe_unused]] f_t bound_tol, + f_t min_violation, + sparse_vector_t& cut, + f_t& cut_rhs, + f_t* work_estimate, + f_t max_work_estimate) { const size_t cycle_size = cycle_vertices.size(); if (cycle_size < 5 || (cycle_size % 2) == 0) { @@ -596,8 +598,9 @@ clique_cut_build_status_t build_zero_half_cut(const std::vector& cycle_vert f_t rhs_acc = -f_m; - auto accumulate = - [&](const std::vector& verts, f_t weight, bool is_cycle) -> clique_cut_build_status_t { + auto accumulate = [&](const std::vector& verts, + f_t weight, + [[maybe_unused]] bool is_cycle) -> clique_cut_build_status_t { ZERO_HALF_DEBUG("build_zero_half_cut accumulate verts.size=%zu weight=%g is_cycle=%d", verts.size(), static_cast(weight), @@ -607,10 +610,10 @@ clique_cut_build_status_t build_zero_half_cut(const std::vector& cycle_vert static_cast(vertex_idx), static_cast(2 * num_vars)); cuopt_assert(vertex_idx >= 0 && vertex_idx < 2 * num_vars, "Zero-half vertex out of range"); - const i_t var_idx = vertex_idx % num_vars; - const bool complement = vertex_idx >= num_vars; - const f_t lower_bound = lower_bounds[var_idx]; - const f_t upper_bound = upper_bounds[var_idx]; + const i_t var_idx = vertex_idx % num_vars; + const bool complement = vertex_idx >= num_vars; + [[maybe_unused]] const f_t lower_bound = lower_bounds[var_idx]; + [[maybe_unused]] const f_t upper_bound = upper_bounds[var_idx]; cuopt_assert(var_types[var_idx] != variable_type_t::CONTINUOUS, "Zero-half cut contains continuous variable"); cuopt_assert(lower_bound >= -bound_tol, "Zero-half variable lower bound below zero"); @@ -2028,7 +2031,9 @@ bool flow_cover_generation_t::separate_single_node_flow_cover( template flow_cover_evaluation_t flow_cover_generation_t::evaluate_c_mir_flow_cover_inequality( - const flow_cover_context_t& context, f_t single_node_flow_b, f_t lambda) + [[maybe_unused]] const flow_cover_context_t& context, + f_t single_node_flow_b, + f_t lambda) { auto& scratch = *this; constexpr f_t min_mir_beta_fraction = 0.01; @@ -2135,7 +2140,9 @@ flow_cover_generation_t::evaluate_c_mir_flow_cover_inequality( template flow_cover_evaluation_t flow_cover_generation_t::evaluate_simple_generalized_flow_cover_inequality( - const flow_cover_context_t& context, f_t single_node_flow_b, f_t lambda) + [[maybe_unused]] const flow_cover_context_t& context, + f_t single_node_flow_b, + f_t lambda) { auto& scratch = *this; const f_t min_violation = static_cast(1e-6); @@ -2331,7 +2338,7 @@ i_t knapsack_generation_t::generate_knapsack_cut( const lp_problem_t& lp, const simplex_solver_settings_t& settings, csr_matrix_t& Arow, - const std::vector& new_slacks, + [[maybe_unused]] const std::vector& new_slacks, const std::vector& var_types, const std::vector& xstar, i_t knapsack_row, @@ -2690,8 +2697,8 @@ template void knapsack_generation_t::lift_knapsack_cut( const inequality_t& knapsack_inequality, const inequality_t& base_cut, - const std::vector& c1_partition, - const std::vector& c2_partition, + [[maybe_unused]] const std::vector& c1_partition, + [[maybe_unused]] const std::vector& c2_partition, inequality_t& lifted_cut, f_t start_time) { @@ -4099,8 +4106,6 @@ void cut_generation_t::generate_mir_cuts( variable_bounds_t& variable_bounds, f_t start_time) { - f_t mir_start_time = tic(); - constexpr bool verbose = false; complemented_mixed_integer_rounding_cut_t complemented_mir(lp, settings, new_slacks); strong_cg_cut_t cg(lp, var_types, xstar); @@ -4139,9 +4144,7 @@ void cut_generation_t::generate_mir_cuts( aggregated_mark[i] = 1; aggregated_rows.push_back(i); - const i_t row_nz = Arow.row_length(i); - const i_t slack = complemented_mir.slack_cols(i); - const f_t slack_value = xstar[slack]; + const i_t slack = complemented_mir.slack_cols(i); if (max_score <= 0.0) { break; } if (work_estimate > 2e9) { break; } @@ -4377,7 +4380,6 @@ void cut_generation_t::generate_gomory_cuts( f_t start_time) { tableau_equality_t tableau(lp, basis_update, nonbasic_list); - mixed_integer_gomory_cut_t gomory_cut; complemented_mixed_integer_rounding_cut_t complemented_mir(lp, settings, new_slacks); simplex_solver_settings_t variable_settings = settings; variable_settings.inside_submip = 1; @@ -4504,7 +4506,7 @@ i_t tableau_equality_t::generate_base_equality( basis_update_mpf_t& basis_update, const std::vector& xstar, const std::vector& basic_list, - const std::vector& nonbasic_list, + [[maybe_unused]] const std::vector& nonbasic_list, i_t i, inequality_t& inequality) { @@ -4728,9 +4730,9 @@ variable_bounds_t::variable_bounds_t(const lp_problem_t& lp, slack_map_.resize(lp.num_rows, -1); std::vector slack_coeff(lp.num_rows, 0.0); for (i_t j : new_slacks) { - const i_t col_start = lp.A.col_start[j]; - const i_t col_end = lp.A.col_start[j + 1]; - const i_t col_len = col_end - col_start; + const i_t col_start = lp.A.col_start[j]; + const i_t col_end = lp.A.col_start[j + 1]; + [[maybe_unused]] const i_t col_len = col_end - col_start; assert(col_len == 1); const i_t i = lp.A.i[col_start]; slack_map_[i] = j; @@ -4992,7 +4994,7 @@ variable_bounds_t::variable_bounds_t(const lp_problem_t& lp, template complemented_mixed_integer_rounding_cut_t::complemented_mixed_integer_rounding_cut_t( const lp_problem_t& lp, - const simplex_solver_settings_t& settings, + [[maybe_unused]] const simplex_solver_settings_t& settings, const std::vector& new_slacks) : is_slack_(lp.num_cols, 0), slack_rows_(lp.num_cols, -1), @@ -5092,7 +5094,6 @@ bool complemented_mixed_integer_rounding_cut_t::cut_generation_heurist const f_t x_j = transformed_xstar[j]; const f_t new_upper_j = new_upper(j); const f_t dist_upper = new_upper_j - x_j; - const f_t dist_lower = x_j; const bool between_bounds = x_j > 1e-6 && (new_upper_j == inf || dist_upper > 0.0); if (between_bounds && abs_aj > 1e-6) { deltas_to_try.push_back(abs_aj); } } @@ -5276,7 +5277,7 @@ bool complemented_mixed_integer_rounding_cut_t::cut_generation_heurist template bool complemented_mixed_integer_rounding_cut_t::scale_uncomplement_and_generate_cut( const std::vector& var_types, - const std::vector& transformed_xstar, + [[maybe_unused]] const std::vector& transformed_xstar, const std::vector& complemented_indices, const inequality_t& complemented_inequality, f_t delta, @@ -5316,8 +5317,7 @@ void complemented_mixed_integer_rounding_cut_t::remove_small_coefficie const std::vector& upper_bounds, inequality_t& cut) { - const i_t nz = cut.size(); - i_t removed = 0; + i_t removed = 0; for (i_t k = 0; k < cut.size(); k++) { const i_t j = cut.index(k); @@ -5755,7 +5755,6 @@ void complemented_mixed_integer_rounding_cut_t::substitute_slacks( // Remove slacks from the cut // So that the cut is only over the original variables bool found_slack = false; - i_t cut_nz = 0; std::vector cut_indices; cut_indices.reserve(cut.size()); if (work_estimate != nullptr) { *work_estimate += cut.size(); } @@ -5836,8 +5835,8 @@ void complemented_mixed_integer_rounding_cut_t::substitute_slacks( template f_t complemented_mixed_integer_rounding_cut_t::combine_rows( - const lp_problem_t& lp, - csr_matrix_t& Arow, + [[maybe_unused]] const lp_problem_t& lp, + [[maybe_unused]] csr_matrix_t& Arow, i_t xj, const inequality_t& pivot_row, inequality_t& inequality) @@ -5926,7 +5925,7 @@ strong_cg_cut_t::strong_cg_cut_t(const lp_problem_t& lp, template i_t strong_cg_cut_t::remove_continuous_variables_integers_nonnegative( const lp_problem_t& lp, - const simplex_solver_settings_t& settings, + [[maybe_unused]] const simplex_solver_settings_t& settings, const std::vector& var_types, inequality_t& inequality) { @@ -6043,7 +6042,7 @@ void strong_cg_cut_t::to_original_integer_variables(const lp_problem_t template i_t strong_cg_cut_t::generate_strong_cg_cut_integer_only( - const simplex_solver_settings_t& settings, + [[maybe_unused]] const simplex_solver_settings_t& settings, const std::vector& var_types, const inequality_t& inequality, inequality_t& cut) @@ -6226,7 +6225,7 @@ i_t add_cuts(const simplex_solver_settings_t& settings, lp_solution_t& solution, basis_update_mpf_t& basis_update, std::vector& basic_list, - std::vector& nonbasic_list, + [[maybe_unused]] std::vector& nonbasic_list, std::vector& vstatus, std::vector& edge_norms) diff --git a/cpp/src/dual_simplex/basis_solves.cpp b/cpp/src/dual_simplex/basis_solves.cpp index 66541c60ff..3ba98a6003 100644 --- a/cpp/src/dual_simplex/basis_solves.cpp +++ b/cpp/src/dual_simplex/basis_solves.cpp @@ -30,7 +30,7 @@ i_t reorder_basic_list(const std::vector& q, std::vector& basic_list) } template -void get_basis_from_vstatus(i_t m, +void get_basis_from_vstatus([[maybe_unused]] i_t m, const std::vector& vstatus, std::vector& basis_list, std::vector& nonbasic_list, @@ -54,7 +54,7 @@ void get_basis_from_vstatus(i_t m, superbasic_list.push_back(j); } } - i_t num_super_basic = superbasic_list.size(); + [[maybe_unused]] i_t num_super_basic = superbasic_list.size(); assert(num_basic == m); } @@ -170,7 +170,7 @@ i_t factorize_basis(const csc_matrix_t& A, std::vector& slacks_needed, f_t& work_estimate) { - raft::common::nvtx::range scope("LU::factorize_basis"); + [[maybe_unused]] raft::common::nvtx::range scope("LU::factorize_basis"); const i_t m = basic_list.size(); constexpr f_t medium_tol = 1e-12; @@ -178,7 +178,7 @@ i_t factorize_basis(const csc_matrix_t& A, constexpr bool verbose = false; if (eliminate_singletons) { // TODO: We should see if we can find the singletons without explictly forming the matrix B - f_t fact_start = tic(); + [[maybe_unused]] f_t fact_start = tic(); csc_matrix_t B(A.m, A.m, 1); work_estimate += A.m; form_b(A, basic_list, B, work_estimate); @@ -558,7 +558,7 @@ i_t factorize_basis(const csc_matrix_t& A, // Check the diagonal entries of U for (i_t k = 0; k < m; ++k) { - const i_t col_end = U.col_start[k + 1] - 1; + [[maybe_unused]] const i_t col_end = U.col_start[k + 1] - 1; assert(U.i[col_end] == k); } @@ -677,7 +677,7 @@ i_t factorize_basis(const csc_matrix_t& A, template i_t basis_repair(const csc_matrix_t& A, - const simplex_solver_settings_t& settings, + [[maybe_unused]] const simplex_solver_settings_t& settings, const std::vector& lower, const std::vector& upper, const std::vector& deficient, @@ -779,8 +779,8 @@ i_t form_b(const csc_matrix_t& A, work_estimate += 3 * m; B.reallocate(Bnz); work_estimate += 2 * Bnz; - const i_t Bnz_check = Bnz; - Bnz = 0; + [[maybe_unused]] const i_t Bnz_check = Bnz; + Bnz = 0; for (i_t k = 0; k < m; ++k) { B.col_start[k] = Bnz; const i_t j = basic_list[k]; @@ -858,7 +858,7 @@ i_t b_transpose_solve(const csc_matrix_t& L, // U'*r = c // L'*w = r - raft::common::nvtx::range scope("LU::b_transpose_solve"); + [[maybe_unused]] raft::common::nvtx::range scope("LU::b_transpose_solve"); f_t work_estimate = 0; // Solve for r such that U'*r = c @@ -898,7 +898,7 @@ i_t b_solve(const csc_matrix_t& L, const std::vector& rhs, std::vector& solution) { - const i_t m = L.m; + [[maybe_unused]] const i_t m = L.m; assert(p.size() == m); assert(rhs.size() == m); assert(solution.size() == m); diff --git a/cpp/src/dual_simplex/basis_updates.cpp b/cpp/src/dual_simplex/basis_updates.cpp index f81962d054..b6ac6d8043 100644 --- a/cpp/src/dual_simplex/basis_updates.cpp +++ b/cpp/src/dual_simplex/basis_updates.cpp @@ -36,8 +36,8 @@ i_t basis_update_t::b_solve(const std::vector& rhs, std::vector& solution, std::vector& Lsol) const { - raft::common::nvtx::range scope("LU::b_solve"); - const i_t m = L0_.m; + [[maybe_unused]] raft::common::nvtx::range scope("LU::b_solve"); + [[maybe_unused]] const i_t m = L0_.m; assert(row_permutation_.size() == m); assert(rhs.size() == m); assert(solution.size() == m); @@ -62,7 +62,7 @@ i_t basis_update_t::b_solve(const sparse_vector_t& rhs, sparse_vector_t& solution, sparse_vector_t& Lsol) const { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; assert(row_permutation_.size() == m); assert(rhs.n == m); assert(solution.n == m); @@ -88,7 +88,7 @@ template i_t basis_update_t::b_transpose_solve(const std::vector& rhs, std::vector& solution) const { - raft::common::nvtx::range scope("LU::b_transpose_solve"); + [[maybe_unused]] raft::common::nvtx::range scope("LU::b_transpose_solve"); // Observe that // P*B = L*U // B'*P' = U'*L' @@ -100,7 +100,7 @@ i_t basis_update_t::b_transpose_solve(const std::vector& rhs, // 2. Solve L'*w = r for w // 3. Compute y = P'*w - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; assert(rhs.size() == m); assert(row_permutation_.size() == m); assert(solution.size() == m); @@ -132,7 +132,7 @@ i_t basis_update_t::b_transpose_solve(const sparse_vector_t& // 2. Solve L'*w = r for w // 3. Compute y = P'*w - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; assert(rhs.n == m); assert(solution.n == m); @@ -274,7 +274,7 @@ i_t basis_update_t::l_solve(sparse_vector_t& rhs) const // First solve // L0*x0 = b - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; f_t work_estimate = 0; i_t top = sparse_triangle_solve( @@ -360,7 +360,7 @@ i_t basis_update_t::l_transpose_solve(std::vector& rhs) const // L' = Rk^{-T} * Rk-1^{-T} * ... * R2^{-T} * R1^{-T} * L0^T // L'*y = c // Rk^{-T}* Rk-1^{-T} * ... * R2^{-T} * R1^{-T} * L0^T * y = c - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; for (i_t k = num_updates_ - 1; k >= 0; --k) { const i_t r = pivot_indices_[k]; assert(r < m); @@ -554,7 +554,7 @@ i_t basis_update_t::u_solve(std::vector& x) const // 1. Compute bprime = Q'*b // 2. Solve for y such that U*y = bprime // 3. Compute Q*y = x - const i_t m = U_.m; + [[maybe_unused]] const i_t m = U_.m; std::vector bprime(m); inverse_permute_vector(col_permutation_, x, bprime); @@ -625,7 +625,7 @@ i_t basis_update_t::u_transpose_solve(sparse_vector_t& rhs) // 1. Compute bprime = Q'*b // 2. Solve for y such that U'*y = bprime // 3. Compute Q*y = x - const i_t m = U_.m; + [[maybe_unused]] const i_t m = U_.m; sparse_vector_t bprime(1, 0); #ifdef CHECK_PERMUTATION std::vector rhs_dense(m); @@ -1278,8 +1278,8 @@ i_t basis_update_mpf_t::append_cuts(const csr_matrix_t& cuts i_t L_nz = L0_.col_start[m]; csc_matrix_t new_L(m + cuts_basic.m, m + cuts_basic.m, L_nz + V_nz + cuts_basic.m); work_estimate_ += (L_nz + V_nz + cuts_basic.m) + (m + cuts_basic.m); - i_t predicted_nz = L_nz + V_nz + cuts_basic.m; - L_nz = 0; + [[maybe_unused]] i_t predicted_nz = L_nz + V_nz + cuts_basic.m; + L_nz = 0; for (i_t j = 0; j < m; ++j) { new_L.col_start[j] = L_nz; const i_t col_start = L0_.col_start[j]; @@ -1355,7 +1355,7 @@ template void basis_update_mpf_t::gather_into_sparse_vector(i_t nz, sparse_vector_t& out) const { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; out.i.clear(); out.x.clear(); out.i.reserve(nz); @@ -1379,8 +1379,8 @@ void basis_update_mpf_t::gather_into_sparse_vector(i_t nz, template void basis_update_mpf_t::solve_to_workspace(i_t top) const { - const i_t m = L0_.m; - i_t nz = 0; + [[maybe_unused]] const i_t m = L0_.m; + i_t nz = 0; for (i_t p = top; p < m; ++p) { const i_t i = xi_workspace_[p]; xi_workspace_[m + nz] = i; @@ -1425,7 +1425,7 @@ void basis_update_mpf_t::solve_to_sparse_vector(i_t top, template i_t basis_update_mpf_t::scatter_into_workspace(const sparse_vector_t& in) const { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // scatter pattern into xi_workspace_ i_t nz = in.i.size(); for (i_t k = 0; k < nz; ++k) { @@ -1565,7 +1565,7 @@ i_t basis_update_mpf_t::b_transpose_solve(const std::vector& rhs, std::vector& solution, std::vector& UTsol) const { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // P*B = L*U // B'*P' = U'*L' // We want to solve @@ -1736,7 +1736,7 @@ template i_t basis_update_mpf_t::l_transpose_solve(sparse_vector_t& rhs) const { total_sparse_L_transpose_++; - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // L'*x = b // L0^T * x = T_0^-T * T_1^-T * ... * T_{num_updates_ - 1}^-T * b = b' @@ -1826,7 +1826,7 @@ template i_t basis_update_mpf_t::b_solve(const std::vector& rhs, std::vector& solution) const { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; std::vector Lsol(m); work_estimate_ += m; return b_solve(rhs, solution, Lsol); @@ -1839,7 +1839,7 @@ i_t basis_update_mpf_t::b_solve(const std::vector& rhs, std::vector& Lsol, bool need_Lsol) const { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // P*B = L*U // B*x = b // P*B*x = P*b @@ -1895,8 +1895,8 @@ i_t basis_update_mpf_t::b_solve(const sparse_vector_t& rhs, sparse_vector_t& Lsol, bool need_Lsol) const { - const i_t m = L0_.m; - solution = rhs; + [[maybe_unused]] const i_t m = L0_.m; + solution = rhs; work_estimate_ += 2 * rhs.i.size(); solution.inverse_permute_vector(inverse_row_permutation_); work_estimate_ += 3 * rhs.i.size(); @@ -1989,7 +1989,7 @@ template i_t basis_update_mpf_t::u_solve(std::vector& rhs) const { total_dense_U_++; - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // U*x = y simplex::upper_triangular_solve(U0_, rhs, work_estimate_); return 0; @@ -1999,7 +1999,7 @@ template i_t basis_update_mpf_t::u_solve(sparse_vector_t& rhs) const { total_sparse_U_++; - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // U*x = y // Solve U0*x = y @@ -2014,7 +2014,7 @@ template i_t basis_update_mpf_t::l_solve(std::vector& rhs) const { total_dense_L_++; - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; // L*x = y // L0 * T0 * T1 * ... * T_{num_updates_ - 1} * x = y @@ -2112,15 +2112,15 @@ i_t basis_update_mpf_t::update(const std::vector& utilde, const std::vector& etilde, i_t leaving_index) { - const i_t m = L0_.m; + [[maybe_unused]] const i_t m = L0_.m; #ifdef PRINT_NUM_UPDATES printf("Update: num_updates_ %d\n", num_updates_); #endif // We are going to create a new matrix T = I + u*v^T - const i_t col_start = U0_.col_start[leaving_index]; - const i_t col_end = U0_.col_start[leaving_index + 1]; - std::vector u = utilde; + [[maybe_unused]] const i_t col_start = U0_.col_start[leaving_index]; + [[maybe_unused]] const i_t col_end = U0_.col_start[leaving_index + 1]; + std::vector u = utilde; work_estimate_ += 2 * utilde.size(); // u = utilde - U0(:, leaving_index) add_sparse_column(U0_, leaving_index, -1.0, u); @@ -2138,7 +2138,7 @@ i_t basis_update_mpf_t::update(const std::vector& utilde, printf("Update: S_start %d S_nz %d num updates %d S.n %d\n", S_start, S_nz, num_updates_, S_.n); #endif - i_t S_nz_start = S_nz; + [[maybe_unused]] i_t S_nz_start = S_nz; // Scatter u into S S_.append_column(u); @@ -2263,9 +2263,9 @@ void basis_update_mpf_t::l_multiply(std::vector& inout) const for (i_t k = num_updates_ - 1; k >= 0; --k) { // T_k = ( I + u v^T) // T_k * b = b + u * (v^T * b) = b + theta * u, theta = v^T b - const i_t u_col = 2 * k; - const i_t v_col = 2 * k + 1; - const f_t mu = mu_values_[k]; + const i_t u_col = 2 * k; + const i_t v_col = 2 * k + 1; + [[maybe_unused]] const f_t mu = mu_values_[k]; // dot = v^T b f_t dot = dot_product(v_col, inout); @@ -2288,9 +2288,9 @@ void basis_update_mpf_t::l_transpose_multiply(std::vector& inout) const f_t zero_tol = 1e-13; for (i_t k = 0; k < num_updates_; ++k) { - const i_t u_col = 2 * k; - const i_t v_col = 2 * k + 1; - const f_t mu = mu_values_[k]; + const i_t u_col = 2 * k; + const i_t v_col = 2 * k + 1; + [[maybe_unused]] const f_t mu = mu_values_[k]; // T_k = ( I + u v^T) // T_k^T = ( I + v u^T) @@ -2348,7 +2348,7 @@ int basis_update_mpf_t::refactor_basis( std::vector& nonbasic_list, std::vector& vstatus) { - raft::common::nvtx::range scope("LU::refactor_basis"); + [[maybe_unused]] raft::common::nvtx::range scope("LU::refactor_basis"); std::vector deficient; std::vector slacks_needed; std::vector superbasic_list; // Empty superbasic list diff --git a/cpp/src/dual_simplex/bound_flipping_ratio_test.cpp b/cpp/src/dual_simplex/bound_flipping_ratio_test.cpp index cb0964dc05..88f5967a11 100644 --- a/cpp/src/dual_simplex/bound_flipping_ratio_test.cpp +++ b/cpp/src/dual_simplex/bound_flipping_ratio_test.cpp @@ -18,8 +18,8 @@ template i_t bound_flipping_ratio_test_t::compute_breakpoints(std::vector& indicies, std::vector& ratios) { - i_t n = n_; - i_t m = m_; + [[maybe_unused]] i_t n = n_; + [[maybe_unused]] i_t m = m_; constexpr bool verbose = false; f_t pivot_tol = settings_.pivot_tol; const f_t dual_tol = settings_.dual_tol / 10; @@ -117,10 +117,10 @@ template i_t bound_flipping_ratio_test_t::compute_step_length(f_t& step_length, i_t& nonbasic_entering) { - const i_t m = m_; - const i_t n = n_; - const i_t nz = delta_z_indices_.size(); - constexpr bool verbose = false; + [[maybe_unused]] const i_t m = m_; + [[maybe_unused]] const i_t n = n_; + const i_t nz = delta_z_indices_.size(); + constexpr bool verbose = false; // Compute the initial set of breakpoints std::vector indicies(nz); @@ -204,7 +204,7 @@ void bound_flipping_ratio_test_t::heap_passes(const std::vector& { std::vector bare_idx(num_breakpoints); constexpr bool verbose = false; - const f_t dual_tol = settings_.dual_tol; + [[maybe_unused]] const f_t dual_tol = settings_.dual_tol; const f_t zero_tol = settings_.zero_tol; const std::vector& delta_z = delta_z_; const std::vector& nonbasic_list = nonbasic_list_; @@ -281,15 +281,15 @@ void bound_flipping_ratio_test_t::bucket_pass(const std::vector& const std::vector& current_ratios, i_t num_breakpoints, f_t& slope, - f_t& step_length, - i_t& nonbasic_entering, - i_t& entering_index) + [[maybe_unused]] f_t& step_length, + [[maybe_unused]] i_t& nonbasic_entering, + [[maybe_unused]] i_t& entering_index) { - const f_t dual_tol = settings_.dual_tol; - const f_t zero_tol = settings_.zero_tol; - const std::vector& delta_z = delta_z_; - const std::vector& nonbasic_list = nonbasic_list_; - const i_t N = num_breakpoints; + [[maybe_unused]] const f_t dual_tol = settings_.dual_tol; + [[maybe_unused]] const f_t zero_tol = settings_.zero_tol; + [[maybe_unused]] const std::vector& delta_z = delta_z_; + const std::vector& nonbasic_list = nonbasic_list_; + const i_t N = num_breakpoints; const i_t K = 400; // 0, -16, -15, ...., 0, 1, ...., 400 - 18 = 382 std::vector buckets(K, 0.0); diff --git a/cpp/src/dual_simplex/bounds_strengthening.cpp b/cpp/src/dual_simplex/bounds_strengthening.cpp index cac5515d8e..3e65c4780e 100644 --- a/cpp/src/dual_simplex/bounds_strengthening.cpp +++ b/cpp/src/dual_simplex/bounds_strengthening.cpp @@ -35,10 +35,10 @@ static inline bool check_infeasibility(f_t min_a, f_t max_a, f_t cnst_lb, f_t cn #define DEBUG_BOUND_STRENGTHENING 0 template -void print_bounds_stats(const std::vector& lower, - const std::vector& upper, - const simplex_solver_settings_t& settings, - const std::string msg) +void print_bounds_stats([[maybe_unused]] const std::vector& lower, + [[maybe_unused]] const std::vector& upper, + [[maybe_unused]] const simplex_solver_settings_t& settings, + [[maybe_unused]] const std::string msg) { #if DEBUG_BOUND_STRENGTHENING f_t lb_norm = 0.0; diff --git a/cpp/src/dual_simplex/crossover.cpp b/cpp/src/dual_simplex/crossover.cpp index e1ba272adf..74912696c2 100644 --- a/cpp/src/dual_simplex/crossover.cpp +++ b/cpp/src/dual_simplex/crossover.cpp @@ -35,7 +35,7 @@ crossover_status_t return_to_status(int status) } template -void verify_basis(i_t m, i_t n, const std::vector& vstatus) +void verify_basis([[maybe_unused]] i_t m, i_t n, const std::vector& vstatus) { i_t num_basic = 0; i_t num_nonbasic = 0; @@ -64,14 +64,14 @@ void compare_vstatus_with_lists(i_t m, i_t n, const std::vector& basic_list, const std::vector& nonbasic_list, - const std::vector& vstatus) + [[maybe_unused]] const std::vector& vstatus) { for (i_t k = 0; k < m; ++k) { - const i_t j = basic_list[k]; + [[maybe_unused]] const i_t j = basic_list[k]; assert(vstatus[j] == variable_status_t::BASIC); } for (i_t k = 0; k < std::min(static_cast(nonbasic_list.size()), n - m); ++k) { - const i_t j = nonbasic_list[k]; + [[maybe_unused]] const i_t j = nonbasic_list[k]; assert(vstatus[j] == variable_status_t::NONBASIC_LOWER || vstatus[j] == variable_status_t::NONBASIC_UPPER || vstatus[j] == variable_status_t::NONBASIC_FREE || @@ -85,17 +85,17 @@ f_t dual_infeasibility(const lp_problem_t& lp, const std::vector& vstatus, const std::vector& z) { - raft::common::nvtx::range scope("DualSimplex::dual_infeasibility"); - const i_t n = lp.num_cols; - const i_t m = lp.num_rows; - i_t num_infeasible = 0; - f_t sum_infeasible = 0.0; - constexpr f_t tight_tol = 1e-6; - i_t lower_bound_inf = 0; - i_t upper_bound_inf = 0; - i_t free_inf = 0; - i_t non_basic_lower_inf = 0; - i_t non_basic_upper_inf = 0; + [[maybe_unused]] raft::common::nvtx::range scope("DualSimplex::dual_infeasibility"); + const i_t n = lp.num_cols; + [[maybe_unused]] const i_t m = lp.num_rows; + i_t num_infeasible = 0; + f_t sum_infeasible = 0.0; + constexpr f_t tight_tol = 1e-6; + i_t lower_bound_inf = 0; + i_t upper_bound_inf = 0; + i_t free_inf = 0; + i_t non_basic_lower_inf = 0; + i_t non_basic_upper_inf = 0; for (i_t j = 0; j < n; ++j) { if (vstatus[j] == variable_status_t::NONBASIC_FIXED) { @@ -697,8 +697,6 @@ f_t primal_ratio_test(const lp_problem_t& lp, i_t& basic_leaving_index, i_t& bound) { - const i_t m = lp.num_rows; - const i_t n = lp.num_cols; f_t step_length = 1.0; constexpr f_t pivot_tol = 1e-9; for (i_t k = 0; k < delta_xB.i.size(); ++k) { @@ -754,7 +752,6 @@ i_t primal_push(const lp_problem_t& lp, settings.log.debug("Primal push: superbasic %ld\n", superbasic_list.size()); std::vector& x = solution.x; - std::vector& y = solution.y; std::vector& z = solution.z; f_t last_print_time = tic(); @@ -1221,7 +1218,7 @@ crossover_status_t crossover(const lp_problem_t& lp, lp_solution_t& solution, std::vector& vstatus) { - raft::common::nvtx::range scope("Barrier::crossover"); + [[maybe_unused]] raft::common::nvtx::range scope("Barrier::crossover"); const i_t m = lp.num_rows; const i_t n = lp.num_cols; f_t crossover_start = tic(); @@ -1281,8 +1278,6 @@ crossover_status_t crossover(const lp_problem_t& lp, constexpr f_t basis_threshold = 1e-6; for (i_t j = 0; j < n; ++j) { if (vstatus[j] != variable_status_t::BASIC) { - const f_t lower_bound_slack = initial_solution.x[j] - lp.lower[j]; - const f_t upper_bound_slack = lp.upper[j] - initial_solution.x[j]; if (std::abs(lp.lower[j] - lp.upper[j]) < fixed_tolerance) { vstatus[j] = variable_status_t::NONBASIC_FIXED; } else if (solution.z[j] > -basis_threshold && lp.lower[j] > -inf) { @@ -1406,7 +1401,6 @@ crossover_status_t crossover(const lp_problem_t& lp, f_t primal_infeas = primal_infeasibility(lp, settings, vstatus, solution.x); f_t dual_infeas = dual_infeasibility(lp, settings, vstatus, solution.z); - f_t obj = compute_objective(lp, solution.x); f_t primal_res = primal_residual(lp, solution); f_t dual_res = dual_residual(lp, solution); diff --git a/cpp/src/dual_simplex/folding.cpp b/cpp/src/dual_simplex/folding.cpp index a56659b3ff..76f4e77624 100644 --- a/cpp/src/dual_simplex/folding.cpp +++ b/cpp/src/dual_simplex/folding.cpp @@ -74,7 +74,7 @@ void find_vertices_to_refine(const std::unordered_set& refining_color_verti } template -void compute_sums_of_refined_vertices(i_t refining_color, +void compute_sums_of_refined_vertices([[maybe_unused]] i_t refining_color, const std::unordered_set& refining_color_vertices, const std::vector& vertices_to_refine, const std::vector& offsets, @@ -108,7 +108,7 @@ void compute_sums(const csc_matrix_t& A, const csr_matrix_t& Arow, i_t num_row_colors, i_t num_col_colors, - i_t total_colors_seen, + [[maybe_unused]] i_t total_colors_seen, const std::vector& row_color_map, const std::vector& col_color_map, const color_t& refining_color, @@ -120,7 +120,7 @@ void compute_sums(const csc_matrix_t& A, std::vector& vertex_to_sum, std::vector& max_sum_by_color) { - i_t num_colors = num_row_colors + num_col_colors; + [[maybe_unused]] i_t num_colors = num_row_colors + num_col_colors; colors_to_update.clear(); vertices_to_refine.clear(); if (refining_color.row_or_column == kRow) { @@ -224,7 +224,7 @@ i_t find_colors_to_split(const std::vector& colors_to_update, template i_t split_colors(i_t color, - i_t refining_color, + [[maybe_unused]] i_t refining_color, int8_t side_being_split, std::vector& vertex_to_sum, std::map>& color_sums, @@ -233,7 +233,7 @@ i_t split_colors(i_t color, std::vector& color_stack, std::vector& color_in_stack, std::vector& color_map_B, - std::vector& marked_vertices, + [[maybe_unused]] std::vector& marked_vertices, std::vector>& vertices_to_refine_by_color, std::vector& min_sum_by_color, std::vector& max_sum_by_color, @@ -591,7 +591,7 @@ coloring_status_t color_graph(const csc_matrix_t& A, colors_per_refinement = static_cast(num_row_colors + num_col_colors) / static_cast(num_refinements); - i_t projected_colors = + [[maybe_unused]] i_t projected_colors = num_row_colors + num_col_colors + static_cast(colors_per_refinement * static_cast(color_stack.size())); diff --git a/cpp/src/dual_simplex/initial_basis.cpp b/cpp/src/dual_simplex/initial_basis.cpp index e75bad0e67..fef06578ce 100644 --- a/cpp/src/dual_simplex/initial_basis.cpp +++ b/cpp/src/dual_simplex/initial_basis.cpp @@ -108,7 +108,7 @@ i_t initial_basis_selection(const lp_problem_t& problem, std::vector& vstatus, std::vector& dependent_rows) { - raft::common::nvtx::range scope("DualSimplex::initial_basis"); + [[maybe_unused]] raft::common::nvtx::range scope("DualSimplex::initial_basis"); i_t m = problem.num_rows; i_t n = problem.num_cols; i_t nz = problem.A.col_start[n]; diff --git a/cpp/src/dual_simplex/phase2.cpp b/cpp/src/dual_simplex/phase2.cpp index a5f10c3229..b1f0e3e898 100644 --- a/cpp/src/dual_simplex/phase2.cpp +++ b/cpp/src/dual_simplex/phase2.cpp @@ -869,7 +869,7 @@ bool update_primal_infeasibilities(const lp_problem_t& lp, const simplex_solver_settings_t& settings, const std::vector& basic_list, const std::vector& x, - i_t entering_index, + [[maybe_unused]] i_t entering_index, i_t leaving_index, std::vector& basic_change_list, std::vector& squared_infeasibilities, @@ -924,17 +924,18 @@ void clean_up_infeasibilities(std::vector& squared_infeasibilities, } template -i_t steepest_edge_pricing_with_infeasibilities(const lp_problem_t& lp, - const simplex_solver_settings_t& settings, - const std::vector& x, - const std::vector& dy_steepest_edge, - const std::vector& basic_mark, - std::vector& squared_infeasibilities, - std::vector& infeasibility_indices, - i_t& direction, - i_t& basic_leaving, - f_t& max_val, - f_t& work_estimate) +i_t steepest_edge_pricing_with_infeasibilities( + const lp_problem_t& lp, + [[maybe_unused]] const simplex_solver_settings_t& settings, + const std::vector& x, + const std::vector& dy_steepest_edge, + const std::vector& basic_mark, + std::vector& squared_infeasibilities, + std::vector& infeasibility_indices, + i_t& direction, + i_t& basic_leaving, + f_t& max_val, + f_t& work_estimate) { max_val = 0.0; i_t leaving_index = -1; @@ -1207,10 +1208,10 @@ template i_t flip_bounds(const lp_problem_t& lp, const simplex_solver_settings_t& settings, const std::vector& bounded_variables, - const std::vector& objective, + [[maybe_unused]] const std::vector& objective, const std::vector& z, const std::vector& delta_z_indices, - const std::vector& nonbasic_list, + [[maybe_unused]] const std::vector& nonbasic_list, i_t entering_index, std::vector& vstatus, std::vector& delta_x, @@ -1349,8 +1350,8 @@ i_t initialize_steepest_edge_norms(const lp_problem_t& lp, const i_t j = basic_list[k]; f_t init = -1.0; if (row_degree[mapping[k]] == 1) { - const i_t u = mapping[k]; - const f_t alpha = coeff[k]; + [[maybe_unused]] const i_t u = mapping[k]; + const f_t alpha = coeff[k]; // dy[u] = -1.0 / alpha; f_t my_init = 1.0 / (alpha * alpha); init = my_init; @@ -1430,7 +1431,7 @@ i_t initialize_steepest_edge_norms(const lp_problem_t& lp, } template -i_t update_steepest_edge_norms(const simplex_solver_settings_t& settings, +i_t update_steepest_edge_norms([[maybe_unused]] const simplex_solver_settings_t& settings, const std::vector& basic_list, const basis_update_mpf_t& ft, i_t direction, @@ -1444,7 +1445,7 @@ i_t update_steepest_edge_norms(const simplex_solver_settings_t& settin std::vector& delta_y_steepest_edge, f_t& work_estimate) { - const i_t delta_y_nz = delta_y_sparse.i.size(); + [[maybe_unused]] const i_t delta_y_nz = delta_y_sparse.i.size(); v_sparse.clear(); // B^T delta_y = - direction * e_basic_leaving_index // We want B v = - B^{-T} e_basic_leaving_index @@ -1456,8 +1457,8 @@ i_t update_steepest_edge_norms(const simplex_solver_settings_t& settin v_sparse.scatter(v); work_estimate += 2 * v_sparse.i.size(); - const i_t leaving_index = basic_list[basic_leaving_index]; - const f_t prev_dy_norm_squared = delta_y_steepest_edge[leaving_index]; + const i_t leaving_index = basic_list[basic_leaving_index]; + [[maybe_unused]] const f_t prev_dy_norm_squared = delta_y_steepest_edge[leaving_index]; #ifdef STEEPEST_EDGE_DEBUG const f_t err = std::abs(dy_norm_squared - prev_dy_norm_squared) / (1.0 + dy_norm_squared); if (err > 1e-3) { @@ -1550,11 +1551,11 @@ i_t compute_perturbation(const lp_problem_t& lp, f_t& sum_perturb, f_t& work_estimate) { - const i_t n = lp.num_cols; - const i_t m = lp.num_rows; - const f_t tight_tol = settings.tight_tol; - i_t num_perturb = 0; - sum_perturb = 0.0; + [[maybe_unused]] const i_t n = lp.num_cols; + [[maybe_unused]] const i_t m = lp.num_rows; + const f_t tight_tol = settings.tight_tol; + i_t num_perturb = 0; + sum_perturb = 0.0; for (i_t k = 0; k < delta_z_indices.size(); ++k) { const i_t j = delta_z_indices[k]; if (lp.upper[j] == inf && lp.lower[j] > -inf && z[j] < -tight_tol) { @@ -1747,7 +1748,7 @@ i_t compute_delta_x(const lp_problem_t& lp, i_t basic_leaving_index, i_t direction, const std::vector& basic_list, - const std::vector& delta_x_flip, + [[maybe_unused]] const std::vector& delta_x_flip, const sparse_vector_t& rhs_sparse, const std::vector& delta_z, const std::vector& x, @@ -1885,15 +1886,15 @@ f_t dual_infeasibility(const lp_problem_t& lp, f_t tight_tol, f_t dual_tol) { - const i_t n = lp.num_cols; - const i_t m = lp.num_rows; - i_t num_infeasible = 0; - f_t sum_infeasible = 0.0; - i_t lower_bound_inf = 0; - i_t upper_bound_inf = 0; - i_t free_inf = 0; - i_t non_basic_lower_inf = 0; - i_t non_basic_upper_inf = 0; + const i_t n = lp.num_cols; + [[maybe_unused]] const i_t m = lp.num_rows; + i_t num_infeasible = 0; + f_t sum_infeasible = 0.0; + i_t lower_bound_inf = 0; + i_t upper_bound_inf = 0; + i_t free_inf = 0; + i_t non_basic_lower_inf = 0; + i_t non_basic_upper_inf = 0; for (i_t j = 0; j < n; ++j) { if (vstatus[j] == variable_status_t::NONBASIC_FIXED) { continue; } @@ -2022,8 +2023,8 @@ f_t primal_infeasibility_breakdown(const lp_problem_t& lp, template f_t primal_infeasibility(const lp_problem_t& lp, - const simplex_solver_settings_t& settings, - const std::vector& vstatus, + [[maybe_unused]] const simplex_solver_settings_t& settings, + [[maybe_unused]] const std::vector& vstatus, const std::vector& x) { const i_t n = lp.num_cols; @@ -2325,8 +2326,8 @@ f_t amount_of_perturbation(const lp_problem_t& lp, const std::vector -void prepare_optimality(i_t info, - f_t orig_primal_infeas, +void prepare_optimality([[maybe_unused]] i_t info, + [[maybe_unused]] f_t orig_primal_infeas, const lp_problem_t& lp, const simplex_solver_settings_t& settings, basis_update_mpf_t& ft, @@ -2336,7 +2337,7 @@ void prepare_optimality(i_t info, const std::vector& vstatus, int phase, f_t start_time, - f_t max_val, + [[maybe_unused]] f_t max_val, i_t iter, const std::vector& x, std::vector& y, @@ -2347,10 +2348,10 @@ void prepare_optimality(i_t info, const i_t n = lp.num_cols; f_t work_estimate = 0; // Work in this function is not captured - sol.objective = compute_objective(lp, sol.x); - sol.user_objective = compute_user_objective(lp, sol.objective); - f_t perturbation = amount_of_perturbation(lp, objective); - f_t orig_perturbation = perturbation; + sol.objective = compute_objective(lp, sol.x); + sol.user_objective = compute_user_objective(lp, sol.objective); + f_t perturbation = amount_of_perturbation(lp, objective); + [[maybe_unused]] f_t orig_perturbation = perturbation; if (perturbation > 1e-6 && phase == 2) { // Try to remove perturbation std::vector unperturbed_y(m); @@ -2507,8 +2508,8 @@ dual_status_t dual_phase2(i_t phase, work_limit_context_t* work_unit_context) { PHASE2_NVTX_RANGE("DualSimplex::phase2"); - const i_t m = lp.num_rows; - const i_t n = lp.num_cols; + const i_t m = lp.num_rows; + [[maybe_unused]] const i_t n = lp.num_cols; std::vector basic_list(m); std::vector nonbasic_list; basis_update_mpf_t ft(m, settings.refactor_frequency); @@ -2700,7 +2701,7 @@ dual_status_t dual_phase2_with_advanced_basis(i_t phase, f_t steepest_edge_start = tic(); i_t status = phase2::initialize_steepest_edge_norms( lp, settings, start_time, basic_list, ft, delta_y_steepest_edge, phase2_work_estimate); - f_t steepest_edge_time = toc(steepest_edge_start); + [[maybe_unused]] f_t steepest_edge_time = toc(steepest_edge_start); if (status == CONCURRENT_HALT_RETURN) { return dual_status_t::CONCURRENT_LIMIT; } if (status == -1) { return dual_status_t::TIME_LIMIT; } } @@ -3421,20 +3422,21 @@ dual_status_t dual_phase2_with_advanced_basis(i_t phase, #endif timers.start_timer(); - f_t se_norms_start_work = ft.work_estimate(); - const i_t steepest_edge_status = phase2::update_steepest_edge_norms(settings, - basic_list, - ft, - direction, - delta_y_sparse, - steepest_edge_norm_check, - scaled_delta_xB_sparse, - basic_leaving_index, - entering_index, - v, - v_sparse, - delta_y_steepest_edge, - phase2_work_estimate); + f_t se_norms_start_work = ft.work_estimate(); + [[maybe_unused]] const i_t steepest_edge_status = + phase2::update_steepest_edge_norms(settings, + basic_list, + ft, + direction, + delta_y_sparse, + steepest_edge_norm_check, + scaled_delta_xB_sparse, + basic_leaving_index, + entering_index, + v, + v_sparse, + delta_y_steepest_edge, + phase2_work_estimate); #ifdef STEEPEST_EDGE_DEBUG if (steepest_edge_status == -1) { settings.log.printf("Num updates %d\n", ft.num_updates()); diff --git a/cpp/src/dual_simplex/phase2.hpp b/cpp/src/dual_simplex/phase2.hpp index daa946e019..e2dac55644 100644 --- a/cpp/src/dual_simplex/phase2.hpp +++ b/cpp/src/dual_simplex/phase2.hpp @@ -35,7 +35,7 @@ enum class dual_status_t { UNSET = 8 }; -static std::string dual_status_to_string(dual_status_t status) +[[maybe_unused]] static std::string dual_status_to_string(dual_status_t status) { switch (status) { case dual_status_t::OPTIMAL: return "OPTIMAL"; diff --git a/cpp/src/dual_simplex/presolve.cpp b/cpp/src/dual_simplex/presolve.cpp index 6e72b2e078..ca8dcce8e7 100644 --- a/cpp/src/dual_simplex/presolve.cpp +++ b/cpp/src/dual_simplex/presolve.cpp @@ -304,7 +304,7 @@ i_t remove_fixed_variables(f_t fixed_tolerance, } template -i_t convert_less_than_to_equal(const user_problem_t& user_problem, +i_t convert_less_than_to_equal([[maybe_unused]] const user_problem_t& user_problem, std::vector& row_sense, lp_problem_t& problem, i_t& less_rows, @@ -458,7 +458,7 @@ i_t convert_less_than_to_equal(const user_problem_t& user_problem, } template -i_t convert_greater_to_less(const user_problem_t& user_problem, +i_t convert_greater_to_less([[maybe_unused]] const user_problem_t& user_problem, std::vector& row_sense, lp_problem_t& problem, i_t& greater_rows, @@ -479,8 +479,7 @@ i_t convert_greater_to_less(const user_problem_t& user_problem, for (i_t i = 0; i < problem.num_rows; i++) { if (row_sense[i] == 'G') { - i_t row_start = Arow.row_start[i]; - i_t row_end = Arow.row_start[i + 1]; + i_t row_end = Arow.row_start[i + 1]; for (i_t p = Arow.row_start[i]; p < row_end; p++) { Arow.x[p] *= -1; } @@ -663,7 +662,6 @@ i_t add_artifical_variables(lp_problem_t& problem, std::vector& new_slacks) { const i_t n = problem.num_cols; - const i_t m = problem.num_rows; const i_t num_artificial_vars = equality_rows.size() - range_rows.size(); const i_t num_cols = n + num_artificial_vars; i_t nnz = problem.A.col_start[n] + num_artificial_vars; @@ -1560,9 +1558,9 @@ void crush_primal_solution(const user_problem_t& user_problem, // Compute the value for each of the added slack variables for (i_t j : new_slacks) { - const i_t col_start = problem.A.col_start[j]; - const i_t col_end = problem.A.col_start[j + 1]; - const i_t diff = col_end - col_start; + const i_t col_start = problem.A.col_start[j]; + const i_t col_end = problem.A.col_start[j + 1]; + [[maybe_unused]] const i_t diff = col_end - col_start; assert(diff == 1); const i_t i = problem.A.i[col_start]; assert(solution[j] == 0.0); @@ -1601,9 +1599,9 @@ void crush_primal_solution_with_slack(const user_problem_t& user_probl constexpr bool verbose = false; // Compute the value for each of the added slack variables for (i_t j : new_slacks) { - const i_t col_start = problem.A.col_start[j]; - const i_t col_end = problem.A.col_start[j + 1]; - const i_t diff = col_end - col_start; + const i_t col_start = problem.A.col_start[j]; + const i_t col_end = problem.A.col_start[j + 1]; + [[maybe_unused]] const i_t diff = col_end - col_start; assert(diff == 1); const i_t i = problem.A.i[col_start]; assert(solution[j] == 0.0); @@ -1650,9 +1648,9 @@ f_t crush_dual_solution(const user_problem_t& user_problem, assert(user_problem.num_rows == problem.num_rows); for (i_t j : new_slacks) { - const i_t col_start = problem.A.col_start[j]; - const i_t col_end = problem.A.col_start[j + 1]; - const i_t diff = col_end - col_start; + const i_t col_start = problem.A.col_start[j]; + const i_t col_end = problem.A.col_start[j + 1]; + [[maybe_unused]] const i_t diff = col_end - col_start; assert(diff == 1); const i_t i = problem.A.i[col_start]; @@ -1790,9 +1788,7 @@ void uncrush_solution(const presolve_info_t& presolve_info, // 0 <= x, // 0 <= w - i_t reduced_cols = presolve_info.folding_info.D.n; i_t previous_cols = presolve_info.folding_info.D.m; - i_t reduced_rows = presolve_info.folding_info.C_s.m; i_t previous_rows = presolve_info.folding_info.C_s.n; std::vector xtilde(previous_cols); diff --git a/cpp/src/dual_simplex/primal.cpp b/cpp/src/dual_simplex/primal.cpp index 78c7107ca3..2efc6f019b 100644 --- a/cpp/src/dual_simplex/primal.cpp +++ b/cpp/src/dual_simplex/primal.cpp @@ -21,7 +21,7 @@ namespace { template void set_primal_variables_on_bounds(const lp_problem_t& lp, const simplex_solver_settings_t& settings, - const std::vector& z, + [[maybe_unused]] const std::vector& z, std::vector& vstatus, std::vector& x) { @@ -60,16 +60,16 @@ f_t dual_infeasibility(const lp_problem_t& lp, const std::vector& vstatus, const std::vector& z) { - const i_t n = lp.num_cols; - const i_t m = lp.num_rows; - i_t num_infeasible = 0; - f_t sum_infeasible = 0.0; - constexpr f_t tight_tol = 0; - i_t lower_bound_inf = 0; - i_t upper_bound_inf = 0; - i_t free_inf = 0; - i_t non_basic_lower_inf = 0; - i_t non_basic_upper_inf = 0; + const i_t n = lp.num_cols; + [[maybe_unused]] const i_t m = lp.num_rows; + i_t num_infeasible = 0; + f_t sum_infeasible = 0.0; + constexpr f_t tight_tol = 0; + i_t lower_bound_inf = 0; + i_t upper_bound_inf = 0; + i_t free_inf = 0; + i_t non_basic_lower_inf = 0; + i_t non_basic_upper_inf = 0; for (i_t j = 0; j < n; ++j) { if (lp.upper[j] == inf && lp.lower[j] > -inf && z[j] < -tight_tol) { @@ -153,19 +153,19 @@ i_t phase2_pricing(const lp_problem_t& lp, template i_t ratio_test(const lp_problem_t& lp, - const std::vector& vstatus, + [[maybe_unused]] const std::vector& vstatus, const std::vector& basic_list, std::vector& x, std::vector& delta_x, f_t& step_length, i_t& basic_leaving) { - const i_t m = lp.num_rows; - const i_t n = lp.num_cols; - basic_leaving = -1; - i_t leaving_index = -1; - f_t min_val = inf; - constexpr f_t pivot_tol = 1e-8; + const i_t m = lp.num_rows; + [[maybe_unused]] const i_t n = lp.num_cols; + basic_leaving = -1; + i_t leaving_index = -1; + f_t min_val = inf; + constexpr f_t pivot_tol = 1e-8; for (i_t k = 0; k < m; ++k) { const i_t j = basic_list[k]; if (delta_x[j] == 0.0) { continue; } diff --git a/cpp/src/dual_simplex/right_looking_lu.cpp b/cpp/src/dual_simplex/right_looking_lu.cpp index 6a717cd257..548bf8f626 100644 --- a/cpp/src/dual_simplex/right_looking_lu.cpp +++ b/cpp/src/dual_simplex/right_looking_lu.cpp @@ -237,7 +237,7 @@ class trailing_matrix_t { assert(row_counts_.get_elements_with_count(nz).size() >= 0); nsearch_start = nsearch; for (const i_t i : row_counts_.get_elements_with_count(nz)) { - const i_t rdeg = row_counts_.get_count(i); + [[maybe_unused]] const i_t rdeg = row_counts_.get_count(i); assert(rdeg == nz); const i_t r_start = row_start_[i]; const i_t r_end = row_end_[i]; @@ -819,7 +819,7 @@ i_t right_looking_lu(const csc_matrix_t& A, std::vector& pinv, f_t& work_estimate) { - raft::common::nvtx::range scope("LU::right_looking_lu"); + [[maybe_unused]] raft::common::nvtx::range scope("LU::right_looking_lu"); const i_t n = column_list.size(); const i_t m = A.m; @@ -1006,10 +1006,10 @@ i_t right_looking_lu_row_permutation_only(const csc_matrix_t& A, // Factorize PAQ = LU, where A is m x n with m >= n, and P and Q are permutation matrices // We return the inverser row permutation vector pinv and the column permutation vector q - f_t factorization_start_time = tic(); - f_t work_estimate = 0; - const i_t n = A.n; - const i_t m = A.m; + f_t factorization_start_time = tic(); + [[maybe_unused]] f_t work_estimate = 0; + const i_t n = A.n; + const i_t m = A.m; assert(pinv.size() == m); assert(q.size() == n); (void)tol; // Unused; kept for API compatibility with right_looking_lu_row_permutation_only @@ -1682,7 +1682,7 @@ i_t right_looking_ldlt(const csc_matrix_t& A, std::vector& D, f_t& work_estimate) { - raft::common::nvtx::range scope("LU::right_looking_ldlt"); + [[maybe_unused]] raft::common::nvtx::range scope("LU::right_looking_ldlt"); const i_t n = A.n; const i_t input_nnz = A.nnz(); assert(A.m == n); diff --git a/cpp/src/dual_simplex/singletons.cpp b/cpp/src/dual_simplex/singletons.cpp index 8b151337b7..a9511e9340 100644 --- a/cpp/src/dual_simplex/singletons.cpp +++ b/cpp/src/dual_simplex/singletons.cpp @@ -185,7 +185,6 @@ i_t find_singletons(const csc_matrix_t& A, std::vector Rj(nz); work_estimate += 3 * m + n + nz; - i_t max_queue_len = std::max(m, n); std::queue singleton_queue; // Compute Cdeg and Rdeg @@ -274,12 +273,12 @@ i_t find_singletons(const csc_matrix_t& A, #ifdef SINGLETON_DEBUG printf("Col singletons %d\n", col_singletons); #endif - i_t num_empty_cols = complete_permutation(singletons_found, Cdeg, col_perm); + [[maybe_unused]] i_t num_empty_cols = complete_permutation(singletons_found, Cdeg, col_perm); work_estimate += 2 * Cdeg.size(); #ifdef SINGLETON_DEBUG printf("Completed col perm. %d empty cols. Starting row perm\n", num_empty_cols); #endif - i_t num_empty_rows = complete_permutation(singletons_found, Rdeg, row_perm); + [[maybe_unused]] i_t num_empty_rows = complete_permutation(singletons_found, Rdeg, row_perm); work_estimate += 2 * Rdeg.size(); #ifdef SINGLETON_DEBUG printf("Empty rows %d Empty columns %d\n", num_empty_rows, num_empty_cols); diff --git a/cpp/src/dual_simplex/solve.cpp b/cpp/src/dual_simplex/solve.cpp index 7c239b91fd..3fd1d34476 100644 --- a/cpp/src/dual_simplex/solve.cpp +++ b/cpp/src/dual_simplex/solve.cpp @@ -173,9 +173,9 @@ lp_status_t solve_linear_program_advanced(const lp_problem_t& original std::vector& edge_norms, work_limit_context_t* work_unit_context) { - raft::common::nvtx::range scope("DualSimplex::solve_lp"); - const i_t m = original_lp.num_rows; - const i_t n = original_lp.num_cols; + [[maybe_unused]] raft::common::nvtx::range scope("DualSimplex::solve_lp"); + const i_t m = original_lp.num_rows; + [[maybe_unused]] const i_t n = original_lp.num_cols; assert(m <= n); std::vector basic_list(m); std::vector nonbasic_list; @@ -211,7 +211,7 @@ lp_status_t solve_linear_program_with_advanced_basis( presolve_info_t presolve_info; i_t ok; { - raft::common::nvtx::range scope_presolve("DualSimplex::presolve"); + [[maybe_unused]] raft::common::nvtx::range scope_presolve("DualSimplex::presolve"); ok = presolve(original_lp, settings, presolved_lp, presolve_info); } if (ok == CONCURRENT_HALT_RETURN) { return lp_status_t::CONCURRENT_LIMIT; } @@ -232,7 +232,7 @@ lp_status_t solve_linear_program_with_advanced_basis( std::vector column_scales; std::vector row_scales_simplex; { - raft::common::nvtx::range scope_scaling("DualSimplex::scaling"); + [[maybe_unused]] raft::common::nvtx::range scope_scaling("DualSimplex::scaling"); scaling(presolved_lp, settings, lp, column_scales, row_scales_simplex); } assert(presolved_lp.num_cols == lp.num_cols); @@ -262,7 +262,7 @@ lp_status_t solve_linear_program_with_advanced_basis( edge_norms.clear(); dual_status_t phase1_status; { - raft::common::nvtx::range scope_phase1("DualSimplex::phase1"); + [[maybe_unused]] raft::common::nvtx::range scope_phase1("DualSimplex::phase1"); phase1_status = dual_phase2(1, 1, start_time, @@ -416,7 +416,6 @@ lp_status_t solve_linear_program_with_barrier( cuopt::mathematical_optimization::barrier_cache_t* cache, const raft::handle_t* handle_ptr) { - lp_status_t status = lp_status_t::UNSET; simplex_solver_settings_t barrier_settings = settings; auto const* xf = (cache != nullptr && cache->c_dirty()) ? cache->transform() : nullptr; diff --git a/cpp/src/dual_simplex/solve.hpp b/cpp/src/dual_simplex/solve.hpp index f8966e29c1..d77ad555cd 100644 --- a/cpp/src/dual_simplex/solve.hpp +++ b/cpp/src/dual_simplex/solve.hpp @@ -40,7 +40,7 @@ enum class lp_status_t { UNSET = 10 }; -static std::string lp_status_to_string(lp_status_t status) +[[maybe_unused]] static std::string lp_status_to_string(lp_status_t status) { switch (status) { case lp_status_t::OPTIMAL: return "OPTIMAL"; diff --git a/cpp/src/grpc/client/grpc_client.cpp b/cpp/src/grpc/client/grpc_client.cpp index fd5c20f5c8..733919da75 100644 --- a/cpp/src/grpc/client/grpc_client.cpp +++ b/cpp/src/grpc/client/grpc_client.cpp @@ -141,7 +141,7 @@ grpc_client_t::~grpc_client_t() // std::terminate — defeating the purpose of catching at all. stop_logs_.store(true); try { - std::lock_guard lk(log_context_mutex_); + [[maybe_unused]] std::lock_guard lk(log_context_mutex_); if (active_log_context_) { static_cast(active_log_context_)->TryCancel(); } @@ -285,7 +285,7 @@ void grpc_client_t::start_log_streaming(const std::string& job_id) if (log_thread_ && log_thread_->joinable()) { stop_logs_.store(true); { - std::lock_guard lk(log_context_mutex_); + [[maybe_unused]] std::lock_guard lk(log_context_mutex_); if (active_log_context_) { static_cast(active_log_context_)->TryCancel(); } @@ -312,7 +312,7 @@ void grpc_client_t::stop_log_streaming() // Cancel the in-flight streaming RPC so reader->Read() returns false // immediately instead of blocking until the server sends a message. { - std::lock_guard lk(log_context_mutex_); + [[maybe_unused]] std::lock_guard lk(log_context_mutex_); if (active_log_context_) { static_cast(active_log_context_)->TryCancel(); } @@ -561,7 +561,7 @@ bool grpc_client_t::stream_logs( // another thread. The mutex ensures the pointer is never dangling: // we clear it under the same lock before `context` goes out of scope. { - std::lock_guard lk(log_context_mutex_); + [[maybe_unused]] std::lock_guard lk(log_context_mutex_); active_log_context_ = &context; } @@ -583,7 +583,7 @@ bool grpc_client_t::stream_logs( auto status = reader->Finish(); { - std::lock_guard lk(log_context_mutex_); + [[maybe_unused]] std::lock_guard lk(log_context_mutex_); active_log_context_ = nullptr; } diff --git a/cpp/src/grpc/client/solve_remote.cpp b/cpp/src/grpc/client/solve_remote.cpp index 6fbf49896e..3ccee0f5ae 100644 --- a/cpp/src/grpc/client/solve_remote.cpp +++ b/cpp/src/grpc/client/solve_remote.cpp @@ -82,7 +82,7 @@ std::unique_ptr> solve_lp_remote( cpu_optimization_problem_t const& cpu_problem, pdlp_solver_settings_t const& settings) { - init_logger_t log(settings.log_file, settings.log_to_console); + [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); CUOPT_LOG_INFO("Using remote GPU backend"); @@ -142,7 +142,7 @@ std::unique_ptr> solve_mip_remote( cpu_optimization_problem_t const& cpu_problem, mip_solver_settings_t const& settings) { - init_logger_t log(settings.log_file, settings.log_to_console); + [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); CUOPT_LOG_INFO("Using remote GPU backend"); @@ -194,7 +194,7 @@ std::unique_ptr> solve_mip_remote( // Set up incumbent callback forwarding if (has_incumbents) { CUOPT_LOG_INFO("solve_mip_remote - setting up inline incumbent callback forwarding"); - config.incumbent_callback = [&mip_callbacks](int64_t index, + config.incumbent_callback = [&mip_callbacks]([[maybe_unused]] int64_t index, double objective, const std::vector& solution) -> bool { // Forward incumbent to all user callbacks (invoked from main thread with GIL) diff --git a/cpp/src/grpc/server/grpc_job_management.cpp b/cpp/src/grpc/server/grpc_job_management.cpp index d35840cc92..d027914241 100644 --- a/cpp/src/grpc/server/grpc_job_management.cpp +++ b/cpp/src/grpc/server/grpc_job_management.cpp @@ -16,7 +16,7 @@ bool send_job_data_pipe(int worker_idx, const std::vector& data) { int fd; { - std::lock_guard lock(worker_pipes_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); if (worker_idx < 0 || worker_idx >= static_cast(worker_pipes.size())) { return false; } fd = worker_pipes[worker_idx].to_worker_fd; } @@ -98,12 +98,12 @@ std::pair submit_job_async(std::vector&& request_dat job_queue[slot].worker_pid = 0; { - std::lock_guard lock(pending_data_mutex); + [[maybe_unused]] std::lock_guard lock(pending_data_mutex); pending_job_data[job_id] = std::move(request_data); } { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); JobInfo info; info.job_id = job_id; info.status = JobStatus::QUEUED; @@ -153,12 +153,12 @@ std::pair submit_chunked_job_async(PendingChunkedUpload&& chu job_queue[slot].worker_pid = 0; { - std::lock_guard lock(pending_data_mutex); + [[maybe_unused]] std::lock_guard lock(pending_data_mutex); pending_chunked_data[job_id] = std::move(chunked_data); } { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); JobInfo info; info.job_id = job_id; info.status = JobStatus::QUEUED; @@ -180,7 +180,7 @@ std::pair submit_chunked_job_async(PendingChunkedUpload&& chu JobStatus check_job_status(const std::string& job_id, std::string& message) { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { @@ -232,7 +232,7 @@ void delete_log_file(const std::string& job_id) int cancel_job(const std::string& job_id, JobStatus& job_status_out, std::string& message) { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { @@ -295,12 +295,12 @@ int cancel_job(const std::string& job_id, JobStatus& job_status_out, std::string delete_log_file(job_id); { - std::lock_guard wlock(waiters_mutex); + [[maybe_unused]] std::lock_guard wlock(waiters_mutex); auto wit = waiting_threads.find(job_id); if (wit != waiting_threads.end()) { auto waiter = wit->second; { - std::lock_guard waiter_lock(waiter->mutex); + [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = "Job cancelled by user"; waiter->success = false; waiter->ready = true; @@ -325,12 +325,12 @@ int cancel_job(const std::string& job_id, JobStatus& job_status_out, std::string message = "Job cancelled"; { - std::lock_guard wlock(waiters_mutex); + [[maybe_unused]] std::lock_guard wlock(waiters_mutex); auto wit = waiting_threads.find(job_id); if (wit != waiting_threads.end()) { auto waiter = wit->second; { - std::lock_guard waiter_lock(waiter->mutex); + [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = "Job cancelled by user"; waiter->success = false; waiter->ready = true; @@ -357,12 +357,12 @@ bool delete_job(const std::string& job_id, std::string& message) } { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); job_tracker.erase(job_id); } { - std::lock_guard lock(pending_data_mutex); + [[maybe_unused]] std::lock_guard lock(pending_data_mutex); pending_job_data.erase(job_id); pending_chunked_data.erase(job_id); } diff --git a/cpp/src/grpc/server/grpc_server_main.cpp b/cpp/src/grpc/server/grpc_server_main.cpp index d307f5ede0..73a50ca170 100644 --- a/cpp/src/grpc/server/grpc_server_main.cpp +++ b/cpp/src/grpc/server/grpc_server_main.cpp @@ -277,7 +277,7 @@ int main(int argc, char** argv) spawn_workers(); { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); bool any_worker = false; for (pid_t pid : worker_pids) { if (pid > 0) { diff --git a/cpp/src/grpc/server/grpc_server_threads.cpp b/cpp/src/grpc/server/grpc_server_threads.cpp index 4f8a2d44d4..2f724074c8 100644 --- a/cpp/src/grpc/server/grpc_server_threads.cpp +++ b/cpp/src/grpc/server/grpc_server_threads.cpp @@ -24,7 +24,7 @@ void worker_monitor_thread() std::vector dead; { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); for (size_t i = 0; i < worker_pids.size(); ++i) { pid_t pid = worker_pids[i]; if (pid <= 0) continue; @@ -62,7 +62,7 @@ void worker_monitor_thread() pid_t new_pid = spawn_single_worker(static_cast(dw.index)); { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); if (dw.index < worker_pids.size() && worker_pids[dw.index] == 0) { worker_pids[dw.index] = (new_pid > 0) ? new_pid : 0; } @@ -101,7 +101,7 @@ void result_retrieval_thread() if (is_chunked) { PendingChunkedUpload chunked; { - std::lock_guard lock(pending_data_mutex); + [[maybe_unused]] std::lock_guard lock(pending_data_mutex); auto it = pending_chunked_data.find(job_id); if (it != pending_chunked_data.end()) { chunked = std::move(it->second); @@ -112,7 +112,7 @@ void result_retrieval_thread() if (has_data) { int to_fd; { - std::lock_guard wpl(worker_pipes_mutex); + [[maybe_unused]] std::lock_guard wpl(worker_pipes_mutex); to_fd = worker_pipes[worker_idx].to_worker_fd; } auto pipe_t0 = std::chrono::steady_clock::now(); @@ -155,7 +155,7 @@ void result_retrieval_thread() } else { std::vector job_data; { - std::lock_guard lock(pending_data_mutex); + [[maybe_unused]] std::lock_guard lock(pending_data_mutex); auto it = pending_job_data.find(job_id); if (it != pending_job_data.end()) { job_data = std::move(it->second); @@ -229,7 +229,7 @@ void result_retrieval_thread() } int from_fd; { - std::lock_guard wpl(worker_pipes_mutex); + [[maybe_unused]] std::lock_guard wpl(worker_pipes_mutex); from_fd = worker_pipes[worker_idx].from_worker_fd; } auto pipe_recv_t0 = std::chrono::steady_clock::now(); @@ -260,7 +260,7 @@ void result_retrieval_thread() } { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { if (success) { @@ -302,12 +302,12 @@ void result_retrieval_thread() } { - std::lock_guard lock(waiters_mutex); + [[maybe_unused]] std::lock_guard lock(waiters_mutex); auto wit = waiting_threads.find(job_id); if (wit != waiting_threads.end()) { auto waiter = wit->second; { - std::lock_guard waiter_lock(waiter->mutex); + [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = error_message; waiter->success = success; waiter->ready = true; @@ -343,7 +343,7 @@ void incumbent_retrieval_thread() while (keep_running) { std::vector pfds; { - std::lock_guard lock(worker_pipes_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); pfds.reserve(worker_pipes.size()); for (const auto& wp : worker_pipes) { if (wp.incumbent_from_worker_fd >= 0) { @@ -392,7 +392,7 @@ void incumbent_retrieval_thread() entry.assignment = std::move(assignment); { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { it->second.incumbents.push_back(std::move(entry)); @@ -427,7 +427,7 @@ void session_reaper_thread() auto now = std::chrono::steady_clock::now(); { - std::lock_guard lock(chunked_uploads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); for (auto it = chunked_uploads.begin(); it != chunked_uploads.end();) { if (now - it->second.last_activity > timeout) { if (config.verbose) { @@ -441,7 +441,7 @@ void session_reaper_thread() } { - std::lock_guard lock(chunked_downloads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); for (auto it = chunked_downloads.begin(); it != chunked_downloads.end();) { if (now - it->second.created > timeout) { if (config.verbose) { diff --git a/cpp/src/grpc/server/grpc_service_impl.cpp b/cpp/src/grpc/server/grpc_service_impl.cpp index 142524bb92..ae153ce136 100644 --- a/cpp/src/grpc/server/grpc_service_impl.cpp +++ b/cpp/src/grpc/server/grpc_service_impl.cpp @@ -14,7 +14,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // Unary submit: the entire problem fits in a single gRPC message. // Serializes the request and delegates slot reservation + tracking to // submit_job_async (shared with the chunked path's submit_chunked_job_async). - Status SubmitJob(ServerContext* context, + Status SubmitJob([[maybe_unused]] ServerContext* context, const cuopt::remote::SubmitJobRequest* request, cuopt::remote::SubmitJobResponse* response) override { @@ -87,7 +87,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S } { - std::lock_guard lock(chunked_uploads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); if (chunked_uploads.size() >= kMaxChunkedSessions) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Too many concurrent chunked upload sessions (limit " + @@ -118,7 +118,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S const std::string& upload_id = request->upload_id(); const auto& ac = request->chunk(); - std::lock_guard lock(chunked_uploads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); auto it = chunked_uploads.find(upload_id); if (it == chunked_uploads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown upload_id: " + upload_id); @@ -237,7 +237,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // Take ownership of the upload session and remove it from the active map. ChunkedUploadState state; { - std::lock_guard lock(chunked_uploads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); auto it = chunked_uploads.find(upload_id); if (it == chunked_uploads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown upload_id: " + upload_id); @@ -312,7 +312,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S int64_t result_size_bytes = 0; if (status == JobStatus::COMPLETED) { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { result_size_bytes = it->second.result_size_bytes; } } @@ -331,7 +331,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S (void)context; std::string job_id = request->job_id(); - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { return Status(StatusCode::NOT_FOUND, "Job not found"); } @@ -394,7 +394,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // Begin a chunked result download: snapshot the result arrays into a // download session. The client calls GetResultChunk to fetch slices and // FinishChunkedDownload when done (which frees the session). - Status StartChunkedDownload(ServerContext* context, + Status StartChunkedDownload([[maybe_unused]] ServerContext* context, const cuopt::remote::StartChunkedDownloadRequest* request, cuopt::remote::StartChunkedDownloadResponse* response) override { @@ -404,7 +404,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // client fetch chunks at its own pace without holding the tracker lock. ChunkedDownloadState state; { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { return Status(StatusCode::NOT_FOUND, "Job not found: " + job_id); @@ -425,7 +425,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S response->set_max_message_bytes(server_max_message_bytes()); { - std::lock_guard lock(chunked_downloads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); if (chunked_downloads.size() >= kMaxChunkedSessions) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Too many concurrent chunked download sessions (limit " + @@ -447,7 +447,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S return Status::OK; } - Status GetResultChunk(ServerContext* context, + Status GetResultChunk([[maybe_unused]] ServerContext* context, const cuopt::remote::GetResultChunkRequest* request, cuopt::remote::GetResultChunkResponse* response) override { @@ -456,7 +456,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S int64_t elem_offset = request->element_offset(); int64_t max_elements = request->max_elements(); - std::lock_guard lock(chunked_downloads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); auto it = chunked_downloads.find(download_id); if (it == chunked_downloads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown download_id: " + download_id); @@ -500,14 +500,14 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S return Status::OK; } - Status FinishChunkedDownload(ServerContext* context, + Status FinishChunkedDownload([[maybe_unused]] ServerContext* context, const cuopt::remote::FinishChunkedDownloadRequest* request, cuopt::remote::FinishChunkedDownloadResponse* response) override { std::string download_id = request->download_id(); response->set_download_id(download_id); - std::lock_guard lock(chunked_downloads_mutex); + [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); auto it = chunked_downloads.find(download_id); if (it == chunked_downloads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown download_id: " + download_id); @@ -610,7 +610,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // Fast path: if the job is already in a terminal state, return immediately. { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { response->set_job_status(cuopt::remote::NOT_FOUND); @@ -642,7 +642,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // RPCs for the same job share a single JobWaiter instance. std::shared_ptr waiter; { - std::lock_guard lock(waiters_mutex); + [[maybe_unused]] std::lock_guard lock(waiters_mutex); auto it = waiting_threads.find(job_id); if (it != waiting_threads.end()) { waiter = it->second; @@ -659,7 +659,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // loop so that cleanup (waiters decrement) happens in one place below. bool client_cancelled = false; { - std::unique_lock lock(waiter->mutex); + [[maybe_unused]] std::unique_lock lock(waiter->mutex); while (!waiter->ready) { if (context->IsCancelled()) { client_cancelled = true; @@ -693,7 +693,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S response->set_job_status(cuopt::remote::COMPLETED); response->set_message(""); { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto job_it = job_tracker.find(job_id); response->set_result_size_bytes( (job_it != job_tracker.end()) ? job_it->second.result_size_bytes : 0); @@ -711,7 +711,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S case JobStatus::COMPLETED: { response->set_job_status(cuopt::remote::COMPLETED); response->set_message(""); - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto job_it = job_tracker.find(job_id); response->set_result_size_bytes( (job_it != job_tracker.end()) ? job_it->second.result_size_bytes : 0); @@ -873,7 +873,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S if (from_index < 0) { from_index = 0; } - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { return Status(StatusCode::NOT_FOUND, "Job not found"); } diff --git a/cpp/src/grpc/server/grpc_worker_infra.cpp b/cpp/src/grpc/server/grpc_worker_infra.cpp index 139d86b5ff..911ea6f3b2 100644 --- a/cpp/src/grpc/server/grpc_worker_infra.cpp +++ b/cpp/src/grpc/server/grpc_worker_infra.cpp @@ -174,7 +174,7 @@ void close_worker_pipes_child_ends(int worker_id) pid_t spawn_worker(int worker_id, bool is_replacement) { - std::lock_guard lock(worker_pipes_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); if (is_replacement) { close_worker_pipes_server(worker_id); } @@ -211,7 +211,7 @@ pid_t spawn_worker(int worker_id, bool is_replacement) void spawn_workers() { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); // Index i is worker_id: keep failed startups as 0 so monitor/respawn and // pipe tables stay aligned even when some initial forks fail. worker_pids.assign(static_cast(config.num_workers), 0); @@ -223,7 +223,7 @@ void spawn_workers() void kill_all_workers() { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); for (pid_t pid : worker_pids) { if (pid > 0) { kill(pid, SIGKILL); } } @@ -231,7 +231,7 @@ void kill_all_workers() void close_all_server_worker_pipes() { - std::lock_guard lock(worker_pipes_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); for (auto& wp : worker_pipes) { close_all_worker_pipes(wp); } @@ -248,7 +248,7 @@ void cancel_all_active_jobs_for_shutdown() } { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); for (auto& [job_id, info] : job_tracker) { (void)job_id; if (info.status == JobStatus::QUEUED || info.status == JobStatus::PROCESSING) { @@ -259,11 +259,11 @@ void cancel_all_active_jobs_for_shutdown() } { - std::lock_guard wlock(waiters_mutex); + [[maybe_unused]] std::lock_guard wlock(waiters_mutex); for (auto& [job_id, waiter] : waiting_threads) { (void)job_id; { - std::lock_guard waiter_lock(waiter->mutex); + [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = "Server shutting down"; waiter->success = false; waiter->ready = true; @@ -291,7 +291,7 @@ void wait_for_workers() while (std::chrono::steady_clock::now() < deadline) { bool any_alive = false; { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); for (pid_t& pid : worker_pids) { if (pid <= 0) continue; int status = 0; @@ -313,7 +313,7 @@ void wait_for_workers() } { - std::lock_guard lock(worker_pids_mutex); + [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); for (pid_t pid : worker_pids) { if (pid > 0) { kill(pid, SIGKILL); @@ -352,7 +352,7 @@ void mark_worker_jobs_failed(pid_t dead_worker_pid) // 1. Drop the buffered request data (no longer needed). { - std::lock_guard lock(pending_data_mutex); + [[maybe_unused]] std::lock_guard lock(pending_data_mutex); pending_job_data.erase(job_id); } @@ -392,7 +392,7 @@ void mark_worker_jobs_failed(pid_t dead_worker_pid) job_queue[i].cancelled = false; { - std::lock_guard lock(tracker_mutex); + [[maybe_unused]] std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { if (was_cancelled) { diff --git a/cpp/src/io/experimental_mps_fast/fast_parser.cpp b/cpp/src/io/experimental_mps_fast/fast_parser.cpp index cb2290a8c4..07130cf31d 100644 --- a/cpp/src/io/experimental_mps_fast/fast_parser.cpp +++ b/cpp/src/io/experimental_mps_fast/fast_parser.cpp @@ -150,7 +150,7 @@ static std::mutex& get_timer_mutex() static void flush_timers() { #ifdef MPS_FAST_TIMERS - std::lock_guard lock(get_timer_mutex()); + [[maybe_unused]] std::lock_guard lock(get_timer_mutex()); auto& buffer = get_timer_buffer(); for (const auto& entry : buffer) { std::fprintf(stderr, @@ -228,7 +228,7 @@ class scoped_timer_t { nvtx_.end(); if (accumulator_) { *accumulator_ += elapsed_ms; } auto [rss_kb, hwm_kb] = current_process_rss_kb(); - std::lock_guard lock(get_timer_mutex()); + [[maybe_unused]] std::lock_guard lock(get_timer_mutex()); get_timer_buffer().push_back({name_, elapsed_ms, rss_kb, hwm_kb}); #endif } @@ -1901,7 +1901,7 @@ static void parse_columns_section_parallel(parse_state_t& state, perf_snapshots[(size_t)t] = perf_counters.stop(); #endif } catch (...) { - std::lock_guard lock(error_mutex); + [[maybe_unused]] std::lock_guard lock(error_mutex); if (!first_error) { first_error = std::current_exception(); } } } diff --git a/cpp/src/io/experimental_mps_fast/file_reader.hpp b/cpp/src/io/experimental_mps_fast/file_reader.hpp index c2df168ac6..01e7515741 100644 --- a/cpp/src/io/experimental_mps_fast/file_reader.hpp +++ b/cpp/src/io/experimental_mps_fast/file_reader.hpp @@ -105,7 +105,7 @@ class parallel_error_latch_t { public: void capture(std::exception_ptr eptr) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); if (!first_error_) { first_error_ = eptr; stopped_.store(true, std::memory_order_release); diff --git a/cpp/src/io/experimental_mps_fast/hash_table_smallstr.hpp b/cpp/src/io/experimental_mps_fast/hash_table_smallstr.hpp index bf33d7e895..64ccfedb94 100644 --- a/cpp/src/io/experimental_mps_fast/hash_table_smallstr.hpp +++ b/cpp/src/io/experimental_mps_fast/hash_table_smallstr.hpp @@ -176,7 +176,7 @@ class smallstr_hash_table_t { #endif } - void print_build_probe_report(size_t n_rows) const + void print_build_probe_report([[maybe_unused]] size_t n_rows) const { #ifdef MPS_FAST_PERF_COUNTERS hash_build_probe_stats_t stats = build_probe_stats_; diff --git a/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp b/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp index 3ec0182271..2615282c70 100644 --- a/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp +++ b/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp @@ -402,7 +402,7 @@ std::size_t lz4_input_stream_t::reserve_size_hint() const noexcept void lz4_input_stream_t::commit_up_to(std::size_t bytes) { MPS_NVTX_RANGE("lz4_commit_output", nvtx::colors::alloc); - std::lock_guard lock(commit_mutex_); + [[maybe_unused]] std::lock_guard lock(commit_mutex_); if (bytes <= output_committed_size_) return; if (bytes > output_mapped_size_) { mps_parser_fail(error_type_t::OutOfMemoryError, "LZ4 output exceeded reserved virtual mapping"); @@ -530,7 +530,7 @@ struct lz4_pipeline_t { if (state.decode_refs.load(std::memory_order_acquire) != 0) { return; } uint8_t expected = 0; if (!state.released.compare_exchange_strong(expected, 1, std::memory_order_acq_rel)) { return; } - std::lock_guard lock(window_release_mutex); + [[maybe_unused]] std::lock_guard lock(window_release_mutex); if (windows[index].data) { windows[index].data.reset(); compressed_resident_bytes.fetch_sub(windows[index].size, std::memory_order_relaxed); @@ -576,7 +576,7 @@ struct lz4_pipeline_t { } { MPS_NVTX_RANGE("lz4_window_publish", nvtx::colors::generic); - std::lock_guard lock(window_mutex); + [[maybe_unused]] std::lock_guard lock(window_mutex); window_done[index] = 1; } window_cv.notify_all(); @@ -603,7 +603,7 @@ struct lz4_pipeline_t { std::vector wait_for_decode_batch() { MPS_NVTX_RANGE("lz4_decode_wait_batch", nvtx::colors::io); - std::unique_lock lock(desc_mutex); + [[maybe_unused]] std::unique_lock lock(desc_mutex); desc_cv.wait(lock, [&] { return latch.stopped() || scanner_done || !desc_queue.empty(); }); if (latch.stopped() || desc_queue.empty()) { return {}; } std::vector batch = std::move(desc_queue.front()); @@ -676,7 +676,7 @@ struct lz4_pipeline_t { } for (std::size_t wi = first; wi <= last; ++wi) { MPS_NVTX_RANGE("lz4_metadata_wait_window", nvtx::colors::io); - std::unique_lock lock(window_mutex); + [[maybe_unused]] std::unique_lock lock(window_mutex); window_cv.wait(lock, [&] { return latch.stopped() || window_done[wi] != 0; }); if (latch.stopped() && window_done[wi] == 0) { mps_parser_fail(error_type_t::RuntimeError, @@ -694,7 +694,7 @@ struct lz4_pipeline_t { } { MPS_NVTX_RANGE("lz4_metadata_enqueue_batch", nvtx::colors::generic); - std::lock_guard lock(desc_mutex); + [[maybe_unused]] std::lock_guard lock(desc_mutex); desc_queue.push_back(std::move(batch)); } batch.clear(); @@ -707,13 +707,13 @@ struct lz4_pipeline_t { nvtx::name_current_thread("lz4-metadata-scan"); scan_lz4_metadata(); { - std::lock_guard lock(desc_mutex); + [[maybe_unused]] std::lock_guard lock(desc_mutex); scanner_done = true; } desc_cv.notify_all(); } catch (...) { { - std::lock_guard lock(desc_mutex); + [[maybe_unused]] std::lock_guard lock(desc_mutex); scanner_done = true; } fail_and_notify(std::current_exception()); diff --git a/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp b/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp index 32cbf3a105..7c3c746f21 100644 --- a/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp +++ b/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp @@ -80,7 +80,7 @@ void mps_phase_registry_t::publish(mps_phase_kind phase, mps_phase_range_t range omp_event_handle_t event{}; bool fulfill = false; { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); if (ready_[idx].load(std::memory_order_acquire)) { return; } ranges_[idx] = range; ready_[idx].store(true, std::memory_order_release); @@ -98,7 +98,7 @@ void mps_phase_registry_t::attach_event(mps_phase_kind phase, omp_event_handle_t std::size_t idx = phase_index(phase); bool fulfill = false; { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); events_[idx] = event; has_event_[idx] = true; if (ready_[idx].load(std::memory_order_acquire) && !event_fulfilled_[idx]) { @@ -116,15 +116,15 @@ bool mps_phase_registry_t::ready(mps_phase_kind phase) const mps_phase_range_t mps_phase_registry_t::range(mps_phase_kind phase) const { - std::size_t idx = phase_index(phase); - bool is_ready = ready_[idx].load(std::memory_order_acquire); + std::size_t idx = phase_index(phase); + [[maybe_unused]] bool is_ready = ready_[idx].load(std::memory_order_acquire); assert(is_ready); return ranges_[idx]; } void mps_phase_registry_t::publish_endata(const char* begin, bool present) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); if (endata_ready_.load(std::memory_order_acquire)) { return; } endata_begin_ = begin; endata_present_ = present; @@ -335,7 +335,7 @@ void mps_section_block_scanner_t::advance_ready_frontier() std::size_t new_ready = 0; bool grew = false; { - std::lock_guard lock(frontier_mutex_); + [[maybe_unused]] std::lock_guard lock(frontier_mutex_); while (next_block_ < block_count_ && block_decoded_[next_block_].load(std::memory_order_acquire)) { new_ready = block_end_offsets_[next_block_].load(std::memory_order_acquire); @@ -366,7 +366,7 @@ void mps_section_block_scanner_t::notify_ready_phases() // publish present=false once a later boundary proves they cannot still appear. // ENDATA, or final ready bytes for truncated/non-newline files, is the final // boundary for the trailing optional/quadratic phases. - std::lock_guard lock(publish_mutex_); + [[maybe_unused]] std::lock_guard lock(publish_mutex_); std::size_t ready = ready_bytes_.load(std::memory_order_acquire); const char* ready_ptr = data_ + ready; const char* rows = diff --git a/cpp/src/io/mps_writer.cpp b/cpp/src/io/mps_writer.cpp index d0eaa428c8..f6a81086c2 100644 --- a/cpp/src/io/mps_writer.cpp +++ b/cpp/src/io/mps_writer.cpp @@ -151,7 +151,6 @@ void mps_writer_t::write(const std::string& mps_file_path) else n_constraints = problem_.get_constraint_lower_bounds().size(); const auto& quadratic_constraints = problem_.get_quadratic_constraints(); - const i_t n_quadratic_constraints = static_cast(quadratic_constraints.size()); std::vector objective_coefficients(problem_.get_objective_coefficients().size()); std::vector constraint_lower_bounds(n_constraints); diff --git a/cpp/src/io/utilities/error.hpp b/cpp/src/io/utilities/error.hpp index 0055c889f6..f5043f0b6c 100644 --- a/cpp/src/io/utilities/error.hpp +++ b/cpp/src/io/utilities/error.hpp @@ -99,7 +99,6 @@ inline void mps_parser_expects_fatal(bool cond, error_type_t error_type, const c char msg[2048]; vsnprintf(msg, sizeof(msg), fmt, args); va_end(args); - std::string error_string = error_to_string(error_type); std::fprintf(stderr, "{\"MPS_PARSER_ERROR_TYPE\": \"%s\", \"msg\": \"%s\"}\n", error_to_string(error_type).c_str(), diff --git a/cpp/src/linear_algebra/sort_csr.cuh b/cpp/src/linear_algebra/sort_csr.cuh index 1b57bb3163..1f93b98cd6 100644 --- a/cpp/src/linear_algebra/sort_csr.cuh +++ b/cpp/src/linear_algebra/sort_csr.cuh @@ -21,7 +21,7 @@ namespace mathematical_optimization { template void sort_csr(optimization_problem_t& op_problem) { - raft::common::nvtx::range fun_scope("sort_csr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_csr"); auto stream_view = op_problem.get_handle_ptr()->get_stream(); rmm::device_uvector d_tmp_storage_bytes(0, stream_view); size_t tmp_storage_bytes{0}; diff --git a/cpp/src/linear_algebra/sparse_matrix.cpp b/cpp/src/linear_algebra/sparse_matrix.cpp index 158fecefcf..d47116a1e1 100644 --- a/cpp/src/linear_algebra/sparse_matrix.cpp +++ b/cpp/src/linear_algebra/sparse_matrix.cpp @@ -59,7 +59,6 @@ i_t coo_to_csc(const std::vector& Ai, if (A.nz_max < Ai.size()) { A.reallocate(static_cast(Ai.size())); } i_t n = A.n; - i_t m = A.m; i_t nz = Aj.size(); std::vector workspace(n); @@ -152,7 +151,7 @@ i_t csc_matrix_t::load_a_column(i_t j, std::vector& Aj) const template void csc_matrix_t::append_column(const std::vector& x) { - const i_t m = this->m; + [[maybe_unused]] const i_t m = this->m; assert(x.size() == m); const i_t xsz = x.size(); i_t nz = this->col_start[this->n]; @@ -173,7 +172,7 @@ void csc_matrix_t::append_column(const std::vector& x) template void csc_matrix_t::append_column(const sparse_vector_t& x) { - const i_t m = this->m; + [[maybe_unused]] const i_t m = this->m; assert(x.n == m); i_t nz = this->col_start[this->n]; const i_t xnz = x.i.size(); @@ -473,8 +472,8 @@ void csc_matrix_t::print_matrix() const template void csc_matrix_t::compare(csc_matrix_t const& B) const { - auto my_nnz = this->col_start[this->n]; - auto B_nnz = B.col_start[B.n]; + [[maybe_unused]] auto my_nnz = this->col_start[this->n]; + [[maybe_unused]] auto B_nnz = B.col_start[B.n]; assert(my_nnz == B_nnz); assert(this->m == B.m); assert(this->n == B.n); @@ -573,7 +572,7 @@ i_t scatter(const csc_matrix_t& A, } template -i_t csc_matrix_t::check_matrix(std::string matrix_name) const +i_t csc_matrix_t::check_matrix([[maybe_unused]] std::string matrix_name) const { #ifdef CHECK_MATRIX std::vector row_marker(this->m, -1); @@ -778,8 +777,8 @@ template i_t csc_matrix_t::permute_rows(const std::vector& pinv, csc_matrix_t& C) const { - i_t m = this->m; - i_t n = this->n; + [[maybe_unused]] i_t m = this->m; + i_t n = this->n; assert(C.m == m); assert(C.n == n); @@ -806,8 +805,8 @@ i_t csc_matrix_t::permute_rows_and_cols(const std::vector& pinv, const std::vector& q, csc_matrix_t& C) const { - i_t m = this->m; - i_t n = this->n; + [[maybe_unused]] i_t m = this->m; + i_t n = this->n; assert(C.m == m); assert(C.n == n); @@ -921,7 +920,6 @@ f_t sparse_dot(const std::vector& xind, const i_t nx = xind.size(); const i_t col_start = Y.col_start[y_col]; const i_t col_end = Y.col_start[y_col + 1]; - const i_t ny = col_end - col_start; f_t dot = 0.0; for (i_t i = 0, k = col_start; i < nx && k < col_end;) { const i_t p = xind[i]; diff --git a/cpp/src/linear_algebra/sparse_matrix.hpp b/cpp/src/linear_algebra/sparse_matrix.hpp index 95ee0f0f32..5cea1ea183 100644 --- a/cpp/src/linear_algebra/sparse_matrix.hpp +++ b/cpp/src/linear_algebra/sparse_matrix.hpp @@ -252,8 +252,8 @@ i_t matrix_transpose_vector_multiply(const csc_matrix_t& A, f_t beta, std::vector& y) { - i_t m = A.m; - i_t n = A.n; + [[maybe_unused]] i_t m = A.m; + i_t n = A.n; assert(y.size() == n); assert(x.size() == m); diff --git a/cpp/src/linear_algebra/sparse_vector.cpp b/cpp/src/linear_algebra/sparse_vector.cpp index 17839b342f..607ea9252a 100644 --- a/cpp/src/linear_algebra/sparse_vector.cpp +++ b/cpp/src/linear_algebra/sparse_vector.cpp @@ -126,7 +126,7 @@ template void sparse_vector_t::inverse_permute_vector(const std::vector& p, sparse_vector_t& y) const { - i_t m = p.size(); + [[maybe_unused]] i_t m = p.size(); assert(n == m); i_t nz = i.size(); y.n = n; @@ -154,7 +154,6 @@ f_t sparse_vector_t::sparse_dot(const csc_matrix_t& Y, i_t y { const i_t col_start = Y.col_start[y_col]; const i_t col_end = Y.col_start[y_col + 1]; - const i_t ny = col_end - col_start; const i_t nx = i.size(); f_t dot = 0.0; for (i_t h = 0, k = col_start; h < nx && k < col_end;) { diff --git a/cpp/src/math_optimization/solution_writer.cu b/cpp/src/math_optimization/solution_writer.cu index c22fb46da3..74c8c09ae3 100644 --- a/cpp/src/math_optimization/solution_writer.cu +++ b/cpp/src/math_optimization/solution_writer.cu @@ -22,7 +22,7 @@ void solution_writer_t::write_solution_to_sol_file(const std::string& filename, const std::vector& variable_names, const std::vector& variable_values) { - raft::common::nvtx::range fun_scope("write final solution to .sol file"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("write final solution to .sol file"); std::ofstream file(filename.data()); if (!file.is_open()) { diff --git a/cpp/src/mip_heuristics/diversity/diversity_manager.cu b/cpp/src/mip_heuristics/diversity/diversity_manager.cu index 96165e6064..6625c95dbc 100644 --- a/cpp/src/mip_heuristics/diversity/diversity_manager.cu +++ b/cpp/src/mip_heuristics/diversity/diversity_manager.cu @@ -127,7 +127,7 @@ void diversity_manager_t::consume_staged_simplex_solution(lp_state_t staged_simplex_dual_solution_local; f_t staged_simplex_objective_local = std::numeric_limits::infinity(); { - std::lock_guard guard(relaxed_solution_mutex); + [[maybe_unused]] std::lock_guard guard(relaxed_solution_mutex); cuopt_assert(simplex_solution_exists.load(), "Simplex solution flag set without a staged simplex solution"); staged_simplex_solution_local = staged_simplex_solution; @@ -168,7 +168,7 @@ bool diversity_manager_t::run_local_search(solution_t& solut timer_t& timer, ls_config_t& ls_config) { - raft::common::nvtx::range fun_scope("run_local_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_local_search"); i_t ls_mab_option = mab_ls.select_mab_option(); mab_ls_config_t::get_local_search_and_lm_from_config(ls_mab_option, ls_config); ls_hash_map.insert(solution); @@ -181,7 +181,7 @@ bool diversity_manager_t::run_local_search(solution_t& solut template void diversity_manager_t::generate_solution(f_t time_limit, bool random_start) { - raft::common::nvtx::range fun_scope("generate_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_solution"); solution_t sol(*problem_ptr); sol.compute_feasibility(); // if a feasible is found, it is added to the population @@ -193,7 +193,7 @@ template void diversity_manager_t::add_user_given_solutions( std::vector>& initial_sol_vector) { - raft::common::nvtx::range fun_scope("add_user_given_solutions"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_user_given_solutions"); const bool has_papilo = problem_ptr->has_papilo_presolve_data(); const i_t papilo_orig_n = problem_ptr->get_papilo_original_num_variables(); for (size_t sol_idx = 0; sol_idx < context.settings.initial_solutions.size(); ++sol_idx) { @@ -293,7 +293,7 @@ void diversity_manager_t::add_user_given_solutions( template bool diversity_manager_t::run_presolve(f_t time_limit, timer_t global_timer) { - raft::common::nvtx::range fun_scope("run_presolve"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_presolve"); CUOPT_LOG_INFO("\nRunning cuOpt presolve"); timer_t presolve_timer(time_limit); @@ -401,7 +401,7 @@ bool diversity_manager_t::run_presolve(f_t time_limit, timer_t global_ template void diversity_manager_t::generate_quick_feasible_solution() { - raft::common::nvtx::range fun_scope("generate_quick_feasible_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_quick_feasible_solution"); solution_t solution(*problem_ptr); // min 1 second, max 10 seconds const f_t generate_fast_solution_time = @@ -476,7 +476,7 @@ struct ls_cpufj_raii_guard_t { template solution_t diversity_manager_t::run_solver() { - raft::common::nvtx::range fun_scope("run_solver"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_solver"); CUOPT_LOG_DEBUG("Determinism mode: %s", context.settings.determinism_mode == CUOPT_MODE_DETERMINISTIC ? "deterministic" @@ -599,7 +599,7 @@ solution_t diversity_manager_t::run_solver() bool use_staged_simplex_solution = false; { - std::lock_guard guard(relaxed_solution_mutex); + [[maybe_unused]] std::lock_guard guard(relaxed_solution_mutex); use_staged_simplex_solution = simplex_solution_exists.load(); if (!use_staged_simplex_solution && root_lp_usable) { raft::copy(lp_optimal_solution.data(), @@ -780,7 +780,7 @@ template void diversity_manager_t::recombine_and_ls_with_all(solution_t& solution, bool add_only_feasible) { - raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); // if (population.population_hash_map.check_skip_solution(solution, 1)) { return; } auto population_vector = population.population_to_vector(); for (auto& curr_sol : population_vector) { @@ -813,7 +813,7 @@ template void diversity_manager_t::recombine_and_ls_with_all( std::vector>& solutions, bool add_only_feasible) { - raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); if (solutions.size() > 0) { CUOPT_LOG_DEBUG("Running recombiners on B&B solutions with size %lu", solutions.size()); // add all solutions because time limit might have been consumed and we might have exited before @@ -867,7 +867,7 @@ diversity_manager_t::recombine_and_local_search(solution_t& solution_t& sol2, recombiner_enum_t recombiner_type) { - raft::common::nvtx::range fun_scope("recombine_and_local_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine_and_local_search"); CUOPT_LOG_DEBUG("Recombining sol cost:feas %f : %d and %f : %d", sol1.get_quality(population.weights), sol1.get_feasible(), @@ -892,7 +892,6 @@ diversity_manager_t::recombine_and_local_search(solution_t& offspring.get_quality(population.weights), offspring.get_feasible()); cuopt_assert(offspring.test_number_all_integer(), "All must be integers before LS"); - bool feasibility_before = offspring.get_feasible(); ls_config_t ls_config; ls_config.best_objective_of_parents = best_objective_of_parents; ls_config.at_least_one_parent_feasible = at_least_one_parent_feasible; @@ -1036,7 +1035,7 @@ void diversity_manager_t::set_simplex_solution(const std::vector& f_t objective) { CUOPT_LOG_DEBUG("Setting simplex solution with objective %f", objective); - std::lock_guard lock(relaxed_solution_mutex); + [[maybe_unused]] std::lock_guard lock(relaxed_solution_mutex); global_concurrent_halt = 1; cuopt_assert(lp_optimal_solution.size() == solution.size(), "Assignment size mismatch"); cuopt_assert(problem_ptr->n_constraints == dual_solution.size(), "Dual assignment size mismatch"); diff --git a/cpp/src/mip_heuristics/diversity/population.cu b/cpp/src/mip_heuristics/diversity/population.cu index 16f11b9e76..1cf38b949f 100644 --- a/cpp/src/mip_heuristics/diversity/population.cu +++ b/cpp/src/mip_heuristics/diversity/population.cu @@ -93,7 +93,7 @@ template std::pair, solution_t> population_t::get_two_random( bool tournament) { - raft::common::nvtx::range fun_scope("get_two_random"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_two_random"); cuopt_assert(indices.size() > 2, "There should be enough solutions"); size_t add = (size_t)(!solutions[0].first); size_t i = add + std::uniform_int_distribution(0, (indices.size() - 2))(rng); @@ -127,7 +127,7 @@ std::pair, solution_t> population_t::ge template void population_t::add_solutions_from_vec(std::vector>&& solutions) { - raft::common::nvtx::range fun_scope("add_solution_from_vec"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_solution_from_vec"); for (auto&& sol : solutions) { add_solution(std::move(sol)); } @@ -136,7 +136,7 @@ void population_t::add_solutions_from_vec(std::vector size_t population_t::get_external_solution_size() { - std::lock_guard lock(solution_mutex); + [[maybe_unused]] std::lock_guard lock(solution_mutex); return external_solution_queue.size(); } @@ -146,7 +146,7 @@ void population_t::add_external_solution(const std::vector& solut solution_origin_t origin) { context.solution_publication.publish_if_better(problem_ptr, solution, objective); - std::lock_guard lock(solution_mutex); + [[maybe_unused]] std::lock_guard lock(solution_mutex); if (origin == solution_origin_t::CPUFJ) { external_solution_queue_cpufj.emplace_back(solution, objective, origin); @@ -197,7 +197,7 @@ void population_t::preempt_heuristic_solver() template std::vector> population_t::get_external_solutions() { - std::lock_guard lock(solution_mutex); + [[maybe_unused]] std::lock_guard lock(solution_mutex); std::vector> return_vector; [[maybe_unused]] i_t counter = 0; f_t new_best_feasible_objective = best_feasible_objective; @@ -398,8 +398,8 @@ void population_t::adjust_weights_according_to_best_feasible() template std::pair population_t::add_solution(solution_t&& sol) { - std::lock_guard lock(write_mutex); - raft::common::nvtx::range fun_scope("add_solution"); + [[maybe_unused]] std::lock_guard lock(write_mutex); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_solution"); // Sync the input solution's stream to ensure all device data is visible. // The solution might have been created/modified on a different stream, // and we need those operations to complete before reading device data @@ -574,7 +574,7 @@ void population_t::compute_new_weights() template void population_t::update_qualities() { - std::lock_guard lock(write_mutex); + [[maybe_unused]] std::lock_guard lock(write_mutex); if (indices.size() == 1) return; using pr = std::pair; for (size_t i = !is_feasible(); i < indices.size(); i++) @@ -590,7 +590,7 @@ void population_t::update_qualities() template void population_t::update_weights() { - raft::common::nvtx::range fun_scope("adjust_weight_changes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("adjust_weight_changes"); CUOPT_LOG_DEBUG("Changing the weights"); compute_new_weights(); normalize_weights(); @@ -610,7 +610,7 @@ bool population_t::check_sols_similar(solution_t& sol1, template size_t population_t::best_similar_index(solution_t& sol) { - raft::common::nvtx::range fun_scope("best_similar_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("best_similar_index"); if (indices.size() == 1) return max_solutions; for (size_t i = 1; i < indices.size(); i++) { if (check_sols_similar(sol, solutions[indices[i].first].second)) { return i; } @@ -623,7 +623,7 @@ size_t population_t::best_similar_index(solution_t& sol) template i_t population_t::insert_index(std::pair to_insert) { - raft::common::nvtx::range fun_scope("insert_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_index"); // Assert free index is available indices.emplace_back(0, 0.0); size_t start = indices.size() - 1; @@ -640,7 +640,7 @@ template bool population_t::check_if_feasible_similar_exists(size_t start_index, solution_t& sol) { - raft::common::nvtx::range fun_scope("check_if_feasible_similar_exists"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_if_feasible_similar_exists"); for (size_t i = start_index; i < indices.size(); i++) { if (check_sols_similar(sol, solutions[indices[i].first].second)) { if (solutions[indices[i].first].second.get_feasible()) { return true; } @@ -652,7 +652,7 @@ bool population_t::check_if_feasible_similar_exists(size_t start_index template void population_t::eradicate_similar(size_t start_index, solution_t& sol) { - raft::common::nvtx::range fun_scope("eradicate_similar"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("eradicate_similar"); for (size_t i = start_index; i < indices.size(); i++) { if (check_sols_similar(sol, solutions[indices[i].first].second)) { solutions[indices[i].first].first = false; // mark place as available @@ -673,7 +673,7 @@ void population_t::eradicate_similar(size_t start_index, solution_t std::vector> population_t::population_to_vector() { - std::lock_guard lock(write_mutex); + [[maybe_unused]] std::lock_guard lock(write_mutex); if (solutions.empty()) return {}; std::vector> sol_vec; bool population_feasible = is_feasible(); @@ -686,7 +686,7 @@ std::vector> population_t::population_to_vector() template void population_t::halve_the_population() { - raft::common::nvtx::range fun_scope("halve_the_population"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("halve_the_population"); // try 3/4 here if (current_size() <= (max_solutions * halving_skip_ratio)) { return; } CUOPT_LOG_DEBUG("Halving the population, current size: %lu", current_size()); @@ -696,7 +696,7 @@ void population_t::halve_the_population() constexpr i_t max_adjustments = 4; size_t max_var_threshold = get_max_var_threshold(problem_ptr->n_integer_vars); - std::lock_guard lock(write_mutex); + [[maybe_unused]] std::lock_guard lock(write_mutex); while (current_size() > max_solutions / 2) { clear_except_best_feasible(); var_threshold = std::max(var_threshold * 0.97, 0.5 * problem_ptr->n_integer_vars); @@ -722,7 +722,7 @@ void population_t::halve_the_population() template size_t population_t::find_free_solution_index() { - raft::common::nvtx::range fun_scope("find_free_solution_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_free_solution_index"); // ASSERT such index exists for (size_t i = 1; i < solutions.size(); i++) if (solutions[i].first == false) return i; @@ -752,7 +752,7 @@ template void population_t::find_diversity(std::vector>& initial_sol_vector, bool avg) { - raft::common::nvtx::range fun_scope("find_diversity"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_diversity"); i_t n_feasible = 0; size_t average = 0; size_t max = 0; @@ -861,7 +861,7 @@ void population_t::run_all_recombiners(solution_t& sol) template void population_t::diversity_step(i_t max_iterations_without_improvement) { - raft::common::nvtx::range fun_scope("diversity_step"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("diversity_step"); dm.diversity_step(max_iterations_without_improvement); } diff --git a/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh index fca4821d4d..ddb116215f 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh @@ -38,7 +38,7 @@ class bound_prop_recombiner_t : public recombiner_t { rmm::device_uvector>& probing_values, i_t n_vars_from_other) { - raft::common::nvtx::range fun_scope("get_probing_values_for_infeasible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_probing_values_for_infeasible"); auto guiding_view = guiding.view(); auto other_view = other.view(); auto offspring_view = offspring.view(); @@ -99,10 +99,10 @@ class bound_prop_recombiner_t : public recombiner_t { solution_t& other, solution_t& offspring, rmm::device_uvector>& probing_values, - i_t n_vars_from_other, + [[maybe_unused]] i_t n_vars_from_other, rmm::device_uvector& variable_map) { - raft::common::nvtx::range fun_scope("get_probing_values_for_feasible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_probing_values_for_feasible"); cuopt_assert(n_vars_from_other == offspring.problem_ptr->n_integer_vars, "The number of vars from other should match!"); auto guiding_view = guiding.view(); @@ -135,7 +135,7 @@ class bound_prop_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - raft::common::nvtx::range fun_scope("bound_prop_recombiner"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("bound_prop_recombiner"); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; // copy the solution from guiding @@ -173,7 +173,7 @@ class bound_prop_recombiner_t : public recombiner_t { constraint_prop.max_n_failed_repair_iterations = bp_recombiner_config_t::n_repair_iterations; rmm::device_uvector> probing_values(a.problem_ptr->n_variables, a.handle_ptr->get_stream()); - probing_config_t probing_config(a.problem_ptr->n_variables, a.handle_ptr); + probing_config_t probing_config(a.problem_ptr->n_variables); if (guiding_solution.get_feasible() && !a.problem_ptr->expensive_to_fix_vars) { this->compute_vars_to_fix(offspring, vars_to_fix, n_vars_from_other, n_vars_from_guiding); auto [fixed_problem, fixed_assignment, variable_map] = offspring.fix_variables(vars_to_fix); diff --git a/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh index 993a534a38..90f9ffe50c 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh @@ -39,7 +39,7 @@ class fp_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - raft::common::nvtx::range fun_scope("FP recombiner"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("FP recombiner"); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; // copy the solution from A diff --git a/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh index 0cc1684b7a..1d81f39976 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh @@ -34,7 +34,7 @@ class line_segment_recombiner_t : public recombiner_t { i_t n_points_to_search, i_t remaining_variables) { - raft::common::nvtx::range fun_scope("generate_delta_vector"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_delta_vector"); CUOPT_LOG_DEBUG("LS rec: Number of different variables %d MAX_VARS %d", remaining_variables, ls_recombiner_config_t::max_n_of_vars_from_other); @@ -71,7 +71,7 @@ class line_segment_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - raft::common::nvtx::range fun_scope("line_segment_recombiner"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("line_segment_recombiner"); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; // copy the solution from A diff --git a/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh b/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh index 7990465b81..af7545b577 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh @@ -32,7 +32,7 @@ class sub_mip_recombiner_t : public recombiner_t { { } - void solution_callback(std::vector& solution, f_t objective) + void solution_callback(std::vector& solution, [[maybe_unused]] f_t objective) { CUOPT_LOG_DEBUG("SUBMIP added solution with objective %.16e", objective); solution_vector.push_back(solution); @@ -42,7 +42,7 @@ class sub_mip_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - raft::common::nvtx::range fun_scope("Sub-MIP recombiner"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Sub-MIP recombiner"); solution_vector.clear(); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; @@ -86,7 +86,7 @@ class sub_mip_recombiner_t : public recombiner_t { static_cast(1), true); scaling.scale_problem(); - fixed_problem.presolve_data.reset_additional_vars(fixed_problem, offspring.handle_ptr); + fixed_problem.presolve_data.reset_additional_vars(fixed_problem); fixed_problem.presolve_data.initialize_var_mapping(fixed_problem, offspring.handle_ptr); trivial_presolve(fixed_problem); fixed_problem.check_problem_representation(true); diff --git a/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu b/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu index 66c97d9b7c..22837e804b 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu @@ -63,7 +63,7 @@ void early_gpufj_t::start() #pragma omp task default(none) shared(fj_ptr_) priority(CUOPT_DEFAULT_TASK_PRIORITY) \ depend(out : *fj_ptr_) { - raft::device_setter guard(this->device_id_); + [[maybe_unused]] raft::device_setter guard(this->device_id_); fj_ptr_->solve(*this->solution_ptr_); } } diff --git a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu index 450019d415..63e5e6b378 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu @@ -320,7 +320,7 @@ void fj_t::climber_init(i_t climber_idx) template void fj_t::climber_init(i_t climber_idx, cuda::stream_ref climber_stream) { - raft::common::nvtx::range scope("climber_init"); + [[maybe_unused]] raft::common::nvtx::range scope("climber_init"); cuopt_assert(climber_idx >= 0 && climber_idx < climbers.size(), ""); @@ -664,7 +664,7 @@ void fj_t::run_step_device(cuda::stream_ref climber_stream, i_t climber_idx, bool use_graph) { - raft::common::nvtx::range scope("run_step_device"); + [[maybe_unused]] raft::common::nvtx::range scope("run_step_device"); auto [grid_setval, blocks_setval] = setval_launch_dims; auto [grid_update_changed_constraints, blocks_update_changed_constraints] = update_changed_constraints_launch_dims; @@ -1067,7 +1067,7 @@ void fj_t::resize_vectors(const raft::handle_t* handle_ptr) template i_t fj_t::solve(solution_t& solution) { - raft::common::nvtx::range scope("fj_solve"); + [[maybe_unused]] raft::common::nvtx::range scope("fj_solve"); timer_t timer(settings.time_limit); handle_ptr = const_cast(solution.handle_ptr); pb_ptr = solution.problem_ptr; diff --git a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cuh b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cuh index b71892b39d..28e80c323b 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cuh +++ b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cuh @@ -535,12 +535,12 @@ class fj_t { fj_settings_t* settings; - HDI f_t lower_excess_score(i_t cstr, f_t lhs, f_t c_lb) const + HDI f_t lower_excess_score([[maybe_unused]] i_t cstr, f_t lhs, f_t c_lb) const { return raft::min(lhs - c_lb, (f_t)0); } - HDI f_t upper_excess_score(i_t cstr, f_t lhs, f_t c_ub) const + HDI f_t upper_excess_score([[maybe_unused]] i_t cstr, f_t lhs, f_t c_ub) const { return raft::min(c_ub - lhs, (f_t)0); } @@ -568,7 +568,7 @@ class fj_t { // which may suffer from numerical errors and lead to very slight (~machine epsilon) // violations of the actual bounds. // Use a slightly tightened tolerance in FJ to account for this. - HDI f_t get_corrected_tolerance(i_t cstr, f_t c_lb, f_t c_ub) const + HDI f_t get_corrected_tolerance([[maybe_unused]] i_t cstr, f_t c_lb, f_t c_ub) const { f_t cstr_tolerance = get_cstr_tolerance( c_lb, c_ub, pb.tolerances.absolute_tolerance, pb.tolerances.relative_tolerance); diff --git a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu index f50849fcff..eebe49bde7 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu @@ -414,8 +414,8 @@ DI void check_variable_feasibility(const typename fj_t::climber_data_t bool check_integer) { for (i_t var_idx = threadIdx.x; var_idx < fj.pb.n_variables; var_idx += blockDim.x) { - auto val = fj.incumbent_assignment[var_idx]; - bool feasible = fj.pb.check_variable_within_bounds(var_idx, val); + auto val = fj.incumbent_assignment[var_idx]; + [[maybe_unused]] bool feasible = fj.pb.check_variable_within_bounds(var_idx, val); cuopt_assert(feasible, "invalid variable assignment"); if (check_integer && fj.pb.is_integer_var(var_idx)) @@ -499,7 +499,7 @@ DI bool save_best_solution(typename fj_t::climber_data_t::view_t& fj) cuopt_assert( *fj.weighted_violation_score <= *fj.max_cstr_weight * fj.pb.tolerances.absolute_tolerance, "Violated constraint and score mismatch"); - bool check_integer = fj.settings->mode != fj_mode_t::ROUNDING; + [[maybe_unused]] bool check_integer = fj.settings->mode != fj_mode_t::ROUNDING; cuopt_func_call(check_feasibility(fj, check_integer)); } // return whether it is an improving local minimum diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu index 807ad8d729..309495ad0e 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu @@ -64,8 +64,7 @@ void finalize_fj_cpu_host_initialization( const typename mip_solver_settings_t::tolerances_t& tolerances); template -thrust::tuple get_mtm_for_bound(const typename fj_t::climber_data_t::view_t& fj, - i_t var_idx, +thrust::tuple get_mtm_for_bound(i_t var_idx, i_t cstr_idx, f_t cstr_coeff, f_t bound, @@ -386,7 +385,7 @@ static void log_regression_features(fj_cpu_climber_t& fj_cpu, i_t n_cstrs = fj_cpu.h_offsets.size() - 1; // Dynamic runtime features - double violated_ratio = (double)fj_cpu.violated_constraints.size() / n_cstrs; + [[maybe_unused]] double violated_ratio = (double)fj_cpu.violated_constraints.size() / n_cstrs; // Compute per-iteration metrics [[maybe_unused]] double nnz_per_move = 0.0; @@ -394,44 +393,45 @@ static void log_regression_features(fj_cpu_climber_t& fj_cpu, fj_cpu.n_lift_moves_window + fj_cpu.n_mtm_viol_moves_window + fj_cpu.n_mtm_sat_moves_window; if (total_moves > 0) { nnz_per_move = (double)fj_cpu.nnz_processed_window / total_moves; } - double eval_intensity = (double)fj_cpu.nnz_processed_window / 1000.0; + [[maybe_unused]] double eval_intensity = (double)fj_cpu.nnz_processed_window / 1000.0; // Cache and locality metrics i_t cache_hits_window = fj_cpu.hit_count - fj_cpu.hit_count_window_start; i_t cache_misses_window = fj_cpu.miss_count - fj_cpu.miss_count_window_start; i_t total_cache_accesses = cache_hits_window + cache_misses_window; - double cache_hit_rate = + [[maybe_unused]] double cache_hit_rate = total_cache_accesses > 0 ? (double)cache_hits_window / total_cache_accesses : 0.0; i_t unique_cstrs = fj_cpu.unique_cstrs_accessed_window.size(); i_t unique_vars = fj_cpu.unique_vars_accessed_window.size(); // Reuse ratios: how many times each constraint/variable was accessed on average - double cstr_reuse_ratio = + [[maybe_unused]] double cstr_reuse_ratio = unique_cstrs > 0 ? (double)fj_cpu.nnz_processed_window / unique_cstrs : 0.0; - double var_reuse_ratio = + [[maybe_unused]] double var_reuse_ratio = unique_vars > 0 ? (double)fj_cpu.n_variable_updates_window / unique_vars : 0.0; // Working set size estimation (KB) // Each constraint: lhs (f_t) + 2 bounds (f_t) + sumcomp (f_t) = 4 * sizeof(f_t) // Each variable: assignment (f_t) = 1 * sizeof(f_t) i_t working_set_bytes = unique_cstrs * 4 * sizeof(f_t) + unique_vars * sizeof(f_t); - double working_set_kb = working_set_bytes / 1024.0; + [[maybe_unused]] double working_set_kb = working_set_bytes / 1024.0; // Coverage: what fraction of problem is actively touched - double cstr_coverage = (double)unique_cstrs / n_cstrs; - double var_coverage = (double)unique_vars / n_vars; + [[maybe_unused]] double cstr_coverage = (double)unique_cstrs / n_cstrs; + [[maybe_unused]] double var_coverage = (double)unique_vars / n_vars; - double loads_per_iter = 0.0; - double stores_per_iter = 0.0; - double l1_miss = -1.0; - double l3_miss = -1.0; + [[maybe_unused]] double loads_per_iter = 0.0; + [[maybe_unused]] double stores_per_iter = 0.0; + [[maybe_unused]] double l1_miss = -1.0; + [[maybe_unused]] double l3_miss = -1.0; // Compute memory statistics - double mem_loads_mb = mem_loads_bytes / 1e6; - double mem_stores_mb = mem_stores_bytes / 1e6; - double mem_total_mb = (mem_loads_bytes + mem_stores_bytes) / 1e6; - double mem_bandwidth_gb_per_sec = (mem_total_mb / 1000.0) / (time_window_ms / 1000.0); + [[maybe_unused]] double mem_loads_mb = mem_loads_bytes / 1e6; + [[maybe_unused]] double mem_stores_mb = mem_stores_bytes / 1e6; + double mem_total_mb = (mem_loads_bytes + mem_stores_bytes) / 1e6; + [[maybe_unused]] double mem_bandwidth_gb_per_sec = + (mem_total_mb / 1000.0) / (time_window_ms / 1000.0); // Build per-wrapper memory statistics string std::stringstream wrapper_stats; @@ -989,10 +989,7 @@ static void update_weights(fj_cpu_climber_t& fj_cpu) } template -static void apply_move(fj_cpu_climber_t& fj_cpu, - i_t var_idx, - f_t delta, - bool localmin = false) +static void apply_move(fj_cpu_climber_t& fj_cpu, i_t var_idx, f_t delta) { timing_raii_t timer(fj_cpu.apply_move_times); CPUFJ_NVTX_RANGE("CPUFJ::apply_move"); @@ -1402,14 +1399,8 @@ static thrust::tuple find_lift_move( // Process each bound separately, as both are satified and may both be finite // otherwise range constraints aren't correctly handled for (auto [bound, sign] : {std::make_tuple(c_lb, -1), std::make_tuple(c_ub, 1)}) { - auto [delta, slack] = get_mtm_for_bound(fj_cpu.view, - var_idx, - cstr_idx, - cstr_coeff, - bound, - sign, - fj_cpu.h_assignment, - fj_cpu.h_lhs); + auto [delta, slack] = get_mtm_for_bound( + var_idx, cstr_idx, cstr_coeff, bound, sign, fj_cpu.h_assignment, fj_cpu.h_lhs); if (cstr_coeff * sign < 0) { if (is_integer_var(fj_cpu, var_idx)) delta = ceil(delta); @@ -1653,7 +1644,7 @@ void finalize_fj_cpu_host_initialization( i_t nnz, const typename mip_solver_settings_t::tolerances_t& tolerances) { - raft::common::nvtx::range scope("finalize_fj_cpu_host_initialization"); + [[maybe_unused]] raft::common::nvtx::range scope("finalize_fj_cpu_host_initialization"); cuopt_assert(n_variables >= 0, "invalid variable count"); cuopt_assert(n_constraints >= 0, "invalid constraint count"); @@ -1884,8 +1875,8 @@ static void sanity_checks(fj_cpu_climber_t& fj_cpu) // Check that each constraint is in exactly one of violated_constraints or satisfied_constraints for (i_t cstr_idx = 0; cstr_idx < fj_cpu.view.pb.n_constraints; ++cstr_idx) { - bool in_viol = fj_cpu.violated_constraints.count(cstr_idx) > 0; - bool in_sat = fj_cpu.satisfied_constraints.count(cstr_idx) > 0; + [[maybe_unused]] bool in_viol = fj_cpu.violated_constraints.count(cstr_idx) > 0; + [[maybe_unused]] bool in_sat = fj_cpu.satisfied_constraints.count(cstr_idx) > 0; cuopt_assert( in_viol != in_sat, "Constraint must be in exactly one of violated_constraints or satisfied_constraints"); @@ -1907,7 +1898,7 @@ std::unique_ptr> fj_t::create_cpu_climber( fj_settings_t settings, bool randomize_params) { - raft::common::nvtx::range scope("fj_cpu_init"); + [[maybe_unused]] raft::common::nvtx::range scope("fj_cpu_init"); auto fj_cpu = std::make_unique>(preemption_flag); @@ -2007,7 +1998,7 @@ void cpufj_solve(fj_cpu_climber_t* fj_cpu, f_t in_time_limit, double w } if (score > fj_staged_score_t::zero() && !should_perturb) { - apply_move(*fj_cpu, move.var_idx, move.value, false); + apply_move(*fj_cpu, move.var_idx, move.value); // Track move types if (is_lift) fj_cpu->n_lift_moves_window++; if (is_mtm_viol) fj_cpu->n_mtm_viol_moves_window++; @@ -2024,15 +2015,15 @@ void cpufj_solve(fj_cpu_climber_t* fj_cpu, f_t in_time_limit, double w two_opt_move_t two_opt_move; if (!should_perturb) two_opt_move = find_two_opt_move(*fj_cpu); if (two_opt_move.score > fj_staged_score_t::zero()) { - apply_move(*fj_cpu, two_opt_move.first.var_idx, two_opt_move.first.value, true); - apply_move(*fj_cpu, two_opt_move.second.var_idx, two_opt_move.second.value, true); + apply_move(*fj_cpu, two_opt_move.first.var_idx, two_opt_move.first.value); + apply_move(*fj_cpu, two_opt_move.second.var_idx, two_opt_move.second.value); fj_cpu->n_mtm_viol_moves_window += 2; } else { thrust::tie(move, score) = find_mtm_move_viol(*fj_cpu, 1, true); // pick a single random violated constraint i_t var_idx = move.var_idx >= 0 ? move.var_idx : 0; f_t delta = move.var_idx >= 0 ? move.value : 0; - apply_move(*fj_cpu, var_idx, delta, true); + apply_move(*fj_cpu, var_idx, delta); } ++local_mins; ++fj_cpu->n_local_minima_window; @@ -2098,7 +2089,8 @@ void cpufj_solve(fj_cpu_climber_t* fj_cpu, f_t in_time_limit, double w auto loop_end = std::chrono::high_resolution_clock::now(); double total_time = std::chrono::duration_cast>(loop_end - loop_start).count(); - double avg_time_per_iter = fj_cpu->iterations > 0 ? total_time / fj_cpu->iterations : 0; + [[maybe_unused]] double avg_time_per_iter = + fj_cpu->iterations > 0 ? total_time / fj_cpu->iterations : 0; CUOPT_LOG_TRACE("%sCPUFJ Average time per iteration: %.8fms", fj_cpu->log_prefix.c_str(), avg_time_per_iter * 1000.0); @@ -2118,7 +2110,7 @@ std::unique_ptr> init_fj_cpu_standalone( uint64_t seed, fj_settings_t settings) { - raft::common::nvtx::range scope("init_fj_cpu_standalone"); + [[maybe_unused]] raft::common::nvtx::range scope("init_fj_cpu_standalone"); auto fj_cpu = std::make_unique>(preemption_flag); @@ -2162,7 +2154,7 @@ void fj_cpu_worker_t::run_async(f_t time_limit, double work_unit_limit { if (!is_initialized) return; - auto& fj_ptr = fj_cpu; + [[maybe_unused]] auto& fj_ptr = fj_cpu; #pragma omp task shared(fj_cpu, is_initialized, fj_ptr) firstprivate(time_limit, work_unit_limit) \ priority(CUOPT_DEFAULT_TASK_PRIORITY) default(none) depend(out : fj_ptr) { @@ -2186,7 +2178,7 @@ void fj_cpu_worker_t::stop() preemption_flag = true; - auto& fj_ptr = fj_cpu; + [[maybe_unused]] auto& fj_ptr = fj_cpu; #pragma omp taskwait depend(in : fj_ptr) is_initialized = false; fj_cpu.reset(); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh index b9efd193d1..15dd0d9ba9 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh @@ -31,12 +31,12 @@ template struct fj_cpu_shared_incumbent_t { // True when the candidate beat the shared best, in which case it was stored. bool publish(f_t candidate_objective, - f_t candidate_user_objective, + [[maybe_unused]] f_t candidate_user_objective, const std::vector& candidate) { // Unlocked reject first: the publish sites are hot on instances that improve in tiny steps. if (!(candidate_objective < objective.load(std::memory_order_relaxed))) return false; - std::lock_guard lock(guard); + [[maybe_unused]] std::lock_guard lock(guard); if (!(candidate_objective < objective.load(std::memory_order_relaxed))) return false; assignment = candidate; objective.store(candidate_objective, std::memory_order_relaxed); @@ -48,7 +48,7 @@ struct fj_cpu_shared_incumbent_t { bool adopt(f_t local_objective, std::vector& destination, f_t* adopted_objective = nullptr) { if (!(objective.load(std::memory_order_relaxed) < local_objective)) return false; - std::lock_guard lock(guard); + [[maybe_unused]] std::lock_guard lock(guard); const f_t shared_objective = objective.load(std::memory_order_relaxed); if (!(shared_objective < local_objective)) return false; cuopt_assert(assignment.size() == destination.size(), "shared incumbent size mismatch"); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu index a0ec2c509f..660a900b17 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu @@ -27,7 +27,7 @@ namespace cuopt::mathematical_optimization::mip { -static const char* fj_binary_reject_name(fj_binary_reject_t reason) +[[maybe_unused]] static const char* fj_binary_reject_name(fj_binary_reject_t reason) { switch (reason) { case fj_binary_reject_t::none: return "none"; @@ -59,8 +59,8 @@ constexpr int32_t fj_bin_obj_escalate_max = 10; constexpr int32_t fj_bin_2opt_candidates = 64; // bounds for the components of the packed score -constexpr int32_t fj_bin_base_limit = 1 << 16; -constexpr int32_t fj_bin_bonus_limit = 1 << 14; +[[maybe_unused]] constexpr int32_t fj_bin_base_limit = 1 << 16; +[[maybe_unused]] constexpr int32_t fj_bin_bonus_limit = 1 << 14; // tuned values for the argmax tile // tile size is set relative to L1$ if available @@ -844,7 +844,7 @@ struct fj_bin_engine_t { void init(fj_cpu_climber_t& climber) { - phase_timer_t timer(climber.bin_setup.engine_init); + [[maybe_unused]] phase_timer_t timer(climber.bin_setup.engine_init); const auto& params = climber.settings.parameters; seed = climber.settings.seed; rng = raft::random::PCGenerator((uint64_t)seed, 0, 0); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu index ffed26751a..56ac89cd32 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu @@ -96,7 +96,7 @@ static void build_transpose(fj_bin_problem_t& pb) template fj_bin_scan_t fj_bin_scan(const fj_cpu_climber_t& c, fj_bin_setup_times_t& times) { - phase_timer_t timer(times.scan); + [[maybe_unused]] phase_timer_t timer(times.scan); fj_bin_scan_t out; const int32_t n_cols = c.problem->n_variables; const int32_t n_rows = c.problem->n_constraints; @@ -122,12 +122,10 @@ fj_bin_scan_t fj_bin_scan(const fj_cpu_climber_t& c, fj_bin_setup_time } } - const auto& offsets = c.problem->offsets; - const auto& reverse_offsets = c.problem->reverse_offsets; - const auto& reverse_constraints = c.problem->reverse_constraints; - const auto& coeffs = c.problem->coefficients; - const auto& cstr_lb = c.problem->cstr_lb; - const auto& cstr_ub = c.problem->cstr_ub; + const auto& offsets = c.problem->offsets; + const auto& coeffs = c.problem->coefficients; + const auto& cstr_lb = c.problem->cstr_lb; + const auto& cstr_ub = c.problem->cstr_ub; double max_abs_coefficient = 0; std::vector row_values; @@ -382,7 +380,7 @@ bool fj_bin_encode(const fj_cpu_climber_t& c, int& coefficient_bits, fj_bin_setup_times_t& times) { - phase_timer_t timer(times.encode); + [[maybe_unused]] phase_timer_t timer(times.encode); const int32_t n_cols = c.problem->n_variables; const int32_t n_rows = c.problem->n_constraints; if (n_cols <= 0 || n_rows <= 0) return false; diff --git a/cpp/src/mip_heuristics/feasibility_jump/load_balancing.cuh b/cpp/src/mip_heuristics/feasibility_jump/load_balancing.cuh index 52038d1a67..4fb034a65f 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/load_balancing.cuh +++ b/cpp/src/mip_heuristics/feasibility_jump/load_balancing.cuh @@ -207,7 +207,7 @@ __global__ void load_balancing_compute_workid_mappings( cuopt_assert(idx >= 0 && idx < var_indices.size(), "invalid index"); i_t var_idx = var_indices[idx]; cuopt_assert(var_idx >= 0 && var_idx < fj.pb.n_variables, "invalid var_idx"); - uint32_t subworkid = *ptr - (workid + 1); + [[maybe_unused]] uint32_t subworkid = *ptr - (workid + 1); auto [offset_begin, offset_end] = fj.pb.reverse_range_for_var(var_idx); diff --git a/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu b/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu index c2ef6299c7..2e6150b78f 100644 --- a/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu +++ b/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu @@ -132,7 +132,7 @@ bool feasibility_pump_t::linear_project_onto_polytope(solution_t::test_fj_feasible(solution_t& soluti template bool feasibility_pump_t::handle_cycle(solution_t& solution) { - raft::common::nvtx::range fun_scope("handle_cycle"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("handle_cycle"); CUOPT_LOG_DEBUG("running handle cycle"); bool is_feasible = false; fp_fj_cycle_time_begin = timer.remaining_time(); @@ -356,7 +356,7 @@ bool feasibility_pump_t::handle_cycle(solution_t& solution) template bool feasibility_pump_t::restart_fp(solution_t& solution) { - raft::common::nvtx::range fun_scope("restart_fp"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("restart_fp"); bool is_feasible = handle_cycle(solution); // reset the distance last_distances.resize(0); @@ -393,7 +393,7 @@ void feasibility_pump_t::resize_vectors(problem_t& problem, template bool feasibility_pump_t::check_distance_cycle(solution_t& solution) { - raft::common::nvtx::range fun_scope("check_distance_cycle"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_distance_cycle"); f_t distance_to_last_rounding = compute_l1_distance( solution.problem_ptr->integer_indices, last_rounding, solution.assignment, solution.handle_ptr); @@ -421,7 +421,7 @@ bool feasibility_pump_t::check_distance_cycle(solution_t& so template void feasibility_pump_t::relax_general_integers(solution_t& solution) { - raft::common::nvtx::range fun_scope("relax_general_integers"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("relax_general_integers"); orig_variable_types.resize(solution.problem_ptr->n_variables, solution.handle_ptr->get_stream()); auto var_types = make_span(solution.problem_ptr->variable_types); @@ -470,7 +470,7 @@ void feasibility_pump_t::revert_relaxation(solution_t& solut template bool feasibility_pump_t::run_single_fp_descent(solution_t& solution) { - raft::common::nvtx::range fun_scope("run_single_fp_descent"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_single_fp_descent"); // start by doing nearest rounding solution.round_nearest(rng()); raft::copy(last_rounding.data(), @@ -501,7 +501,7 @@ bool feasibility_pump_t::run_single_fp_descent(solution_t& s is_feasible = round(solution); cuopt_func_call(solution.test_variable_bounds(true)); if (is_feasible) { - bool res = solution.compute_feasibility(); + [[maybe_unused]] bool res = solution.compute_feasibility(); cuopt_assert(res, "Feasibility issue"); return true; } @@ -553,7 +553,7 @@ bool feasibility_pump_t::run_single_fp_descent(solution_t& s return false; } if (is_feasible) { - bool res = solution.compute_feasibility(); + [[maybe_unused]] bool res = solution.compute_feasibility(); cuopt_assert(res, "Feasibility issue"); return true; } diff --git a/cpp/src/mip_heuristics/local_search/local_search.cu b/cpp/src/mip_heuristics/local_search/local_search.cu index 2548a804e9..60a4916d45 100644 --- a/cpp/src/mip_heuristics/local_search/local_search.cu +++ b/cpp/src/mip_heuristics/local_search/local_search.cu @@ -202,7 +202,7 @@ void local_search_t::start_cpufj_deterministic(mip::branch_and_bound_t // Set up callback to send solutions to B&B with work unit timestamps deterministic_cpu_fj->improvement_callback = - [&bb](f_t obj, const std::vector& h_vec, double work_units) { + [&bb]([[maybe_unused]] f_t obj, const std::vector& h_vec, double work_units) { bb.queue_external_solution_deterministic(h_vec, work_units); }; @@ -378,7 +378,7 @@ bool local_search_t::run_local_search(solution_t& solution, timer_t timer, const ls_config_t& ls_config) { - raft::common::nvtx::range fun_scope("local search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("local search"); fj_settings_t fj_settings; if (timer.check_time_limit()) return false; // adjust these time limits @@ -440,7 +440,7 @@ bool local_search_t::run_fj_annealing(solution_t& solution, timer_t timer, const ls_config_t& ls_config) { - raft::common::nvtx::range fun_scope("run_fj_annealing"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fj_annealing"); auto prev_settings = fj.settings; solution.compute_feasibility(); @@ -470,7 +470,7 @@ bool local_search_t::run_fj_line_segment(solution_t& solutio timer_t timer, const ls_config_t& ls_config) { - raft::common::nvtx::range fun_scope("run_fj_line_segment"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fj_line_segment"); rmm::device_uvector starting_point(solution.assignment, solution.handle_ptr->get_stream()); line_segment_search.settings.best_of_parents_cost = ls_config.best_objective_of_parents; line_segment_search.settings.parents_infeasible = !ls_config.at_least_one_parent_feasible; @@ -492,7 +492,7 @@ bool local_search_t::check_fj_on_lp_optimal(solution_t& solu bool perturb, timer_t timer) { - raft::common::nvtx::range fun_scope("check_fj_on_lp_optimal"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_fj_on_lp_optimal"); if (lp_optimal_exists) { raft::copy(solution.assignment.data(), lp_optimal_solution.data(), @@ -533,7 +533,7 @@ bool local_search_t::check_fj_on_lp_optimal(solution_t& solu template bool local_search_t::run_fj_on_zero(solution_t& solution, timer_t timer) { - raft::common::nvtx::range fun_scope("run_fj_on_zero"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fj_on_zero"); thrust::fill(solution.handle_ptr->get_thrust_policy(), solution.assignment.begin(), solution.assignment.end(), @@ -553,7 +553,7 @@ bool local_search_t::run_staged_fp(solution_t& solution, timer_t timer, population_t* population_ptr) { - raft::common::nvtx::range fun_scope("run_staged_fp"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_staged_fp"); cuopt_assert(population_ptr != nullptr, "Population pointer must not be null"); auto n_vars = solution.problem_ptr->n_variables; auto n_binary_vars = solution.problem_ptr->get_n_binary_variables(); @@ -642,7 +642,7 @@ template void local_search_t::save_solution_and_add_cutting_plane( solution_t& solution, rmm::device_uvector& best_solution, f_t& best_objective) { - raft::common::nvtx::range fun_scope("save_solution_and_add_cutting_plane"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("save_solution_and_add_cutting_plane"); if (solution.get_objective() < best_objective) { raft::copy(best_solution.data(), solution.assignment.data(), @@ -680,12 +680,10 @@ void local_search_t::reset_alpha_and_save_solution( solution_t& solution, problem_t* old_problem_ptr, population_t* population_ptr, - i_t i, - i_t last_improved_iteration, rmm::device_uvector& best_solution, f_t& best_objective) { - raft::common::nvtx::range fun_scope("reset_alpha_and_save_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("reset_alpha_and_save_solution"); fp.config.alpha = default_alpha; solution_t solution_copy(solution); solution_copy.problem_ptr = old_problem_ptr; @@ -715,14 +713,13 @@ void local_search_t::reset_alpha_and_save_solution( template void local_search_t::reset_alpha_and_run_recombiners( solution_t& solution, - problem_t* old_problem_ptr, population_t* population_ptr, i_t i, i_t last_improved_iteration, rmm::device_uvector& best_solution, f_t& best_objective) { - raft::common::nvtx::range fun_scope("reset_alpha_and_run_recombiners"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("reset_alpha_and_run_recombiners"); const auto& hp = context.settings.heuristic_params; const i_t iterations_for_stagnation = hp.stagnation_trigger; const i_t max_iterations_without_improvement = hp.max_iterations_without_improvement; @@ -747,7 +744,7 @@ bool local_search_t::run_fp(solution_t& solution, timer_t timer, population_t* population_ptr) { - raft::common::nvtx::range fun_scope("run_fp"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fp"); cuopt_assert(population_ptr != nullptr, "Population pointer must not be null"); const i_t n_fp_iterations = 1000000; bool is_feasible = solution.compute_feasibility(); @@ -795,13 +792,8 @@ bool local_search_t::run_fp(solution_t& solution, if (is_feasible) { CUOPT_LOG_DEBUG("Found feasible in FP with obj %f. Continue with FJ!", solution.get_objective()); - reset_alpha_and_save_solution(solution, - old_problem_ptr, - population_ptr, - i, - last_improved_iteration, - best_solution, - best_objective); + reset_alpha_and_save_solution( + solution, old_problem_ptr, population_ptr, best_solution, best_objective); last_improved_iteration = i; } // if not feasible, it means it is a cycle @@ -819,22 +811,12 @@ bool local_search_t::run_fp(solution_t& solution, if (is_feasible) { CUOPT_LOG_DEBUG("Found feasible during restart with obj %f. Continue with FJ!", solution.get_objective()); - reset_alpha_and_save_solution(solution, - old_problem_ptr, - population_ptr, - i, - last_improved_iteration, - best_solution, - best_objective); + reset_alpha_and_save_solution( + solution, old_problem_ptr, population_ptr, best_solution, best_objective); last_improved_iteration = i; } else { - reset_alpha_and_run_recombiners(solution, - old_problem_ptr, - population_ptr, - i, - last_improved_iteration, - best_solution, - best_objective); + reset_alpha_and_run_recombiners( + solution, population_ptr, i, last_improved_iteration, best_solution, best_objective); } } } @@ -855,7 +837,7 @@ bool local_search_t::generate_solution(solution_t& solution, population_t* population_ptr, f_t time_limit) { - raft::common::nvtx::range fun_scope("generate_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_solution"); cuopt_assert(population_ptr != nullptr, "Population pointer must not be null"); timer_t timer(time_limit); auto n_vars = solution.problem_ptr->n_variables; diff --git a/cpp/src/mip_heuristics/local_search/local_search.cuh b/cpp/src/mip_heuristics/local_search/local_search.cuh index e22d7e2d0e..ed20420ccd 100644 --- a/cpp/src/mip_heuristics/local_search/local_search.cuh +++ b/cpp/src/mip_heuristics/local_search/local_search.cuh @@ -91,7 +91,6 @@ class local_search_t { void resize_to_new_problem(); void resize_to_old_problem(problem_t* old_problem_ptr); void reset_alpha_and_run_recombiners(solution_t& solution, - problem_t* old_problem_ptr, population_t* population_ptr, i_t i, i_t last_unimproved_iteration, @@ -100,8 +99,6 @@ class local_search_t { void reset_alpha_and_save_solution(solution_t& solution, problem_t* old_problem_ptr, population_t* population_ptr, - i_t i, - i_t last_unimproved_iteration, rmm::device_uvector& best_solution, f_t& best_objective); diff --git a/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu b/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu index f64545e8c8..45e92a0e51 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu +++ b/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu @@ -1065,7 +1065,7 @@ bool constraint_prop_t::apply_round( timer_t& timer, std::optional>> probing_config) { - raft::common::nvtx::range fun_scope("constraint prop round"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("constraint prop round"); max_timer = timer_t{max_time_for_bounds_prop}; if (check_brute_force_rounding(sol)) { return true; } recovery_mode = false; @@ -1171,7 +1171,8 @@ template bool constraint_prop_t::handle_fixed_vars( solution_t& sol, problem_t* original_problem, - const std::tuple, std::vector, std::vector>& var_probe_vals, + [[maybe_unused]] const std::tuple, std::vector, std::vector>& + var_probe_vals, size_t* set_count_ptr, rmm::device_uvector& unset_vars) { diff --git a/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cuh b/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cuh index 89ab15b737..4a338d8901 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cuh +++ b/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cuh @@ -31,7 +31,7 @@ struct repair_stats_t { template struct probing_config_t { - probing_config_t(i_t n_vars, const raft::handle_t* handle_ptr) : probing_values(n_vars) {} + probing_config_t(i_t n_vars) : probing_values(n_vars) {} bool use_balanced_probing = false; i_t n_of_fixed_from_first = 0; i_t n_of_fixed_from_second = 0; diff --git a/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu b/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu index f4ca208843..30b5dfd3d5 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu +++ b/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu @@ -706,7 +706,7 @@ bool lb_constraint_prop_t::apply_round( timer_t& timer, std::optional>> probing_candidates) { - raft::common::nvtx::range fun_scope("constraint prop round"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("constraint prop round"); // this is second timer that can continue but without recovery mode const f_t max_time_for_bounds_prop = 5.; diff --git a/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu b/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu index 48b4559772..2d8fc56fa4 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu +++ b/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu @@ -66,7 +66,7 @@ bool check_brute_force_rounding(solution_t& solution) <<<1, TPB, 0, solution.handle_ptr->get_stream().get()>>>( solution.view(), n_integers_to_round, cuopt::make_span(var_map), best_config.data()); solution.handle_ptr->sync_stream(); - bool feas = solution.compute_feasibility(); + [[maybe_unused]] bool feas = solution.compute_feasibility(); cuopt_assert(feas, "Solution must be feasible!"); return true; } diff --git a/cpp/src/mip_heuristics/mip_scaling_strategy.cu b/cpp/src/mip_heuristics/mip_scaling_strategy.cu index 41525a9c65..99f2212bf1 100644 --- a/cpp/src/mip_heuristics/mip_scaling_strategy.cu +++ b/cpp/src/mip_heuristics/mip_scaling_strategy.cu @@ -493,7 +493,7 @@ size_t dry_run_cub( template void mip_scaling_strategy_t::scale_problem(bool do_objective_scaling) { - raft::common::nvtx::range fun_scope("mip_scale_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("mip_scale_problem"); auto& matrix_values = op_problem_scaled_.get_constraint_matrix_values(); auto& matrix_offsets = op_problem_scaled_.get_constraint_matrix_offsets(); diff --git a/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.cpp b/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.cpp index 598918f67e..3321c7ed43 100644 --- a/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.cpp +++ b/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.cpp @@ -481,7 +481,7 @@ papilo::PresolveStatus BHWCoeffReduce::execute(const papilo::Problem& const papilo::Num& num, papilo::Reductions& reductions, const papilo::Timer& timer, - int& reason_of_infeasibility) + [[maybe_unused]] int& reason_of_infeasibility) { const auto& constraint_matrix = problem.getConstraintMatrix(); const auto& lhs_values = constraint_matrix.getLeftHandSides(); diff --git a/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.hpp b/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.hpp index d334bf399f..5495ac966d 100644 --- a/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.hpp +++ b/cpp/src/mip_heuristics/presolve/bhw_coeff_reduce.hpp @@ -11,6 +11,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" // ignore boost error for pip wheel build #pragma GCC diagnostic ignored "-Wnarrowing" +#pragma GCC diagnostic ignored "-Wunused-parameter" #endif #include #include @@ -73,7 +74,7 @@ class BHWCoeffReduce : public papilo::PresolveMethod { const papilo::Num& num, papilo::Reductions& reductions, const papilo::Timer& timer, - int& reason_of_infeasibility) override; + [[maybe_unused]] int& reason_of_infeasibility) override; private: bhw_shape_cache_t shape_cache_; diff --git a/cpp/src/mip_heuristics/presolve/block_bve.cu b/cpp/src/mip_heuristics/presolve/block_bve.cu index c8d6ea3314..0fb30a8c87 100644 --- a/cpp/src/mip_heuristics/presolve/block_bve.cu +++ b/cpp/src/mip_heuristics/presolve/block_bve.cu @@ -213,8 +213,8 @@ int bve_greedy_prime_cover(const uint8_t* feas, { cuopt_assert(nb >= 1 && nb <= BVE_MAX_BOUNDARY, "nb out of BVE range"); cuopt_assert(cap >= 1, "clause cap leaves no room for a cover"); - int64_t ops = 0; - auto ops_guard = cuopt::scope_guard([&]() { + int64_t ops = 0; + [[maybe_unused]] auto ops_guard = cuopt::scope_guard([&]() { if (ops_out != nullptr) *ops_out += ops; }); diff --git a/cpp/src/mip_heuristics/presolve/bounds_presolve.cu b/cpp/src/mip_heuristics/presolve/bounds_presolve.cu index 0c84d26fa0..19b77dfc08 100644 --- a/cpp/src/mip_heuristics/presolve/bounds_presolve.cu +++ b/cpp/src/mip_heuristics/presolve/bounds_presolve.cu @@ -261,7 +261,6 @@ template termination_criterion_t bound_presolve_t::solve(problem_t& pb) { timer_t timer(settings.time_limit); - auto& handle_ptr = pb.handle_ptr; copy_input_bounds(pb); return bound_update_loop(pb, timer); } diff --git a/cpp/src/mip_heuristics/presolve/conditional_bound_strengthening.cu b/cpp/src/mip_heuristics/presolve/conditional_bound_strengthening.cu index 14258e6b16..a25897f780 100644 --- a/cpp/src/mip_heuristics/presolve/conditional_bound_strengthening.cu +++ b/cpp/src/mip_heuristics/presolve/conditional_bound_strengthening.cu @@ -48,7 +48,7 @@ void conditional_bound_strengthening_t::resize(problem_t& pr // is computing by chunks, i.e. subset of rows at a time try { select_constraint_pairs_device(problem); - } catch (std::bad_alloc& e) { + } catch (std::bad_alloc&) { select_constraint_pairs_host(problem); } async_fill(locks_per_constraint, 0, problem.handle_ptr->get_stream()); @@ -97,7 +97,7 @@ void spgemm_cusparse([[maybe_unused]] rmm::device_uvector& offsetsA, cusparseSpMatDescr_t matA, matB, matC; cusparseSpGEMMAlg_t alg = CUSPARSE_SPGEMM_ALG1; - rmm::device_buffer dBuffer1(0, stream), dBuffer2(0, stream), dBuffer3(0, stream); + rmm::device_buffer dBuffer1(0, stream), dBuffer2(0, stream); float alpha = 1.0f; float beta = 0.0f; diff --git a/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu b/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu index a8e6997572..7677417b76 100644 --- a/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu +++ b/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu @@ -283,7 +283,7 @@ void remove_small_cliques(clique_table_t& clique_table, cuopt::timer_t size_t i = 0; size_t old_idx = 0; std::vector index_mapping(clique_table.first.size(), -1); - auto it = std::remove_if(clique_table.first.begin(), clique_table.first.end(), [&](auto& clique) { + auto it = std::remove_if(clique_table.first.begin(), clique_table.first.end(), [&](auto&) { bool res = false; if (to_delete[old_idx]) { res = true; @@ -674,7 +674,7 @@ void find_initial_cliques(user_problem_t& problem, cuopt::timer_t& timer, omp_atomic_t* signal_extend) { - cuopt::timer_t stage_timer(std::numeric_limits::infinity()); + [[maybe_unused]] cuopt::timer_t stage_timer(std::numeric_limits::infinity()); #ifdef DEBUG_CLIQUE_TABLE double t_fill = 0.; double t_coeff = 0.; diff --git a/cpp/src/mip_heuristics/presolve/gf2_presolve.cpp b/cpp/src/mip_heuristics/presolve/gf2_presolve.cpp index c0963e5a34..4dad961d16 100644 --- a/cpp/src/mip_heuristics/presolve/gf2_presolve.cpp +++ b/cpp/src/mip_heuristics/presolve/gf2_presolve.cpp @@ -162,12 +162,13 @@ gf2_status_t gf2_solve(std::vector>& A, } template -papilo::PresolveStatus GF2Presolve::execute(const papilo::Problem& problem, - const papilo::ProblemUpdate& problemUpdate, - const papilo::Num& num, - papilo::Reductions& reductions, - const papilo::Timer& timer, - int& reason_of_infeasibility) +papilo::PresolveStatus GF2Presolve::execute( + const papilo::Problem& problem, + [[maybe_unused]] const papilo::ProblemUpdate& problemUpdate, + const papilo::Num& num, + papilo::Reductions& reductions, + [[maybe_unused]] const papilo::Timer& timer, + [[maybe_unused]] int& reason_of_infeasibility) { const auto& constraint_matrix = problem.getConstraintMatrix(); const auto& lhs_values = constraint_matrix.getLeftHandSides(); diff --git a/cpp/src/mip_heuristics/presolve/gf2_presolve.hpp b/cpp/src/mip_heuristics/presolve/gf2_presolve.hpp index 19fdd0bcac..56ceb48009 100644 --- a/cpp/src/mip_heuristics/presolve/gf2_presolve.hpp +++ b/cpp/src/mip_heuristics/presolve/gf2_presolve.hpp @@ -11,6 +11,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" // ignore boost error for pip wheel build #pragma GCC diagnostic ignored "-Wnarrowing" +#pragma GCC diagnostic ignored "-Wunused-parameter" #endif #include #include @@ -47,11 +48,11 @@ class GF2Presolve : public papilo::PresolveMethod { } papilo::PresolveStatus execute(const papilo::Problem& problem, - const papilo::ProblemUpdate& problemUpdate, + [[maybe_unused]] const papilo::ProblemUpdate& problemUpdate, const papilo::Num& num, papilo::Reductions& reductions, - const papilo::Timer& timer, - int& reason_of_infeasibility) override; + [[maybe_unused]] const papilo::Timer& timer, + [[maybe_unused]] int& reason_of_infeasibility) override; private: struct gf2_constraint_t { diff --git a/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu b/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu index bf40838279..0263c81425 100644 --- a/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu +++ b/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu @@ -491,7 +491,7 @@ void load_balanced_bounds_presolve_t::calculate_constraint_slack_iter( { // writes nans to constraint activities that are infeasible //-> less expensive checks for update bounds step - raft::common::nvtx::range scope("act_cuda_task_graph"); + [[maybe_unused]] raft::common::nvtx::range scope("act_cuda_task_graph"); cudaGraphLaunch(calc_slack_erase_inf_cnst_exec, handle_ptr->get_stream().get()); } infeas_cnst_slack_set_to_nan = true; @@ -505,7 +505,7 @@ void load_balanced_bounds_presolve_t::calculate_constraint_slack( // h_bounds_changed is copied to bounds_changed in calc_slack_exec h_bounds_changed = 0; { - raft::common::nvtx::range scope("act_cuda_task_graph"); + [[maybe_unused]] raft::common::nvtx::range scope("act_cuda_task_graph"); cudaGraphLaunch(calc_slack_exec, handle_ptr->get_stream().get()); } infeas_cnst_slack_set_to_nan = false; @@ -518,7 +518,7 @@ bool load_balanced_bounds_presolve_t::update_bounds_from_slack( { // bounds_changed is copied to h_bounds_changed in upd_bnd_exec { - raft::common::nvtx::range scope("upd_cuda_task_graph"); + [[maybe_unused]] raft::common::nvtx::range scope("upd_cuda_task_graph"); cudaGraphLaunch(upd_bnd_exec, handle_ptr->get_stream().get()); } RAFT_CHECK_CUDA(handle_ptr->get_stream().get()); diff --git a/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp b/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp index 1b18fdec96..e248d10614 100644 --- a/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp +++ b/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp @@ -141,9 +141,9 @@ presolve_budget_t evaluate_presolve_budget(const mip_heuristics_hyper_params_t lock(bound_presolve.probing_cache.probing_cache_mutex); + [[maybe_unused]] std::lock_guard lock( + bound_presolve.probing_cache.probing_cache_mutex); if (!bound_presolve.probing_cache.probing_cache.count(var_original) > 0) { std::array, 2> entries_per_var; entries_per_var[0] = cache_item; @@ -332,7 +333,7 @@ inline std::vector compute_prioritized_integer_indices( 0); // compute min and max activity first bound_presolve.calculate_activity_on_problem_bounds(problem); - bool res = bound_presolve.calculate_infeasible_redundant_constraints(problem); + [[maybe_unused]] bool res = bound_presolve.calculate_infeasible_redundant_constraints(problem); cuopt_assert(res, "The activity computation must be feasible during probing cache!"); CUOPT_LOG_DEBUG("prioritized integer_indices n_integer_vars %d", problem.n_integer_vars); // compute the min var slack @@ -895,7 +896,7 @@ bool compute_probing_cache(bound_presolve_t& bound_presolve, double work_limit, size_t step_size_hint) { - raft::common::nvtx::range fun_scope("compute_probing_cache"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_probing_cache"); cuopt_assert(bound_presolve.probing_cache.probing_cache.empty(), "probing cache is built once per solve"); @@ -1018,7 +1019,7 @@ bool compute_probing_cache(bound_presolve_t& bound_presolve, } // end of step apply_substitution_queue_to_problem(substitution_vector_pool, problem); - const double probing_wall = + [[maybe_unused]] const double probing_wall = std::chrono::duration(std::chrono::steady_clock::now() - probing_t0).count(); CUOPT_LOG_DEBUG( "PRESOLVE_PROBING probes=%zu candidates=%zu iters=%.0f work=%.3f work_limit=%.3f step=%zu " diff --git a/cpp/src/mip_heuristics/presolve/semi_continuous.cu b/cpp/src/mip_heuristics/presolve/semi_continuous.cu index a7295b0036..9df5c3dbc6 100644 --- a/cpp/src/mip_heuristics/presolve/semi_continuous.cu +++ b/cpp/src/mip_heuristics/presolve/semi_continuous.cu @@ -152,10 +152,9 @@ bool reformulate_semi_continuous(optimization_problem_t& op_problem, op_problem.set_variable_upper_bounds(var_ub.data(), var_ub.size()); } - const i_t n_orig = op_problem.get_n_variables(); - const i_t n_sc = static_cast(sc_indices.size()); - const auto* handle_ptr = op_problem.get_handle_ptr(); - const f_t big_m = settings.semi_continuous_big_m; + const i_t n_orig = op_problem.get_n_variables(); + const i_t n_sc = static_cast(sc_indices.size()); + const f_t big_m = settings.semi_continuous_big_m; if (used_fallback_big_m != nullptr) { used_fallback_big_m->assign(n_orig, uint8_t{0}); } CUOPT_LOG_INFO("Reformulating %d semi-continuous variables before presolve", n_sc); diff --git a/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.cpp b/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.cpp index 554fb86ccc..ceb158dac3 100644 --- a/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.cpp +++ b/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.cpp @@ -444,7 +444,7 @@ papilo::PresolveStatus SingleLockDualAggregation::execute( const papilo::Num& num, papilo::Reductions& reductions, const papilo::Timer& timer, - int& reason_of_infeasibility) + [[maybe_unused]] int& reason_of_infeasibility) { const int ncols = problem.getNCols(); const auto& options = problemUpdate.getPresolveOptions(); diff --git a/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.hpp b/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.hpp index 5cc5049ac1..a8328b92ad 100644 --- a/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.hpp +++ b/cpp/src/mip_heuristics/presolve/single_lock_dual_aggregation.hpp @@ -10,6 +10,7 @@ #if !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" // ignore boost error for pip wheel build +#pragma GCC diagnostic ignored "-Wunused-parameter" #endif #include #include @@ -36,7 +37,7 @@ class SingleLockDualAggregation : public papilo::PresolveMethod { const papilo::Num& num, papilo::Reductions& reductions, const papilo::Timer& timer, - int& reason_of_infeasibility) override; + [[maybe_unused]] int& reason_of_infeasibility) override; }; } // namespace cuopt::mathematical_optimization::mip diff --git a/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp b/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp index 7bf7bd76d6..ae1e54cc7c 100644 --- a/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp +++ b/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp @@ -71,8 +71,6 @@ void normalize_for_presolve(io::mps_data_model_t const& mps, bool maximize, std::vector& obj_coeffs, f_t& objective_offset, - std::vector& var_lb, - std::vector& var_ub, std::vector& constr_lb, std::vector& constr_ub) { @@ -107,7 +105,7 @@ papilo::Problem build_papilo_problem(io::mps_data_model_t const& bool maximize, problem_category_t category) { - raft::common::nvtx::range fun_scope("Build papilo::Problem from mps_data_model"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Build papilo::Problem from mps_data_model"); const i_t n_cols = mps.get_n_variables(); const i_t n_rows = mps.get_n_constraints(); @@ -120,7 +118,7 @@ papilo::Problem build_papilo_problem(io::mps_data_model_t const& std::vector constr_ub(mps.get_constraint_upper_bounds()); f_t objective_offset = mps.get_objective_offset(); normalize_for_presolve( - mps, maximize, obj_coeffs, objective_offset, var_lb, var_ub, constr_lb, constr_ub); + mps, maximize, obj_coeffs, objective_offset, constr_lb, constr_ub); const auto& coefficients = mps.get_constraint_matrix_values(); const auto& indices = mps.get_constraint_matrix_indices(); @@ -217,7 +215,7 @@ papilo::Problem build_papilo_problem(io::mps_data_model_t const& template papilo::Problem build_papilo_problem(const simplex::user_problem_t& problem) { - raft::common::nvtx::range fun_scope("Build papilo problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Build papilo problem"); // Build a papilo problem from a (host-side) dual-simplex user_problem_t. Unlike the // optimization_problem_t overload, all data already lives on the host and the constraint // matrix is stored column-major (CSC), so there are no device copies and no COO step: the @@ -363,7 +361,7 @@ template void build_user_problem(papilo::Problem const& papilo_problem, simplex::user_problem_t& problem) { - raft::common::nvtx::range fun_scope("Build user problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Build user problem"); const i_t reduced_rows = papilo_problem.getNRows(); const i_t reduced_cols = papilo_problem.getNCols(); @@ -466,7 +464,7 @@ io::mps_data_model_t build_reduced_mps_from_pslp(Presolver* pslp_preso bool maximize, f_t original_obj_offset) { - raft::common::nvtx::range fun_scope("Build mps_data_model from PSLP"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Build mps_data_model from PSLP"); io::mps_data_model_t mps; if constexpr (std::is_same_v) { @@ -520,7 +518,7 @@ template io::mps_data_model_t build_reduced_mps_from_papilo( papilo::Problem const& papilo_problem, bool maximize) { - raft::common::nvtx::range fun_scope("Reduced mps <- Papilo"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Reduced mps <- Papilo"); io::mps_data_model_t mps; auto obj = papilo_problem.getObjective(); @@ -785,9 +783,6 @@ void set_presolve_methods( template void set_presolve_options(papilo::Presolve& presolver, - problem_category_t category, - f_t absolute_tolerance, - f_t relative_tolerance, f_t time_limit, bool dual_postsolve, i_t num_cpu_threads, @@ -807,7 +802,6 @@ template void set_presolve_parameters( papilo::Presolve& presolver, problem_category_t category, - int nrows, int ncols, int max_badgesize, std::optional> const& method_allowlist = std::nullopt) @@ -842,7 +836,7 @@ template third_party_presolve_status_t third_party_presolve_t::apply_pslp( io::mps_data_model_t const& mps, double time_limit) { - raft::common::nvtx::range fun_scope("Apply PSLP presolver on host"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Apply PSLP presolver on host"); if constexpr (std::is_same_v) { const i_t n_cols = mps.get_n_variables(); @@ -859,7 +853,7 @@ third_party_presolve_status_t third_party_presolve_t::apply_pslp( std::vector constr_ub(mps.get_constraint_upper_bounds()); f_t objective_offset = mps.get_objective_offset(); normalize_for_presolve( - mps, maximize_, obj_coeffs, objective_offset, var_lb, var_ub, constr_lb, constr_ub); + mps, maximize_, obj_coeffs, objective_offset, constr_lb, constr_ub); if (var_lb.empty()) { var_lb.assign(n_cols, -std::numeric_limits::infinity()); } if (var_ub.empty()) { var_ub.assign(n_cols, std::numeric_limits::infinity()); } const auto& coefficients = mps.get_constraint_matrix_values(); @@ -913,14 +907,14 @@ third_party_presolve_status_t third_party_presolve_t::apply_papilo( papilo::Problem& papilo_problem, problem_category_t category, bool dual_postsolve, - f_t absolute_tolerance, - f_t relative_tolerance, + [[maybe_unused]] f_t absolute_tolerance, + [[maybe_unused]] f_t relative_tolerance, double time_limit, i_t num_cpu_threads, i_t max_rounds, i_t max_badgesize) { - raft::common::nvtx::range fun_scope("Apply Papilo presolve on host"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Apply Papilo presolve on host"); // Capture original dimensions before papilo.apply() mutates papilo_problem // in place into its reduced form. @@ -936,27 +930,17 @@ third_party_presolve_status_t third_party_presolve_t::apply_papilo( if (category == problem_category_t::MIP) { dual_postsolve = false; } papilo::Presolve papilo_presolver; set_presolve_methods(papilo_presolver, category, dual_postsolve, reduction_allowlist_); - set_presolve_options(papilo_presolver, - category, - absolute_tolerance, - relative_tolerance, - time_limit, - dual_postsolve, - num_cpu_threads, - max_rounds); - set_presolve_parameters(papilo_presolver, - category, - original_n_cons, - original_n_vars, - max_badgesize, - reduction_allowlist_); + set_presolve_options( + papilo_presolver, time_limit, dual_postsolve, num_cpu_threads, max_rounds); + set_presolve_parameters( + papilo_presolver, category, original_n_vars, max_badgesize, reduction_allowlist_); papilo_presolver.setVerbosityLevel(papilo::VerbosityLevel::kQuiet); CUOPT_LOG_DEBUG( "PRESOLVE_PAPILO_BUDGET rounds=%d badge_cap=%d tlim=%g", max_rounds, max_badgesize, time_limit); const auto papilo_t0 = std::chrono::steady_clock::now(); auto result = papilo_presolver.apply(papilo_problem); - const double papilo_wall = + [[maybe_unused]] const double papilo_wall = std::chrono::duration(std::chrono::steady_clock::now() - papilo_t0).count(); // The effective badge is what set_presolve_parameters actually installed; the cap alone is // misleading because it only binds once ncols/2 exceeds it. @@ -1223,18 +1207,11 @@ third_party_presolve_status_t third_party_presolve_t::apply_to_subprob papilo::Presolve papilo_presolver; set_presolve_methods( papilo_presolver, problem_category_t::MIP, dual_postsolve, reduction_allowlist_); - set_presolve_options(papilo_presolver, - problem_category_t::MIP, - settings.primal_tol, - settings.dual_tol, - time_limit, - dual_postsolve, - num_threads, - -1); + set_presolve_options(papilo_presolver, time_limit, dual_postsolve, num_threads, -1); // Node presolve already runs under a finite time limit, so it keeps the unbounded round count and // uncapped badge; the budgets apply to root presolve only. set_presolve_parameters( - papilo_presolver, problem_category_t::MIP, orig_rows, orig_cols, -1, reduction_allowlist_); + papilo_presolver, problem_category_t::MIP, orig_cols, -1, reduction_allowlist_); // Disable papilo logs papilo_presolver.setVerbosityLevel(papilo::VerbosityLevel::kQuiet); diff --git a/cpp/src/mip_heuristics/problem/presolve_data.cu b/cpp/src/mip_heuristics/problem/presolve_data.cu index b6d1efb641..d3b36c3767 100644 --- a/cpp/src/mip_heuristics/problem/presolve_data.cu +++ b/cpp/src/mip_heuristics/problem/presolve_data.cu @@ -29,7 +29,7 @@ template bool presolve_data_t::pre_process_assignment(problem_t& problem, rmm::device_uvector& assignment) { - raft::common::nvtx::range fun_scope("pre_process_assignment"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("pre_process_assignment"); auto has_nans = cuopt::mathematical_optimization::mip::has_nans(problem.handle_ptr, assignment); if (has_nans) { CUOPT_LOG_DEBUG("Solution discarded due to nans"); @@ -153,7 +153,7 @@ void presolve_data_t::post_process_assignment( bool resize_to_original_problem, cuda::stream_ref stream) { - raft::common::nvtx::range fun_scope("post_process_assignment"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("post_process_assignment"); cuopt_assert(current_assignment.size() == variable_mapping.size(), "size mismatch"); auto assgn = make_span(current_assignment); auto fixed_assgn = make_span(fixed_var_assignment); @@ -196,7 +196,7 @@ template void presolve_data_t::post_process_solution(problem_t& problem, solution_t& solution) { - raft::common::nvtx::range fun_scope("post_process_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("post_process_solution"); post_process_assignment(problem, solution.assignment); // this is for resizing other fields such as excess, slack so that we can compute the feasibility solution.resize_to_original_problem(); diff --git a/cpp/src/mip_heuristics/problem/presolve_data.cuh b/cpp/src/mip_heuristics/problem/presolve_data.cuh index cae3a498e7..28f8341ad1 100644 --- a/cpp/src/mip_heuristics/problem/presolve_data.cuh +++ b/cpp/src/mip_heuristics/problem/presolve_data.cuh @@ -96,7 +96,7 @@ class presolve_data_t { postsolve_reconstructions.clear(); } - void reset_additional_vars(const problem_t& problem, const raft::handle_t* handle_ptr) + void reset_additional_vars(const problem_t& problem) { variable_offsets.assign(problem.n_variables, 0); additional_var_used.assign(problem.n_variables, false); diff --git a/cpp/src/mip_heuristics/problem/problem.cu b/cpp/src/mip_heuristics/problem/problem.cu index e7ffec35e2..d8f3e7b244 100644 --- a/cpp/src/mip_heuristics/problem/problem.cu +++ b/cpp/src/mip_heuristics/problem/problem.cu @@ -500,7 +500,7 @@ void csr_to_csc_transpose(const i_t* csr_offsets, template void problem_t::compute_transpose_of_problem() { - raft::common::nvtx::range fun_scope("compute_transpose_of_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_transpose_of_problem"); csrsort_cusparse(coefficients, variables, offsets, n_constraints, n_variables, handle_ptr); RAFT_CUBLAS_TRY(raft::linalg::detail::cublassetpointermode( handle_ptr->get_cublas_handle(), CUBLAS_POINTER_MODE_DEVICE, handle_ptr->get_stream().get())); @@ -568,8 +568,8 @@ template void problem_t::check_problem_representation(bool check_transposed, bool check_mip_related_data) { - raft::common::nvtx::range fun_scope("check_problem_representation"); - raft::common::nvtx::range scope("check_problem_representation"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_problem_representation"); + [[maybe_unused]] raft::common::nvtx::range scope("check_problem_representation"); cuopt_assert(!offsets.is_empty(), "A_offsets must never be empty."); if (check_transposed) { @@ -832,7 +832,7 @@ template void problem_t::recompute_auxilliary_data(bool check_representation, bool compute_related_vars) { - raft::common::nvtx::range fun_scope("recompute_auxilliary_data"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("recompute_auxilliary_data"); compute_n_integer_vars(); compute_binary_var_table(); compute_vars_with_objective_coeffs(); @@ -849,7 +849,7 @@ void problem_t::recompute_auxilliary_data(bool check_representation, template void problem_t::compute_auxiliary_data() { - raft::common::nvtx::range fun_scope("compute_auxiliary_data"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_auxiliary_data"); // Compute sparsity: nnz / (n_rows * n_cols) sparsity = (n_constraints > 0 && n_variables > 0) @@ -898,7 +898,7 @@ void problem_t::compute_auxiliary_data() template void problem_t::compute_n_integer_vars() { - raft::common::nvtx::range fun_scope("compute_n_integer_vars"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_n_integer_vars"); cuopt_assert(n_variables == variable_types.size(), "size mismatch"); integer_indices.resize(n_variables, handle_ptr->get_stream()); auto end = @@ -931,7 +931,7 @@ bool problem_t::integer_equal(f_t val1, f_t val2) const template void problem_t::compute_binary_var_table() { - raft::common::nvtx::range fun_scope("compute_binary_var_table"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_binary_var_table"); auto pb_view = view(); is_binary_variable.resize(n_variables, handle_ptr->get_stream()); @@ -973,7 +973,7 @@ void problem_t::compute_binary_var_table() template void problem_t::compute_related_variables(double time_limit) { - raft::common::nvtx::range fun_scope("compute_related_variables"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_related_variables"); if (n_variables == 0) { related_variables.resize(0, handle_ptr->get_stream()); related_variables_offsets.resize(0, handle_ptr->get_stream()); @@ -1125,7 +1125,7 @@ typename problem_t::view_t problem_t::view() template void problem_t::resize_variables(size_t size) { - raft::common::nvtx::range fun_scope("resize_variables"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_variables"); variable_bounds.resize(size, handle_ptr->get_stream()); variable_types.resize(size, handle_ptr->get_stream()); objective_coefficients.resize(size, handle_ptr->get_stream()); @@ -1139,7 +1139,7 @@ void problem_t::resize_constraints(size_t matrix_size, size_t constraint_size, size_t n_variables) { - raft::common::nvtx::range fun_scope("resize_constraints"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_constraints"); auto prev_dual_size = lp_state.prev_dual.size(); coefficients.resize(matrix_size, handle_ptr->get_stream()); variables.resize(matrix_size, handle_ptr->get_stream()); @@ -1165,7 +1165,7 @@ void problem_t::resize_constraints(size_t matrix_size, template void problem_t::insert_variables(variables_delta_t& h_vars) { - raft::common::nvtx::range fun_scope("insert_variables"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_variables"); CUOPT_LOG_DEBUG("problem added variable size %d prev %d", h_vars.size(), n_variables); // resize the variable arrays if it can't fit the variables resize_variables(n_variables + h_vars.size()); @@ -1197,7 +1197,7 @@ void problem_t::insert_variables(variables_delta_t& h_vars) template void problem_t::insert_constraints(constraints_delta_t& h_constraints) { - raft::common::nvtx::range fun_scope("insert_constraints"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_constraints"); CUOPT_LOG_DEBUG( "added nnz %d constraints %d offset size %d prev nnz %d prev cstr %d prev offset size%d ", h_constraints.matrix_size(), @@ -1249,7 +1249,7 @@ void problem_t::insert_constraints(constraints_delta_t& h_co template void problem_t::set_implied_integers(const std::vector& implied_integer_indices) { - raft::common::nvtx::range fun_scope("set_implied_integers"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("set_implied_integers"); auto d_indices = cuopt::device_copy(implied_integer_indices, handle_ptr->get_stream()); thrust::for_each(handle_ptr->get_thrust_policy(), d_indices.begin(), @@ -1418,7 +1418,7 @@ void problem_t::substitute_variables(const std::vector& var_indic const std::vector& offset_values, const std::vector& coefficient_values) { - raft::common::nvtx::range fun_scope("substitute_variables"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("substitute_variables"); cuopt_assert((are_exclusive(var_indices, var_to_substitute_indices)), "variables and var_to_substitute_indices are not exclusive"); const i_t dummy_substituted_variable = var_indices[0]; @@ -1589,7 +1589,7 @@ void problem_t::fix_given_variables(problem_t& original_prob const rmm::device_uvector& variables_to_fix, const raft::handle_t* handle_ptr) { - raft::common::nvtx::range fun_scope("fix_given_variables"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("fix_given_variables"); fixing_helpers.reduction_in_rhs.resize(n_constraints, handle_ptr->get_stream()); fixing_helpers.variable_fix_mask.resize(original_problem.n_variables, handle_ptr->get_stream()); thrust::fill(handle_ptr->get_thrust_policy(), @@ -1688,7 +1688,7 @@ problem_t problem_t::get_problem_after_fixing_vars( rmm::device_uvector& variable_map, const raft::handle_t* handle_ptr) { - raft::common::nvtx::range fun_scope("get_problem_after_fixing_vars"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_problem_after_fixing_vars"); auto start_time = std::chrono::high_resolution_clock::now(); cuopt_assert(n_variables == assignment.size(), "Assignment size issue"); problem_t problem(*this, true); @@ -1704,12 +1704,13 @@ problem_t problem_t::get_problem_after_fixing_vars( handle_ptr->get_thrust_policy(), variables_to_fix.begin(), variables_to_fix.end())), "variables_to_fix should be sorted!"); - i_t* result_end = thrust::set_difference(handle_ptr->get_thrust_policy(), - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(0) + n_variables, - variables_to_fix.begin(), - variables_to_fix.end(), - variable_map.begin()); + [[maybe_unused]] i_t* result_end = + thrust::set_difference(handle_ptr->get_thrust_policy(), + thrust::make_counting_iterator(0), + thrust::make_counting_iterator(0) + n_variables, + variables_to_fix.begin(), + variables_to_fix.end(), + variable_map.begin()); RAFT_CHECK_CUDA(handle_ptr->get_stream().get()); cuopt_assert(result_end - variable_map.data() == variable_map.size(), "Size issue in set_difference"); @@ -1758,7 +1759,7 @@ void problem_t::remove_given_variables(problem_t& original_p rmm::device_uvector& variable_map, const raft::handle_t* handle_ptr) { - raft::common::nvtx::range fun_scope("remove_given_variables"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_given_variables"); thrust::fill(handle_ptr->get_thrust_policy(), offsets.begin(), offsets.end(), 0); cuopt_assert(assignment.size() == n_variables, "Variable size mismatch"); cuopt_assert(variable_map.size() < n_variables, "Too many variables to fix"); @@ -1831,7 +1832,8 @@ template rmm::device_uvector problem_t::get_fixed_assignment_from_integer_fixed_problem( const rmm::device_uvector& assignment) { - raft::common::nvtx::range fun_scope("get_fixed_assignment_from_integer_fixed_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "get_fixed_assignment_from_integer_fixed_problem"); rmm::device_uvector fixed_assignment(integer_fixed_variable_map.size(), handle_ptr->get_stream()); // first remove the assignment and variable related vectors @@ -1857,7 +1859,7 @@ void problem_t::test_problem_fixing_time() template void problem_t::compute_integer_fixed_problem() { - raft::common::nvtx::range fun_scope("compute_integer_fixed_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_integer_fixed_problem"); cuopt_assert(integer_fixed_problem == nullptr, "Integer fixed problem already computed"); if (n_variables == n_integer_vars) { integer_fixed_problem = nullptr; @@ -1888,7 +1890,7 @@ template void problem_t::fill_integer_fixed_problem(rmm::device_uvector& assignment, const raft::handle_t* handle_ptr) { - raft::common::nvtx::range fun_scope("fill_integer_fixed_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("fill_integer_fixed_problem"); cuopt_assert(integer_fixed_problem->n_variables > 0, "Integer fixed problem not computed"); copy_rhs_from_problem(handle_ptr); integer_fixed_problem->fix_given_variables(*this, assignment, integer_indices, handle_ptr); @@ -1901,7 +1903,7 @@ template std::vector>> compute_var_to_constraint_map( const problem_t& pb) { - raft::common::nvtx::range fun_scope("compute_var_to_constraint_map"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_var_to_constraint_map"); std::vector>> variable_constraint_map(pb.n_variables); auto stream = pb.handle_ptr->get_stream(); auto h_variables = cuopt::host_copy(pb.variables, stream); @@ -1922,7 +1924,7 @@ template void standardize_bounds(std::vector>>& variable_constraint_map, problem_t& pb) { - raft::common::nvtx::range fun_scope("standardize_bounds"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("standardize_bounds"); auto handle_ptr = pb.handle_ptr; auto stream = handle_ptr->get_stream(); auto h_var_bounds = cuopt::host_copy(pb.variable_bounds, stream); @@ -2001,7 +2003,7 @@ template void compute_csr(const std::vector>>& variable_constraint_map, problem_t& pb) { - raft::common::nvtx::range fun_scope("compute_csr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_csr"); auto handle_ptr = pb.handle_ptr; std::vector> vars_per_constraint(pb.n_constraints); std::vector> coefficient_per_constraint(pb.n_constraints); @@ -2041,7 +2043,7 @@ void compute_csr(const std::vector>>& variable_c template void problem_t::preprocess_problem() { - raft::common::nvtx::range fun_scope("preprocess_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("preprocess_problem"); auto variable_constraint_map = compute_var_to_constraint_map(*this); standardize_bounds(variable_constraint_map, *this); compute_csr(variable_constraint_map, *this); @@ -2065,7 +2067,7 @@ template void problem_t::set_constraints_from_host_user_problem( const user_problem_t& user_problem) { - raft::common::nvtx::range fun_scope("set_constraints_from_host_user_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("set_constraints_from_host_user_problem"); cuopt_assert(user_problem.handle_ptr == handle_ptr, "handle mismatch"); cuopt_assert(user_problem.num_cols == n_variables, "num cols mismatch"); const i_t num_rows = user_problem.num_rows; @@ -2123,7 +2125,7 @@ void problem_t::set_constraints_from_host_csr(const std::vector& const std::vector& row_upper, const std::vector& names) { - raft::common::nvtx::range fun_scope("set_constraints_from_host_csr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("set_constraints_from_host_csr"); n_constraints = static_cast(row_lower.size()); cuopt_assert(row_upper.size() == static_cast(n_constraints), "row bound size mismatch"); cuopt_assert(offsets_in.size() == static_cast(n_constraints) + 1, @@ -2213,7 +2215,7 @@ void problem_t::papilo_uncrush_assignment(rmm::device_uvector& as template void problem_t::get_host_user_problem(user_problem_t& user_problem) const { - raft::common::nvtx::range fun_scope("get_host_user_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_host_user_problem"); // std::lock_guard lock(problem_mutex); i_t m = n_constraints; i_t n = n_variables; @@ -2357,7 +2359,7 @@ uint32_t problem_t::get_fingerprint() const template void problem_t::compute_vars_with_objective_coeffs() { - raft::common::nvtx::range fun_scope("compute_vars_with_objective_coeffs"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_vars_with_objective_coeffs"); auto h_objective_coefficients = cuopt::host_copy(objective_coefficients, handle_ptr->get_stream()); std::vector vars_with_objective_coeffs_; @@ -2374,7 +2376,7 @@ void problem_t::compute_vars_with_objective_coeffs() template void problem_t::add_cutting_plane_at_objective(f_t objective) { - raft::common::nvtx::range fun_scope("add_cutting_plane_at_objective"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_cutting_plane_at_objective"); CUOPT_LOG_DEBUG("Adding cutting plane at objective %f", objective); if (cutting_plane_added) { // modify the RHS diff --git a/cpp/src/mip_heuristics/problem/problem_helpers.cuh b/cpp/src/mip_heuristics/problem/problem_helpers.cuh index 00093330ca..e0de81772b 100644 --- a/cpp/src/mip_heuristics/problem/problem_helpers.cuh +++ b/cpp/src/mip_heuristics/problem/problem_helpers.cuh @@ -86,7 +86,7 @@ static void set_variable_bounds(mip::problem_t& op_problem) template static void set_bounds_if_not_set(mip::problem_t& op_problem) { - raft::common::nvtx::range scope("set_bounds_if_not_set"); + [[maybe_unused]] raft::common::nvtx::range scope("set_bounds_if_not_set"); // If an user gave row type instead of lower/upper bounds if (op_problem.constraint_lower_bounds.is_empty() && @@ -135,7 +135,7 @@ struct negate { template static void convert_to_maximization_problem(mip::problem_t& op_problem) { - raft::common::nvtx::range scope("convert_to_maximization_problem"); + [[maybe_unused]] raft::common::nvtx::range scope("convert_to_maximization_problem"); if (op_problem.objective_coefficients.size()) { // Negate objective coefficient @@ -239,7 +239,7 @@ static void check_csr_representation([[maybe_unused]] const rmm::device_uvector< [[maybe_unused]] i_t n_variables, [[maybe_unused]] i_t n_constraints) { - raft::common::nvtx::range scope("check_csr_representation"); + [[maybe_unused]] raft::common::nvtx::range scope("check_csr_representation"); cuopt_assert(variables.size() == coefficients.size(), "A_index and A_values must have same sizes."); @@ -318,7 +318,7 @@ static bool check_bounds_sanity(const mip::problem_t& problem) check_constraint_bounds_sanity(problem); } -static void check_cusparse_status(cusparseStatus_t status) +[[maybe_unused]] static void check_cusparse_status(cusparseStatus_t status) { if (status != CUSPARSE_STATUS_SUCCESS) { throw std::runtime_error("CUSPARSE error: " + std::string(cusparseGetErrorString(status))); @@ -405,7 +405,7 @@ static void csrsort_cusparse(rmm::device_uvector& values, template static void convert_greater_to_less(mip::problem_t& problem) { - raft::common::nvtx::range scope("convert_greater_to_less"); + [[maybe_unused]] raft::common::nvtx::range scope("convert_greater_to_less"); auto* handle_ptr = problem.handle_ptr; diff --git a/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu b/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu index 14a56cb903..21d7044d5e 100644 --- a/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu +++ b/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu @@ -38,7 +38,7 @@ optimization_problem_solution_t get_relaxed_lp_solution( lp_state_t& lp_state, const relaxed_lp_settings_t& settings) { - raft::common::nvtx::range fun_scope("get_relaxed_lp_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_relaxed_lp_solution"); pdlp_solver_settings_t pdlp_settings{}; pdlp_settings.detect_infeasibility = settings.check_infeasibility; pdlp_settings.set_optimality_tolerance(settings.tolerance); diff --git a/cpp/src/mip_heuristics/root_heuristics.hpp b/cpp/src/mip_heuristics/root_heuristics.hpp index b9645579b5..6aa9dd60c2 100644 --- a/cpp/src/mip_heuristics/root_heuristics.hpp +++ b/cpp/src/mip_heuristics/root_heuristics.hpp @@ -58,13 +58,13 @@ struct cut_pass_heuristics_t { halt_ = true; if (submip_worker_) { - diving_worker_t* worker = submip_worker_.get(); + [[maybe_unused]] diving_worker_t* worker = submip_worker_.get(); #pragma omp taskwait depend(in : *worker) submip_worker_.reset(); } for (auto& worker : diving_workers_) { - diving_worker_t* w = worker.get(); + [[maybe_unused]] diving_worker_t* w = worker.get(); #pragma omp taskwait depend(in : *w) worker.reset(); } @@ -107,7 +107,7 @@ struct cut_pass_heuristics_t { } diving_worker_t* create_diving_worker( - i_t cut_pass, + [[maybe_unused]] i_t cut_pass, const simplex::lp_problem_t& lp, const simplex::simplex_solver_settings_t& settings, const mip_node_t& root_node, diff --git a/cpp/src/mip_heuristics/solution_publication.cuh b/cpp/src/mip_heuristics/solution_publication.cuh index feedc17913..0a8379cba9 100644 --- a/cpp/src/mip_heuristics/solution_publication.cuh +++ b/cpp/src/mip_heuristics/solution_publication.cuh @@ -50,7 +50,7 @@ class solution_publication_t { void set_published_floor(f_t solver_objective) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); best_published_objective_ = solver_objective; } @@ -64,7 +64,7 @@ class solution_publication_t { cuopt_assert(problem_ptr != nullptr, "Publication problem pointer must not be null"); cuopt_assert(std::isfinite(solver_objective), "Published objective must be finite"); - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); cuopt_assert(assignment.size() == (size_t)problem_ptr->n_variables, "Published assignment size must match the problem"); const auto& objective_variables = problem_ptr->vars_with_objective_coeffs.first; diff --git a/cpp/src/mip_heuristics/solve.cu b/cpp/src/mip_heuristics/solve.cu index 6a6c6d795c..59290cf040 100644 --- a/cpp/src/mip_heuristics/solve.cu +++ b/cpp/src/mip_heuristics/solve.cu @@ -121,7 +121,7 @@ mip_solution_t run_mip_solver( std::unique_ptr> symmetry = nullptr) { try { - raft::common::nvtx::range fun_scope("run_mip"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_mip"); if (settings.get_mip_callbacks().size() > 0) { auto callback_num_variables = problem.original_problem_ptr->get_n_variables(); const bool has_semi_continuous_callback_translation = @@ -290,7 +290,7 @@ mip_solution_t run_mip_solver( f_t user_obj, const std::vector& assignment, const char* heuristic_name) { - std::lock_guard lock(papilo_callback_mutex); + [[maybe_unused]] std::lock_guard lock(papilo_callback_mutex); if (solver_obj >= papilo_best_solver_obj) { return; } papilo_best_solver_obj = solver_obj; @@ -401,7 +401,7 @@ mip_solution_t solve_mip_helper( : settings.time_limit; // Create log stream for file logging and add it to default logger - init_logger_t log(settings.log_file, settings.log_to_console); + [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); // Init libraies before to not include it in solve time // This needs to be called before pdlp is initialized init_handler(op_problem.get_handle_ptr()); @@ -410,7 +410,7 @@ mip_solution_t solve_mip_helper( if (pre_solve_heuristics) { pre_solve_heuristics->stop(); } - raft::common::nvtx::range fun_scope("Running solver"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Running solver"); auto timer = timer_t(time_limit); problem_checking_t::check_problem_representation(op_problem); @@ -566,7 +566,7 @@ mip_solution_t solve_mip_helper( f_t user_obj, const std::vector& assignment, const char* heuristic_name) { - std::lock_guard lock(early_callback_mutex); + [[maybe_unused]] std::lock_guard lock(early_callback_mutex); if (solver_obj >= early_best_objective.load()) { return; } early_best_objective.store(solver_obj); early_best_user_obj = user_obj; diff --git a/cpp/src/mip_heuristics/structural/early_structural.cu b/cpp/src/mip_heuristics/structural/early_structural.cu index 0f64e49eff..d537b59c86 100644 --- a/cpp/src/mip_heuristics/structural/early_structural.cu +++ b/cpp/src/mip_heuristics/structural/early_structural.cu @@ -89,7 +89,7 @@ void early_structural_t::start() task_launched_ = true; // OpenMP depend clauses require a variable or array element. - auto* task_token = &preemption_flag_; + [[maybe_unused]] auto* task_token = &preemption_flag_; CUOPT_LOG_DEBUG("Launching early structural task for %s", active_->name()); #pragma omp task priority(CUOPT_DEFAULT_TASK_PRIORITY) depend(out : *task_token) this->run(); @@ -100,7 +100,7 @@ void early_structural_t::stop() { if (!task_launched_) { return; } - auto* task_token = &preemption_flag_; + [[maybe_unused]] auto* task_token = &preemption_flag_; preemption_flag_.store(true); #pragma omp taskwait depend(in : *task_token) task_launched_ = false; diff --git a/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh b/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh index 97abcea3fc..b71ae60997 100644 --- a/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh +++ b/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh @@ -36,7 +36,7 @@ class work_unit_ordered_queue_t { */ void push(float timestamp, const T& work) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); queue_.emplace(timestamp, work); } @@ -48,7 +48,7 @@ class work_unit_ordered_queue_t { */ void push(float timestamp, T&& work) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); queue_.emplace(timestamp, std::move(work)); } @@ -57,7 +57,7 @@ class work_unit_ordered_queue_t { */ void pop() { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); queue_.pop(); } @@ -68,7 +68,7 @@ class work_unit_ordered_queue_t { */ entry_t top_with_timestamp() const { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); return queue_.top(); } @@ -78,7 +78,7 @@ class work_unit_ordered_queue_t { */ T top() const { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); return queue_.top().second; } @@ -89,7 +89,7 @@ class work_unit_ordered_queue_t { */ bool empty() const { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); return queue_.empty(); } @@ -98,13 +98,13 @@ class work_unit_ordered_queue_t { */ std::size_t size() const { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); return queue_.size(); } void clear() { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); queue_ = std::priority_queue, min_heap_cmp>(); } diff --git a/cpp/src/pdlp/cpu_optimization_problem.cpp b/cpp/src/pdlp/cpu_optimization_problem.cpp index 98f82a6faf..b6d9d467b4 100644 --- a/cpp/src/pdlp/cpu_optimization_problem.cpp +++ b/cpp/src/pdlp/cpu_optimization_problem.cpp @@ -737,7 +737,7 @@ void cpu_optimization_problem_t::write_to_mps(const std::string& mps_f static_cast(Q_indices_.size()), Q_offsets_.data(), static_cast(Q_offsets_.size()), - false); + is_symmetrized); } if (!quadratic_constraints_.empty()) { diff --git a/cpp/src/pdlp/cusparse_view.cu b/cpp/src/pdlp/cusparse_view.cu index 7c63c87c91..91b8789666 100644 --- a/cpp/src/pdlp/cusparse_view.cu +++ b/cpp/src/pdlp/cusparse_view.cu @@ -311,7 +311,7 @@ cusparse_view_t::cusparse_view_t( buffer_transpose_mixed_{0, handle_ptr->get_stream()}, mixed_precision_enabled_{false} { - raft::common::nvtx::range fun_scope("Initializing cuSparse view"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Initializing cuSparse view"); #ifdef PDLP_DEBUG_MODE RAFT_CUDA_TRY(cudaDeviceSynchronize()); diff --git a/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu b/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu index ba141b413f..2e63fe71ba 100644 --- a/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu +++ b/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu @@ -53,7 +53,7 @@ void multi_gpu_engine_t::gather_potential_next_solutions_to_master() template void multi_gpu_engine_t::distributed_bound_objective_rescaling(f_t c_scaling_weight) { - raft::common::nvtx::range scope("distributed_bound_objective_rescaling"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_bound_objective_rescaling"); // 1) + 2) Local raw squared norms on each shard, accumulate on host. // Use compute_sum_bounds_squared / compute_sum_weighted_squares (not @@ -118,7 +118,7 @@ template void multi_gpu_engine_t::distributed_ruiz_inf_scaling(int num_iter, i_t n_global_vars) { if (num_iter <= 0 || n_global_vars <= 0) return; - raft::common::nvtx::range scope("distributed_ruiz_inf_scaling"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_ruiz_inf_scaling"); for (int it = 0; it < num_iter; ++it) { refresh_halo_cummulative_scalings(); @@ -146,7 +146,7 @@ template void multi_gpu_engine_t::distributed_pock_chambolle_scaling(f_t alpha, i_t n_global_vars) { if (n_global_vars <= 0) return; - raft::common::nvtx::range scope("distributed_pock_chambolle_scaling"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_pock_chambolle_scaling"); refresh_halo_cummulative_scalings(); @@ -164,10 +164,9 @@ void multi_gpu_engine_t::distributed_pock_chambolle_scaling(f_t alpha, // Mirrors single GPU scaling template void multi_gpu_engine_t::distributed_scaling(pdlp_hyper_params_t const& hyper_params, - i_t n_global_vars, - bool inside_mip) + i_t n_global_vars) { - raft::common::nvtx::range scope("distributed_scaling"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_scaling"); // 1) Matrix scaling passes populate the cumulative row/col scalings on // every shard. Each pass keeps the halo copies refreshed internally. @@ -204,7 +203,7 @@ f_t multi_gpu_engine_t::distributed_max_singular_value_squared(i_t n_g int max_iterations, f_t tolerance) { - raft::common::nvtx::range scope("distributed_max_singular_value_squared"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_max_singular_value_squared"); // ┌──────────────────────────────────────────────────────────────┐ // │ Setup │ @@ -326,7 +325,7 @@ f_t multi_gpu_engine_t::distributed_max_singular_value_squared(i_t n_g // Convergence check via global residual norm. distributed_l2_norm_bufs(q_owned, residual_norm); auto& s0 = *shards[0]; - raft::device_setter guard0(s0.device_id); + [[maybe_unused]] raft::device_setter guard0(s0.device_id); f_t h_res{}; raft::copy(&h_res, residual_norm[0].data(), 1, s0.stream.view()); s0.stream.synchronize(); @@ -335,7 +334,7 @@ f_t multi_gpu_engine_t::distributed_max_singular_value_squared(i_t n_g // σ_max² is the same on every shard after the last allreduce. auto& s0 = *shards[0]; - raft::device_setter guard0(s0.device_id); + [[maybe_unused]] raft::device_setter guard0(s0.device_id); f_t sigma_sq_h{}; raft::copy(&sigma_sq_h, sigma_sq[0].data(), 1, s0.stream.view()); s0.stream.synchronize(); @@ -356,7 +355,7 @@ void multi_gpu_engine_t::distributed_compute_initial_step_size( int max_iterations, f_t tolerance) { - raft::common::nvtx::range scope("distributed_compute_initial_step_size"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_compute_initial_step_size"); cuopt_assert(master_pdlp_ != nullptr, "distributed_compute_initial_step_size requires set_master(...)"); cuopt_expects(hyper_params.initial_step_size_max_singular_value, @@ -386,7 +385,7 @@ template void multi_gpu_engine_t::distributed_compute_initial_primal_weight( pdlp_hyper_params_t const& hyper_params) { - raft::common::nvtx::range scope("distributed_compute_initial_primal_weight"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_compute_initial_primal_weight"); cuopt_assert(master_pdlp_ != nullptr, "distributed_compute_initial_primal_weight requires set_master(...)"); cuopt_expects( @@ -413,8 +412,8 @@ void multi_gpu_engine_t::distributed_compute_initial_primal_weight( template void multi_gpu_engine_t::distributed_bound_objective_rescaling(F_TYPE); \ template void multi_gpu_engine_t::distributed_ruiz_inf_scaling(int, int); \ template void multi_gpu_engine_t::distributed_pock_chambolle_scaling(F_TYPE, int); \ - template void multi_gpu_engine_t::distributed_scaling( \ - pdlp_hyper_params_t const&, int, bool); \ + template void multi_gpu_engine_t::distributed_scaling(pdlp_hyper_params_t const&, \ + int); \ template F_TYPE multi_gpu_engine_t::distributed_max_singular_value_squared( \ int, int, F_TYPE); \ template void multi_gpu_engine_t::distributed_compute_initial_step_size( \ diff --git a/cpp/src/pdlp/distributed_pdlp/distributed_utils.cu b/cpp/src/pdlp/distributed_pdlp/distributed_utils.cu index 62461553a0..28d9baf186 100644 --- a/cpp/src/pdlp/distributed_pdlp/distributed_utils.cu +++ b/cpp/src/pdlp/distributed_pdlp/distributed_utils.cu @@ -23,8 +23,7 @@ std::vector> create_rank_data_from_parts( const std::vector& A_t_values, i_t nb_parts, i_t nb_cstr, - i_t nb_vars, - i_t nnz) + i_t nb_vars) { std::vector> rank_data(nb_parts, rank_data_t(nb_parts)); cuopt_expects(static_cast(parts.size()) == nb_cstr + nb_vars, @@ -257,7 +256,6 @@ template std::vector> create_rank_data_from_parts& A_t_values, int nb_parts, int nb_cstr, - int nb_vars, - int nnz); + int nb_vars); } // namespace cuopt::mathematical_optimization::pdlp diff --git a/cpp/src/pdlp/distributed_pdlp/distributed_utils.hpp b/cpp/src/pdlp/distributed_pdlp/distributed_utils.hpp index a96a5178f9..7a0bdd1a46 100644 --- a/cpp/src/pdlp/distributed_pdlp/distributed_utils.hpp +++ b/cpp/src/pdlp/distributed_pdlp/distributed_utils.hpp @@ -23,7 +23,6 @@ std::vector> create_rank_data_from_parts( const std::vector& A_t_values, i_t nb_parts, i_t nb_cstr, - i_t nb_vars, - i_t nnz); + i_t nb_vars); } // namespace cuopt::mathematical_optimization::pdlp diff --git a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu index 40cfa4855d..ea063b7713 100644 --- a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu +++ b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu @@ -51,7 +51,7 @@ multi_gpu_engine_t::multi_gpu_engine_t( // 3. Construct one shard per rank, pinned to its device. Ownership of each // communicator moves into its shard. for (int r = 0; r < nb_parts; ++r) { - raft::device_setter guard(devices[r]); // shard ctor needs device set + [[maybe_unused]] raft::device_setter guard(devices[r]); // shard ctor needs device set shards.emplace_back(std::make_unique>( devices[r], std::move(rank_data[r]), std::move(comms[r]), mps, sub_solver_settings)); } @@ -334,7 +334,7 @@ void multi_gpu_engine_t::allreduce_sum_inplace_to_master_buf( auto master_stream = master_pdlp_->get_handle_ptr()->get_stream(); sync_await_shards(master_stream); auto& s0 = *shards[0]; - raft::device_setter guard(s0.device_id); + [[maybe_unused]] raft::device_setter guard(s0.device_id); raft::copy(master_dst.data_handle(), shard_scalars[0].data_handle(), 1, master_stream); } @@ -422,7 +422,7 @@ void multi_gpu_engine_t::distributed_l2_norm_to_master_buf( auto master_stream = master_pdlp_->get_handle_ptr()->get_stream(); sync_await_shards(master_stream); auto& s0 = *shards[0]; - raft::device_setter guard(s0.device_id); + [[maybe_unused]] raft::device_setter guard(s0.device_id); raft::copy(master_dst.data_handle(), shard_out[0].data_handle(), 1, master_stream); } diff --git a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp index da22ee556e..2caa23df0d 100644 --- a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp +++ b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp @@ -103,7 +103,7 @@ struct multi_gpu_engine_t { { for (int r = 0; r < static_cast(shards.size()); ++r) { auto& s = *shards[r]; - raft::device_setter guard(s.device_id); + [[maybe_unused]] raft::device_setter guard(s.device_id); // If the function is invocable with a pdlp_shard_t& and an int, call it with the // shard and the rank. if constexpr (std::is_invocable_v&, int>) { @@ -481,9 +481,7 @@ struct multi_gpu_engine_t { // - Pock-Chambolle scaling -> same // - per-shard apply_cummulative_scaling_to_problem() // - global bound/objective rescaling via distributed_bound_objective_rescaling - void distributed_scaling(pdlp_hyper_params_t const& hyper_params, - i_t n_global_vars, - bool inside_mip); + void distributed_scaling(pdlp_hyper_params_t const& hyper_params, i_t n_global_vars); // Distributed sigma_max(A)^2 via power iteration (used to seed the initial // step size). Returns the square of the largest singular value of the scaled diff --git a/cpp/src/pdlp/distributed_pdlp/partitioner.cpp b/cpp/src/pdlp/distributed_pdlp/partitioner.cpp index 8bff6503b3..2c57afafeb 100644 --- a/cpp/src/pdlp/distributed_pdlp/partitioner.cpp +++ b/cpp/src/pdlp/distributed_pdlp/partitioner.cpp @@ -150,11 +150,11 @@ std::vector kaminpar_partitioner_t::partition( // The actual partition computation auto t0 = std::chrono::high_resolution_clock::now(); - const kaminpar::shm::EdgeWeight edge_cut = + [[maybe_unused]] const kaminpar::shm::EdgeWeight edge_cut = engine.compute_partition(std::span(block_of)); - auto t1 = std::chrono::high_resolution_clock::now(); - const double dt = std::chrono::duration(t1 - t0).count(); + auto t1 = std::chrono::high_resolution_clock::now(); + [[maybe_unused]] const double dt = std::chrono::duration(t1 - t0).count(); CUOPT_LOG_TRACE( "KaMinPar partitioned bipartite graph: nvtx=%d nnz=%d nb_parts=%d nthreads=%d edge_cut=%lld " diff --git a/cpp/src/pdlp/distributed_pdlp/shard.hpp b/cpp/src/pdlp/distributed_pdlp/shard.hpp index dcca723c3e..495d6e501d 100644 --- a/cpp/src/pdlp/distributed_pdlp/shard.hpp +++ b/cpp/src/pdlp/distributed_pdlp/shard.hpp @@ -39,7 +39,7 @@ struct nccl_comm_deleter_t { { if (comm == nullptr) return; cuopt_assert(device_id >= 0, "nccl_comm_deleter_t: device_id not set"); - raft::device_setter guard(device_id); + [[maybe_unused]] raft::device_setter guard(device_id); CUOPT_NCCL_TRY_NO_THROW(ncclCommDestroy(comm)); } }; diff --git a/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu b/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu index 28f8b47257..d911e94f0b 100644 --- a/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu +++ b/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu @@ -91,7 +91,7 @@ pdlp_initial_scaling_strategy_t::pdlp_initial_scaling_strategy_t( cummulative_constraint_matrix_scaling_{static_cast(dual_size_h_), stream_view_}, cummulative_variable_scaling_{static_cast(primal_size_h_), stream_view_} { - raft::common::nvtx::range fun_scope("Initializing initial_scaling_strategy"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Initializing initial_scaling_strategy"); #ifdef PDLP_DEBUG_MODE RAFT_CUDA_TRY(cudaDeviceSynchronize()); std::cout << "Initializing initial_scaling_strategy" << std::endl; @@ -132,7 +132,7 @@ template void pdlp_initial_scaling_strategy_t::compute_scaling_vectors( i_t number_of_ruiz_iterations, f_t alpha) { - raft::common::nvtx::range fun_scope("compute_scaling_vectors"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_scaling_vectors"); // Skip scaling entirely for a shape-0 problem (distributed PDLP builds the // master pdlp_solver_t from a shape-0 placeholder) @@ -558,7 +558,7 @@ void pdlp_initial_scaling_strategy_t::resize_context(i_t new_size) template void pdlp_initial_scaling_strategy_t::apply_cummulative_scaling_to_problem() { - raft::common::nvtx::range fun_scope("apply_cummulative_scaling_to_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("apply_cummulative_scaling_to_problem"); // scale A i_t number_of_blocks = op_problem_scaled_.n_constraints / block_size; @@ -705,7 +705,7 @@ void pdlp_initial_scaling_strategy_t::apply_bound_objective_rescaling_ template void pdlp_initial_scaling_strategy_t::scale_problem() { - raft::common::nvtx::range fun_scope("scale_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("scale_problem"); apply_cummulative_scaling_to_problem(); @@ -851,7 +851,7 @@ void pdlp_initial_scaling_strategy_t::unscale_solutions( rmm::device_uvector& dual_solution, rmm::device_uvector& dual_slack) const { - raft::common::nvtx::range fun_scope("unscale_solutions"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("unscale_solutions"); if (primal_solution.size()) { cuopt_expects(primal_solution.size() % static_cast(primal_size_h_) == 0, diff --git a/cpp/src/pdlp/optimization_problem.cu b/cpp/src/pdlp/optimization_problem.cu index 98efded26e..aad1225b7d 100644 --- a/cpp/src/pdlp/optimization_problem.cu +++ b/cpp/src/pdlp/optimization_problem.cu @@ -73,7 +73,7 @@ optimization_problem_t::optimization_problem_t(raft::handle_t const* h row_types_(0, stream_view_), variable_types_(0, stream_view_) { - raft::common::nvtx::range fun_scope("optimization problem construction"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("optimization problem construction"); } template @@ -191,7 +191,7 @@ void optimization_problem_t::set_quadratic_objective_matrix( i_t size_indices, const i_t* Q_offsets, i_t size_offsets, - bool validate_positive_semi_definite) + [[maybe_unused]] bool validate_positive_semi_definite) { cuopt_expects(Q_values != nullptr, error_type_t::ValidationError, "Q_values cannot be null"); cuopt_expects( diff --git a/cpp/src/pdlp/pdhg.cu b/cpp/src/pdlp/pdhg.cu index 586444679d..c07284ab40 100644 --- a/cpp/src/pdlp/pdhg.cu +++ b/cpp/src/pdlp/pdhg.cu @@ -389,7 +389,7 @@ i_t pdhg_solver_t::get_dual_size() const template void pdhg_solver_t::compute_next_dual_solution(rmm::device_uvector& dual_step_size) { - raft::common::nvtx::range fun_scope("compute_next_dual_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_next_dual_solution"); // proj(y+sigma(b-K(2x'-x))) // rewritten as proj(y+sigma(b-K(x'+delta_x))) // with the introduction of constraint lower and upper bounds the b @@ -690,7 +690,7 @@ void pdhg_solver_t::compute_next_primal_dual_solution( rmm::device_uvector& dual_step_size, i_t total_pdlp_iterations) { - raft::common::nvtx::range fun_scope("compute_next_primal_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_next_primal_solution"); #ifdef PDLP_DEBUG_MODE std::cout << " compute_next_primal_solution:" << std::endl; #endif @@ -1228,7 +1228,8 @@ void pdhg_solver_t::compute_next_primal_dual_solution_reflected( const rmm::device_uvector& bound_rescaling, bool should_major) { - raft::common::nvtx::range fun_scope("compute_next_primal_dual_solution_reflected"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "compute_next_primal_dual_solution_reflected"); using f_t2 = typename type_2::type; @@ -1497,7 +1498,7 @@ template void pdhg_solver_t::update_solution( cusparse_view_t& current_op_problem_evaluation_cusparse_view_) { - raft::common::nvtx::range fun_scope("update_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("update_solution"); // Instead of copying, use a swap (that moves pointers) // It's ok because the next will be overwritten next iteration anyways diff --git a/cpp/src/pdlp/pdlp.cu b/cpp/src/pdlp/pdlp.cu index 9f3365d59c..775e015661 100644 --- a/cpp/src/pdlp/pdlp.cu +++ b/cpp/src/pdlp/pdlp.cu @@ -523,8 +523,7 @@ pdlp_solver_t::pdlp_solver_t( h_A_t_values, settings.num_gpus, n_cstr, - n_vars, - nnz); + n_vars); // ----- 5. Per-shard settings ----- pdlp_solver_settings_t sub_pdlp_settings = settings; @@ -1008,7 +1007,7 @@ template std::optional> pdlp_solver_t::check_batch_termination(const timer_t& timer) { - raft::common::nvtx::range fun_scope("check_batch_termination"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_batch_termination"); // Forced to do it in two lines because of macro template interaction [[maybe_unused]] const bool is_cupdlpx = is_cupdlpx_restart(settings_.hyper_params); @@ -1055,7 +1054,7 @@ pdlp_solver_t::check_batch_termination(const timer_t& timer) // climbers return their latest state if (settings_.first_primal_feasible && current_termination_strategy_.any_primal_feasible_or_optimal()) { - raft::common::nvtx::range fpf_scope("first_primal_feasible_batch_snapshot"); + [[maybe_unused]] raft::common::nvtx::range fpf_scope("first_primal_feasible_batch_snapshot"); for (size_t i = 0; i < current_termination_strategy_.get_terminations_status().size(); ++i) { snapshot_climber_into_return(i); } @@ -1097,13 +1096,13 @@ pdlp_solver_t::check_batch_termination(const timer_t& timer) std::move(current_termination_strategy_.get_terminations_status())); } else if (enable_batch_resizing) // Some might be optimal, let's remove them from the batch { - raft::common::nvtx::range fun_scope("remove_done_climbers"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_done_climbers"); std::unordered_set to_remove; for (size_t i = 0; i < current_termination_strategy_.get_terminations_status().size(); ++i) { // Found one that is done if (current_termination_strategy_.is_done( current_termination_strategy_.get_termination_status(i), accept_primal_feasible)) { - raft::common::nvtx::range fun_scope("remove_done_climber"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_done_climber"); #ifdef BATCH_VERBOSE_MODE const bool externally_solved = (current_termination_strategy_.get_termination_status(i) == pdlp_termination_status_t::ConcurrentLimit); @@ -1131,7 +1130,7 @@ template std::optional> pdlp_solver_t::check_termination( const timer_t& timer) { - raft::common::nvtx::range fun_scope("Check termination"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Check termination"); // Still need to always compute the termination condition for current even if we don't check them // after for kkt restart @@ -1862,7 +1861,7 @@ void pdlp_solver_t::swap_all_context( { if (swap_pairs.empty()) { return; } - raft::common::nvtx::range fun_scope("swap_all_context"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("swap_all_context"); pdhg_solver_.swap_context(swap_pairs); restart_strategy_.swap_context(swap_pairs); @@ -1881,7 +1880,7 @@ void pdlp_solver_t::swap_all_context( template void pdlp_solver_t::resize_all_context(i_t new_size) { - raft::common::nvtx::range fun_scope("resize_all_context"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_all_context"); // Resize PDHG and its saddle point pdhg_solver_.resize_context(new_size); @@ -1901,7 +1900,7 @@ template void pdlp_solver_t::resize_and_swap_all_context_loop( const std::unordered_set& climber_strategies_to_remove) { - raft::common::nvtx::range fun_scope("resize_and_swap_all_context_loop"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_and_swap_all_context_loop"); cuopt_assert(climber_strategies_to_remove.size() != climber_strategies_.size(), "We should never remove all climbers"); @@ -2207,7 +2206,7 @@ static void compute_primal_dual_deltas(pdhg_solver_t& pdhg, cuda::stre template void pdlp_solver_t::compute_fixed_error(std::vector& has_restarted) { - raft::common::nvtx::range fun_scope("compute_fixed_error"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_fixed_error"); #ifdef CUPDLP_DEBUG_MODE printf("Computing compute_fixed_point_error \n"); @@ -3176,7 +3175,7 @@ void pdlp_solver_t::take_constant_step(bool is_major_iteration) template void pdlp_solver_t::halpern_update() { - raft::common::nvtx::range fun_scope("halpern_update"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("halpern_update"); if (is_distributed_master()) { multi_gpu_engine->for_each_shard([&](auto& shard) { shard.sub_pdlp->halpern_update(); }); @@ -3262,9 +3261,9 @@ template void pdlp_solver_t::scale_problem() { // Scale problem then free scratch buffers - raft::common::nvtx::range fun_scope("pdlp_solver_t::scale_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("pdlp_solver_t::scale_problem"); if (is_distributed_master()) { - multi_gpu_engine->distributed_scaling(settings_.hyper_params, primal_size_h_, inside_mip_); + multi_gpu_engine->distributed_scaling(settings_.hyper_params, primal_size_h_); // Free per-shard scratch: no further scaling passes happen after this point. multi_gpu_engine->for_each_shard([](auto& shard) { @@ -3284,7 +3283,7 @@ void pdlp_solver_t::scale_problem() template void pdlp_solver_t::create_spmv_op_plans() { - raft::common::nvtx::range fun_scope("pdlp_solver_t::create_spmv_op_plans"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("pdlp_solver_t::create_spmv_op_plans"); if (is_distributed_master()) { // Distributed path: fan out the same per-shard cusparse_view call the // single-GPU path would make. @@ -3307,7 +3306,7 @@ void pdlp_solver_t::create_spmv_op_plans() template void pdlp_solver_t::compute_initial_step_size() { - raft::common::nvtx::range fun_scope("compute_initial_step_size"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_initial_step_size"); // Shared knobs for the power-iteration path (both single-GPU and // distributed) @@ -3497,7 +3496,7 @@ __global__ void compute_weights_initial_primal_weight_from_squared_norms( template void pdlp_solver_t::compute_initial_primal_weight() { - raft::common::nvtx::range fun_scope("compute_initial_primal_weight"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_initial_primal_weight"); if (is_distributed_master()) { // Distributed dispatch: diff --git a/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu b/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu index dc58066fc5..37b8e3cb9b 100644 --- a/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu +++ b/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu @@ -211,7 +211,7 @@ pdlp_restart_strategy_t::pdlp_restart_strategy_t( climber_strategies_(climber_strategies), hyper_params_(hyper_params) { - raft::common::nvtx::range fun_scope("Initializing restart strategy"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Initializing restart strategy"); // Init the vectors RAFT_CUDA_TRY(cudaMemsetAsync(last_restart_duality_gap_.primal_solution_.data(), @@ -335,7 +335,7 @@ bool pdlp_restart_strategy_t::run_trust_region_restart( rmm::device_uvector& primal_weight, const rmm::device_uvector& step_size) { - raft::common::nvtx::range fun_scope("run trust region restart"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run trust region restart"); #ifdef PDLP_VERBOSE_MODE std::cout << "Trust region restart:" << std::endl; #endif @@ -886,9 +886,9 @@ void pdlp_restart_strategy_t::cupdlpx_restart( rmm::device_uvector& primal_step_size, rmm::device_uvector& dual_step_size, rmm::device_uvector& best_primal_weight, - const std::vector& should_restart) + [[maybe_unused]] const std::vector& should_restart) { - raft::common::nvtx::range fun_scope("cupdlpx_restart"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("cupdlpx_restart"); // TODO later batch mode: remove if you have per climber restart cuopt_assert( @@ -1115,7 +1115,7 @@ void pdlp_restart_strategy_t::compute_restart( [[maybe_unused]] rmm::device_uvector& best_primal_weight, std::vector& has_restarted) { - raft::common::nvtx::range fun_scope("compute_restart"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_restart"); if (hyper_params_.restart_strategy == static_cast(restart_strategy_t::KKT_RESTART)) { cuopt_expects(climber_strategies_.size() == 1, @@ -1229,7 +1229,7 @@ void pdlp_restart_strategy_t::compute_new_primal_weight( rmm::device_uvector& primal_step_size, rmm::device_uvector& dual_step_size) { - raft::common::nvtx::range fun_scope("compute_new_primal_weight"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_new_primal_weight"); cuopt_assert(!batch_mode_, "compute_new_primal_weight not supported in batch mode"); @@ -1251,7 +1251,8 @@ void pdlp_restart_strategy_t::distance_squared_moved_from_last_restart i_t stride, rmm::device_uvector& distance_moved) { - raft::common::nvtx::range fun_scope("distance_squared_moved_from_last_restart_period"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "distance_squared_moved_from_last_restart_period"); #ifdef PDLP_DEBUG_MODE rmm::device_scalar debuga{stream_view_}; rmm::device_scalar debugb{stream_view_}; @@ -1348,7 +1349,7 @@ template void pdlp_restart_strategy_t::update_last_restart_information( localized_duality_gap_container_t& duality_gap, rmm::device_uvector& primal_weight) { - raft::common::nvtx::range fun_scope("update_last_restart_information"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("update_last_restart_information"); compute_distance_traveled_last_restart_kernel<<<1, 1, 0, stream_view_.get()>>>( duality_gap.view(), primal_weight.data(), last_restart_duality_gap_.distance_traveled_.data()); @@ -1435,7 +1436,8 @@ void pdlp_restart_strategy_t::should_do_adaptive_restart_normalized_du rmm::device_uvector& primal_weight, i_t& restart) { - raft::common::nvtx::range fun_scope("should_do_adaptive_restart_normalized_duality_gap"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "should_do_adaptive_restart_normalized_duality_gap"); #ifdef PDLP_DEBUG_MODE std::cout << "Should do adaptive restart normalized duality gap" << std::endl; #endif @@ -1516,7 +1518,7 @@ void pdlp_restart_strategy_t::compute_localized_duality_gaps( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - raft::common::nvtx::range fun_scope("compute_localized_duality_gaps"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_localized_duality_gaps"); #ifdef PDLP_DEBUG_MODE std::cout << "Compute localized duality gaps:" << std::endl; #endif @@ -1565,7 +1567,7 @@ void pdlp_restart_strategy_t::bound_optimal_objective( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - raft::common::nvtx::range fun_scope("bound_optimal_objective"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("bound_optimal_objective"); #ifdef PDLP_DEBUG_MODE std::cout << "Bound optimal objective:" << std::endl; #endif @@ -1587,7 +1589,7 @@ void pdlp_restart_strategy_t::compute_bound(const rmm::device_uvector< rmm::device_uvector& tmp, rmm::device_scalar& bound) { - raft::common::nvtx::range fun_scope("compute_bound"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_bound"); #ifdef PDLP_DEBUG_MODE std::cout << "Compute bound" << std::endl; #endif @@ -1930,7 +1932,7 @@ void pdlp_restart_strategy_t::solve_bound_constrained_trust_region( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - raft::common::nvtx::range fun_scope("solve_bound_constrained_trust_region"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("solve_bound_constrained_trust_region"); #ifdef PDLP_DEBUG_MODE std::cout << " Solve bound constrained trust region:" << std::endl; #endif @@ -2226,7 +2228,8 @@ void pdlp_restart_strategy_t::compute_distance_traveled_from_last_rest rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - raft::common::nvtx::range fun_scope("compute_distance_traveled_from_last_restart"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "compute_distance_traveled_from_last_restart"); // norm( // new_primal_solution - last_restart.primal_solution, // )^2 @@ -2260,7 +2263,7 @@ void pdlp_restart_strategy_t::compute_primal_gradient( localized_duality_gap_container_t& duality_gap, cusparse_view_t& cusparse_view) { - raft::common::nvtx::range fun_scope("compute_primal_gradient"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_gradient"); #ifdef PDLP_DEBUG_MODE std::cout << " Compute primal gradient:" << std::endl; #endif @@ -2330,7 +2333,7 @@ void pdlp_restart_strategy_t::compute_dual_gradient( cusparse_view_t& cusparse_view, rmm::device_uvector& tmp_dual) { - raft::common::nvtx::range fun_scope("compute_dual_gradient"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_gradient"); #ifdef PDLP_DEBUG_MODE std::cout << " Compute dual gradient:" << std::endl; #endif @@ -2374,7 +2377,7 @@ void pdlp_restart_strategy_t::compute_lagrangian_value( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - raft::common::nvtx::range fun_scope("compute_lagrangian_value"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_lagrangian_value"); #ifdef PDLP_DEBUG_MODE std::cout << " Compute lagrangian value:" << std::endl; #endif diff --git a/cpp/src/pdlp/solve.cu b/cpp/src/pdlp/solve.cu index 38202c6b51..08296f3b40 100644 --- a/cpp/src/pdlp/solve.cu +++ b/cpp/src/pdlp/solve.cu @@ -859,15 +859,13 @@ optimization_problem_solution_t run_pdlp(mip::problem_t& pro "Single-precision PDLP is not supported in batch mode."); auto start_solver = std::chrono::high_resolution_clock::now(); - timer_t timer_pdlp(timer.remaining_time()); - auto sol = run_pdlp_solver(problem, settings, timer, is_batch_mode); + auto sol = run_pdlp_solver(problem, settings, timer, is_batch_mode); // Negate dual variables and reduced costs for maximization problems if (problem.maximize) { adjust_dual_solution_and_reduced_cost( sol.get_dual_solution(), sol.get_reduced_cost(), problem.handle_ptr->get_stream()); problem.handle_ptr->sync_stream(); } - auto pdlp_solve_time = timer_pdlp.elapsed_time(); sol.set_solve_time(timer.elapsed_time()); CUOPT_LOG_CONDITIONAL_INFO(!settings.inside_mip, "PDLP finished"); if (sol.get_termination_status() != pdlp_termination_status_t::ConcurrentLimit) { @@ -1285,8 +1283,8 @@ static size_t max_memory_batch_size(const optimization_problem_t& prob { size_t st_free_mem, st_total_mem; RAFT_CUDA_TRY(cudaMemGetInfo(&st_free_mem, &st_total_mem)); - const double free_mem = static_cast(st_free_mem); - const double total_mem = static_cast(st_total_mem); + const double free_mem = static_cast(st_free_mem); + [[maybe_unused]] const double total_mem = static_cast(st_total_mem); while (memory_max_batch_size > 0) { const double mem_est = batch_pdlp_memory_estimator(problem, @@ -1353,8 +1351,8 @@ static optimization_problem_solution_t run_batch_pdlp_splitting( collect_solutions); size_t st_free_mem, st_total_mem; RAFT_CUDA_TRY(cudaMemGetInfo(&st_free_mem, &st_total_mem)); - const double free_mem = static_cast(st_free_mem); - const double total_mem = static_cast(st_total_mem); + const double free_mem = static_cast(st_free_mem); + [[maybe_unused]] const double total_mem = static_cast(st_total_mem); #ifdef BATCH_VERBOSE_MODE std::cout << "Memory estimate: " << memory_estimate << std::endl; @@ -1571,8 +1569,6 @@ optimization_problem_solution_t run_concurrent( bool is_batch_mode) { CUOPT_LOG_CONDITIONAL_INFO(!settings.inside_mip, "Running concurrent (showing only PDLP log)\n"); - timer_t timer_concurrent(timer.remaining_time()); - // Copy the settings so that we can set the concurrent halt pointer pdlp_solver_settings_t settings_pdlp(settings); @@ -1655,7 +1651,7 @@ optimization_problem_solution_t run_concurrent( }; if (settings.num_gpus > 1) { problem.handle_ptr->sync_stream(); - raft::device_setter device_setter(1); // Scoped variable + [[maybe_unused]] raft::device_setter device_setter(1); // Scoped variable CUOPT_LOG_DEBUG("Barrier device: %d", device_setter.get_current_device()); call_barrier_thread(); } else { @@ -1717,7 +1713,8 @@ optimization_problem_solution_t run_concurrent( dispatch_concurrent_solvers(); } else { // Stand-alone LP: stand up a local team sized for 1 dispatcher + 1 per spawned task. - const int num_workers = 1 + (settings.inside_mip ? 0 : 1) + (enable_barrier ? 1 : 0); + [[maybe_unused]] const int num_workers = + 1 + (settings.inside_mip ? 0 : 1) + (enable_barrier ? 1 : 0); #pragma omp parallel num_threads(num_workers) default(shared) { #pragma omp single @@ -1878,7 +1875,7 @@ optimization_problem_solution_t solve_qcqp( { try { // Create log stream for file logging and add it to default logger - init_logger_t log(settings.log_file, settings.log_to_console); + [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); print_version_info(); // Init libraries before to not include it in solve time @@ -1904,7 +1901,7 @@ optimization_problem_solution_t solve_qcqp( } } - raft::common::nvtx::range fun_scope("Running QCQP solver"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Running QCQP solver"); const bool has_q_obj = op_problem.has_quadratic_objective(); const bool has_qc = op_problem.has_quadratic_constraints(); if (has_q_obj && has_qc) { @@ -2061,7 +2058,7 @@ optimization_problem_solution_t solve_lp( try { pdlp_solver_settings_t settings(settings_const); // Create log stream for file logging and add it to default logger - init_logger_t log(settings.log_file, settings.log_to_console); + [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); if (!settings_const.inside_mip) print_version_info(); @@ -2069,10 +2066,10 @@ optimization_problem_solution_t solve_lp( // This needs to be called before pdlp is initialized init_handler(op_problem.get_handle_ptr()); - raft::common::nvtx::range fun_scope("Running solver"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Running solver"); if (problem_checking) { - raft::common::nvtx::range fun_scope("Check problem representation"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Check problem representation"); // This is required as user might forget to set some fields problem_checking_t::check_problem_representation(op_problem); // In batch PDLP for strong branching, the initial solutions will be by design out of bounds. @@ -2366,7 +2363,7 @@ template cuopt::mathematical_optimization::io::mps_data_model_t op_problem_to_mps_data_model( const optimization_problem_t& op_problem) { - raft::common::nvtx::range fun_scope("op_problem -> mps_data_model (D->H)"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("op_problem -> mps_data_model (D->H)"); cuopt::mathematical_optimization::io::mps_data_model_t mps; mps.set_maximize(op_problem.get_sense()); @@ -2561,7 +2558,7 @@ optimization_problem_solution_t solve_lp_distributed_from_mps( "bound_objective_rescaling=true). Set pdlp_solver_mode = Stable3 (the default) or adjust " "the hyper-params to match."); - init_logger_t log(settings_resolved.log_file, settings_resolved.log_to_console); + [[maybe_unused]] init_logger_t log(settings_resolved.log_file, settings_resolved.log_to_console); print_version_info(visible_device_count); init_handler(handle_ptr); diff --git a/cpp/src/pdlp/solver_solution.cu b/cpp/src/pdlp/solver_solution.cu index ace97647f1..a6b0a0cadf 100644 --- a/cpp/src/pdlp/solver_solution.cu +++ b/cpp/src/pdlp/solver_solution.cu @@ -214,7 +214,7 @@ void optimization_problem_solution_t::write_to_file(std::string_view f cuda::stream_ref stream_view, bool generate_variable_values) { - raft::common::nvtx::range fun_scope("write final solution to file"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("write final solution to file"); cuopt_expects(termination_stats_.size() == 1, error_type_t::ValidationError, diff --git a/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu b/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu index 245c36f8bf..231a4308f5 100644 --- a/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu +++ b/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu @@ -340,7 +340,7 @@ void adaptive_step_size_strategy_t::compute_step_sizes( rmm::device_uvector& dual_step_size, i_t total_pdlp_iterations) { - raft::common::nvtx::range fun_scope("compute_step_sizes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_step_sizes"); cuopt_assert(!batch_mode_, "Batch mode is not supported for compute_step_sizes"); diff --git a/cpp/src/pdlp/termination_strategy/convergence_information.cu b/cpp/src/pdlp/termination_strategy/convergence_information.cu index f7e2725dc7..4693488f55 100644 --- a/cpp/src/pdlp/termination_strategy/convergence_information.cu +++ b/cpp/src/pdlp/termination_strategy/convergence_information.cu @@ -228,7 +228,7 @@ void convergence_information_t::distributed_init_l2_norms( error_type_t::ValidationError, "distributed_init_l2_norms: only the Stable3-shaped path is " "supported (initial_primal_weight_combined_bounds=false)."); - raft::common::nvtx::range scope("distributed_init_l2_norms"); + [[maybe_unused]] raft::common::nvtx::range scope("distributed_init_l2_norms"); f_t global_rhs_sq = f_t(0); @@ -552,7 +552,7 @@ void convergence_information_t::compute_convergence_information( dual_residual_.size() == primal_size_h_ * climber_strategies_.size(), "dual_residual_ size must be equal to primal_size_h_ * climber_strategies_.size()"); } - raft::common::nvtx::range fun_scope("compute_convergence_information"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_convergence_information"); #ifdef CUPDLP_DEBUG_MODE print("primal_iterate", primal_iterate); @@ -714,7 +714,7 @@ void convergence_information_t::compute_primal_residual( rmm::device_uvector& tmp_dual, [[maybe_unused]] const rmm::device_uvector& dual_iterate) { - raft::common::nvtx::range fun_scope("compute_primal_residual"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_residual"); // primal_product if (!batch_mode_) { @@ -802,7 +802,7 @@ template void convergence_information_t::compute_primal_objective_owned_partial( const rmm::device_uvector& primal_solution, i_t n_owned) { - raft::common::nvtx::range fun_scope("compute_primal_objective_owned_partial"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_objective_owned_partial"); cuopt_assert(!batch_mode_, "owned-partial primal objective is only used in non-batch mGPU mode"); cuopt_assert(n_owned <= primal_size_h_, "n_owned must be <= primal_size_h_ (owned slice is a prefix)"); @@ -820,7 +820,7 @@ template void convergence_information_t::compute_primal_objective( rmm::device_uvector& primal_solution) { - raft::common::nvtx::range fun_scope("compute_primal_objective"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_objective"); if (!batch_mode_) { compute_primal_objective_owned_partial(primal_solution, primal_size_h_); @@ -871,7 +871,7 @@ void convergence_information_t::compute_dual_residual( cuopt_assert(dual_residual_.size() == primal_solution.size(), "dual_residual_ size must be equal to primal_solution size"); - raft::common::nvtx::range fun_scope("compute_dual_residual"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_residual"); // compute objective product (Q*x) if QP // gradient is recomputed with the dual solution that has been computed since the gradient was @@ -948,7 +948,7 @@ void convergence_information_t::compute_dual_objective_owned_partial( i_t n_owned_var, i_t n_owned_cstr) { - raft::common::nvtx::range fun_scope("compute_dual_objective_owned_partial"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_objective_owned_partial"); cuopt_assert(!batch_mode_, "owned-partial dual objective is only used in non-batch mGPU mode"); cuopt_assert(hyper_params_.use_reflected_primal_dual, "owned-partial dual objective requires use_reflected_primal_dual"); @@ -991,7 +991,7 @@ void convergence_information_t::compute_dual_objective( [[maybe_unused]] const rmm::device_uvector& primal_solution, [[maybe_unused]] const rmm::device_uvector& dual_slack) { - raft::common::nvtx::range fun_scope("compute_dual_objective"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_objective"); // for QP would need to add + problem.objective_constant - 0.5 * objective_product' * // primal_solution @@ -1078,7 +1078,7 @@ template void convergence_information_t::compute_reduced_cost_from_primal_gradient( const rmm::device_uvector& primal_gradient, const rmm::device_uvector& primal_solution) { - raft::common::nvtx::range fun_scope("compute_reduced_cost_from_primal_gradient"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_reduced_cost_from_primal_gradient"); using f_t2 = typename type_2::type; cub::DeviceTransform::Transform( @@ -1109,7 +1109,8 @@ void convergence_information_t::compute_reduced_cost_from_primal_gradi template void convergence_information_t::compute_reduced_costs_dual_objective_contribution() { - raft::common::nvtx::range fun_scope("compute_reduced_costs_dual_objective_contribution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "compute_reduced_costs_dual_objective_contribution"); using f_t2 = typename type_2::type; // if reduced cost is positive -> lower bound, negative -> upper bounds, 0 -> 0 diff --git a/cpp/src/pdlp/termination_strategy/infeasibility_information.cu b/cpp/src/pdlp/termination_strategy/infeasibility_information.cu index 100365c366..cf2229f8c6 100644 --- a/cpp/src/pdlp/termination_strategy/infeasibility_information.cu +++ b/cpp/src/pdlp/termination_strategy/infeasibility_information.cu @@ -234,7 +234,7 @@ void infeasibility_information_t::compute_infeasibility_information( rmm::device_uvector& primal_ray, rmm::device_uvector& dual_ray) { - raft::common::nvtx::range fun_scope("compute_infeasibility_information"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_infeasibility_information"); using f_t2 = typename type_2::type; if (is_cupdlpx_restart(hyper_params_)) { diff --git a/cpp/src/pdlp/termination_strategy/termination_strategy.cu b/cpp/src/pdlp/termination_strategy/termination_strategy.cu index 9738675690..4cee4f88bd 100644 --- a/cpp/src/pdlp/termination_strategy/termination_strategy.cu +++ b/cpp/src/pdlp/termination_strategy/termination_strategy.cu @@ -162,7 +162,7 @@ void pdlp_termination_strategy_t::evaluate_termination_criteria( const rmm::device_uvector& combined_bounds, const rmm::device_uvector& objective_coefficients) { - raft::common::nvtx::range fun_scope("Evaluate termination criteria"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Evaluate termination criteria"); convergence_information_.compute_convergence_information(current_pdhg_solver, primal_iterate, diff --git a/cpp/src/pdlp/translate.hpp b/cpp/src/pdlp/translate.hpp index 135d3168f6..ef168ca829 100644 --- a/cpp/src/pdlp/translate.hpp +++ b/cpp/src/pdlp/translate.hpp @@ -215,7 +215,8 @@ template static simplex::user_problem_t cuopt_optimization_problem_to_user_problem( raft::handle_t const* handle_ptr, optimization_problem_t& model) { - raft::common::nvtx::range fun_scope("QCQP: cuopt_optimization_problem_to_user_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope( + "QCQP: cuopt_optimization_problem_to_user_problem"); simplex::user_problem_t user_problem(handle_ptr); i_t const m = model.get_n_constraints(); diff --git a/cpp/src/pdlp/utilities/cython_solve.cu b/cpp/src/pdlp/utilities/cython_solve.cu index 739297fe94..f30983af03 100644 --- a/cpp/src/pdlp/utilities/cython_solve.cu +++ b/cpp/src/pdlp/utilities/cython_solve.cu @@ -56,7 +56,7 @@ cuopt::mathematical_optimization::lp_solution_interface_t* call_sol cuopt::mathematical_optimization::pdlp_solver_settings_t& solver_settings, bool is_batch_mode) { - raft::common::nvtx::range fun_scope("Call Solve LP"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Call Solve LP"); cuopt_expects(problem_interface->get_problem_category() == cuopt::mathematical_optimization::problem_category_t::LP, error_type_t::ValidationError, @@ -84,7 +84,7 @@ cuopt::mathematical_optimization::mip_solution_interface_t* call_so problem_interface, cuopt::mathematical_optimization::mip_solver_settings_t& solver_settings) { - raft::common::nvtx::range fun_scope("Call Solve MIP"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Call Solve MIP"); cuopt_expects((problem_interface->get_problem_category() == cuopt::mathematical_optimization::problem_category_t::MIP) or (problem_interface->get_problem_category() == @@ -107,7 +107,7 @@ std::unique_ptr call_solve( bool is_batch_mode, barrier_cache_t* cache_in) { - raft::common::nvtx::range fun_scope("Call Solve"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Call Solve"); cuopt_expects( data_model != nullptr, error_type_t::ValidationError, "call_solve: data_model is null."); @@ -292,8 +292,10 @@ static int compute_max_thread( } std::pair>, double> solve_batch_remote( - std::vector*> data_models, - cuopt::mathematical_optimization::solver_settings_t* solver_settings) + [[maybe_unused]] std::vector< + cuopt::mathematical_optimization::io::data_model_view_t*> data_models, + [[maybe_unused]] cuopt::mathematical_optimization::solver_settings_t* + solver_settings) { cuopt_expects( false, @@ -307,7 +309,7 @@ std::pair>, double> call_batch_solve( std::vector*> data_models, cuopt::mathematical_optimization::solver_settings_t* solver_settings) { - raft::common::nvtx::range fun_scope("Call batch solve"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("Call batch solve"); if (cuopt::mathematical_optimization::is_remote_execution_enabled()) { return solve_batch_remote(data_models, solver_settings); @@ -315,8 +317,8 @@ std::pair>, double> call_batch_solve( // Hold the logger configuration for the whole batch so that worker-local // init_logger_t instances inside solve_lp() reuse it. - init_logger_t batch_log(solver_settings->get_pdlp_settings().log_file, - solver_settings->get_pdlp_settings().log_to_console); + [[maybe_unused]] init_logger_t batch_log(solver_settings->get_pdlp_settings().log_file, + solver_settings->get_pdlp_settings().log_to_console); const std::size_t size = data_models.size(); @@ -325,7 +327,7 @@ std::pair>, double> call_batch_solve( auto start_solver = std::chrono::high_resolution_clock::now(); // Limit parallelism as too much stream overlap gets too slow - const int max_thread = compute_max_thread(data_models); + [[maybe_unused]] const int max_thread = compute_max_thread(data_models); if (solver_settings->get_parameter(CUOPT_METHOD) == CUOPT_METHOD_CONCURRENT) { CUOPT_LOG_INFO("Concurrent mode not supported for batch solve. Using PDLP instead. "); diff --git a/cpp/src/routing/adapters/adapted_generator.cu b/cpp/src/routing/adapters/adapted_generator.cu index da4027add2..294a5ec013 100644 --- a/cpp/src/routing/adapters/adapted_generator.cu +++ b/cpp/src/routing/adapters/adapted_generator.cu @@ -31,7 +31,7 @@ bool adapted_generator_t::make_feasible( costs const& weight, bool clear_scores) { - raft::common::nvtx::range fun_scope("make_feasible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("make_feasible"); auto [resource, index] = pool_allocator.resource_pool->acquire(); resource.ges.set_solution_ptr(&adapted_solution.sol, clear_scores); resource.ges.start_timer(std::chrono::steady_clock::now(), time_limit); @@ -89,7 +89,7 @@ void adapted_generator_t::generate_solution( const costs& weight, const timer_t& timer) { - raft::common::nvtx::range fun_scope("generate_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_solution"); if (sol.problem->is_tsp) { generate_tsp_solution(sol, desired_vehicle_ids); return; diff --git a/cpp/src/routing/adapters/adapted_modifier.cu b/cpp/src/routing/adapters/adapted_modifier.cu index 4675581a6d..ba743e71af 100644 --- a/cpp/src/routing/adapters/adapted_modifier.cu +++ b/cpp/src/routing/adapters/adapted_modifier.cu @@ -26,7 +26,7 @@ template void adapted_modifier_t::perturbate( adapted_sol_t& adapted_solution, costs weight, i_t perturbation_count) { - raft::common::nvtx::range fun_scope("perturbate"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("perturbate"); auto [resource, index] = pool_allocator.resource_pool->acquire(); auto gpu_weight = get_cuopt_cost(weight); // temporarily set it to double max. it is not used anymore @@ -48,7 +48,7 @@ void adapted_modifier_t::improve( f_t time_limit, bool run_cycle_finder) { - raft::common::nvtx::range fun_scope("improve"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("improve"); auto [resource, index] = pool_allocator.resource_pool->acquire(); // set the excess limit to to the total excess with some multiplier auto gpu_weight = get_cuopt_cost(weight); @@ -70,7 +70,7 @@ template void adapted_modifier_t::add_unserviced_request( adapted_sol_t& adapted_solution, costs final_weight) { - raft::common::nvtx::range fun_scope("add_unserviced_request"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_unserviced_request"); // find unserviced requests auto [resource, index] = pool_allocator.resource_pool->acquire(); resource.ges.set_solution_ptr(&adapted_solution.sol); @@ -94,7 +94,7 @@ void adapted_modifier_t::add_selected_unserviced_requests( costs final_weight) { if (unserviced_nodes.empty()) { return; } - raft::common::nvtx::range fun_scope("add_selected_unserviced_request"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_selected_unserviced_request"); // find unserviced requests auto [resource, index] = pool_allocator.resource_pool->acquire(); resource.ges.set_solution_ptr(&adapted_solution.sol); @@ -120,7 +120,7 @@ void adapted_modifier_t::equalize_routes_and_nodes( costs final_weight, bool skip_adding_nodes_to_a) { - raft::common::nvtx::range fun_scope("equalize_routes_and_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("equalize_routes_and_nodes"); // If both solutions have no unserviced nodes (default behavior) // and if they have equal route count we should exit early @@ -167,7 +167,7 @@ template bool adapted_modifier_t::eject_request_infeasible_nodes( adapted_sol_t& sol) { - raft::common::nvtx::range fun_scope("eject_request_infeasible_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("eject_request_infeasible_nodes"); helper_set.clear(); helper_nodes.clear(); for (int i = 0; i < (int)sol.problem->get_num_orders(); i++) { @@ -215,7 +215,7 @@ template void adapted_modifier_t::insert_infeasible_nodes( adapted_sol_t& sol, costs& weights) { - raft::common::nvtx::range fun_scope("insert_infeasible_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_infeasible_nodes"); // add cluster/order infeasible nodes to the solution sol.add_nodes_to_best(helper_nodes, weights); } @@ -224,7 +224,7 @@ template bool adapted_modifier_t::make_cluster_order_feasible_request( adapted_sol_t& sol, costs weights) { - raft::common::nvtx::range fun_scope("make_cluster_order_feasible_request"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("make_cluster_order_feasible_request"); if constexpr (REQUEST == request_t::VRP) { return true; } if (eject_request_infeasible_nodes(sol)) { insert_infeasible_nodes(sol, weights); diff --git a/cpp/src/routing/adapters/adapted_sol.cuh b/cpp/src/routing/adapters/adapted_sol.cuh index b152da3d95..dd1df49bb3 100644 --- a/cpp/src/routing/adapters/adapted_sol.cuh +++ b/cpp/src/routing/adapters/adapted_sol.cuh @@ -107,7 +107,7 @@ struct adapted_sol_t { std::vector desired_vehicles = {}) : sol(*problem_, 0, sol_handle_, desired_vehicles), problem(problem_) { - raft::common::nvtx::range fun_scope("adapted_sol_t ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("adapted_sol_t ctr"); initialize_host_data(); populate_host_data(true); } @@ -117,7 +117,7 @@ struct adapted_sol_t { adapted_sol_t& operator=(const adapted_sol_t& other_sol) { - raft::common::nvtx::range fun_scope("adapted_sol_t assignment"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("adapted_sol_t assignment"); if (this == &other_sol) return *this; infeasibility_cost = other_sol.infeasibility_cost; problem = other_sol.problem; @@ -137,7 +137,7 @@ struct adapted_sol_t { void reset_viable_of_problem() { - raft::common::nvtx::range fun_scope("reset_viable_of_problem"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("reset_viable_of_problem"); initialize_incompatible(const_cast&>(*sol.problem_ptr), &sol); } @@ -145,8 +145,8 @@ struct adapted_sol_t { bool inline check_device_host_coherence_() { [[maybe_unused]] const auto copy_infeasibility_cost = infeasibility_cost; - const auto copy_succ = succ; - const auto copy_pred = pred; + [[maybe_unused]] const auto copy_succ = succ; + [[maybe_unused]] const auto copy_pred = pred; const auto copy_nodes = nodes; const auto copy_routes = routes; sol.compute_backward_forward(); @@ -165,7 +165,7 @@ struct adapted_sol_t { double get_cost(costs& weight) { - raft::common::nvtx::range fun_scope("get_cost"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_cost"); auto cuopt_weight = get_cuopt_cost(weight); sol.compute_cost(); return sol.get_total_cost(cuopt_weight); @@ -176,14 +176,14 @@ struct adapted_sol_t { bool unserviced(int node) const { - raft::common::nvtx::range fun_scope("unserviced"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("unserviced"); return (!pred[node].is_valid() && !succ[node].is_valid()); } // adds nodes to best position that minimizes cluster violations void add_nodes_to_best(const std::vector>& nodes_to_insert, costs& weight) { - raft::common::nvtx::range fun_scope("add_nodes_to_best"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_best"); sol.add_nodes_to_best(nodes_to_insert, get_cuopt_cost(weight)); populate_host_data(); check_device_host_coherence(); @@ -194,13 +194,13 @@ struct adapted_sol_t { // routes_to_search array void unset_routes_to_search() { - raft::common::nvtx::range fun_scope("unset_routes_to_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("unset_routes_to_search"); sol.unset_routes_to_search(); } void set_routes_to_search() { - raft::common::nvtx::range fun_scope("set_routes_to_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("set_routes_to_search"); sol.set_routes_to_search(); } @@ -209,7 +209,7 @@ struct adapted_sol_t { NodeInfo<> prev_node, NodeInfo<> next_node) { - raft::common::nvtx::range fun_scope("add_nodes_to_route"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_route"); i_t route_id, intra_idx; if (!prev_node.is_depot()) { std::tie(route_id, intra_idx) = sol.route_node_map.get_route_id_and_intra_idx(prev_node); @@ -230,7 +230,7 @@ struct adapted_sol_t { // returns false if we encounter an empty route bool remove_nodes(const std::vector>& nodes_to_eject) { - raft::common::nvtx::range fun_scope("remove_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_nodes"); bool success = sol.remove_nodes(nodes_to_eject); populate_host_data(); check_device_host_coherence(); @@ -251,7 +251,7 @@ struct adapted_sol_t { double calculate_similarity_radius_asymetric(const adapted_sol_t& second) const { - raft::common::nvtx::range fun_scope("calculate_similarity_radius"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("calculate_similarity_radius"); // check_device_host_coherence(); int common_edges = 0; int nodes = problem->get_num_orders(); @@ -290,7 +290,7 @@ struct adapted_sol_t { void add_new_routes(const std::vector>>>& routes) { - raft::common::nvtx::range fun_scope("add_new_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_new_routes"); cuopt_assert(routes.size() > 0, "Indices array cannot be empty"); thrust::fill(sol.sol_handle->get_thrust_policy(), sol.routes_to_copy.data() + sol.n_routes, @@ -325,7 +325,7 @@ struct adapted_sol_t { std::vector get_nodes_of_routes(const std::vector& routes_to_copy) const { - raft::common::nvtx::range fun_scope("remove_route"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_route"); std::vector copy_nodes; if (routes_to_copy.empty()) { return copy_nodes; } @@ -344,7 +344,7 @@ struct adapted_sol_t { void remove_routes(std::vector routes_to_remove) { if (routes_to_remove.empty()) { return; } - raft::common::nvtx::range fun_scope("remove_route"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_route"); std::sort(routes_to_remove.begin(), routes_to_remove.end()); sol.remove_routes(routes_to_remove); for (size_t i = 0; i < routes_to_remove.size(); ++i) { @@ -408,7 +408,7 @@ struct adapted_sol_t { void different_route_ids(std::vector& route_ids, adapted_sol_t const& input) const noexcept { - raft::common::nvtx::range fun_scope("different_route_ids"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("different_route_ids"); route_ids.clear(); for (size_t i = 0; i < routes.size(); i++) { if (routes[i].is_empty()) { continue; } @@ -443,7 +443,7 @@ struct adapted_sol_t { void populate_unserviced_nodes() { - raft::common::nvtx::range fun_scope("populate_unserviced_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_unserviced_nodes"); has_unserviced_nodes = false; auto h_route_id_per_node = host_copy(sol.route_node_map.route_id_per_node, sol.sol_handle->get_stream()); @@ -467,14 +467,14 @@ struct adapted_sol_t { void clear_solution(std::vector vehicle_ids) { - raft::common::nvtx::range fun_scope("clear_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("clear_solution"); sol.clear_routes(vehicle_ids); initialize_host_data(); } void populate_host_data(bool copy_all = false, bool skip_route_copy = false) { - raft::common::nvtx::range fun_scope("populate_host_data"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_host_data"); sol.compute_cost(); cuopt_func_call(sol.check_cost_coherence(default_weights)); sol.sol_handle->sync_stream(); diff --git a/cpp/src/routing/crossovers/dispose.hpp b/cpp/src/routing/crossovers/dispose.hpp index 47060b8770..7074d8cad9 100644 --- a/cpp/src/routing/crossovers/dispose.hpp +++ b/cpp/src/routing/crossovers/dispose.hpp @@ -22,7 +22,7 @@ struct dispose { bool recombine(Solution& sol) { - raft::common::nvtx::range fun_scope("dispose"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("dispose"); if (sol.sol.get_n_routes() <= sol.sol.problem_ptr->data_view_ptr->get_min_vehicles()) { return false; } diff --git a/cpp/src/routing/crossovers/eax_recombiner.hpp b/cpp/src/routing/crossovers/eax_recombiner.hpp index 2bb97a6668..83af2cd6c7 100644 --- a/cpp/src/routing/crossovers/eax_recombiner.hpp +++ b/cpp/src/routing/crossovers/eax_recombiner.hpp @@ -56,7 +56,7 @@ struct a_eax { bool asymmetric = true, bool use_perfect_edges_limit = true) { - raft::common::nvtx::range fun_scope("eax"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("eax"); // THIS IS TEMPORARY UNTIL EMPTY ROUTES ARE FIXED if (check_if_routes_empty(a) || check_if_routes_empty(b)) return false; if (!set_recombination_depot(a, b)) { return false; } diff --git a/cpp/src/routing/crossovers/inversion_recombiner.hpp b/cpp/src/routing/crossovers/inversion_recombiner.hpp index 4092782b53..9b2b435d63 100644 --- a/cpp/src/routing/crossovers/inversion_recombiner.hpp +++ b/cpp/src/routing/crossovers/inversion_recombiner.hpp @@ -53,7 +53,7 @@ struct inversion { * } */ bool recombine(Solution& a, const Solution& b) { - raft::common::nvtx::range fun_scope("inversion"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("inversion"); // THIS IS TEMPORARY UNTIL EMPTY ROUTES ARE FIXED if (check_if_routes_empty(a) || check_if_routes_empty(b)) return false; bool relative = next_random() % 2; diff --git a/cpp/src/routing/crossovers/optimal_eax_cycles.cu b/cpp/src/routing/crossovers/optimal_eax_cycles.cu index 1aa8861062..61e067f423 100644 --- a/cpp/src/routing/crossovers/optimal_eax_cycles.cu +++ b/cpp/src/routing/crossovers/optimal_eax_cycles.cu @@ -143,7 +143,7 @@ template void optimal_cycles_t::get_min_delta_and_index( adapted_sol_t& sol, i_t num_items) { - raft::common::nvtx::range fun_scope("get_min_delta_and_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_min_delta_and_index"); // Determine temporary device storage requirements size_t temp_storage_bytes = 0; cub::DeviceReduce::ArgMin(static_cast(nullptr), @@ -169,7 +169,7 @@ template bool optimal_cycles_t::insert_cycle_to_found_position( adapted_sol_t& sol, i_t n_rotations) { - raft::common::nvtx::range fun_scope("insert_cycle_to_found_position"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_cycle_to_found_position"); auto& solution = sol.sol; size_t sh_size = solution.check_routes_can_insert_and_get_sh_size(n_rotations); constexpr i_t TPB = 128; @@ -194,7 +194,7 @@ bool optimal_cycles_t::add_cycles_request( std::vector>>& cycles, costs final_weight) { - raft::common::nvtx::range fun_scope("add_cycles_request_vrp"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_cycles_request_vrp"); auto [resource, index] = pool_allocator.resource_pool->acquire(); auto gpu_weight = get_cuopt_cost(final_weight); resource.ls.set_active_weights(gpu_weight, std::numeric_limits::max()); @@ -252,7 +252,7 @@ template void optimal_cycles_t::find_best_rotate_cycle( std::vector>& cycle, adapted_sol_t& s) { - raft::common::nvtx::range fun_scope("find_best_rotate_cycle"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_best_rotate_cycle"); cuopt_assert(REQUEST == request_t::PDP, "A runtime error occurred in find_best_rotate_cycle!"); cuopt_expects(REQUEST == request_t::PDP, error_type_t::RuntimeError, "A runtime error occurred!"); cycle_helper.resize(cycle.size(), NodeInfo<>()); @@ -306,7 +306,7 @@ template void optimal_cycles_t::insert_cycle_to_route_request( std::vector>& cycle, size_t route_id, adapted_sol_t& s) { - raft::common::nvtx::range fun_scope("insert_cycle_to_route_PDP"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_cycle_to_route_PDP"); cuopt_assert(REQUEST == request_t::PDP, "A runtime error occurred in insert_cycle_to_route_request!"); cuopt_expects(REQUEST == request_t::PDP, error_type_t::RuntimeError, "A runtime error occurred!"); diff --git a/cpp/src/routing/crossovers/ox_recombiner.cuh b/cpp/src/routing/crossovers/ox_recombiner.cuh index 7da8ba5f58..0dddea576d 100644 --- a/cpp/src/routing/crossovers/ox_recombiner.cuh +++ b/cpp/src/routing/crossovers/ox_recombiner.cuh @@ -180,7 +180,7 @@ struct OX { /// count violation, size/memory guards) — A is then left unchanged. bool recombine(Solution& A, Solution& B) { - raft::common::nvtx::range fun_scope("ox"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("ox"); if (check_if_routes_empty(A) || check_if_routes_empty(B)) return false; @@ -349,8 +349,7 @@ struct OX { std::vector>> tmp_routes; std::unordered_set routes_to_remove; std::unordered_set vehicle_ids_to_remove; - const auto& dimensions_info = A.problem->dimensions_info; - int i = routes_number; + int i = routes_number; if (optimal_routes_search) { i = optimal_routes_number; } int end_index = offspring.size() - 1; [[maybe_unused]] double cost_n, cost_p, total_delta = 0.; @@ -420,9 +419,6 @@ struct OX { A.remove_routes(std::vector(routes_to_remove.begin(), routes_to_remove.end())); std::vector> tmp_node_info; - auto vehicle_ids_to_remove_vec = - std::vector(vehicle_ids_to_remove.begin(), vehicle_ids_to_remove.end()); - for (auto const& [bucket, tmp_route] : tmp_routes) { for (auto const& node : tmp_route) { tmp_node_info.push_back(A.problem->get_node_info_of_node(node)); @@ -556,8 +552,8 @@ struct OX { auto edge = tmp_transpose.indices[transpose_offset + x]; auto veh = tmp_transpose.buckets[transpose_offset + x]; if (edge == ref_edge && veh == ref_veh) { - found = true; - auto weight = tmp_transpose.weights[transpose_offset + x]; + found = true; + [[maybe_unused]] auto weight = tmp_transpose.weights[transpose_offset + x]; cuopt_assert(std::abs(ref_weight - weight) < 0.01, "Mismatch weights"); } } @@ -570,7 +566,7 @@ struct OX { template void sort_graph_edges(Solution const& A, ox_graph_t& graph) { - raft::common::nvtx::range fun_scope("ox_sort_graph"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("ox_sort_graph"); auto stream_view = A.sol.sol_handle->get_stream(); auto policy = A.sol.sol_handle->get_thrust_policy(); @@ -620,7 +616,7 @@ struct OX { void compute_transpose_graph(Solution const& A) { - raft::common::nvtx::range fun_scope("transpose_graph"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("transpose_graph"); constexpr auto const TPB = 128; auto const n_blocks = n_buckets * d_graph.get_num_vertices(); @@ -636,7 +632,7 @@ struct OX { //! } void bellman_ford(Solution& A) { - raft::common::nvtx::range fun_scope("bellman_ford"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("bellman_ford"); compute_transpose_graph(A); cuopt_func_call(test_transpose_graph(A.sol.sol_handle->get_stream())); @@ -645,7 +641,6 @@ struct OX { d_path_cost.resize((problem_size + 1) * row_size, A.sol.sol_handle->get_stream()); d_predecessor.resize((problem_size + 1) * row_size, A.sol.sol_handle->get_stream()); d_predecessor_vehicle.resize((problem_size + 1) * row_size, A.sol.sol_handle->get_stream()); - auto max_val = std::numeric_limits::max(); async_fill(d_path_cost, std::numeric_limits::max(), A.sol.sol_handle->get_stream()); async_fill(d_predecessor, -1, A.sol.sol_handle->get_stream()); async_fill(d_predecessor_vehicle, -1, A.sol.sol_handle->get_stream()); @@ -658,8 +653,6 @@ struct OX { constexpr auto const TPB = 128; auto min_cost_of_last_column = std::numeric_limits::max(); auto cost_of_last_column = std::numeric_limits::max(); - const auto& dimensions_info = A.problem->dimensions_info; - cuopt::device_copy( d_vehicle_availability, vehicle_availability, A.sol.sol_handle->get_stream()); @@ -941,8 +934,8 @@ struct OX { for (size_t i = 0; i < graph.size(); ++i) { cuopt_assert(graph[i].size() == h_graph[i].size(), "Mismatch number of edges"); for (size_t j = 0; j < graph[i].size(); ++j) { - auto [ref_edge, ref_weight, ref_veh] = graph[i][j]; - auto [edge, weight, veh] = h_graph[i][j]; + [[maybe_unused]] auto [ref_edge, ref_weight, ref_veh] = graph[i][j]; + [[maybe_unused]] auto [edge, weight, veh] = h_graph[i][j]; cuopt_assert(ref_edge == edge, "Edge mismatch"); cuopt_assert(std::abs(ref_weight - weight) < 0.01, "Weight mismatch"); cuopt_assert(ref_veh == veh, "Vehicle type mismatch"); @@ -954,7 +947,7 @@ struct OX { //! depots. } void calculate_edge_costs(Solution& A) { - raft::common::nvtx::range fun_scope("calculate_edge_costs"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("calculate_edge_costs"); d_graph.reset(A.sol.sol_handle); diff --git a/cpp/src/routing/crossovers/srex_recombiner.hpp b/cpp/src/routing/crossovers/srex_recombiner.hpp index ffdc09130d..90f8ed7a7d 100644 --- a/cpp/src/routing/crossovers/srex_recombiner.hpp +++ b/cpp/src/routing/crossovers/srex_recombiner.hpp @@ -42,7 +42,7 @@ struct srex { * } */ bool recombine(Solution& a, Solution& b, bool& ret) { - raft::common::nvtx::range fun_scope("srex"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("srex"); // different routes from a & b > 1. Set min routes if (a.routes.size() <= 1 || b.routes.size() <= 1) return false; if (check_if_routes_empty(a) || check_if_routes_empty(b)) return false; @@ -68,7 +68,6 @@ struct srex { ret = (s.from_a.size() > s.from_b.size()) ? false : true; auto& guiding = (ret == false) ? a : b; - auto& other = (ret == true) ? a : b; auto& guiding_ids = (ret == false) ? s.from_a : s.from_b; auto& other_ids = (ret == true) ? s.from_a : s.from_b; diff --git a/cpp/src/routing/diversity/diverse_solver.hpp b/cpp/src/routing/diversity/diverse_solver.hpp index 67bf300084..2c0297d835 100644 --- a/cpp/src/routing/diversity/diverse_solver.hpp +++ b/cpp/src/routing/diversity/diverse_solver.hpp @@ -250,7 +250,7 @@ struct solve { improvement_timer(timer_), perturbation_count(0) { - raft::common::nvtx::range fun_scope("solve ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("solve ctr"); std::uniform_int_distribution uniform(0, UINT64_MAX); s_xoshiro[0] = uniform(rng); @@ -676,7 +676,7 @@ struct solve { const std::string& path = "./", bool from_dir = false) { - raft::common::nvtx::range fun_scope("perform_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_search"); feasible_only = feasible_only_; target_vehicles_ = routes_number; @@ -713,7 +713,7 @@ struct solve { * similar to all other) refill with generated ones } */ void refill_reserve(const std::vector& vehicle_ids, int sols_num = 5) { - raft::common::nvtx::range fun_scope("refill_reserve"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("refill_reserve"); if (timer.check_time_limit()) return; @@ -733,7 +733,7 @@ struct solve { * best initial diversity level. } */ int find_initial_diversity(std::vector& sols, bool avg) { - raft::common::nvtx::range fun_scope("find_initial_diversity"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_initial_diversity"); int threshold_index = 0; double average = 0.0; double max = 0.0; @@ -769,7 +769,7 @@ struct solve { * generations to achieve pool size of at least 3. } */ void generate_initial(int routes_number, int islands_size = -1) { - raft::common::nvtx::range fun_scope("generate_initial"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_initial"); bool first_gen = true; size_t start_index = std::min(3, diversity_levels.size() - 1); auto next_injection = 0; @@ -924,7 +924,7 @@ struct solve { */ void adjust_weights(double best_before_improvement) { - raft::common::nvtx::range fun_scope("adjust_weights"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("adjust_weights"); const auto& best_found = working_population.best(); double cost_of_best_feasible = working_population.is_feasible() @@ -965,7 +965,7 @@ struct solve { int start_threshold_index, bool consider_expensive_recombiners = true) { - raft::common::nvtx::range fun_scope("improve_population"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("improve_population"); if (p.current_size() < 2) return; while (start_threshold_index >= 0) { @@ -1020,14 +1020,13 @@ struct solve { bool consider_expensive_recombiners = true) { // std::cout << "Improve population\n"; - raft::common::nvtx::range fun_scope("improve_population_fixed_threshold"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("improve_population_fixed_threshold"); if (p.current_size() < 2) return; bool improved = true; while (improved) { - int k = max_iterations_without_improvement; - improved = false; - double quality_before = p.best_quality(); + int k = max_iterations_without_improvement; + improved = false; while (k-- > 0) { fflush(f.file_ptr); if (improvement_timer.check_time_limit()) return; @@ -1096,7 +1095,7 @@ struct solve { bool& guiding, bool consider_expensive_recombiners = false) { - raft::common::nvtx::range fun_scope("recombine"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine"); guiding = false; bool success = false; @@ -1126,8 +1125,6 @@ struct solve { } std::uniform_int_distribution dist(0, recombine_options.size() - 1); - const auto& dimensions_info = a.problem->dimensions_info; - // Pick a random element from set auto recombiner_it = std::begin(recombine_options); std::advance(recombiner_it, dist(rng)); @@ -1231,9 +1228,6 @@ struct solve { benchmark_print("Empty file!\n"); throw std::invalid_argument("Empty file!"); } - std::string s; - std::stringstream ss(lines[0]); - std::vector>>> inst_data; std::set added_node_ids; // Note that the BKS search is currently supported only for homogenous case, @@ -1306,7 +1300,7 @@ struct solve { try { solution sol = load_solution(entry.path(), routes_number); solutions.emplace_back(std::move(sol)); - } catch (const std::invalid_argument& e) { + } catch (const std::invalid_argument&) { printf("skipping file\n"); continue; } @@ -1320,7 +1314,7 @@ struct solve { try { solution sol = load_solution(entry.path(), routes_number); solutions.emplace_back(std::move(sol)); - } catch (const std::invalid_argument& e) { + } catch (const std::invalid_argument&) { printf("error loading BKS file\n"); continue; } diff --git a/cpp/src/routing/diversity/population.hpp b/cpp/src/routing/diversity/population.hpp index af52c2cb7c..f1b5ccc76a 100644 --- a/cpp/src/routing/diversity/population.hpp +++ b/cpp/src/routing/diversity/population.hpp @@ -56,7 +56,7 @@ struct population { allocator& pool_allocator) : max_solutions(max_solutions_), weights(weights_), problem_ptr(P_) { - raft::common::nvtx::range fun_scope("population ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("population ctr"); solutions.reserve(max_solutions_); for (size_t i = 0; i < max_solutions_; ++i) { bool occupied = false; @@ -83,7 +83,7 @@ struct population { std::vector get_n_best(int number) { - raft::common::nvtx::range fun_scope("get_n_best"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_n_best"); number = std::min(number, indices.size() - 1); size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); @@ -104,7 +104,7 @@ struct population { * return all availible solutions. } */ std::vector get_n_random(int number, bool tournament = false, int ignore_first_n = 0) { - raft::common::nvtx::range fun_scope("get_n_random"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_n_random"); number = std::min(number, indices.size() - 1 - ignore_first_n); size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); @@ -180,7 +180,7 @@ struct population { /*! \brief { Get random solution. } */ solution get_random_solution(bool tournament) { - raft::common::nvtx::range fun_scope("get_random_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_random_solution"); // Assert size > 1 size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); size_t i = add + next_random() % (indices.size() - 1); @@ -194,7 +194,7 @@ struct population { /*! \brief { Get random solution with strong tournament selection. } */ solution get_random_solution_tournament() const { - raft::common::nvtx::range fun_scope("get_random_solution_tournament"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_random_solution_tournament"); // Assert size > 1 size_t i1 = 1 + next_random() % (indices.size() - 1); for (int i = 0; i < 14; i++) { @@ -206,7 +206,7 @@ struct population { /*! \brief { Get two random solutions. } */ void get_two_random(std::pair& random_pair, bool tournament) { - raft::common::nvtx::range fun_scope("get_two_random"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_two_random"); // Assert size > 2 size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); size_t i = add + next_random() % (indices.size() - 1); @@ -241,7 +241,7 @@ struct population { */ int add_solution(int elapsed_time, solution& sol) { - raft::common::nvtx::range fun_scope("add_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_solution"); double sol_cost = sol.get_cost(weights); cuopt_func_call(sol.sol.check_cost_coherence(detail::default_weights)); @@ -311,7 +311,7 @@ struct population { */ void change_weights(costs& weights_) { - raft::common::nvtx::range fun_scope("change_weights"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("change_weights"); weights = weights_; if (indices.size() == 1) return; using pr = std::pair; @@ -330,7 +330,7 @@ struct population { * found we return max_solutions. }*/ size_t best_similar_index(const solution& sol) { - raft::common::nvtx::range fun_scope("best_similar_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("best_similar_index"); if (indices.size() == 1) return max_solutions; for (size_t i = 1; i < indices.size(); i++) { if (sol.calculate_similarity_radius(solutions[indices[i].first].second) > threshold) { @@ -347,7 +347,7 @@ struct population { */ int insert_index(std::pair to_insert) { - raft::common::nvtx::range fun_scope("insert_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_index"); // Assert free index is availible indices.emplace_back(0, 0.0); size_t start = indices.size() - 1; @@ -365,7 +365,7 @@ struct population { */ void eradicate_similar(size_t start_index, solution& sol) { - raft::common::nvtx::range fun_scope("eradicate_similar"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("eradicate_similar"); for (size_t i = start_index; i < indices.size(); i++) { if (sol.calculate_similarity_radius(solutions[indices[i].first].second) > threshold) { solutions[indices[i].first].first = false; // mark place as availible @@ -387,7 +387,7 @@ struct population { */ size_t find_free_solution_index() { - raft::common::nvtx::range fun_scope("find_free_solution_index"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_free_solution_index"); // ASSERT such index exists for (size_t i = 1; i < solutions.size(); i++) if (solutions[i].first == false) return i; diff --git a/cpp/src/routing/ges/eject_until_feasible.cu b/cpp/src/routing/ges/eject_until_feasible.cu index b5cc4dbd93..f10c58628c 100644 --- a/cpp/src/routing/ges/eject_until_feasible.cu +++ b/cpp/src/routing/ges/eject_until_feasible.cu @@ -357,7 +357,7 @@ __global__ void populate_ep_with_selected_unserved_kernel( template void solution_t::eject_until_feasible(bool add_slack_to_sol) { - raft::common::nvtx::range fun_scope("eject_until_feasible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("eject_until_feasible"); auto stream = sol_handle->get_stream(); const i_t TPB = 32; compute_max_active(); @@ -376,7 +376,7 @@ template void solution_t::populate_ep_with_unserved( ejection_pool_t>& EP) { - raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); auto stream = sol_handle->get_stream(); rmm::device_scalar ep_index_out(EP.index_, stream); const i_t TPB = 256; @@ -395,7 +395,7 @@ template void solution_t::populate_ep_with_selected_unserved( ejection_pool_t>& EP, const std::vector& unserviced) { - raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); auto stream = sol_handle->get_stream(); rmm::device_scalar ep_index_out(EP.index_, stream); constexpr auto const TPB = 256; diff --git a/cpp/src/routing/ges/execute_insertion.cu b/cpp/src/routing/ges/execute_insertion.cu index 8dace9832d..1d10e6ef66 100644 --- a/cpp/src/routing/ges/execute_insertion.cu +++ b/cpp/src/routing/ges/execute_insertion.cu @@ -238,7 +238,7 @@ template bool guided_ejection_search_t::execute_best_insertion_ejection_solution( request_info_t* d_request, i_t& counter) { - raft::common::nvtx::range fun_scope("execute_best_insertion_ejection_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("execute_best_insertion_ejection_solution"); counter++; constexpr uint64_t unset_val = static_cast(-1); @@ -353,7 +353,7 @@ template bool guided_ejection_search_t::perform_insertion( const request_info_t* request) { - raft::common::nvtx::range fun_scope("perform_insertion"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_insertion"); // Picks a random one and execute the move const found_sol_t selected_candidate = select_random_initialized(feasible_candidates_data_, solution_ptr); @@ -375,7 +375,7 @@ template i_t guided_ejection_search_t::find_single_insertion( const request_info_t* request) { - raft::common::nvtx::range fun_scope("find_single_insertion"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_single_insertion"); constexpr i_t threads_per_block = 64; i_t grid_size = solution_ptr->get_n_routes(); cuopt_assert(grid_size > 0, "Number of route in solution should be positive."); @@ -419,7 +419,7 @@ template bool guided_ejection_search_t::try_single_insert_with_perturbation( const request_info_t* request) { - raft::common::nvtx::range fun_scope("try_single_insert_with_perturbation"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("try_single_insert_with_perturbation"); i_t const_1, const_2; const_1 = 1; const_2 = 8; diff --git a/cpp/src/routing/ges/execute_insertion.cuh b/cpp/src/routing/ges/execute_insertion.cuh index fbeec209c8..e67896d9fd 100644 --- a/cpp/src/routing/ges/execute_insertion.cuh +++ b/cpp/src/routing/ges/execute_insertion.cuh @@ -35,7 +35,6 @@ DI void execute_insert(typename solution_t::view_t& view, request_id_t const& request_location, const request_info_t* request_id) { - const auto& dimensions_info = view.problem.dimensions_info; cuopt_assert(__popc(__activemask() == 1), "execute_insert should be called by a single thread"); auto request_node = view.get_request(request_id); diff --git a/cpp/src/routing/ges/guided_ejection_search.cu b/cpp/src/routing/ges/guided_ejection_search.cu index bc127d2462..66f67cc03f 100644 --- a/cpp/src/routing/ges/guided_ejection_search.cu +++ b/cpp/src/routing/ges/guided_ejection_search.cu @@ -78,7 +78,7 @@ guided_ejection_search_t::guided_ejection_search_t( intermediate_file(file), dump_intermediate(false) { - raft::common::nvtx::range fun_scope("guided_ejection_search_t"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("guided_ejection_search_t"); reset_p_scores(); } @@ -189,7 +189,7 @@ __global__ void incr_p_scores(const request_info_t* request_id, template void guided_ejection_search_t::shuffle_pool() { - raft::common::nvtx::range fun_scope("shuffle_pool"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("shuffle_pool"); // include the ejected request in shuffle ++EP.index_; EP.random_shuffle(solution_ptr->problem_ptr->seed_gen.get_seed()); @@ -202,7 +202,7 @@ bool guided_ejection_search_t::guided_ejection_search_loop(i_ bool minimize_routes, i_t desired_ep_size) { - raft::common::nvtx::range fun_scope("guided_ejection_search_loop"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("guided_ejection_search_loop"); i_t iteration_limit = 500000; i_t ges_loop_iterations = 0; i_t consecutive_ejection_failure = 1; @@ -322,7 +322,7 @@ bool guided_ejection_search_t::guided_ejection_search_loop(i_ template bool guided_ejection_search_t::greedy_insert(bool insert_all) { - raft::common::nvtx::range fun_scope("greedy_insert"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("greedy_insert"); i_t const n_max_multiple_insertions = std::max( 2 * solution_ptr->get_n_routes(), (i_t)(solution_ptr->get_num_requests() * insertion_rate)); @@ -347,7 +347,7 @@ bool guided_ejection_search_t::greedy_insert(bool insert_all) template void guided_ejection_search_t::init_ejection_pool() { - raft::common::nvtx::range fun_scope("init_ejection_pool"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("init_ejection_pool"); solution_ptr->populate_ep_with_unserved(EP); } @@ -357,7 +357,7 @@ void guided_ejection_search_t::init_ejection_pool() template bool guided_ejection_search_t::fixed_route_loop() { - raft::common::nvtx::range fun_scope("fixed_route_loop"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("fixed_route_loop"); i_t counter = 0; bool all_inserted = greedy_insert(); @@ -483,7 +483,7 @@ bool guided_ejection_search_t::construct_feasible_solution() template void guided_ejection_search_t::route_minimizer_loop() { - raft::common::nvtx::range fun_scope("route_minimizer_loop"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("route_minimizer_loop"); // If ejection pool is not empty first run fixed route loop with if (!EP.empty()) { diff --git a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu index d3d621dfbe..093f9cdc25 100644 --- a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu +++ b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu @@ -578,8 +578,8 @@ __global__ void execute_lexico_move( cuopt_assert(request_id != nullptr, "Request id should not be nullptr"); cuopt_assert(request_id->is_valid(solution.problem.order_info.depot_included), "Request id should be positive"); - p_val_seq_t p_val_seq = bit_cast(*global_min_p); - i_t original_block_idx = global_sequence[0]; + [[maybe_unused]] p_val_seq_t p_val_seq = bit_cast(*global_min_p); + i_t original_block_idx = global_sequence[0]; i_t route_id, pickup_insert_idx; get_route_id_and_insertion_idx( route_id, pickup_insert_idx, original_block_idx, solution); diff --git a/cpp/src/routing/ges/squeeze.cu b/cpp/src/routing/ges/squeeze.cu index c60481b7ee..650a6409c4 100644 --- a/cpp/src/routing/ges/squeeze.cu +++ b/cpp/src/routing/ges/squeeze.cu @@ -150,7 +150,7 @@ template i_t guided_ejection_search_t::try_multiple_feasible_insertions( i_t n_insertions, const bool enable_perturbation) { - raft::common::nvtx::range fun_scope("try_multiple_insert"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("try_multiple_insert"); if (enable_perturbation) { i_t const_1, const_2; @@ -186,7 +186,7 @@ i_t guided_ejection_search_t::try_multiple_feasible_insertion template void guided_ejection_search_t::squeeze_all_ep() { - raft::common::nvtx::range fun_scope("squeeze_all_ep"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze_all_ep"); constexpr auto const squeeze_size = 100; constexpr auto const include_objective = false; @@ -230,7 +230,7 @@ void guided_ejection_search_t::squeeze_all_ep() template bool guided_ejection_search_t::squeeze_all_and_save() { - raft::common::nvtx::range fun_scope("squeeze_all_and_save"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze_all_and_save"); // copy current solution state squeeze_save_state.copy_device_solution(*solution_ptr); auto save_ep_size = EP.size(); @@ -284,7 +284,7 @@ template void guided_ejection_search_t::squeeze( const request_info_t* request, bool random_route) { - raft::common::nvtx::range fun_scope("squeeze"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze"); auto stream = solution_ptr->sol_handle->get_stream(); const i_t n_blocks = solution_ptr->n_routes; size_t sh_size = solution_ptr->check_routes_can_insert_and_get_sh_size() + sizeof(cand_t); @@ -330,7 +330,7 @@ template bool guided_ejection_search_t::try_squeeze_feasible( const request_info_t* request, bool random_route) { - raft::common::nvtx::range fun_scope("try_squeeze"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("try_squeeze"); // copy current solution state squeeze_save_state.copy_device_solution(*solution_ptr); squeeze(request, random_route); @@ -365,7 +365,7 @@ bool guided_ejection_search_t::try_squeeze_feasible( template void guided_ejection_search_t::squeeze_breaks() { - raft::common::nvtx::range fun_scope("squeeze_breaks"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze_breaks"); solution_ptr->global_runtime_checks(false, false, "squeeze_breaks_begin"); auto stream = solution_ptr->sol_handle->get_stream(); size_t n_break_dims = solution_ptr->problem_ptr->get_max_break_dimensions(); @@ -390,7 +390,7 @@ void guided_ejection_search_t::squeeze_breaks() template bool guided_ejection_search_t::try_squeeze_breaks_feasible() { - raft::common::nvtx::range fun_scope("try_squeeze_breaks_feasible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("try_squeeze_breaks_feasible"); size_t n_break_dims = solution_ptr->problem_ptr->get_max_break_dimensions(); if (n_break_dims == 0) { return solution_ptr->is_feasible(); } diff --git a/cpp/src/routing/ges/squeeze.cuh b/cpp/src/routing/ges/squeeze.cuh index 64fc8ea264..38540f8ad4 100644 --- a/cpp/src/routing/ges/squeeze.cuh +++ b/cpp/src/routing/ges/squeeze.cuh @@ -28,10 +28,9 @@ __device__ void find_squeeze_pos(typename solution_t::view_t& { __shared__ double reduction_buf[2 * raft::WarpSize]; __shared__ i_t reduction_idx; - const auto& dimensions_info = solution.problem.dimensions_info; - auto request_node = solution.get_request(request); - auto gl_route = solution.routes[route_id]; - auto sh_route = route_t::view_t::create_shared_route( + auto request_node = solution.get_request(request); + auto gl_route = solution.routes[route_id]; + auto sh_route = route_t::view_t::create_shared_route( shmem, gl_route, gl_route.get_num_nodes()); __syncthreads(); sh_route.copy_from(gl_route); diff --git a/cpp/src/routing/local_search/compute_compatible.cu b/cpp/src/routing/local_search/compute_compatible.cu index 4953c683e4..e6ef560f0d 100644 --- a/cpp/src/routing/local_search/compute_compatible.cu +++ b/cpp/src/routing/local_search/compute_compatible.cu @@ -438,7 +438,7 @@ template void local_search_t::calculate_route_compatibility( solution_t& sol) { - raft::common::nvtx::range fun_scope("calculate_route_compatibility"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("calculate_route_compatibility"); // note that this was allocated for the max size // reset all even though we are not using the full array. thrust::fill(sol.sol_handle->get_thrust_policy(), @@ -460,7 +460,7 @@ template void problem_t::sort_viable_matrix(rmm::device_uvector& viable_from_matrix, rmm::device_uvector& viable_to_matrix) { - raft::common::nvtx::range fun_scope("sort_viable_matrix"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_viable_matrix"); rmm::device_uvector segments(get_num_orders() * get_num_requests(), handle_ptr->get_stream()); const i_t l_n_requests = get_num_requests(); @@ -569,7 +569,7 @@ void problem_t::sort_viable_matrix(rmm::device_uvector& viable_fr template void initialize_incompatible(problem_t& problem, solution_t* sol_ptr) { - raft::common::nvtx::range fun_scope("initialize_incompatible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("initialize_incompatible"); typename solution_t::view_t sol_view; bool is_problem_run = true; raft::handle_t const* handle_ptr = problem.handle_ptr; diff --git a/cpp/src/routing/local_search/compute_insertions.cu b/cpp/src/routing/local_search/compute_insertions.cu index 87ed71fde1..240196d09b 100644 --- a/cpp/src/routing/local_search/compute_insertions.cu +++ b/cpp/src/routing/local_search/compute_insertions.cu @@ -385,8 +385,6 @@ __device__ i_t find_request_insertion(typename solution_t::vi auto other_route_id = solution.route_node_map.get_route_id(node_id); cuopt_assert(other_route_id >= 0 || insert_unserviced, "Other route id cannot be -1, it must have been filtered!"); - const auto& dimensions_info = solution.problem.dimensions_info; - auto request_node = other_route_id >= 0 ? solution.routes[other_route_id].get_request_node(solution.route_node_map, request_id) @@ -810,7 +808,7 @@ void find_insertions(solution_t& sol, if (search_type == search_type_t::RANDOM) { name = "random_find_insertions"; } constexpr bool insert_unserviced = false; - raft::common::nvtx::range fun_scope(name); + [[maybe_unused]] raft::common::nvtx::range fun_scope(name); i_t TPB = get_n_viable(); // the formula is obtained with a linear regression across different instances move_candidates.number_of_blocks_per_ls_route = @@ -873,7 +871,7 @@ void find_unserviced_insertions(solution_t& sol, constexpr bool insert_unserviced = true; auto name = "find_unserviced_insertions"; - raft::common::nvtx::range fun_scope(name); + [[maybe_unused]] raft::common::nvtx::range fun_scope(name); constexpr auto const TPB = get_n_viable(); // the formula is obtained with a linear regression across different instances move_candidates.number_of_blocks_per_ls_route = diff --git a/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu b/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu index d8d2d0f3c0..f6a8773668 100644 --- a/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu +++ b/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu @@ -25,7 +25,7 @@ namespace detail { template bool ExactCycleFinder::call_init(graph_t& graph) { - raft::common::nvtx::range fun_scope("call_init"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("call_init"); auto n_vertices = graph.get_num_vertices(); auto n_threads = 128; auto n_blocks = n_vertices; @@ -48,7 +48,7 @@ bool ExactCycleFinder::call_init(graph_t& graph) template void ExactCycleFinder::sort_cycle_costs_by_key(int n_items) { - raft::common::nvtx::range fun_scope("sort_cycle_costs_by_key"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_cycle_costs_by_key"); // sort cycle candidates by weight // resize only once if the problem size don't change if (sorted_key_indices.size() < (size_t)n_items) { @@ -104,7 +104,7 @@ void ExactCycleFinder::sort_cycle_costs_by_key(int n_items template bool ExactCycleFinder::call_find(graph_t& graph, i_t level) { - raft::common::nvtx::range fun_scope("call_find"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("call_find"); auto n_threads = 128; auto n_blocks = graph.get_num_vertices(); size_t sh_size = @@ -163,7 +163,7 @@ bool test_empty(typename detail::device_map_t, double>::view_t template bool ExactCycleFinder::find_cycle(graph_t& graph) { - raft::common::nvtx::range fun_scope("find_cycle"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_cycle"); d_valid_paths.clear(handle_ptr->get_stream()); cuopt_assert(test_empty(d_valid_paths.subspan(0), handle_ptr->get_stream()), ""); if (!call_init(graph)) { return false; } @@ -181,7 +181,7 @@ template void ExactCycleFinder::get_cycle(graph_t& graph, ret_cycles_t& d_ret) { - raft::common::nvtx::range fun_scope("get_cycle"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_cycle"); auto n_threads = 256; auto n_blocks = std::min((d_valid_paths.max_available + n_threads - 1) / n_threads, max_blocks); @@ -292,7 +292,7 @@ void ExactCycleFinder::sort_occupied(int level, graph_t& graph, int curr_level_occupied) { - raft::common::nvtx::range fun_scope("sort_occupied"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_occupied"); auto curr_map = d_valid_paths.subspan(level); cuopt_assert(check_occupied_head(level, graph), ""); @@ -344,7 +344,7 @@ void ExactCycleFinder::find_best_cycles( ret_cycles_t& ret, const solution_handle_t* sol_handle) { - raft::common::nvtx::range fun_scope("find_best_cycles"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_best_cycles"); handle_ptr = const_cast*>(sol_handle); best_cycles.reset(handle_ptr->get_stream()); cycle_candidates.reset(graph.get_num_vertices(), handle_ptr); diff --git a/cpp/src/routing/local_search/fill_gpu_graph.cu b/cpp/src/routing/local_search/fill_gpu_graph.cu index 036b84fcfa..fb6a0c9873 100644 --- a/cpp/src/routing/local_search/fill_gpu_graph.cu +++ b/cpp/src/routing/local_search/fill_gpu_graph.cu @@ -84,14 +84,11 @@ __global__ void fill_graph_kernel(typename solution_t::view_t template __global__ void fill_intra_candidates(typename solution_t::view_t solution, typename move_candidates_t::view_t move_candidates, - int64_t seed) + [[maybe_unused]] int64_t seed) { __shared__ double shmem[raft::WarpSize * 2]; __shared__ i_t reduction_idx; - i_t route_id = blockIdx.x; - raft::random::PCGenerator thread_rng(seed + (threadIdx.x + blockIdx.x * blockDim.x), - uint64_t(route_id * (threadIdx.x + blockIdx.x * blockDim.x)), - 0); + i_t route_id = blockIdx.x; double thread_best_cost = std::numeric_limits::max(); i_t thread_best_node_id = -1; i_t counter = 1; @@ -153,7 +150,7 @@ __global__ void fill_intra_candidates(typename solution_t::vi template void local_search_t::fill_gpu_graph(solution_t& solution) { - raft::common::nvtx::range fun_scope("fill_gpu_graph"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("fill_gpu_graph"); constexpr i_t TPB = 128; solution.sol_handle->sync_stream(); const auto stream = solution.sol_handle->get_stream(); diff --git a/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu b/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu index f2782704bc..231d112481 100644 --- a/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu +++ b/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu @@ -176,7 +176,7 @@ bool run_vehicle_assignment(solution_t& sol, move_candidates_t& move_candidates, vehicle_assignment_t& vehicle_assignment) { - raft::common::nvtx::range fun_scope("vehicle_assignment_heuristic"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("vehicle_assignment_heuristic"); sol.global_runtime_checks(false, false, "vehicle_assignment_checks_start"); [[maybe_unused]] double cost_before = 0., cost_after = 0.; diff --git a/cpp/src/routing/local_search/local_search.cu b/cpp/src/routing/local_search/local_search.cu index 08f72970b7..75b3a48acf 100644 --- a/cpp/src/routing/local_search/local_search.cu +++ b/cpp/src/routing/local_search/local_search.cu @@ -43,7 +43,7 @@ local_search_t::local_search_t(const solution_handle_tget_stream()), locks_(max_routes, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("local_search_t"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("local_search_t"); } // sets the search weights and excess values for the local search template @@ -57,7 +57,7 @@ void local_search_t::set_active_weights(const infeasible_cost template bool local_search_t::run_two_opt_search(solution_t& sol) { - raft::common::nvtx::range fun_scope("run_two_opt_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_two_opt_search"); bool move_found = perform_two_opt(sol, move_candidates); sol.sol_handle->sync_stream(); if (move_found) { @@ -71,7 +71,7 @@ bool local_search_t::run_two_opt_search(solution_t bool local_search_t::run_sliding_search(solution_t& sol) { - raft::common::nvtx::range fun_scope("run_sliding_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_sliding_search"); bool move_found = sol.problem_ptr->is_tsp ? perform_sliding_tsp(sol, move_candidates) : perform_sliding_window(sol, move_candidates); sol.sol_handle->sync_stream(); @@ -86,7 +86,7 @@ bool local_search_t::run_sliding_search(solution_t bool local_search_t::run_collect_prizes(solution_t& sol) { - raft::common::nvtx::range fun_scope("run_collect_prizes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_collect_prizes"); // don't run prize collection if there is no prize dimension if (!sol.problem_ptr->dimensions_info.has_dimension(dim_t::PRIZE)) { return false; } @@ -103,7 +103,7 @@ bool local_search_t::run_collect_prizes(solution_t bool local_search_t::run_cross_search(solution_t& sol) { - raft::common::nvtx::range fun_scope("run_cross_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_cross_search"); if (sol.n_routes < 2) { return false; } // independent thread scheduling is not present in pascal and we use it in populate_cross_list // kernel @@ -138,9 +138,9 @@ bool local_search_t::run_cross_search(solution_t template > bool local_search_t::run_fast_search(solution_t& sol, - bool full_set) + [[maybe_unused]] bool full_set) { - raft::common::nvtx::range fun_scope("run_fast_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fast_search"); std::vector fast_operators{fast_operators_t::SLIDING, fast_operators_t::CROSS}; if (!sol.problem_ptr->fleet_info.is_homogenous_ && !sol.problem_ptr->has_non_uniform_breaks()) { @@ -182,7 +182,7 @@ template > bool local_search_t::run_fast_search(solution_t& sol, bool full_set) { - raft::common::nvtx::range fun_scope("run_fast_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fast_search"); std::vector fast_operators{fast_operators_t::SLIDING}; diff --git a/cpp/src/routing/local_search/move_candidates/move_candidates.cuh b/cpp/src/routing/local_search/move_candidates/move_candidates.cuh index d009209226..f54a785d9d 100644 --- a/cpp/src/routing/local_search/move_candidates/move_candidates.cuh +++ b/cpp/src/routing/local_search/move_candidates/move_candidates.cuh @@ -54,7 +54,7 @@ struct shared_pool_t { std::tuple acquire() { - std::unique_lock lock(mutex); + [[maybe_unused]] std::unique_lock lock(mutex); while (true) { if (indices.size()) { int index = indices.front(); @@ -67,7 +67,7 @@ struct shared_pool_t { void release(int index) { - std::unique_lock lock(mutex); + [[maybe_unused]] std::unique_lock lock(mutex); indices.push(index); cond.notify_one(); } @@ -201,7 +201,6 @@ class cand_matrix_t { { cuopt_assert(sink < matrix_width, "Sink should be smaller than matrix_width!"); cuopt_assert(source < matrix_height, "Source should be smaller than matrix_height!"); - cand_t cand; i_t idx = source * matrix_width + sink; return get_candidate(idx); } @@ -271,7 +270,7 @@ class cand_matrix_t { void reset(solution_handle_t const* sol_handle) { - raft::common::nvtx::range fun_scope("cand_matrix_t reset"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("cand_matrix_t reset"); async_fill(cost_counter, cost_counter_t{.cost = std::numeric_limits::max()}, sol_handle->get_stream()); @@ -356,7 +355,7 @@ class move_candidates_t { inline void reset(solution_handle_t const* sol_handle) { - raft::common::nvtx::range fun_scope("move_candidates reset"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("move_candidates reset"); move_candidate_reset_graph.start_capture(sol_handle->get_stream()); cycles.reset(sol_handle); graph.reset(sol_handle); diff --git a/cpp/src/routing/local_search/perform_moves.cu b/cpp/src/routing/local_search/perform_moves.cu index 4cedba85da..f79a4af378 100644 --- a/cpp/src/routing/local_search/perform_moves.cu +++ b/cpp/src/routing/local_search/perform_moves.cu @@ -411,7 +411,7 @@ template bool local_search_t::populate_cross_moves( solution_t& solution, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("populate_cross_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_cross_moves"); reset_cross_vectors(solution); const i_t TPB = 256; size_t sh_size = solution.n_routes * (sizeof(i_t) + sizeof(cross_cand_t)); @@ -438,7 +438,7 @@ template void local_search_t::populate_move_path( solution_t& solution, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("populate_move_path"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_move_path"); auto n_cycles = move_candidates.cycles.n_cycles_.value(solution.sol_handle->get_stream()); if (n_cycles) { populate_move_path_kernel @@ -454,7 +454,7 @@ template void local_search_t::perform_moves(solution_t& solution, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("perform_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_moves"); solution.global_runtime_checks(false, false, "perform_moves_start"); auto stream = solution.sol_handle->get_stream(); constexpr i_t TPB = 32; diff --git a/cpp/src/routing/local_search/prize_collection.cu b/cpp/src/routing/local_search/prize_collection.cu index a47a28b5a1..ce99ec14bd 100644 --- a/cpp/src/routing/local_search/prize_collection.cu +++ b/cpp/src/routing/local_search/prize_collection.cu @@ -145,7 +145,6 @@ __global__ void execute_moves(typename solution_t::view_t sol insertion_locations.id() = curr_route_cand.pickup_insertion; ejected_request.id() = curr_route_cand.ejected_node_id; insertion_request.id() = curr_route_cand.inserted_node_id; - double cost = curr_route_cand.cost; if constexpr (REQUEST == request_t::PDP) { if (ejected_request.pickup < solution.get_num_orders()) { ejected_request.delivery = solution.problem.order_info.pair_indices[ejected_request.pickup]; diff --git a/cpp/src/routing/local_search/random_cross.cu b/cpp/src/routing/local_search/random_cross.cu index 0769e28c5f..d5caf5ce96 100644 --- a/cpp/src/routing/local_search/random_cross.cu +++ b/cpp/src/routing/local_search/random_cross.cu @@ -268,7 +268,7 @@ i_t sort_random_moves_by_route_pair_idx(solution_t& sol, template void local_search_t::populate_random_moves(solution_t& sol) { - raft::common::nvtx::range fun_scope("populate_random_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_random_moves"); // extract valid moves constexpr i_t nthreads = 256; auto nblocks = sol.get_num_depot_excluded_orders(); diff --git a/cpp/src/routing/local_search/sliding_tsp.cu b/cpp/src/routing/local_search/sliding_tsp.cu index 90f42a1303..1b582e5289 100644 --- a/cpp/src/routing/local_search/sliding_tsp.cu +++ b/cpp/src/routing/local_search/sliding_tsp.cu @@ -140,9 +140,6 @@ __global__ void find_sliding_moves_tsp( } __syncthreads(); - const double excess_limit = - s_route.get_weighted_excess(move_candidates.weights) * ls_excess_multiplier_route; - sliding_tsp_cand_t sliding_tsp_cand = is_sliding_tsp_uinitialized_t::init_data(); double cost_delta, selection_delta; @@ -480,7 +477,7 @@ template bool local_search_t::perform_sliding_tsp( solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("perform_sliding_tsp"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_sliding_tsp"); sol.global_runtime_checks(false, false, "sliding_tsp_start"); i_t n_moves_found = 0; if (!move_candidates.include_objective) { return false; } diff --git a/cpp/src/routing/local_search/sliding_window.cu b/cpp/src/routing/local_search/sliding_window.cu index 7b545a0021..64eefada02 100644 --- a/cpp/src/routing/local_search/sliding_window.cu +++ b/cpp/src/routing/local_search/sliding_window.cu @@ -694,9 +694,8 @@ __global__ void kernel_perform_sliding_window( extern __shared__ i_t shmem[]; // Each block handles a different starting point for the window // +1 to skip depot - const bool depot_included = solution.problem.order_info.depot_included; - const i_t node_idx = blockIdx.x / blocks_per_node; - const auto node_info = move_candidates.nodes_to_search.sampled_nodes_to_search[node_idx]; + const i_t node_idx = blockIdx.x / blocks_per_node; + const auto node_info = move_candidates.nodes_to_search.sampled_nodes_to_search[node_idx]; cuopt_assert(node_info.node() < solution.get_num_orders() + solution.n_routes * after_depot_insertion_multiplier, @@ -1025,7 +1024,7 @@ template bool local_search_t::perform_sliding_window( solution_t& solution, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("run_sliding_window"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_sliding_window"); i_t n_moves_found = 0; size_t shared_for_tmp_route = 0; solution.compute_max_active(); diff --git a/cpp/src/routing/local_search/two_opt.cu b/cpp/src/routing/local_search/two_opt.cu index 764a2da39f..ead58fe5f6 100644 --- a/cpp/src/routing/local_search/two_opt.cu +++ b/cpp/src/routing/local_search/two_opt.cu @@ -364,7 +364,7 @@ template bool local_search_t::perform_two_opt( solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("run_two_opt"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("run_two_opt"); sol.global_runtime_checks(false, false, "two_opt_start"); i_t n_moves_found = 0; if (!move_candidates.include_objective) { return false; } diff --git a/cpp/src/routing/local_search/vrp/nodes_to_search.cu b/cpp/src/routing/local_search/vrp/nodes_to_search.cu index a3969cebe4..2446721076 100644 --- a/cpp/src/routing/local_search/vrp/nodes_to_search.cu +++ b/cpp/src/routing/local_search/vrp/nodes_to_search.cu @@ -74,7 +74,7 @@ i_t get_sample_size_vrp(i_t n_of_changed_nodes) template void nodes_to_search_t::restore_found_nodes(solution_t& sol) { - raft::common::nvtx::range fun_scope("restore_found_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("restore_found_nodes"); constexpr bool restore_phase = true; // here we are doing a reuse of n_nodes_to_search for the extracted nodes // all other valid nodes to search are already in host side @@ -101,7 +101,7 @@ template bool nodes_to_search_t::sample_nodes_for_recycle( const solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("sample_nodes_for_recycle"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("sample_nodes_for_recycle"); raft::copy(h_best_id_per_node.data(), move_candidates.vrp_move_candidates.best_id_per_node.data(), @@ -127,7 +127,7 @@ template bool nodes_to_search_t::sample_nodes_to_search( const solution_t& sol, std::mt19937& rng, bool full_set) { - raft::common::nvtx::range fun_scope("sample_nodes_to_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("sample_nodes_to_search"); i_t curr_n_nodes_to_search = h_nodes_to_search.size(); if (curr_n_nodes_to_search == 0) return false; if (!full_set) { @@ -161,7 +161,7 @@ template void extract_nodes_to_search(solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("extract_nodes_to_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("extract_nodes_to_search"); auto& nodes_to_search = move_candidates.nodes_to_search; nodes_to_search.extract_nodes_graph.start_capture(sol.sol_handle->get_stream()); nodes_to_search.reset(sol.sol_handle); diff --git a/cpp/src/routing/local_search/vrp/vrp_execute.cu b/cpp/src/routing/local_search/vrp/vrp_execute.cu index 2b6c14f5fe..881b913ae0 100644 --- a/cpp/src/routing/local_search/vrp/vrp_execute.cu +++ b/cpp/src/routing/local_search/vrp/vrp_execute.cu @@ -376,7 +376,7 @@ template i_t extract_non_overlapping_moves(solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("extract_non_overlapping_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("extract_non_overlapping_moves"); i_t TPB = 128; i_t n_blocks_for_compact = (sol.n_routes * sol.n_routes + TPB - 1) / TPB; compact_best_route_pair_moves @@ -415,7 +415,7 @@ bool execute_vrp_moves(solution_t& sol, move_candidates_t& move_candidates, i_t n_moves_found) { - raft::common::nvtx::range fun_scope("execute_vrp_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("execute_vrp_moves"); cuopt_func_call(sol.compute_cost()); cuopt_func_call(double cost_before = sol.get_cost(move_candidates.include_objective, move_candidates.weights)); @@ -475,7 +475,7 @@ template bool select_and_execute_vrp_move(solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("select_and_execute_vrp_move"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("select_and_execute_vrp_move"); cuopt_func_call( move_candidates.debug_delta.set_value_to_zero_async(sol.sol_handle->get_stream())); i_t n_moves_found = extract_non_overlapping_moves(sol, move_candidates); diff --git a/cpp/src/routing/local_search/vrp/vrp_search.cu b/cpp/src/routing/local_search/vrp/vrp_search.cu index 56f66a3572..ee9d57afa8 100644 --- a/cpp/src/routing/local_search/vrp/vrp_search.cu +++ b/cpp/src/routing/local_search/vrp/vrp_search.cu @@ -647,7 +647,7 @@ bool find_vrp_moves(solution_t& sol, move_candidates_t& move_candidates, bool recycle = false) { - raft::common::nvtx::range fun_scope("find_vrp_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("find_vrp_moves"); if (sol.n_routes < 2) { return false; } if (sol.problem_ptr->is_cvrp()) { @@ -684,7 +684,7 @@ template bool recycle_unused_moves(solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("recycle_unused_moves"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("recycle_unused_moves"); auto& nodes_to_search = move_candidates.nodes_to_search; constexpr bool recycle = true; bool nodes_remained = nodes_to_search.sample_nodes_for_recycle(sol, move_candidates); @@ -698,7 +698,7 @@ template bool perform_vrp_search(solution_t& sol, move_candidates_t& move_candidates) { - raft::common::nvtx::range fun_scope("perform_vrp_search"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_vrp_search"); cuopt_func_call(sol.check_cost_coherence(move_candidates.weights)); if (!find_vrp_moves(sol, move_candidates)) { return false; } bool move_found = select_and_execute_vrp_move(sol, move_candidates); diff --git a/cpp/src/routing/route/break_route.cuh b/cpp/src/routing/route/break_route.cuh index f6acaa29bf..408a9c1571 100644 --- a/cpp/src/routing/route/break_route.cuh +++ b/cpp/src/routing/route/break_route.cuh @@ -32,7 +32,7 @@ class break_route_t { breaks_forward(0, sol_handle_->get_stream()), breaks_backward(0, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("zero break_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero break_route_t copy_ctr"); } break_route_t(const break_route_t& break_route, solution_handle_t const* sol_handle_) @@ -40,7 +40,7 @@ class break_route_t { breaks_forward(break_route.breaks_forward, sol_handle_->get_stream()), breaks_backward(break_route.breaks_backward, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("break route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("break route copy_ctr"); } break_route_t& operator=(break_route_t&& break_route) = default; diff --git a/cpp/src/routing/route/capacity_route.cuh b/cpp/src/routing/route/capacity_route.cuh index b91acbd30a..ade1c0331c 100644 --- a/cpp/src/routing/route/capacity_route.cuh +++ b/cpp/src/routing/route/capacity_route.cuh @@ -38,7 +38,7 @@ class capacity_route_t { { cuopt_assert(dim_info.n_capacity_dimensions <= default_max_capacity_dim, "Supplied capacity dimension exceeds limit"); - raft::common::nvtx::range fun_scope("zero capacity route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero capacity route copy_ctr"); } capacity_route_t(const capacity_route_t& capacity_route, @@ -49,7 +49,7 @@ class capacity_route_t { max_after(capacity_route.max_after, sol_handle_->get_stream()), dim_info(capacity_route.dim_info) { - raft::common::nvtx::range fun_scope("capacity route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("capacity route copy_ctr"); } capacity_route_t& operator=(capacity_route_t&& capacity_route) = default; diff --git a/cpp/src/routing/route/cost_route.cuh b/cpp/src/routing/route/cost_route.cuh index 23748bdea4..43fa84b047 100644 --- a/cpp/src/routing/route/cost_route.cuh +++ b/cpp/src/routing/route/cost_route.cuh @@ -41,7 +41,7 @@ class cost_route_t { excess_backward(0, sol_handle_->get_stream()), distance_break_cost_forward(0, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("zero cost_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero cost_route_t copy_ctr"); } cost_route_t(const cost_route_t& cost_route, solution_handle_t const* sol_handle_) @@ -59,7 +59,7 @@ class cost_route_t { excess_backward(cost_route.excess_backward, sol_handle_->get_stream()), distance_break_cost_forward(cost_route.distance_break_cost_forward, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("cost route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("cost route copy_ctr"); } cost_route_t& operator=(cost_route_t&& cost_route) = default; diff --git a/cpp/src/routing/route/dimensions_route.cuh b/cpp/src/routing/route/dimensions_route.cuh index 798909306e..f2c567da24 100644 --- a/cpp/src/routing/route/dimensions_route.cuh +++ b/cpp/src/routing/route/dimensions_route.cuh @@ -84,7 +84,7 @@ class dimensions_route_t { requests(sol_handle_), dimensions_info(dimensions_info_) { - raft::common::nvtx::range fun_scope("zero dimensions_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero dimensions_route_t copy_ctr"); } dimensions_route_t(const dimensions_route_t& dim_route) @@ -101,7 +101,7 @@ class dimensions_route_t { requests(dim_route.requests, dim_route.sol_handle), dimensions_info(dim_route.dimensions_info) { - raft::common::nvtx::range fun_scope("dimensions_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("dimensions_route_t copy_ctr"); } dimensions_route_t& operator=(dimensions_route_t&& route) = default; diff --git a/cpp/src/routing/route/pdp_route.cuh b/cpp/src/routing/route/pdp_route.cuh index 449a2e182f..12288f2b3e 100644 --- a/cpp/src/routing/route/pdp_route.cuh +++ b/cpp/src/routing/route/pdp_route.cuh @@ -35,7 +35,7 @@ class request_route_tget_stream()), tsp_requests(sol_handle_) { - raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); } request_route_t(const request_route_t& request_route, @@ -44,7 +44,7 @@ class request_route_tget_stream()), tsp_requests(request_route.tsp_requests, sol_handle_) { - raft::common::nvtx::range fun_scope("pdp route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("pdp route copy_ctr"); } request_route_t& operator=(request_route_t&& request_route) = default; @@ -61,7 +61,7 @@ class request_route_t::size() * route_size * sizeof(NodeInfo); diff --git a/cpp/src/routing/route/prize_route.cuh b/cpp/src/routing/route/prize_route.cuh index c5abf7df8d..95baf58f35 100644 --- a/cpp/src/routing/route/prize_route.cuh +++ b/cpp/src/routing/route/prize_route.cuh @@ -33,7 +33,7 @@ class prize_route_t { prize_forward(0, sol_handle_->get_stream()), prize_backward(0, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("zero prize_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero prize_route_t copy_ctr"); } prize_route_t(const prize_route_t& prize_route, solution_handle_t const* sol_handle_) @@ -42,7 +42,7 @@ class prize_route_t { prize_forward(prize_route.prize_forward, sol_handle_->get_stream()), prize_backward(prize_route.prize_backward, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("prize route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("prize route copy_ctr"); } prize_route_t& operator=(prize_route_t&& prize_route) = default; diff --git a/cpp/src/routing/route/route.cuh b/cpp/src/routing/route/route.cuh index b624acb903..cfe7e0932d 100644 --- a/cpp/src/routing/route/route.cuh +++ b/cpp/src/routing/route/route.cuh @@ -35,7 +35,7 @@ class route_t { n_nodes(sol_handle_->get_stream()), fleet_info_ptr(fleet_info_ptr_) { - raft::common::nvtx::range fun_scope("zero route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero route_t copy_ctr"); infeasible_cost_t zero_inf; objective_cost_t zero_obj; infeasibility_cost.set_value_async(zero_inf, sol_handle->get_stream()); @@ -59,7 +59,7 @@ class route_t { objective_cost(route.objective_cost, route.sol_handle->get_stream()), fleet_info_ptr(route.fleet_info_ptr) { - raft::common::nvtx::range fun_scope("route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("route copy_ctr"); } route_t& operator=(route_t&& route) = default; diff --git a/cpp/src/routing/route/time_route.cuh b/cpp/src/routing/route/time_route.cuh index 92d0884e5f..3b1a32b30d 100644 --- a/cpp/src/routing/route/time_route.cuh +++ b/cpp/src/routing/route/time_route.cuh @@ -43,7 +43,7 @@ class time_route_t { unavoidable_wait_backward(0, sol_handle_->get_stream()), actual_arrival(0, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("zero time_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero time_route_t copy_ctr"); } time_route_t(const time_route_t& time_route, solution_handle_t const* sol_handle_) @@ -62,7 +62,7 @@ class time_route_t { unavoidable_wait_backward(time_route.unavoidable_wait_backward, sol_handle_->get_stream()), actual_arrival(time_route.actual_arrival, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("time route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("time route copy_ctr"); } time_route_t& operator=(time_route_t&& time_route) = default; diff --git a/cpp/src/routing/route/tsp_route.cuh b/cpp/src/routing/route/tsp_route.cuh index 310418e7ea..176d161960 100644 --- a/cpp/src/routing/route/tsp_route.cuh +++ b/cpp/src/routing/route/tsp_route.cuh @@ -29,14 +29,14 @@ class tsp_route_t { tsp_route_t(solution_handle_t const* sol_handle_) : pred(0, sol_handle_->get_stream()), succ(0, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); } tsp_route_t(const tsp_route_t& tsp_route, solution_handle_t const* sol_handle_) : pred(tsp_route.pred, sol_handle_->get_stream()), succ(tsp_route.succ, sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("pdp route copy_ctr"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("pdp route copy_ctr"); } tsp_route_t& operator=(tsp_route_t&& tsp_route) = default; diff --git a/cpp/src/routing/solution/pool_allocator.cuh b/cpp/src/routing/solution/pool_allocator.cuh index cc7f322a99..979f9c1962 100644 --- a/cpp/src/routing/solution/pool_allocator.cuh +++ b/cpp/src/routing/solution/pool_allocator.cuh @@ -33,7 +33,7 @@ class routing_resource_t { problem_->viables), ges(dummy_sol, &ls) // the ls will be dangled as this object will be moved to the shared pool { - raft::common::nvtx::range fun_scope("routing_resource_t"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("routing_resource_t"); } local_search_t ls; @@ -49,7 +49,7 @@ class pool_allocator_t { i_t desired_n_routes = -1) : problem(problem_), stream(stream_) { - raft::common::nvtx::range fun_scope("pool_allocator_t"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("pool_allocator_t"); // FIXME:: This is temporary, we should let the diversity manager decide this std::vector desired_vehicle_ids; if (desired_n_routes > 0) { diff --git a/cpp/src/routing/solution/solution.cu b/cpp/src/routing/solution/solution.cu index db6b7ff4b8..1463f30f10 100644 --- a/cpp/src/routing/solution/solution.cu +++ b/cpp/src/routing/solution/solution.cu @@ -20,7 +20,7 @@ route_t& solution_t::get_route(i_t route_i "route_id should be less than total number of routes"); cuopt_assert(route_id < (i_t)routes.size(), "route_id should be less than total number of routes"); - raft::common::nvtx::range fun_scope("get_route"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_route"); auto idx = route_id_to_idx[route_id]; return routes[idx]; } @@ -31,7 +31,7 @@ const route_t& solution_t::get_route(i_t r { cuopt_assert(route_id < (i_t)route_id_to_idx.size(), "route_id should be less than total number of routes"); - raft::common::nvtx::range fun_scope("get_route_const"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_route_const"); auto idx = route_id_to_idx[route_id]; return routes[idx]; } @@ -75,7 +75,7 @@ void solution_t::add_route(route_t&& route i_t n_nodes, bool check_size) { - raft::common::nvtx::range fun_scope("add_route"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_route"); cuopt_assert(!check_size || (n_nodes > request_info_t::size()), "There should be at least one request in the route!"); cuopt_expects(!check_size || (n_nodes > request_info_t::size()), @@ -107,7 +107,7 @@ template void solution_t::add_routes( const std::vector>>>& new_routes) { - raft::common::nvtx::range fun_scope("add_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_routes"); cuopt_assert(new_routes.size() > 0, "There should be at least one route in the vector!"); thrust::fill(sol_handle->get_thrust_policy(), routes_to_search.data() + n_routes, @@ -162,7 +162,7 @@ template void solution_t::add_nodes_to_route( const std::vector>& nodes_to_insert, i_t route_id, i_t intra_idx) { - raft::common::nvtx::range fun_scope("add_nodes_to_route"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_route"); cuopt_assert(route_id > -1, "Route id should be valid"); const auto n_nodes_to_insert = nodes_to_insert.size(); raft::copy( @@ -185,7 +185,7 @@ template void solution_t::add_nodes_to_best( const std::vector>& nodes_to_insert, const infeasible_cost_t& weights) { - raft::common::nvtx::range fun_scope("add_nodes_to_best"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_best"); i_t TPB = 256; constexpr bool include_objective = true; // TODO check perf and implement parallel insertion @@ -206,7 +206,7 @@ void solution_t::add_nodes_to_best( template bool solution_t::remove_nodes(const std::vector>& nodes_to_eject) { - raft::common::nvtx::range fun_scope("remove_nodes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_nodes"); const auto n_nodes_to_eject = nodes_to_eject.size(); rmm::device_scalar empty_route_produced(sol_handle->get_stream()); raft::copy(temp_nodes.data(), nodes_to_eject.data(), n_nodes_to_eject, sol_handle->get_stream()); @@ -225,7 +225,7 @@ bool solution_t::remove_nodes(const std::vector>& template void solution_t::clear_routes(std::vector vehicle_ids) { - raft::common::nvtx::range fun_scope("clear_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("clear_routes"); i_t given_n_routes; if (vehicle_ids.empty()) { given_n_routes = problem_ptr->get_fleet_size(); @@ -293,7 +293,7 @@ void solution_t::set_routes_to_search() template void solution_t::set_route_views(i_t start, i_t end) { - raft::common::nvtx::range fun_scope("set_route_views"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("set_route_views"); if (routes.size() > routes_view.size()) { // reserve with the max size routes_view.resize(routes.size(), sol_handle->get_stream()); @@ -323,7 +323,7 @@ void solution_t::set_route_views(i_t start, i_t end) template void solution_t::random_init_routes() { - raft::common::nvtx::range fun_scope("random_init_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("random_init_routes"); auto stream = sol_handle->get_stream(); stream.sync(); const i_t one = 1; @@ -351,7 +351,7 @@ void solution_t::random_init_routes() template void solution_t::compute_initial_data(bool check_feasibility) { - raft::common::nvtx::range fun_scope("compute_initial_data"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_initial_data"); compute_backward_forward(); compute_cost(); eject_until_feasible(); @@ -374,7 +374,7 @@ size_t solution_t::get_temp_route_shared_size(i_t added_size) template i_t solution_t::get_max_active_nodes_for_all_routes() const { - raft::common::nvtx::range fun_scope("get_max_active_nodes_for_all_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_max_active_nodes_for_all_routes"); return max_active_nodes; } @@ -382,7 +382,7 @@ i_t solution_t::get_max_active_nodes_for_all_routes() const template size_t solution_t::check_routes_can_insert_and_get_sh_size(i_t added_nodes) { - raft::common::nvtx::range fun_scope("check_routes_can_insert_and_get_sh_size"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_routes_can_insert_and_get_sh_size"); compute_max_active(); resize_routes(raft::alignTo(max_active_nodes + added_nodes, base_route_size)); return get_temp_route_shared_size(added_nodes); @@ -391,7 +391,7 @@ size_t solution_t::check_routes_can_insert_and_get_sh_size(i_ template void solution_t::resize_routes(i_t new_size) { - raft::common::nvtx::range fun_scope("resize_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_routes"); bool any_resized = false; for (i_t i = 0; i < n_routes; ++i) { @@ -463,7 +463,7 @@ template double solution_t::get_cost(const bool include_objective, const infeasible_cost_t weights) const { - raft::common::nvtx::range fun_scope("get_cost"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_cost"); double total_cost = infeasible_cost_t::dot(weights, infeasibility_cost.value(sol_handle->get_stream())); @@ -498,7 +498,7 @@ infeasible_cost_t solution_t::get_infeasibility_cost() const template bool solution_t::is_feasible() const { - raft::common::nvtx::range fun_scope("is_feasible"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("is_feasible"); auto n_cost = infeasibility_cost.value(sol_handle->get_stream()); bool is_feasible = true; for (size_t dim = 0; dim < (size_t)dim_t::SIZE; ++dim) { @@ -511,7 +511,7 @@ bool solution_t::is_feasible() const template f_t solution_t::get_total_excess(const infeasible_cost_t weights) const { - raft::common::nvtx::range fun_scope("get_total_excess"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("get_total_excess"); auto n_cost = infeasibility_cost.value(sol_handle->get_stream()); return infeasible_cost_t::dot(n_cost, weights); } @@ -527,7 +527,7 @@ void solution_t::print() const template void solution_t::copy_device_solution(solution_t& src_sol) { - raft::common::nvtx::range fun_scope("copy_device_solution"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("copy_device_solution"); sol_handle->sync_stream(); src_sol.sol_handle->sync_stream(); @@ -577,7 +577,7 @@ void solution_t::copy_device_solution(solution_t void solution_t::compute_cost() { - raft::common::nvtx::range fun_scope("compute_cost"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_cost"); const i_t TPB = 256; const auto n_blocks = (n_routes + TPB - 1) / TPB; @@ -594,13 +594,13 @@ void solution_t::compute_cost() template void solution_t::check_cost_coherence(const infeasible_cost_t& weights) { - raft::common::nvtx::range fun_scope("check_cost_coherence"); - double excess_before = get_total_excess(weights); - double cost_before = get_cost(true, weights); + [[maybe_unused]] raft::common::nvtx::range fun_scope("check_cost_coherence"); + [[maybe_unused]] double excess_before = get_total_excess(weights); + [[maybe_unused]] double cost_before = get_cost(true, weights); compute_backward_forward(); compute_cost(); - double excess_after = get_total_excess(weights); - double cost_after = get_cost(true, weights); + [[maybe_unused]] double excess_after = get_total_excess(weights); + [[maybe_unused]] double cost_after = get_cost(true, weights); cuopt_assert(abs(excess_before - excess_after) < 0.00001, "Excess mismatch!"); cuopt_assert(abs(cost_before - cost_after) < 0.00001, "Cost mismatch!"); } @@ -610,7 +610,7 @@ void solution_t::shift_move_routes( const std::vector& route_ids, rmm::device_uvector& route_ids_device_copy) { - raft::common::nvtx::range fun_scope("shift_move_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("shift_move_routes"); // shift and swap route slots i_t remove_counter = 0; // this is not super efficient but not significant @@ -657,7 +657,7 @@ void solution_t::remove_routes( ejection_pool_t>& ejection_pool, const std::vector& routes_to_remove) { - raft::common::nvtx::range fun_scope("remove_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_routes"); if (routes_to_remove.empty()) { return; } @@ -695,7 +695,7 @@ void solution_t::remove_routes( template void solution_t::remove_routes(const std::vector& routes_to_remove) { - raft::common::nvtx::range fun_scope("remove_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_routes"); cuopt_assert(routes_to_remove.size() > 0, "There should be at least one route in the vector!"); // reuse temp_int_vector temp_int_vector.resize(routes_to_remove.size(), sol_handle->get_stream()); @@ -717,7 +717,7 @@ void solution_t::remove_routes(const std::vector& routes template void solution_t::keep_only_vehicles(const std::vector& vehicles_to_keep) { - raft::common::nvtx::range fun_scope("keep_only_vehicles"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("keep_only_vehicles"); // Figure out which routes to remove std::vector routes_to_remove; @@ -733,7 +733,7 @@ void solution_t::keep_only_vehicles(const std::vector& v template i_t solution_t::compute_max_active() { - raft::common::nvtx::range fun_scope("compute_max_active"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_max_active"); i_t TPB = 1024; compute_max_active_kernel <<<1, TPB, 0, sol_handle->get_stream().get()>>>(view()); @@ -744,7 +744,7 @@ i_t solution_t::compute_max_active() template void solution_t::compute_route_id_per_node() { - raft::common::nvtx::range fun_scope("compute_route_id_per_node"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_route_id_per_node"); i_t TPB = 256; compute_route_id_kernel<<get_stream().get()>>>( routes_view.data(), route_node_map.view()); diff --git a/cpp/src/routing/solution/solution.cuh b/cpp/src/routing/solution/solution.cuh index 237b31aa34..1390e471e9 100644 --- a/cpp/src/routing/solution/solution.cuh +++ b/cpp/src/routing/solution/solution.cuh @@ -351,7 +351,7 @@ class solution_t { temp_int_vector(std::max(problem_.get_num_orders(), problem_.get_fleet_size()), sol_handle_->get_stream()) { - raft::common::nvtx::range fun_scope("solution_t"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("solution_t"); thrust::fill( sol_handle_->get_thrust_policy(), d_lock_per_route.begin(), d_lock_per_route.end(), 0); @@ -429,7 +429,7 @@ class solution_t { temp_stack_counter(sol.temp_stack_counter, sol.sol_handle->get_stream()), temp_int_vector(sol.temp_int_vector, sol.sol_handle->get_stream()) { - raft::common::nvtx::range fun_scope("copy ctr solution_t"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("copy ctr solution_t"); cuopt_assert(n_routes <= problem_ptr->get_fleet_size(), "Number of routes should be less than the fleet size"); set_routes_to_copy(); @@ -441,7 +441,7 @@ class solution_t { cuopt_assert(routes.size() == route_id_to_idx.size(), "route and ids should have same size!"); { - raft::common::nvtx::range fun_scope("copy_routes"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("copy_routes"); for (i_t i = 0; i < sol.n_routes; ++i) { routes.emplace_back(sol.get_route(i)); route_id_to_idx.emplace_back(i); diff --git a/cpp/src/routing/solution/solution_handle.cuh b/cpp/src/routing/solution/solution_handle.cuh index e2572d5ca3..8acd34f7a9 100644 --- a/cpp/src/routing/solution/solution_handle.cuh +++ b/cpp/src/routing/solution/solution_handle.cuh @@ -48,7 +48,7 @@ class solution_handle_t { const cudaDeviceProp& get_device_properties() const { - std::lock_guard _(mutex_); + [[maybe_unused]] std::lock_guard _(mutex_); if (!device_prop_initialized_) { RAFT_CUDA_TRY_NO_THROW(cudaGetDeviceProperties(&prop_, dev_id_)); device_prop_initialized_ = true; diff --git a/cpp/src/routing/solve.cu b/cpp/src/routing/solve.cu index 136d77a8b4..6b15985a95 100644 --- a/cpp/src/routing/solve.cu +++ b/cpp/src/routing/solve.cu @@ -17,7 +17,7 @@ assignment_t solve(data_model_view_t const& data_model, solver_settings_t const& settings) { // Without this, CUOPT_LOG_ERROR below sinks into the buffer and is never emitted. - init_logger_t log("", settings.get_error_logging_mode()); + [[maybe_unused]] init_logger_t log("", settings.get_error_logging_mode()); try { cuopt::routing::solver_t solver(data_model, settings); diff --git a/cpp/src/routing/util_kernels/compute_backward_forward.cu b/cpp/src/routing/util_kernels/compute_backward_forward.cu index 4d8faf4095..87aacb819b 100644 --- a/cpp/src/routing/util_kernels/compute_backward_forward.cu +++ b/cpp/src/routing/util_kernels/compute_backward_forward.cu @@ -42,7 +42,7 @@ __global__ void compute_actual_arrival_kernel( template void solution_t::compute_backward_forward() { - raft::common::nvtx::range fun_scope("compute_backward_forward"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_backward_forward"); constexpr i_t TPB = 32; if (n_routes) { compute_backward_forward_kernel @@ -54,7 +54,7 @@ void solution_t::compute_backward_forward() template void solution_t::compute_actual_arrival_times() { - raft::common::nvtx::range fun_scope("compute_backward_forward"); + [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_backward_forward"); constexpr i_t TPB = 32; if (n_routes && problem_ptr->dimensions_info.has_dimension(dim_t::TIME)) compute_actual_arrival_kernel diff --git a/cpp/src/routing/util_kernels/set_nodes_data.cuh b/cpp/src/routing/util_kernels/set_nodes_data.cuh index a871bb4652..dc9955639e 100644 --- a/cpp/src/routing/util_kernels/set_nodes_data.cuh +++ b/cpp/src/routing/util_kernels/set_nodes_data.cuh @@ -86,7 +86,6 @@ __device__ void set_nodes_data_of_single_route( typename route_t::view_t& route) { const auto& order_info = problem.order_info; - const auto& fleet_info = problem.fleet_info; i_t n_nodes_route = route.get_num_nodes(); const i_t vehicle_id = route.get_vehicle_id(); const i_t route_id = route.get_id(); @@ -129,7 +128,6 @@ __device__ void set_nodes_data_of_single_route( typename route_t::view_t& route) { const auto& order_info = problem.order_info; - const auto& fleet_info = problem.fleet_info; i_t n_nodes_route = route.get_num_nodes(); const i_t vehicle_id = route.get_vehicle_id(); const i_t route_id = route.get_id(); diff --git a/cpp/src/routing/utilities/cython.cu b/cpp/src/routing/utilities/cython.cu index 7c1e0170e3..57c6284866 100644 --- a/cpp/src/routing/utilities/cython.cu +++ b/cpp/src/routing/utilities/cython.cu @@ -106,7 +106,7 @@ std::vector> call_batch_solve( std::vector> list(size); // Use OpenMP for parallel execution - const int max_thread = std::min(static_cast(size), omp_get_max_threads()); + [[maybe_unused]] const int max_thread = std::min(static_cast(size), omp_get_max_threads()); rmm::cuda_stream_pool stream_pool(size, rmm::cuda_stream::flags::non_blocking); int device_id = raft::resource::get_device_id(*(data_models[0]->get_handle_ptr())); diff --git a/cpp/src/utilities/cuda_helpers.cuh b/cpp/src/utilities/cuda_helpers.cuh index 778dcd5b60..8505e93506 100644 --- a/cpp/src/utilities/cuda_helpers.cuh +++ b/cpp/src/utilities/cuda_helpers.cuh @@ -206,12 +206,12 @@ inline bool set_shmem_of_kernel(Function* function, size_t dynamic_request_size) dynamic_request_size = raft::alignTo(dynamic_request_size, size_t(1024)); { - std::shared_lock rlock(mtx); + [[maybe_unused]] std::shared_lock rlock(mtx); auto it = shmem_sizes.find(function); if (it != shmem_sizes.end() && dynamic_request_size <= it->second) { return true; } } - std::unique_lock wlock(mtx); + [[maybe_unused]] std::unique_lock wlock(mtx); size_t current_size = shmem_sizes.count(function) ? shmem_sizes[function] : 0; if (dynamic_request_size > current_size) { auto err = cudaFuncSetAttribute( diff --git a/cpp/src/utilities/logger.hpp b/cpp/src/utilities/logger.hpp index 7c9f952d48..fc64bb7264 100644 --- a/cpp/src/utilities/logger.hpp +++ b/cpp/src/utilities/logger.hpp @@ -137,13 +137,13 @@ inline log_console_callback_t g_console_callback = nullptr; */ inline void set_console_log_callback(log_console_callback_t callback) { - std::lock_guard lock(g_console_callback_mutex); + [[maybe_unused]] std::lock_guard lock(g_console_callback_mutex); g_console_callback = callback; } inline log_console_callback_t console_log_callback() { - std::lock_guard lock(g_console_callback_mutex); + [[maybe_unused]] std::lock_guard lock(g_console_callback_mutex); return g_console_callback; } @@ -155,7 +155,7 @@ class log_buffer { void log(rapids_logger::level_enum lvl, const char* msg) { - std::lock_guard lock(mutex); + [[maybe_unused]] std::lock_guard lock(mutex); if (!msg) return; std::string str(msg); @@ -165,13 +165,13 @@ class log_buffer { size_t size() const { - std::lock_guard lock(mutex); + [[maybe_unused]] std::lock_guard lock(mutex); return messages.size(); } std::vector drain_all() { - std::lock_guard lock(mutex); + [[maybe_unused]] std::lock_guard lock(mutex); std::vector out; out.swap(messages); return out; @@ -333,7 +333,7 @@ inline std::shared_ptr make_logger_config(const std::string& log_file, bool log_to_console, bool truncate) { - std::lock_guard lock(g_guard_mutex); + [[maybe_unused]] std::lock_guard lock(g_guard_mutex); // Reuse the configuration already in place; reconfiguring here would re-truncate the file. if (auto existing = g_active_guard.lock()) { return existing; } diff --git a/cpp/src/utilities/producer_sync.hpp b/cpp/src/utilities/producer_sync.hpp index 129fe665a7..08d4979419 100644 --- a/cpp/src/utilities/producer_sync.hpp +++ b/cpp/src/utilities/producer_sync.hpp @@ -29,14 +29,14 @@ class producer_sync_t { void register_producer(std::atomic* progress_ptr) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); producers_.push_back(progress_ptr); cv_.notify_all(); } void deregister_producer(std::atomic* progress_ptr) { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); auto it = std::find(producers_.begin(), producers_.end(), progress_ptr); if (it != producers_.end()) { producers_.erase(it); } cv_.notify_all(); @@ -48,14 +48,14 @@ class producer_sync_t { */ void registration_complete() { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); registration_complete_ = true; cv_.notify_all(); } bool is_registration_complete() const { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); return registration_complete_; } @@ -68,7 +68,7 @@ class producer_sync_t { */ void wait_for_producers(double target_work_units) { - std::unique_lock lock(mutex_); + [[maybe_unused]] std::unique_lock lock(mutex_); cv_.wait(lock, [this, target_work_units] { if (!registration_complete_) { return false; } return all_producers_at_or_ahead(target_work_units); @@ -82,7 +82,7 @@ class producer_sync_t { size_t num_producers() const { - std::lock_guard lock(mutex_); + [[maybe_unused]] std::lock_guard lock(mutex_); return producers_.size(); } diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 41031de5c3..26286c77af 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -95,8 +95,19 @@ function(ConfigureTest CMAKE_TEST_NAME) "${CUOPT_TEST_DIR}/../src" "${CUOPT_TEST_DIR}/../src/io" "${CUOPT_TEST_DIR}" - "${papilo_SOURCE_DIR}/src" - "${papilo_BINARY_DIR}" + ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_include_directories(${CMAKE_TEST_NAME} PRIVATE + "${papilo_SOURCE_DIR}/src" + "${papilo_BINARY_DIR}" + ) + else() + target_include_directories(${CMAKE_TEST_NAME} SYSTEM PRIVATE + "${papilo_SOURCE_DIR}/src" + "${papilo_BINARY_DIR}" + ) + endif() + target_include_directories(${CMAKE_TEST_NAME} SYSTEM PRIVATE "${pslp_SOURCE_DIR}/include" ) target_include_directories(${CMAKE_TEST_NAME} SYSTEM PRIVATE "${dejavu_SOURCE_DIR}") diff --git a/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu b/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu index de2f65bbfb..0c4a81f955 100644 --- a/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu +++ b/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu @@ -42,7 +42,7 @@ static void init_handler(const raft::handle_t* handle_ptr) TEST(barrier, chess_set) { - cuopt::init_logger_t log("", true); + [[maybe_unused]] cuopt::init_logger_t log("", true); namespace simplex = cuopt::mathematical_optimization::simplex; raft::handle_t handle{}; init_handler(&handle); @@ -112,7 +112,7 @@ TEST(barrier, chess_set) TEST(barrier, dual_variable_greater_than) { - cuopt::init_logger_t log("", true); + [[maybe_unused]] cuopt::init_logger_t log("", true); // minimize 3*x0 + 2 * x1 // subject to x0 + x1 >= 1 // x0 + 2x1 >= 3 diff --git a/cpp/tests/linear_programming/pdlp_test.cu b/cpp/tests/linear_programming/pdlp_test.cu index f85e3690c9..43005e2eb3 100644 --- a/cpp/tests/linear_programming/pdlp_test.cu +++ b/cpp/tests/linear_programming/pdlp_test.cu @@ -195,7 +195,8 @@ TEST(pdlp_class, concurrent_null_solver_ptrs_inside_mip) // and sol_barrier_ptr null. const int prev_threads = omp_get_max_threads(); omp_set_num_threads(1); - const cuopt::scope_guard restore_threads{[prev_threads] { omp_set_num_threads(prev_threads); }}; + [[maybe_unused]] const cuopt::scope_guard restore_threads{ + [prev_threads] { omp_set_num_threads(prev_threads); }}; optimization_problem_solution_t solution = solve_lp(&handle_, op_problem, settings); EXPECT_EQ((int)solution.get_termination_status(), CUOPT_TERMINATION_STATUS_OPTIMAL); @@ -2402,8 +2403,8 @@ TEST(pdlp_class, simple_batch_different_objectives) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - const auto& original_obj = op_problem.get_objective_coefficients(); + [[maybe_unused]] const int n_vars = op_problem.get_n_variables(); + const auto& original_obj = op_problem.get_objective_coefficients(); // Create a modified objective: scale by 2.0 std::vector modified_obj(original_obj.begin(), original_obj.end()); @@ -2510,8 +2511,8 @@ TEST(pdlp_class, simple_batch_different_objectives_and_offsets) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - const auto& original_obj = op_problem.get_objective_coefficients(); + [[maybe_unused]] const int n_vars = op_problem.get_n_variables(); + const auto& original_obj = op_problem.get_objective_coefficients(); // Two climbers: (original_obj, offset=3.5) and (2x objective, offset=-7.0) std::vector obj_c1(original_obj.begin(), original_obj.end()); @@ -2568,9 +2569,9 @@ TEST(pdlp_class, simple_batch_different_constraint_bounds) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_constrs = op_problem.get_n_constraints(); - const auto& original_lower_bounds = op_problem.get_constraint_lower_bounds(); - const auto& original_upper_bounds = op_problem.get_constraint_upper_bounds(); + [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); + const auto& original_lower_bounds = op_problem.get_constraint_lower_bounds(); + const auto& original_upper_bounds = op_problem.get_constraint_upper_bounds(); // Build 3 climbers with perturbed bounds: // - climber 0: unchanged (scale factor 1.0) @@ -2636,8 +2637,8 @@ TEST(pdlp_class, simple_batch_everything_different) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - const int n_constrs = op_problem.get_n_constraints(); + const int n_vars = op_problem.get_n_variables(); + [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); const auto& original_obj = op_problem.get_objective_coefficients(); const auto& original_lower_bounds = op_problem.get_constraint_lower_bounds(); @@ -3037,8 +3038,10 @@ TEST(pdlp_class, DISABLED_cupdlpx_batch_infeasible_detection) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector& variable_lower_bounds = op_problem.get_variable_lower_bounds(); - const std::vector& variable_upper_bounds = op_problem.get_variable_upper_bounds(); + [[maybe_unused]] const std::vector& variable_lower_bounds = + op_problem.get_variable_lower_bounds(); + [[maybe_unused]] const std::vector& variable_upper_bounds = + op_problem.get_variable_upper_bounds(); for (size_t i = 0; i < batch_size; i++) { solver_settings.new_bounds.push_back( @@ -3089,8 +3092,10 @@ TEST(pdlp_class, DISABLED_cupdlpx_infeasible_detection_batch_afiro_new_bounds) constexpr int batch_size = 5; - const std::vector& variable_lower_bounds = op_problem.get_variable_lower_bounds(); - const std::vector& variable_upper_bounds = op_problem.get_variable_upper_bounds(); + [[maybe_unused]] const std::vector& variable_lower_bounds = + op_problem.get_variable_lower_bounds(); + [[maybe_unused]] const std::vector& variable_upper_bounds = + op_problem.get_variable_upper_bounds(); for (size_t i = 0; i < batch_size; i++) { solver_settings.new_bounds.push_back({static_cast(i), 1, 7.0, 8.0}); @@ -3332,8 +3337,8 @@ TEST(pdlp_class, strong_branching_test) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const std::vector fractional = {1, 2, 4}; + [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -3439,8 +3444,8 @@ TEST(pdlp_class, strong_branching_user_api) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const std::vector fractional = {1, 2, 4}; + [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -4245,10 +4250,10 @@ TEST(pdlp_class, shared_sb_view_batch_pre_solved) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - const std::vector root_soln_x = {0.891, 0.109, 0.636429}; - const int n_fractional = fractional.size(); - const int batch_size = n_fractional * 2; // 6 + const std::vector fractional = {1, 2, 4}; + [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const int n_fractional = fractional.size(); + const int batch_size = n_fractional * 2; // 6 auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -4377,10 +4382,10 @@ TEST(pdlp_class, shared_sb_view_all_infeasible) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - const std::vector root_soln_x = {0.891, 0.109, 0.636429}; - const int n_fractional = fractional.size(); - const int batch_size = n_fractional; + const std::vector fractional = {1, 2, 4}; + [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const int n_fractional = fractional.size(); + const int batch_size = n_fractional; auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -4448,8 +4453,8 @@ TEST(pdlp_class, big_batch_fixed_path) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - const int n_constrs = op_problem.get_n_constraints(); + const int n_vars = op_problem.get_n_variables(); + [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); const auto& original_obj = op_problem.get_objective_coefficients(); const auto& original_lb = op_problem.get_constraint_lower_bounds(); @@ -4712,8 +4717,8 @@ TEST(pdlp_class, batch_with_optimal_size_query) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - const int n_constrs = op_problem.get_n_constraints(); + const int n_vars = op_problem.get_n_variables(); + [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); const auto& original_obj = op_problem.get_objective_coefficients(); const auto& original_lb = op_problem.get_constraint_lower_bounds(); diff --git a/cpp/tests/linear_programming/unit_tests/presolve_test.cu b/cpp/tests/linear_programming/unit_tests/presolve_test.cu index f8ba6432fe..c6a2ed5c3f 100644 --- a/cpp/tests/linear_programming/unit_tests/presolve_test.cu +++ b/cpp/tests/linear_programming/unit_tests/presolve_test.cu @@ -221,17 +221,17 @@ TEST(pslp_presolve, postsolve_accuracy_afiro) auto mps_data_model = cuopt::mathematical_optimization::io::read_mps(path, true); // Store original problem data for later verification - const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); - const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); - const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); - const auto& orig_obj_coeffs = mps_data_model.get_objective_coefficients(); - const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); - const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); - const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); - const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); - const double orig_obj_offset = mps_data_model.get_objective_offset(); - const int orig_n_vars = mps_data_model.get_n_variables(); - const int orig_n_constraints = mps_data_model.get_n_constraints(); + const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); + const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); + const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); + const auto& orig_obj_coeffs = mps_data_model.get_objective_coefficients(); + const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); + const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); + const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); + const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); + const double orig_obj_offset = mps_data_model.get_objective_offset(); + const int orig_n_vars = mps_data_model.get_n_variables(); + [[maybe_unused]] const int orig_n_constraints = mps_data_model.get_n_constraints(); // Solve with PSLP presolve enabled auto solver_settings = pdlp_solver_settings_t{}; @@ -317,15 +317,15 @@ TEST(pslp_presolve, postsolve_accuracy_larger_problem) auto mps_data_model = cuopt::mathematical_optimization::io::read_mps(path, false); // Store original problem dimensions - const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); - const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); - const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); - const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); - const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); - const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); - const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); - const int orig_n_vars = mps_data_model.get_n_variables(); - const int orig_n_constraints = mps_data_model.get_n_constraints(); + const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); + const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); + const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); + const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); + const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); + const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); + const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); + const int orig_n_vars = mps_data_model.get_n_variables(); + [[maybe_unused]] const int orig_n_constraints = mps_data_model.get_n_constraints(); // Solve with PSLP presolve auto solver_settings = pdlp_solver_settings_t{}; @@ -471,8 +471,8 @@ TEST(pslp_presolve, postsolve_multiple_problems) auto mps_data_model = cuopt::mathematical_optimization::io::read_mps(path, name == "afiro_original"); - const int orig_n_vars = mps_data_model.get_n_variables(); - const int orig_n_constraints = mps_data_model.get_n_constraints(); + const int orig_n_vars = mps_data_model.get_n_variables(); + [[maybe_unused]] const int orig_n_constraints = mps_data_model.get_n_constraints(); auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; diff --git a/cpp/tests/linear_programming/utilities/pdlp_test_utilities.cuh b/cpp/tests/linear_programming/utilities/pdlp_test_utilities.cuh index cff05578fe..68c823b293 100644 --- a/cpp/tests/linear_programming/utilities/pdlp_test_utilities.cuh +++ b/cpp/tests/linear_programming/utilities/pdlp_test_utilities.cuh @@ -26,7 +26,7 @@ namespace cuopt::mathematical_optimization::test { constexpr double tolerance = 1e-6f; -static std::string make_path_absolute(const std::string& file) +[[maybe_unused]] static std::string make_path_absolute(const std::string& file) { std::string rel_file{}; // assume relative paths are relative to RAPIDS_DATASET_ROOT_DIR @@ -52,9 +52,9 @@ static cuopt::mathematical_optimization::optimization_problem_solution_t -static void assign_device_uvector_from_host(rmm::device_uvector& target, - const std::vector& src, - cuda::stream_ref stream) +[[maybe_unused]] static void assign_device_uvector_from_host(rmm::device_uvector& target, + const std::vector& src, + cuda::stream_ref stream) { target.resize(src.size(), stream); raft::copy(target.data(), src.data(), src.size(), stream); @@ -115,7 +115,7 @@ solve_lp_batch_fixed( } // Compute on the CPU x * c to check that the returned objective value is correct -static void test_objective_sanity( +[[maybe_unused]] static void test_objective_sanity( const cuopt::mathematical_optimization::io::mps_data_model_t& op_problem, const rmm::device_uvector& primal_solution, double objective_value, @@ -140,7 +140,7 @@ static void test_objective_sanity( } // Compute on the CPU x * c to check that the returned objective value is correct -static void test_objective_sanity( +[[maybe_unused]] static void test_objective_sanity( const cuopt::mathematical_optimization::io::mps_data_model_t& op_problem, const std::vector& primal_solution, double objective_value, @@ -167,7 +167,7 @@ static void test_objective_sanity( // Check that it corresponds to the bound resdiual // Check that it respect the absolute/relative tolerance // Check that the primal variables respected the variable bounds -static void test_constraint_sanity( +[[maybe_unused]] static void test_constraint_sanity( const cuopt::mathematical_optimization::io::mps_data_model_t& op_problem, const optimization_problem_solution_t::additional_termination_information_t& termination_information, diff --git a/cpp/tests/mip/block_bve_test.cu b/cpp/tests/mip/block_bve_test.cu index c1aca2f690..a8e3c1967c 100644 --- a/cpp/tests/mip/block_bve_test.cu +++ b/cpp/tests/mip/block_bve_test.cu @@ -178,8 +178,8 @@ End template static void with_mip_omp_team(F&& f) { - const int num_threads = std::max(2, omp_get_max_threads()); - const int saved_max_active_levels = omp_get_max_active_levels(); + [[maybe_unused]] const int num_threads = std::max(2, omp_get_max_threads()); + const int saved_max_active_levels = omp_get_max_active_levels(); if (saved_max_active_levels < 2) { omp_set_max_active_levels(2); } #pragma omp parallel num_threads(num_threads) { diff --git a/cpp/tests/mip/incumbent_callback_test.cu b/cpp/tests/mip/incumbent_callback_test.cu index 68131ed054..4c7587931a 100644 --- a/cpp/tests/mip/incumbent_callback_test.cu +++ b/cpp/tests/mip/incumbent_callback_test.cu @@ -147,7 +147,7 @@ void test_incumbent_callback(std::string test_instance, bool include_set_callbac set_solution_callback = std::make_unique(solutions, &user_data); settings.set_mip_callback(set_solution_callback.get(), &user_data); } - auto solution = solve_mip(op_problem, settings); + [[maybe_unused]] auto solution = solve_mip(op_problem, settings); EXPECT_GE(get_solution_callback.n_calls, 1); if (include_set_callback) { EXPECT_GE(set_solution_callback->n_calls, 1); } check_solutions(get_solution_callback, mps_problem, settings); @@ -177,7 +177,8 @@ TEST(mip_solve, incumbent_get_set_callback_test) // population stays empty. The fallback in solver.cu must use the OG-space incumbent. TEST(mip_solve, early_heuristic_incumbent_fallback) { - scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", "1"); + [[maybe_unused]] scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", + "1"); const raft::handle_t handle_{}; auto path = make_path_absolute("mip/pk1.mps"); @@ -213,7 +214,8 @@ TEST(mip_solve, early_heuristic_incumbent_fallback) // through PaPILO presolve and accepted into the heuristic population. TEST(mip_solve, initial_solution_survives_papilo_crush) { - scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", "1"); + [[maybe_unused]] scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", + "1"); const raft::handle_t handle_{}; auto path = make_path_absolute("mip/pk1.mps"); diff --git a/cpp/tests/mip/mip_utils.cuh b/cpp/tests/mip/mip_utils.cuh index 29d4732d42..78d8747805 100644 --- a/cpp/tests/mip/mip_utils.cuh +++ b/cpp/tests/mip/mip_utils.cuh @@ -14,7 +14,7 @@ namespace cuopt::mathematical_optimization::test { -static void test_variable_bounds( +[[maybe_unused]] static void test_variable_bounds( const cuopt::mathematical_optimization::io::mps_data_model_t& problem, const rmm::device_uvector& solution, const cuopt::mathematical_optimization::mip_solver_settings_t settings) @@ -42,7 +42,7 @@ static void test_variable_bounds( EXPECT_TRUE(result); } -static void test_variable_bounds( +[[maybe_unused]] static void test_variable_bounds( const cuopt::mathematical_optimization::io::mps_data_model_t& problem, const std::vector& solution, const cuopt::mathematical_optimization::mip_solver_settings_t settings) @@ -70,7 +70,7 @@ static void test_variable_bounds( } template -static double combine_finite_abs_bounds(f_t lower, f_t upper) +[[maybe_unused]] static double combine_finite_abs_bounds(f_t lower, f_t upper) { f_t val = f_t(0); if (isfinite(upper)) { val = raft::max(val, raft::abs(upper)); } @@ -93,7 +93,7 @@ struct violation { } }; -static void test_constraint_sanity_per_row( +[[maybe_unused]] static void test_constraint_sanity_per_row( const cuopt::mathematical_optimization::io::mps_data_model_t& op_problem, const rmm::device_uvector& solution, double abs_tolerance, @@ -104,8 +104,6 @@ static void test_constraint_sanity_per_row( const std::vector& offsets = op_problem.get_constraint_matrix_offsets(); const std::vector& constraint_lower_bounds = op_problem.get_constraint_lower_bounds(); const std::vector& constraint_upper_bounds = op_problem.get_constraint_upper_bounds(); - const std::vector& variable_lower_bounds = op_problem.get_variable_lower_bounds(); - const std::vector& variable_upper_bounds = op_problem.get_variable_upper_bounds(); std::vector residual(constraint_lower_bounds.size(), 0.0); auto h_solution = cuopt::host_copy(solution, solution.stream()); // CSR SpMV @@ -127,7 +125,7 @@ static void test_constraint_sanity_per_row( } } -static void test_constraint_sanity_per_row( +[[maybe_unused]] static void test_constraint_sanity_per_row( const cuopt::mathematical_optimization::io::mps_data_model_t& op_problem, const std::vector& solution, double abs_tolerance, @@ -158,7 +156,7 @@ static void test_constraint_sanity_per_row( } } -static std::tuple test_mps_file( +[[maybe_unused]] static std::tuple test_mps_file( std::string test_instance, double time_limit = 1, bool heuristics_only = true, diff --git a/cpp/tests/mip/multi_probe_test.cu b/cpp/tests/mip/multi_probe_test.cu index 61be30e15c..92058db4e8 100644 --- a/cpp/tests/mip/multi_probe_test.cu +++ b/cpp/tests/mip/multi_probe_test.cu @@ -33,7 +33,7 @@ namespace cuopt::mathematical_optimization::test { inline auto make_async() { return rmm::mr::cuda_async_memory_resource(); } -static void init_handler(const raft::handle_t* handle_ptr) +[[maybe_unused]] static void init_handler(const raft::handle_t* handle_ptr) { // Init cuBlas / cuSparse context here to avoid having it during solving time RAFT_CUBLAS_TRY(raft::linalg::detail::cublassetpointermode( diff --git a/cpp/tests/mip/unit_test.cu b/cpp/tests/mip/unit_test.cu index 20865b93ff..c9123f22dc 100644 --- a/cpp/tests/mip/unit_test.cu +++ b/cpp/tests/mip/unit_test.cu @@ -146,10 +146,10 @@ class MILPTestParams TEST_P(MILPTestParams, TestSampleMILP) { - bool maximize = std::get<0>(GetParam()); - int scaling = std::get<1>(GetParam()); - bool heuristics_only = std::get<2>(GetParam()); - auto expected_termination_status = std::get<3>(GetParam()); + bool maximize = std::get<0>(GetParam()); + int scaling = std::get<1>(GetParam()); + bool heuristics_only = std::get<2>(GetParam()); + [[maybe_unused]] auto expected_termination_status = std::get<3>(GetParam()); raft::handle_t handle; auto problem = create_std_milp_problem(maximize); @@ -167,10 +167,10 @@ TEST_P(MILPTestParams, TestSampleMILP) TEST_P(MILPTestParams, TestSingleVarMILP) { - bool maximize = std::get<0>(GetParam()); - int scaling = std::get<1>(GetParam()); - bool heuristics_only = std::get<2>(GetParam()); - auto expected_termination_status = std::get<3>(GetParam()); + bool maximize = std::get<0>(GetParam()); + int scaling = std::get<1>(GetParam()); + bool heuristics_only = std::get<2>(GetParam()); + [[maybe_unused]] auto expected_termination_status = std::get<3>(GetParam()); raft::handle_t handle; auto problem = create_single_var_milp_problem(maximize); diff --git a/cpp/tests/routing/unit_tests/top_k.cu b/cpp/tests/routing/unit_tests/top_k.cu index 6a4e48b790..a0cc95e452 100644 --- a/cpp/tests/routing/unit_tests/top_k.cu +++ b/cpp/tests/routing/unit_tests/top_k.cu @@ -241,7 +241,7 @@ class top_cand_test_t : public routing_test_t, public ::testing::TestW double elapsed_ms; this->stream_view_.sync(); { - time_it t(&elapsed_ms); + [[maybe_unused]] time_it t(&elapsed_ms); for (int i = 0; i < iter; ++i) { cub::DeviceSegmentedSort::SortPairs(d_cub_storage_bytes.data(), tmp_storage_bytes, @@ -271,7 +271,7 @@ class top_cand_test_t : public routing_test_t, public ::testing::TestW double elapsed_ms; this->stream_view_.sync(); { - time_it t(&elapsed_ms); + [[maybe_unused]] time_it t(&elapsed_ms); for (int i = 0; i < iter; ++i) { call_top_k(d_input_cost, d_output_cost, d_out_index); } diff --git a/cpp/tests/routing/utilities/data_model.hpp b/cpp/tests/routing/utilities/data_model.hpp index fd1023880e..7dab172bbe 100644 --- a/cpp/tests/routing/utilities/data_model.hpp +++ b/cpp/tests/routing/utilities/data_model.hpp @@ -343,11 +343,11 @@ struct scross_three_routes { // clang-format on }; -static test_data_model_t input_; -static test_data_model_t input_double_; -static simple_two_routes simple_two_routes_; -static simple_three_routes simple_three_routes_; -static scross_three_routes scross_three_routes_; +[[maybe_unused]] static test_data_model_t input_; +[[maybe_unused]] static test_data_model_t input_double_; +[[maybe_unused]] static simple_two_routes simple_two_routes_; +[[maybe_unused]] static simple_three_routes simple_three_routes_; +[[maybe_unused]] static scross_three_routes scross_three_routes_; } // namespace test } // namespace routing diff --git a/cpp/tests/routing/utilities/test_utilities.hpp b/cpp/tests/routing/utilities/test_utilities.hpp index 1543f91426..18c6734f53 100644 --- a/cpp/tests/routing/utilities/test_utilities.hpp +++ b/cpp/tests/routing/utilities/test_utilities.hpp @@ -264,7 +264,6 @@ void load_pickup(const std::string& fileName, Route& route) std::ifstream infile(fileName.c_str()); cuopt_assert(infile.is_open(), "File cannot be opened."); - std::string str; long dump; infile >> route.n_vehicles; diff --git a/cpp/tests/utilities/base_fixture.hpp b/cpp/tests/utilities/base_fixture.hpp index 31d7923dfa..7fdb675e2f 100644 --- a/cpp/tests/utilities/base_fixture.hpp +++ b/cpp/tests/utilities/base_fixture.hpp @@ -93,7 +93,7 @@ inline auto parse_test_options(int argc, char** argv) "rmm_mode", "RMM allocation mode", cxxopts::value()->default_value("pool")); return options.parse(argc, argv); - } catch (const std::exception& e) { + } catch (const std::exception&) { cuopt_assert(false, "Error parsing command line options"); } From 6f6063bf64c3c056eb561046ccf8d6537ce18f4b Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Fri, 18 Sep 2026 15:40:25 -0400 Subject: [PATCH 2/5] style fixes --- cpp/src/io/experimental_mps_fast/file_reader.hpp | 4 ++-- cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp | 4 ++-- cpp/src/routing/crossovers/dispose.hpp | 2 +- cpp/src/routing/crossovers/inversion_recombiner.hpp | 2 +- cpp/src/routing/crossovers/srex_recombiner.hpp | 2 +- cpp/src/routing/diversity/population.hpp | 2 +- cpp/src/routing/ges/execute_insertion.cuh | 2 +- cpp/tests/routing/utilities/data_model.hpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cpp/src/io/experimental_mps_fast/file_reader.hpp b/cpp/src/io/experimental_mps_fast/file_reader.hpp index 01e7515741..7175cdcff8 100644 --- a/cpp/src/io/experimental_mps_fast/file_reader.hpp +++ b/cpp/src/io/experimental_mps_fast/file_reader.hpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights -// reserved. SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 // Input layer for the fast MPS parser: turns on-disk bytes (plain or .lz4) into one // contiguous parse buffer and publishes MPS section boundaries as data becomes available. diff --git a/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp b/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp index 7c3c746f21..cc52204d7c 100644 --- a/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp +++ b/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights -// reserved. SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 #include "mps_section_scanner.hpp" diff --git a/cpp/src/routing/crossovers/dispose.hpp b/cpp/src/routing/crossovers/dispose.hpp index 7074d8cad9..671c7d833d 100644 --- a/cpp/src/routing/crossovers/dispose.hpp +++ b/cpp/src/routing/crossovers/dispose.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ diff --git a/cpp/src/routing/crossovers/inversion_recombiner.hpp b/cpp/src/routing/crossovers/inversion_recombiner.hpp index 9b2b435d63..c715cc3421 100644 --- a/cpp/src/routing/crossovers/inversion_recombiner.hpp +++ b/cpp/src/routing/crossovers/inversion_recombiner.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ diff --git a/cpp/src/routing/crossovers/srex_recombiner.hpp b/cpp/src/routing/crossovers/srex_recombiner.hpp index 90f8ed7a7d..a012aeba29 100644 --- a/cpp/src/routing/crossovers/srex_recombiner.hpp +++ b/cpp/src/routing/crossovers/srex_recombiner.hpp @@ -1,6 +1,6 @@ /* 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 */ diff --git a/cpp/src/routing/diversity/population.hpp b/cpp/src/routing/diversity/population.hpp index f1b5ccc76a..f16b73e59a 100644 --- a/cpp/src/routing/diversity/population.hpp +++ b/cpp/src/routing/diversity/population.hpp @@ -1,6 +1,6 @@ /* 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 */ diff --git a/cpp/src/routing/ges/execute_insertion.cuh b/cpp/src/routing/ges/execute_insertion.cuh index e67896d9fd..fe5421c502 100644 --- a/cpp/src/routing/ges/execute_insertion.cuh +++ b/cpp/src/routing/ges/execute_insertion.cuh @@ -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 */ diff --git a/cpp/tests/routing/utilities/data_model.hpp b/cpp/tests/routing/utilities/data_model.hpp index 7dab172bbe..d0c3c20678 100644 --- a/cpp/tests/routing/utilities/data_model.hpp +++ b/cpp/tests/routing/utilities/data_model.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 */ From e7e64b01029380243967d6532afe3cd8fca5d0fb Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Mon, 21 Sep 2026 14:20:48 -0400 Subject: [PATCH 3/5] Remove unnecessary maybe_unused from RAII objects Signed-off-by: Miles Lubin --- cpp/src/barrier/barrier.cu | 149 +++++++++--------- cpp/src/barrier/csr_kkt_build.cuh | 8 +- cpp/src/barrier/sparse_cholesky.cuh | 12 +- cpp/src/branch_and_bound/branch_and_bound.cpp | 28 ++-- cpp/src/branch_and_bound/mip_node.hpp | 2 +- cpp/src/branch_and_bound/pseudo_costs.cpp | 8 +- cpp/src/dual_simplex/basis_solves.cpp | 4 +- cpp/src/dual_simplex/basis_updates.cpp | 6 +- cpp/src/dual_simplex/crossover.cpp | 4 +- cpp/src/dual_simplex/initial_basis.cpp | 2 +- cpp/src/dual_simplex/right_looking_lu.cpp | 4 +- cpp/src/dual_simplex/solve.cpp | 8 +- cpp/src/grpc/client/grpc_client.cpp | 10 +- cpp/src/grpc/client/solve_remote.cpp | 4 +- cpp/src/grpc/server/grpc_job_management.cpp | 26 +-- cpp/src/grpc/server/grpc_server_main.cpp | 2 +- cpp/src/grpc/server/grpc_server_threads.cpp | 26 +-- cpp/src/grpc/server/grpc_service_impl.cpp | 30 ++-- cpp/src/grpc/server/grpc_worker_infra.cpp | 22 +-- .../io/experimental_mps_fast/fast_parser.cpp | 6 +- .../io/experimental_mps_fast/file_reader.hpp | 2 +- .../experimental_mps_fast/lz4_file_reader.cpp | 16 +- .../mps_section_scanner.cpp | 10 +- cpp/src/linear_algebra/sort_csr.cuh | 2 +- cpp/src/math_optimization/solution_writer.cu | 2 +- .../diversity/diversity_manager.cu | 24 +-- .../mip_heuristics/diversity/population.cu | 38 ++--- .../recombiners/bound_prop_recombiner.cuh | 8 +- .../diversity/recombiners/fp_recombiner.cuh | 2 +- .../recombiners/line_segment_recombiner.cuh | 4 +- .../diversity/recombiners/sub_mip.cuh | 2 +- .../feasibility_jump/early_gpufj.cu | 2 +- .../feasibility_jump/feasibility_jump.cu | 6 +- .../mip_heuristics/feasibility_jump/fj_cpu.cu | 6 +- .../feasibility_jump/fj_cpu.cuh | 4 +- .../feasibility_jump/fj_cpu_binary.cu | 2 +- .../fj_cpu_binary_preprocess.cu | 4 +- .../feasibility_pump/feasibility_pump.cu | 12 +- .../local_search/local_search.cu | 22 +-- .../local_search/rounding/constraint_prop.cu | 2 +- .../rounding/lb_constraint_prop.cu | 2 +- .../mip_heuristics/mip_scaling_strategy.cu | 2 +- cpp/src/mip_heuristics/presolve/block_bve.cu | 4 +- .../presolve/load_balanced_bounds_presolve.cu | 6 +- .../mip_heuristics/presolve/probing_cache.cu | 5 +- .../presolve/third_party_presolve.cpp | 14 +- .../mip_heuristics/problem/presolve_data.cu | 6 +- cpp/src/mip_heuristics/problem/problem.cu | 59 ++++--- .../problem/problem_helpers.cuh | 8 +- .../mip_heuristics/relaxed_lp/relaxed_lp.cu | 2 +- .../mip_heuristics/solution_publication.cuh | 4 +- cpp/src/mip_heuristics/solve.cu | 10 +- .../utilities/work_unit_ordered_queue.cuh | 16 +- cpp/src/pdlp/cusparse_view.cu | 2 +- .../distributed_algorithms.cu | 18 +-- .../pdlp/distributed_pdlp/multi_gpu_engine.cu | 6 +- .../distributed_pdlp/multi_gpu_engine.hpp | 2 +- cpp/src/pdlp/distributed_pdlp/shard.hpp | 2 +- .../initial_scaling.cu | 10 +- cpp/src/pdlp/optimization_problem.cu | 2 +- cpp/src/pdlp/pdhg.cu | 9 +- cpp/src/pdlp/pdlp.cu | 28 ++-- .../restart_strategy/pdlp_restart_strategy.cu | 35 ++-- cpp/src/pdlp/solve.cu | 16 +- cpp/src/pdlp/solver_solution.cu | 2 +- .../adaptive_step_size_strategy.cu | 2 +- .../convergence_information.cu | 21 ++- .../infeasibility_information.cu | 2 +- .../termination_strategy.cu | 2 +- cpp/src/pdlp/translate.hpp | 3 +- cpp/src/pdlp/utilities/cython_solve.cu | 12 +- cpp/src/routing/adapters/adapted_generator.cu | 4 +- cpp/src/routing/adapters/adapted_modifier.cu | 16 +- cpp/src/routing/adapters/adapted_sol.cuh | 36 ++--- cpp/src/routing/crossovers/dispose.hpp | 4 +- cpp/src/routing/crossovers/eax_recombiner.hpp | 2 +- .../crossovers/inversion_recombiner.hpp | 4 +- .../routing/crossovers/optimal_eax_cycles.cu | 10 +- cpp/src/routing/crossovers/ox_recombiner.cuh | 10 +- .../routing/crossovers/srex_recombiner.hpp | 2 +- cpp/src/routing/diversity/diverse_solver.hpp | 18 +-- cpp/src/routing/diversity/population.hpp | 26 +-- cpp/src/routing/ges/eject_until_feasible.cu | 6 +- cpp/src/routing/ges/execute_insertion.cu | 8 +- cpp/src/routing/ges/guided_ejection_search.cu | 14 +- cpp/src/routing/ges/squeeze.cu | 14 +- .../local_search/compute_compatible.cu | 6 +- .../local_search/compute_insertions.cu | 4 +- .../local_search/cycle_finder/cycle_finder.cu | 14 +- .../routing/local_search/fill_gpu_graph.cu | 2 +- .../local_search/hvrp/vehicle_assignment.cu | 2 +- cpp/src/routing/local_search/local_search.cu | 14 +- .../move_candidates/move_candidates.cuh | 8 +- cpp/src/routing/local_search/perform_moves.cu | 6 +- cpp/src/routing/local_search/random_cross.cu | 2 +- cpp/src/routing/local_search/sliding_tsp.cu | 2 +- .../routing/local_search/sliding_window.cu | 2 +- cpp/src/routing/local_search/two_opt.cu | 2 +- .../local_search/vrp/nodes_to_search.cu | 8 +- .../routing/local_search/vrp/vrp_execute.cu | 6 +- .../routing/local_search/vrp/vrp_search.cu | 6 +- cpp/src/routing/route/break_route.cuh | 4 +- cpp/src/routing/route/capacity_route.cuh | 4 +- cpp/src/routing/route/cost_route.cuh | 4 +- cpp/src/routing/route/dimensions_route.cuh | 4 +- cpp/src/routing/route/pdp_route.cuh | 4 +- cpp/src/routing/route/prize_route.cuh | 4 +- cpp/src/routing/route/route.cuh | 4 +- cpp/src/routing/route/time_route.cuh | 4 +- cpp/src/routing/route/tsp_route.cuh | 4 +- cpp/src/routing/solution/pool_allocator.cuh | 4 +- cpp/src/routing/solution/solution.cu | 52 +++--- cpp/src/routing/solution/solution.cuh | 6 +- cpp/src/routing/solution/solution_handle.cuh | 2 +- cpp/src/routing/solve.cu | 2 +- .../util_kernels/compute_backward_forward.cu | 4 +- cpp/src/utilities/cuda_helpers.cuh | 4 +- cpp/src/utilities/logger.hpp | 12 +- cpp/src/utilities/producer_sync.hpp | 12 +- .../dual_simplex/unit_tests/solve_barrier.cu | 4 +- cpp/tests/linear_programming/pdlp_test.cu | 3 +- cpp/tests/mip/incumbent_callback_test.cu | 6 +- cpp/tests/routing/unit_tests/top_k.cu | 4 +- 123 files changed, 615 insertions(+), 637 deletions(-) diff --git a/cpp/src/barrier/barrier.cu b/cpp/src/barrier/barrier.cu index 28d3359003..1367b335a4 100644 --- a/cpp/src/barrier/barrier.cu +++ b/cpp/src/barrier/barrier.cu @@ -574,10 +574,10 @@ class iteration_data_t { cone_combined_step_(false), cone_sigma_mu_(f_t(0)) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: LP Data Creation"); + raft::common::nvtx::range fun_scope("Barrier: LP Data Creation"); { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: direct free linear"); + raft::common::nvtx::range scope("Barrier: LP Data: direct free linear"); // Setup tracking of direct free variables (linear columns only j < cone_start) n_direct_free_linear = direct_free_variables.size(); std::vector is_direct_free_linear_host(lp.num_cols, 0); @@ -599,7 +599,7 @@ class iteration_data_t { bool has_Q = Q.x.size() > 0; indefinite_Q = false; { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: Q setup"); + raft::common::nvtx::range scope("Barrier: LP Data: Q setup"); if (has_Q) { Qdiag.resize(lp.num_cols, 0.0); @@ -640,7 +640,7 @@ class iteration_data_t { } if (!lp.second_order_cone_dims.empty()) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: SOC setup"); + raft::common::nvtx::range scope("Barrier: LP Data: SOC setup"); cone_var_start_ = lp.cone_var_start; i_t total_cone_dim = std::accumulate(lp.second_order_cone_dims.begin(), lp.second_order_cone_dims.end(), i_t(0)); @@ -660,7 +660,7 @@ class iteration_data_t { } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: complementarity buffers"); + raft::common::nvtx::range scope("Barrier: LP Data: complementarity buffers"); const i_t linear_xz_rhs_size = linear_xz_size(lp.num_cols); d_complementarity_xz_rhs_.resize(linear_xz_rhs_size, stream_view_); @@ -679,7 +679,7 @@ class iteration_data_t { } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: upper bounds"); + raft::common::nvtx::range scope("Barrier: LP Data: upper bounds"); // Create the upper bounds vector n_upper_bounds = 0; for (i_t j = 0; j < lp.num_cols; j++) { @@ -692,8 +692,7 @@ class iteration_data_t { std::vector dense_columns_unordered; { - [[maybe_unused]] raft::common::nvtx::range scope( - "Barrier: LP Data: dense columns and augmented"); + raft::common::nvtx::range scope("Barrier: LP Data: dense columns and augmented"); // Decide if we are going to use the augmented system or not n_dense_columns = 0; i_t n_dense_rows = 0; @@ -771,7 +770,7 @@ class iteration_data_t { } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: diag and inv_diag"); + raft::common::nvtx::range scope("Barrier: LP Data: diag and inv_diag"); // D = I + EET diag.set_scalar(1.0); if (n_upper_bounds > 0) { @@ -802,7 +801,7 @@ class iteration_data_t { if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: AD matrix setup"); + raft::common::nvtx::range scope("Barrier: LP Data: AD matrix setup"); // Copy A into AD AD = lp.A; if (!use_augmented && n_dense_columns > 0) { @@ -836,7 +835,7 @@ class iteration_data_t { } if (use_augmented) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSC upload"); + raft::common::nvtx::range scope("Barrier: augmented: device CSC upload"); device_A_csc_.copy(A, handle_ptr->get_stream()); device_AT_csc_.copy(AT, handle_ptr->get_stream()); if (Q.n > 0 && Q.col_start[Q.n] > 0) { @@ -849,7 +848,7 @@ class iteration_data_t { // device_AD / device_A / ADAT path is only used when forming ADAT (!use_augmented). if (!use_augmented) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: device AD path"); + raft::common::nvtx::range scope("Barrier: LP Data: device AD path"); device_AD.copy(AD, handle_ptr->get_stream()); d_original_A_values.resize(device_AD.x.size(), handle_ptr->get_stream()); raft::copy(d_original_A_values.data(), @@ -864,7 +863,7 @@ class iteration_data_t { if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: Cholesky init"); + raft::common::nvtx::range scope("Barrier: LP Data: Cholesky init"); i_t factorization_size = use_augmented ? augmented_system_size(lp.num_cols, lp.num_rows) : lp.num_rows; chol = std::make_unique>( @@ -873,12 +872,12 @@ class iteration_data_t { } if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: LP Data: symbolic analysis"); + raft::common::nvtx::range scope("Barrier: LP Data: symbolic analysis"); // Perform symbolic analysis symbolic_status = 0; if (use_augmented) { { - [[maybe_unused]] raft::common::nvtx::range form_scope("Barrier: LP Data: form augmented"); + raft::common::nvtx::range form_scope("Barrier: LP Data: form augmented"); // Build the sparsity pattern of the augmented system form_augmented(true); } @@ -886,7 +885,7 @@ class iteration_data_t { symbolic_status = chol->analyze(device_augmented); } else { { - [[maybe_unused]] raft::common::nvtx::range form_scope("Barrier: LP Data: form ADAT"); + raft::common::nvtx::range form_scope("Barrier: LP Data: form ADAT"); form_adat(true); } if (settings.concurrent_halt != nullptr && *settings.concurrent_halt == 1) { return; } @@ -905,7 +904,7 @@ class iteration_data_t { settings_ = settings; { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: reset diagonal scaling"); + raft::common::nvtx::range fun_scope("Barrier: reset diagonal scaling"); const bool has_Q = Q.n > 0; const bool has_soc = has_cones(); const bool adaptive_reg = should_use_adaptive_regularization(settings, has_soc); @@ -1023,7 +1022,7 @@ class iteration_data_t { i_t factorization_size = augmented_system_size(n, m); if (first_call) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR build"); + raft::common::nvtx::range scope("Barrier: augmented: device CSR build"); const size_t n_sparse_cone_entries = has_soc && p > 0 ? cones().n_sparse_cone_entries : size_t{0}; @@ -1149,19 +1148,19 @@ class iteration_data_t { void form_adat(bool first_call = false) { handle_ptr->sync_stream(); - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: Form ADAT"); + raft::common::nvtx::range fun_scope("Barrier: Form ADAT"); float64_t start_form_adat = tic(); const i_t m = AD.m; { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: restore A"); + raft::common::nvtx::range scope("Barrier: Form ADAT: restore A"); raft::copy(device_AD.x.data(), d_original_A_values.data(), d_original_A_values.size(), handle_ptr->get_stream()); } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: inv_diag prime"); + raft::common::nvtx::range scope("Barrier: Form ADAT: inv_diag prime"); if (n_dense_columns > 0) { // Adjust inv_diag d_inv_diag_prime.resize(AD.n, stream_view_); @@ -1186,7 +1185,7 @@ class iteration_data_t { "inv_diag_prime.size() != AD.n"); { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: scale AD"); + raft::common::nvtx::range scope("Barrier: Form ADAT: scale AD"); thrust::for_each_n(rmm::exec_policy(stream_view_), thrust::make_counting_iterator(0), i_t(device_AD.x.size()), @@ -1199,7 +1198,7 @@ class iteration_data_t { } if (settings_.concurrent_halt != nullptr && *settings_.concurrent_halt == 1) { return; } if (first_call) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: cusparse init"); + raft::common::nvtx::range scope("Barrier: Form ADAT: cusparse init"); try { if (!cusparse_info_) { cusparse_info_ = std::make_unique>(handle_ptr); @@ -1214,7 +1213,7 @@ class iteration_data_t { if (settings_.concurrent_halt != nullptr && *settings_.concurrent_halt == 1) { return; } { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: Form ADAT: ADAT multiply"); + raft::common::nvtx::range scope("Barrier: Form ADAT: ADAT multiply"); multiply_kernels(handle_ptr, device_A, device_AD, device_ADAT, spgemm_info()); handle_ptr->sync_stream(); } @@ -1972,7 +1971,7 @@ class iteration_data_t { cusparse_view_t& cusparse_view, const rmm::device_uvector& d_inv_diag) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: gpu_adat_multiply"); + raft::common::nvtx::range fun_scope("Barrier: gpu_adat_multiply"); const i_t m = A.m; const i_t n = A.n; @@ -2065,7 +2064,7 @@ class iteration_data_t { f_t beta, rmm::device_uvector& y) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: augmented_multiply"); + raft::common::nvtx::range fun_scope("Barrier: augmented_multiply"); const i_t m = A.m; const i_t n = A.n; const bool has_soc = has_cones(); @@ -2090,8 +2089,7 @@ class iteration_data_t { // r1 <- D * x_1 on linear indices; barrier D is zero on direct free variables const i_t linear_n = has_soc ? cone_start() : n; { - [[maybe_unused]] raft::common::nvtx::range scope( - "Barrier: augmented_multiply: D * x1 (linear)"); + raft::common::nvtx::range scope("Barrier: augmented_multiply: D * x1 (linear)"); pairwise_multiply_skip_direct_free_linear(d_aug_x1_.data(), d_diag_.data(), d_is_direct_free_linear_.data(), @@ -2105,8 +2103,7 @@ class iteration_data_t { // (dense cones: explicit dense H block; sparse cones: rank-2 expansion, which adds // Hs_diag .* x_cone to r1 here and writes the expansion rows into d_aug_y_exp_) if (has_soc) { - [[maybe_unused]] raft::common::nvtx::range scope( - "Barrier: augmented_multiply: cone Hessian (H * x1)"); + raft::common::nvtx::range scope("Barrier: augmented_multiply: cone Hessian (H * x1)"); const i_t m_c = cone_entry_count(); if (cones().has_sparse_cones()) { launch_sparse_augmented_matvec( @@ -2134,14 +2131,13 @@ class iteration_data_t { // r1 <- Q x1 + D x1 + H x1 (cone: same H as above) if (Q.n > 0) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented_multiply: Q * x1"); + raft::common::nvtx::range scope("Barrier: augmented_multiply: Q * x1"); // matrix_vector_multiply(Q, 1.0, x1, 1.0, r1); cusparse_Q_view_.spmv(1.0, d_aug_x1_, 1.0, d_r1_); } { - [[maybe_unused]] raft::common::nvtx::range scope( - "Barrier: augmented_multiply: A products (A^T x2, A x1)"); + raft::common::nvtx::range scope("Barrier: augmented_multiply: A products (A^T x2, A x1)"); // y1 <- - alpha * r1 + beta * y1 // flip the sign of r1 = (Q x1 + D x1 + H x1) axpy(-alpha, d_r1_.data(), beta, d_aug_y1_.data(), d_aug_y1_.data(), n, stream_view_); @@ -2465,7 +2461,7 @@ void barrier_solver_t::create_Q(const lp_problem_t& lp, template int barrier_solver_t::initial_point(iteration_data_t& data) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: initial_point"); + raft::common::nvtx::range fun_scope("Barrier: initial_point"); const bool use_augmented = data.use_augmented; const bool has_direct_free_linear = data.n_direct_free_linear > 0; @@ -2808,7 +2804,7 @@ void barrier_solver_t::gpu_compute_residuals(const rmm::device_uvector const rmm::device_uvector& d_z, iteration_data_t& data) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: GPU compute_residuals"); + raft::common::nvtx::range fun_scope("Barrier: GPU compute_residuals"); data.d_primal_residual_.resize(lp.num_rows, stream_view_); raft::copy(data.d_primal_residual_.data(), data.d_b_.data(), data.d_b_.size(), stream_view_); @@ -2911,7 +2907,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t(data.d_x_.data() + cone_var_start, m_c); cones.z = raft::device_span(data.d_z_.data() + cone_var_start, m_c); @@ -2963,8 +2959,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_tfactorize(data.device_augmented); } @@ -3075,7 +3070,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_tfactorize(data.device_ADAT); } } @@ -3106,7 +3101,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t 0) { @@ -3141,7 +3136,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t( op, data.d_augmented_rhs_, data.d_augmented_soln_, ir_tol); @@ -3214,7 +3209,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t( @@ -3374,7 +3369,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t d_dx_residual_5(lp.num_cols, stream_view_); @@ -3406,7 +3401,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t d_dx_residual_3(lp.num_cols, stream_view_); @@ -3454,7 +3449,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t d_dx_residual_7(data.d_h_, stream_view_); @@ -3483,7 +3478,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t(data.d_dz_.size()); @@ -3507,7 +3502,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t out, @@ -3542,7 +3537,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t d_dv_residual(data.n_upper_bounds, stream_view_); @@ -3591,7 +3586,7 @@ i_t barrier_solver_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t::gpu_compute_search_direction(iteration_data_t& data template void barrier_solver_t::compute_affine_rhs(iteration_data_t& data) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_affine_rhs"); + raft::common::nvtx::range fun_scope("Barrier: compute_affine_rhs"); const bool has_soc = data.has_cones(); const i_t linear_size = data.linear_xz_size(lp.num_cols); const i_t cone_var_start = data.cone_start(); @@ -3808,7 +3803,7 @@ template void barrier_solver_t::compute_target_mu( iteration_data_t& data, f_t mu, f_t& mu_aff, f_t& sigma, f_t& new_mu) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_target_mu"); + raft::common::nvtx::range fun_scope("Barrier: compute_target_mu"); const bool has_soc = data.has_cones(); const auto [primal_w, dual_v] = @@ -3912,7 +3907,7 @@ void barrier_solver_t::compute_target_mu( template void barrier_solver_t::compute_cc_rhs(iteration_data_t& data, f_t& new_mu) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_cc_rhs"); + raft::common::nvtx::range fun_scope("Barrier: compute_cc_rhs"); const bool has_soc = data.has_cones(); const i_t linear_size = data.linear_xz_size(lp.num_cols); @@ -3964,7 +3959,7 @@ void barrier_solver_t::compute_cc_rhs(iteration_data_t& data template void barrier_solver_t::compute_final_direction(iteration_data_t& data) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_final_direction"); + raft::common::nvtx::range fun_scope("Barrier: compute_final_direction"); // dw = dw_aff + dw_cc // dx = dx_aff + dx_cc @@ -4015,7 +4010,7 @@ void barrier_solver_t::compute_primal_dual_step_length(iteration_data_ f_t& step_primal, f_t& step_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_primal_dual_step_length"); + raft::common::nvtx::range fun_scope("Barrier: compute_primal_dual_step_length"); const bool has_soc = data.has_cones(); f_t max_step_primal = 0.0; @@ -4053,7 +4048,7 @@ void barrier_solver_t::compute_next_iterate(iteration_data_t f_t step_primal, f_t step_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: compute_next_iterate"); + raft::common::nvtx::range fun_scope("Barrier: compute_next_iterate"); cub::DeviceTransform::Transform( cuda::std::make_tuple(data.d_w_.data(), data.d_v_.data(), data.d_dw_.data(), data.d_dv_.data()), @@ -4114,8 +4109,7 @@ void barrier_solver_t::compute_residual_norms_mu_and_objective( f_t& primal_objective, f_t& dual_objective) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "Barrier: compute_residual_norms_mu_and_objective"); + raft::common::nvtx::range fun_scope("Barrier: compute_residual_norms_mu_and_objective"); gpu_compute_residuals(data.d_w_, data.d_x_, data.d_y_, data.d_v_, data.d_z_, data); @@ -4277,7 +4271,7 @@ lp_status_t barrier_solver_t::check_for_suboptimal_solution( f_t& relative_complementarity_residual, lp_solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: check_for_suboptimal_solution"); + raft::common::nvtx::range fun_scope("Barrier: check_for_suboptimal_solution"); if (relative_primal_residual < settings.barrier_relaxed_feasibility_tol && relative_dual_residual < settings.barrier_relaxed_optimality_tol && relative_complementarity_residual < settings.barrier_relaxed_complementarity_tol && @@ -4505,7 +4499,7 @@ lp_status_t barrier_solver_t::barrier_advanced_solve(f_t start_time, : (data.has_cones() ? 1e-8 : 1e-6); while (iter < iteration_limit) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: iteration"); + raft::common::nvtx::range fun_scope("Barrier: iteration"); if (toc(start_time) > settings.time_limit) { settings.log.printf("Barrier time limit exceeded\n"); @@ -4524,7 +4518,7 @@ lp_status_t barrier_solver_t::barrier_advanced_solve(f_t start_time, i_t status; { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: search_direction (affine)"); + raft::common::nvtx::range fun_scope("Barrier: search_direction (affine)"); status = gpu_compute_search_direction(data, dual_perturb, primal_perturb, max_affine_residual); } @@ -4565,8 +4559,7 @@ lp_status_t barrier_solver_t::barrier_advanced_solve(f_t start_time, f_t max_corrector_residual = 0.0; { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "Barrier: search_direction (corrector)"); + raft::common::nvtx::range fun_scope("Barrier: search_direction (corrector)"); status = gpu_compute_search_direction(data, dual_perturb, primal_perturb, max_corrector_residual); } @@ -4773,7 +4766,7 @@ lp_status_t barrier_solver_t::solve_with_cache( { settings.log.printf("Barrier solver started at %.2f seconds\n", toc(start_time)); try { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: solve_with_cache"); + raft::common::nvtx::range fun_scope("Barrier: solve_with_cache"); i_t n = lp.num_cols; i_t m = lp.num_rows; @@ -4830,7 +4823,7 @@ lp_status_t barrier_solver_t::solve( { settings.log.printf("Barrier solver started at %.2f seconds\n", toc(start_time)); try { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: solve"); + raft::common::nvtx::range fun_scope("Barrier: solve"); i_t n = lp.num_cols; i_t m = lp.num_rows; diff --git a/cpp/src/barrier/csr_kkt_build.cuh b/cpp/src/barrier/csr_kkt_build.cuh index f88c0a2661..6ade663c2e 100644 --- a/cpp/src/barrier/csr_kkt_build.cuh +++ b/cpp/src/barrier/csr_kkt_build.cuh @@ -512,7 +512,7 @@ void build_augmented_csr_metadata(const cone_data_t& cones, cone_kkt_data_t& metadata, cuda::stream_ref stream) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR metadata"); + raft::common::nvtx::range scope("Barrier: augmented: device CSR metadata"); const i_t n_cones = cones.n_cones; const i_t n_dense = cones.n_dense_cones(); const i_t n_sparse = cones.n_sparse_cones; @@ -648,7 +648,7 @@ i_t build_augmented_csr_on_device(i_t n, rmm::device_uvector row_nnz(factorization_size, stream); { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR count"); + raft::common::nvtx::range scope("Barrier: augmented: device CSR count"); const size_t grid = raft::ceildiv(factorization_size, augmented_csr_block_size); count_augmented_row_nnz_kernel<<>>( factorization_size, @@ -668,7 +668,7 @@ i_t build_augmented_csr_on_device(i_t n, i_t total_nnz = 0; { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR scan"); + raft::common::nvtx::range scope("Barrier: augmented: device CSR scan"); device_augmented.m = factorization_size; device_augmented.n = factorization_size; device_augmented.row_start.resize(static_cast(factorization_size) + 1, stream); @@ -712,7 +712,7 @@ i_t build_augmented_csr_on_device(i_t n, cone_data.dense_cone_diag_csr_indices, std::max(0, n_dense_entries), i_t(-1)); { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier: augmented: device CSR fill"); + raft::common::nvtx::range scope("Barrier: augmented: device CSR fill"); auto views = make_cone_kkt_views(cone_data, augmented_diagonal_indices); const size_t grid = raft::ceildiv(factorization_size, augmented_csr_block_size); fill_augmented_csr_row_kernel<<>>( diff --git a/cpp/src/barrier/sparse_cholesky.cuh b/cpp/src/barrier/sparse_cholesky.cuh index 160805698d..51fdd6d6bc 100644 --- a/cpp/src/barrier/sparse_cholesky.cuh +++ b/cpp/src/barrier/sparse_cholesky.cuh @@ -437,7 +437,7 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { i_t analyze(device_csr_matrix_t& Arow) override { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze"); + raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze"); #ifdef WRITE_MATRIX_MARKET { @@ -478,13 +478,12 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { } if (!first_factor) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : Destroy"); + raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : Destroy"); CUDSS_CALL_AND_CHECK(cudssMatrixDestroy(A), status, "cudssMatrixDestroy for A"); } { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "Barrier: cuDSS Analyze : cudssMatrixCreateCsr"); + raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : cudssMatrixCreateCsr"); #if CUDSS_VERSION_MAJOR > 0 || (CUDSS_VERSION_MAJOR == 0 && CUDSS_VERSION_MINOR >= 8) CUDSS_CALL_AND_CHECK( cudssMatrixCreateCsr(&A, @@ -529,8 +528,7 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { f_t start_symbolic_factor; { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "Barrier: cuDSS Analyze : CUDSS_PHASE_ANALYSIS"); + raft::common::nvtx::range fun_scope("Barrier: cuDSS Analyze : CUDSS_PHASE_ANALYSIS"); status = cudssExecute(handle, CUDSS_PHASE_REORDERING, solverConfig, solverData, A, cudss_x, cudss_b); if (settings_.concurrent_halt != nullptr && *settings_.concurrent_halt == 1) { @@ -584,7 +582,7 @@ class sparse_cholesky_cudss_t : public sparse_cholesky_base_t { } i_t factorize(device_csr_matrix_t& Arow) override { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Factorize: cuDSS"); + raft::common::nvtx::range fun_scope("Factorize: cuDSS"); if (!symbolic_done_ || !A_created) { settings_.log.printf( diff --git a/cpp/src/branch_and_bound/branch_and_bound.cpp b/cpp/src/branch_and_bound/branch_and_bound.cpp index 891bfd7270..ca630f5e26 100644 --- a/cpp/src/branch_and_bound/branch_and_bound.cpp +++ b/cpp/src/branch_and_bound/branch_and_bound.cpp @@ -768,7 +768,7 @@ bool branch_and_bound_t::repair_solution(const std::vector& edge_ template void branch_and_bound_t::repair_heuristic_solutions() { - [[maybe_unused]] raft::common::nvtx::range scope("BB::repair_heuristics"); + raft::common::nvtx::range scope("BB::repair_heuristics"); // Check if there are any solutions to repair std::vector> to_repair; mutex_repair_.lock(); @@ -1566,7 +1566,7 @@ dual_status_t branch_and_bound_t::solve_node_lp( logger_t& log, int64_t iter_limit) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::solve_node"); + raft::common::nvtx::range scope("BB::solve_node"); #ifdef DEBUG_BRANCHING i_t num_integer_variables = 0; for (i_t j = 0; j < original_lp_.num_cols; j++) { @@ -2100,7 +2100,7 @@ template void branch_and_bound_t::dive_with(diving_worker_t* worker, const simplex_solver_settings_t& settings) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::diving_thread"); + raft::common::nvtx::range scope("BB::diving_thread"); if (worker->orbital_fixing) { worker->orbital_fixing->disable(); } logger_t log; log.log = false; @@ -2706,7 +2706,7 @@ template void branch_and_bound_t::recursive_submip( diving_worker_t* worker, simplex_solver_settings_t submip_settings) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::submip_thread"); + raft::common::nvtx::range scope("BB::submip_thread"); if (worker->orbital_fixing) { worker->orbital_fixing->disable(); } i_t submip_level = settings_.submip_settings.level + 1; @@ -3623,7 +3623,7 @@ auto branch_and_bound_t::do_cut_pass( template mip_status_t branch_and_bound_t::solve(mip_solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::solve"); + raft::common::nvtx::range scope("BB::solve"); logger_t log; log.log = false; @@ -3642,7 +3642,7 @@ mip_status_t branch_and_bound_t::solve(mip_solution_t& solut original_lp_, settings_, var_types_, Arow_, new_slacks_); if (guess_.size() != 0) { - [[maybe_unused]] raft::common::nvtx::range scope_guess("BB::check_initial_guess"); + raft::common::nvtx::range scope_guess("BB::check_initial_guess"); std::vector crushed_guess; crush_primal_solution(original_problem_, original_lp_, guess_, new_slacks_, crushed_guess); f_t primal_err; @@ -3972,7 +3972,7 @@ mip_status_t branch_and_bound_t::solve(mip_solution_t& solut pc_.Arow = Arow_; if (!has_initial_pseudocost_) { - [[maybe_unused]] raft::common::nvtx::range scope_sb("BB::strong_branching"); + raft::common::nvtx::range scope_sb("BB::strong_branching"); strong_branching(original_lp_, settings_, exploration_stats_.start_time, @@ -4302,7 +4302,7 @@ global pseudocosts are broadcast to the worker's pseudocost snapshots for the co template void branch_and_bound_t::run_deterministic_coordinator(const csr_matrix_t& Arow) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::deterministic_coordinator"); + raft::common::nvtx::range scope("BB::deterministic_coordinator"); deterministic_horizon_step_ = 0.50; @@ -4472,7 +4472,7 @@ template void branch_and_bound_t::run_deterministic_bfs_loop( deterministic_bfs_worker_t& worker, search_tree_t& search_tree) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::worker_loop"); + raft::common::nvtx::range scope("BB::worker_loop"); while (deterministic_global_termination_status_ == mip_status_t::UNSET) { if (worker.has_work()) { @@ -4510,7 +4510,7 @@ void branch_and_bound_t::run_deterministic_bfs_loop( template void branch_and_bound_t::deterministic_sync_callback() { - [[maybe_unused]] raft::common::nvtx::range scope("BB::deterministic_sync_callback"); + raft::common::nvtx::range scope("BB::deterministic_sync_callback"); ++deterministic_horizon_number_; double horizon_end = deterministic_current_horizon_; @@ -4667,7 +4667,7 @@ node_status_t branch_and_bound_t::solve_node_deterministic( mip_node_t* node_ptr, search_tree_t& search_tree) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::solve_node_deterministic"); + raft::common::nvtx::range scope("BB::solve_node_deterministic"); double work_units_at_start = worker.work_context.global_work_units_elapsed; @@ -4696,7 +4696,7 @@ node_status_t branch_and_bound_t::solve_node_deterministic( bool feasible = true; #ifndef DETERMINISM_DISABLE_BOUNDS_STRENGTHENING - [[maybe_unused]] raft::common::nvtx::range scope_bs("BB::bound_strengthening"); + raft::common::nvtx::range scope_bs("BB::bound_strengthening"); feasible = worker.node_presolver.bounds_strengthening( lp_settings, worker.bounds_changed, worker.leaf_problem.lower, worker.leaf_problem.upper); @@ -5231,7 +5231,7 @@ template void branch_and_bound_t::run_deterministic_diving_loop( deterministic_diving_worker_t& worker) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::diving_worker_loop"); + raft::common::nvtx::range scope("BB::diving_worker_loop"); while (deterministic_global_termination_status_ == mip_status_t::UNSET) { // Process dives from queue until empty or horizon exhausted @@ -5253,7 +5253,7 @@ template void branch_and_bound_t::deterministic_dive( deterministic_diving_worker_t& worker, dive_queue_entry_t entry) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::deterministic_dive"); + raft::common::nvtx::range scope("BB::deterministic_dive"); worker.dive_lower = std::move(entry.resolved_lower); worker.dive_upper = std::move(entry.resolved_upper); diff --git a/cpp/src/branch_and_bound/mip_node.hpp b/cpp/src/branch_and_bound/mip_node.hpp index be5a47c8aa..3e291124c3 100644 --- a/cpp/src/branch_and_bound/mip_node.hpp +++ b/cpp/src/branch_and_bound/mip_node.hpp @@ -376,7 +376,7 @@ class search_tree_t { void update(mip_node_t* node_ptr, node_status_t status) { - [[maybe_unused]] std::lock_guard lock(mutex); + std::lock_guard lock(mutex); std::vector*> stack; node_ptr->set_status(status, stack); remove_fathomed_nodes(stack); diff --git a/cpp/src/branch_and_bound/pseudo_costs.cpp b/cpp/src/branch_and_bound/pseudo_costs.cpp index 362f874a51..d5f34584ed 100644 --- a/cpp/src/branch_and_bound/pseudo_costs.cpp +++ b/cpp/src/branch_and_bound/pseudo_costs.cpp @@ -322,7 +322,7 @@ void strong_branch_helper(i_t start, shared_strong_branching_context_view_t& sb_view, omp_atomic_t& num_strong_branches_completed) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::strong_branch_helper"); + raft::common::nvtx::range scope("BB::strong_branch_helper"); lp_problem_t child_problem = original_lp; constexpr bool verbose = false; @@ -1027,7 +1027,7 @@ void strong_branching_reduced(const lp_problem_t& original_lp, std::vector& strong_branch_up, pseudo_costs_t& pc) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::strong_branching"); + raft::common::nvtx::range scope("BB::strong_branching"); pc.resize(original_lp.num_cols); strong_branch_down.assign(fractional.size(), std::numeric_limits::quiet_NaN()); @@ -1509,7 +1509,7 @@ template i_t pseudo_costs_t::variable_selection(const std::vector& fractional, const std::vector& solution) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::pseudocost_branching"); + raft::common::nvtx::range scope("BB::pseudocost_branching"); i_t branch_var = fractional[0]; f_t max_score = -1; @@ -1547,7 +1547,7 @@ i_t pseudo_costs_t::reliable_variable_selection( const std::vector& new_slacks, const lp_problem_t& original_lp) { - [[maybe_unused]] raft::common::nvtx::range scope("BB::reliability_branching"); + raft::common::nvtx::range scope("BB::reliability_branching"); constexpr f_t eps = 1e-6; f_t start_time = bnb_stats.start_time; diff --git a/cpp/src/dual_simplex/basis_solves.cpp b/cpp/src/dual_simplex/basis_solves.cpp index 3ba98a6003..f3de934cff 100644 --- a/cpp/src/dual_simplex/basis_solves.cpp +++ b/cpp/src/dual_simplex/basis_solves.cpp @@ -170,7 +170,7 @@ i_t factorize_basis(const csc_matrix_t& A, std::vector& slacks_needed, f_t& work_estimate) { - [[maybe_unused]] raft::common::nvtx::range scope("LU::factorize_basis"); + raft::common::nvtx::range scope("LU::factorize_basis"); const i_t m = basic_list.size(); constexpr f_t medium_tol = 1e-12; @@ -858,7 +858,7 @@ i_t b_transpose_solve(const csc_matrix_t& L, // U'*r = c // L'*w = r - [[maybe_unused]] raft::common::nvtx::range scope("LU::b_transpose_solve"); + raft::common::nvtx::range scope("LU::b_transpose_solve"); f_t work_estimate = 0; // Solve for r such that U'*r = c diff --git a/cpp/src/dual_simplex/basis_updates.cpp b/cpp/src/dual_simplex/basis_updates.cpp index b6ac6d8043..126c4a117d 100644 --- a/cpp/src/dual_simplex/basis_updates.cpp +++ b/cpp/src/dual_simplex/basis_updates.cpp @@ -36,7 +36,7 @@ i_t basis_update_t::b_solve(const std::vector& rhs, std::vector& solution, std::vector& Lsol) const { - [[maybe_unused]] raft::common::nvtx::range scope("LU::b_solve"); + raft::common::nvtx::range scope("LU::b_solve"); [[maybe_unused]] const i_t m = L0_.m; assert(row_permutation_.size() == m); assert(rhs.size() == m); @@ -88,7 +88,7 @@ template i_t basis_update_t::b_transpose_solve(const std::vector& rhs, std::vector& solution) const { - [[maybe_unused]] raft::common::nvtx::range scope("LU::b_transpose_solve"); + raft::common::nvtx::range scope("LU::b_transpose_solve"); // Observe that // P*B = L*U // B'*P' = U'*L' @@ -2348,7 +2348,7 @@ int basis_update_mpf_t::refactor_basis( std::vector& nonbasic_list, std::vector& vstatus) { - [[maybe_unused]] raft::common::nvtx::range scope("LU::refactor_basis"); + raft::common::nvtx::range scope("LU::refactor_basis"); std::vector deficient; std::vector slacks_needed; std::vector superbasic_list; // Empty superbasic list diff --git a/cpp/src/dual_simplex/crossover.cpp b/cpp/src/dual_simplex/crossover.cpp index 74912696c2..088a9c449a 100644 --- a/cpp/src/dual_simplex/crossover.cpp +++ b/cpp/src/dual_simplex/crossover.cpp @@ -85,7 +85,7 @@ f_t dual_infeasibility(const lp_problem_t& lp, const std::vector& vstatus, const std::vector& z) { - [[maybe_unused]] raft::common::nvtx::range scope("DualSimplex::dual_infeasibility"); + raft::common::nvtx::range scope("DualSimplex::dual_infeasibility"); const i_t n = lp.num_cols; [[maybe_unused]] const i_t m = lp.num_rows; i_t num_infeasible = 0; @@ -1218,7 +1218,7 @@ crossover_status_t crossover(const lp_problem_t& lp, lp_solution_t& solution, std::vector& vstatus) { - [[maybe_unused]] raft::common::nvtx::range scope("Barrier::crossover"); + raft::common::nvtx::range scope("Barrier::crossover"); const i_t m = lp.num_rows; const i_t n = lp.num_cols; f_t crossover_start = tic(); diff --git a/cpp/src/dual_simplex/initial_basis.cpp b/cpp/src/dual_simplex/initial_basis.cpp index fef06578ce..e75bad0e67 100644 --- a/cpp/src/dual_simplex/initial_basis.cpp +++ b/cpp/src/dual_simplex/initial_basis.cpp @@ -108,7 +108,7 @@ i_t initial_basis_selection(const lp_problem_t& problem, std::vector& vstatus, std::vector& dependent_rows) { - [[maybe_unused]] raft::common::nvtx::range scope("DualSimplex::initial_basis"); + raft::common::nvtx::range scope("DualSimplex::initial_basis"); i_t m = problem.num_rows; i_t n = problem.num_cols; i_t nz = problem.A.col_start[n]; diff --git a/cpp/src/dual_simplex/right_looking_lu.cpp b/cpp/src/dual_simplex/right_looking_lu.cpp index 548bf8f626..63cff5abb5 100644 --- a/cpp/src/dual_simplex/right_looking_lu.cpp +++ b/cpp/src/dual_simplex/right_looking_lu.cpp @@ -819,7 +819,7 @@ i_t right_looking_lu(const csc_matrix_t& A, std::vector& pinv, f_t& work_estimate) { - [[maybe_unused]] raft::common::nvtx::range scope("LU::right_looking_lu"); + raft::common::nvtx::range scope("LU::right_looking_lu"); const i_t n = column_list.size(); const i_t m = A.m; @@ -1682,7 +1682,7 @@ i_t right_looking_ldlt(const csc_matrix_t& A, std::vector& D, f_t& work_estimate) { - [[maybe_unused]] raft::common::nvtx::range scope("LU::right_looking_ldlt"); + raft::common::nvtx::range scope("LU::right_looking_ldlt"); const i_t n = A.n; const i_t input_nnz = A.nnz(); assert(A.m == n); diff --git a/cpp/src/dual_simplex/solve.cpp b/cpp/src/dual_simplex/solve.cpp index 3fd1d34476..abaf981cf6 100644 --- a/cpp/src/dual_simplex/solve.cpp +++ b/cpp/src/dual_simplex/solve.cpp @@ -173,7 +173,7 @@ lp_status_t solve_linear_program_advanced(const lp_problem_t& original std::vector& edge_norms, work_limit_context_t* work_unit_context) { - [[maybe_unused]] raft::common::nvtx::range scope("DualSimplex::solve_lp"); + raft::common::nvtx::range scope("DualSimplex::solve_lp"); const i_t m = original_lp.num_rows; [[maybe_unused]] const i_t n = original_lp.num_cols; assert(m <= n); @@ -211,7 +211,7 @@ lp_status_t solve_linear_program_with_advanced_basis( presolve_info_t presolve_info; i_t ok; { - [[maybe_unused]] raft::common::nvtx::range scope_presolve("DualSimplex::presolve"); + raft::common::nvtx::range scope_presolve("DualSimplex::presolve"); ok = presolve(original_lp, settings, presolved_lp, presolve_info); } if (ok == CONCURRENT_HALT_RETURN) { return lp_status_t::CONCURRENT_LIMIT; } @@ -232,7 +232,7 @@ lp_status_t solve_linear_program_with_advanced_basis( std::vector column_scales; std::vector row_scales_simplex; { - [[maybe_unused]] raft::common::nvtx::range scope_scaling("DualSimplex::scaling"); + raft::common::nvtx::range scope_scaling("DualSimplex::scaling"); scaling(presolved_lp, settings, lp, column_scales, row_scales_simplex); } assert(presolved_lp.num_cols == lp.num_cols); @@ -262,7 +262,7 @@ lp_status_t solve_linear_program_with_advanced_basis( edge_norms.clear(); dual_status_t phase1_status; { - [[maybe_unused]] raft::common::nvtx::range scope_phase1("DualSimplex::phase1"); + raft::common::nvtx::range scope_phase1("DualSimplex::phase1"); phase1_status = dual_phase2(1, 1, start_time, diff --git a/cpp/src/grpc/client/grpc_client.cpp b/cpp/src/grpc/client/grpc_client.cpp index 733919da75..fd5c20f5c8 100644 --- a/cpp/src/grpc/client/grpc_client.cpp +++ b/cpp/src/grpc/client/grpc_client.cpp @@ -141,7 +141,7 @@ grpc_client_t::~grpc_client_t() // std::terminate — defeating the purpose of catching at all. stop_logs_.store(true); try { - [[maybe_unused]] std::lock_guard lk(log_context_mutex_); + std::lock_guard lk(log_context_mutex_); if (active_log_context_) { static_cast(active_log_context_)->TryCancel(); } @@ -285,7 +285,7 @@ void grpc_client_t::start_log_streaming(const std::string& job_id) if (log_thread_ && log_thread_->joinable()) { stop_logs_.store(true); { - [[maybe_unused]] std::lock_guard lk(log_context_mutex_); + std::lock_guard lk(log_context_mutex_); if (active_log_context_) { static_cast(active_log_context_)->TryCancel(); } @@ -312,7 +312,7 @@ void grpc_client_t::stop_log_streaming() // Cancel the in-flight streaming RPC so reader->Read() returns false // immediately instead of blocking until the server sends a message. { - [[maybe_unused]] std::lock_guard lk(log_context_mutex_); + std::lock_guard lk(log_context_mutex_); if (active_log_context_) { static_cast(active_log_context_)->TryCancel(); } @@ -561,7 +561,7 @@ bool grpc_client_t::stream_logs( // another thread. The mutex ensures the pointer is never dangling: // we clear it under the same lock before `context` goes out of scope. { - [[maybe_unused]] std::lock_guard lk(log_context_mutex_); + std::lock_guard lk(log_context_mutex_); active_log_context_ = &context; } @@ -583,7 +583,7 @@ bool grpc_client_t::stream_logs( auto status = reader->Finish(); { - [[maybe_unused]] std::lock_guard lk(log_context_mutex_); + std::lock_guard lk(log_context_mutex_); active_log_context_ = nullptr; } diff --git a/cpp/src/grpc/client/solve_remote.cpp b/cpp/src/grpc/client/solve_remote.cpp index 3ccee0f5ae..74b5a7702c 100644 --- a/cpp/src/grpc/client/solve_remote.cpp +++ b/cpp/src/grpc/client/solve_remote.cpp @@ -82,7 +82,7 @@ std::unique_ptr> solve_lp_remote( cpu_optimization_problem_t const& cpu_problem, pdlp_solver_settings_t const& settings) { - [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); + init_logger_t log(settings.log_file, settings.log_to_console); CUOPT_LOG_INFO("Using remote GPU backend"); @@ -142,7 +142,7 @@ std::unique_ptr> solve_mip_remote( cpu_optimization_problem_t const& cpu_problem, mip_solver_settings_t const& settings) { - [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); + init_logger_t log(settings.log_file, settings.log_to_console); CUOPT_LOG_INFO("Using remote GPU backend"); diff --git a/cpp/src/grpc/server/grpc_job_management.cpp b/cpp/src/grpc/server/grpc_job_management.cpp index d027914241..d35840cc92 100644 --- a/cpp/src/grpc/server/grpc_job_management.cpp +++ b/cpp/src/grpc/server/grpc_job_management.cpp @@ -16,7 +16,7 @@ bool send_job_data_pipe(int worker_idx, const std::vector& data) { int fd; { - [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); + std::lock_guard lock(worker_pipes_mutex); if (worker_idx < 0 || worker_idx >= static_cast(worker_pipes.size())) { return false; } fd = worker_pipes[worker_idx].to_worker_fd; } @@ -98,12 +98,12 @@ std::pair submit_job_async(std::vector&& request_dat job_queue[slot].worker_pid = 0; { - [[maybe_unused]] std::lock_guard lock(pending_data_mutex); + std::lock_guard lock(pending_data_mutex); pending_job_data[job_id] = std::move(request_data); } { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); JobInfo info; info.job_id = job_id; info.status = JobStatus::QUEUED; @@ -153,12 +153,12 @@ std::pair submit_chunked_job_async(PendingChunkedUpload&& chu job_queue[slot].worker_pid = 0; { - [[maybe_unused]] std::lock_guard lock(pending_data_mutex); + std::lock_guard lock(pending_data_mutex); pending_chunked_data[job_id] = std::move(chunked_data); } { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); JobInfo info; info.job_id = job_id; info.status = JobStatus::QUEUED; @@ -180,7 +180,7 @@ std::pair submit_chunked_job_async(PendingChunkedUpload&& chu JobStatus check_job_status(const std::string& job_id, std::string& message) { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { @@ -232,7 +232,7 @@ void delete_log_file(const std::string& job_id) int cancel_job(const std::string& job_id, JobStatus& job_status_out, std::string& message) { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { @@ -295,12 +295,12 @@ int cancel_job(const std::string& job_id, JobStatus& job_status_out, std::string delete_log_file(job_id); { - [[maybe_unused]] std::lock_guard wlock(waiters_mutex); + std::lock_guard wlock(waiters_mutex); auto wit = waiting_threads.find(job_id); if (wit != waiting_threads.end()) { auto waiter = wit->second; { - [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); + std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = "Job cancelled by user"; waiter->success = false; waiter->ready = true; @@ -325,12 +325,12 @@ int cancel_job(const std::string& job_id, JobStatus& job_status_out, std::string message = "Job cancelled"; { - [[maybe_unused]] std::lock_guard wlock(waiters_mutex); + std::lock_guard wlock(waiters_mutex); auto wit = waiting_threads.find(job_id); if (wit != waiting_threads.end()) { auto waiter = wit->second; { - [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); + std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = "Job cancelled by user"; waiter->success = false; waiter->ready = true; @@ -357,12 +357,12 @@ bool delete_job(const std::string& job_id, std::string& message) } { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); job_tracker.erase(job_id); } { - [[maybe_unused]] std::lock_guard lock(pending_data_mutex); + std::lock_guard lock(pending_data_mutex); pending_job_data.erase(job_id); pending_chunked_data.erase(job_id); } diff --git a/cpp/src/grpc/server/grpc_server_main.cpp b/cpp/src/grpc/server/grpc_server_main.cpp index 73a50ca170..d307f5ede0 100644 --- a/cpp/src/grpc/server/grpc_server_main.cpp +++ b/cpp/src/grpc/server/grpc_server_main.cpp @@ -277,7 +277,7 @@ int main(int argc, char** argv) spawn_workers(); { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); bool any_worker = false; for (pid_t pid : worker_pids) { if (pid > 0) { diff --git a/cpp/src/grpc/server/grpc_server_threads.cpp b/cpp/src/grpc/server/grpc_server_threads.cpp index 2f724074c8..4f8a2d44d4 100644 --- a/cpp/src/grpc/server/grpc_server_threads.cpp +++ b/cpp/src/grpc/server/grpc_server_threads.cpp @@ -24,7 +24,7 @@ void worker_monitor_thread() std::vector dead; { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); for (size_t i = 0; i < worker_pids.size(); ++i) { pid_t pid = worker_pids[i]; if (pid <= 0) continue; @@ -62,7 +62,7 @@ void worker_monitor_thread() pid_t new_pid = spawn_single_worker(static_cast(dw.index)); { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); if (dw.index < worker_pids.size() && worker_pids[dw.index] == 0) { worker_pids[dw.index] = (new_pid > 0) ? new_pid : 0; } @@ -101,7 +101,7 @@ void result_retrieval_thread() if (is_chunked) { PendingChunkedUpload chunked; { - [[maybe_unused]] std::lock_guard lock(pending_data_mutex); + std::lock_guard lock(pending_data_mutex); auto it = pending_chunked_data.find(job_id); if (it != pending_chunked_data.end()) { chunked = std::move(it->second); @@ -112,7 +112,7 @@ void result_retrieval_thread() if (has_data) { int to_fd; { - [[maybe_unused]] std::lock_guard wpl(worker_pipes_mutex); + std::lock_guard wpl(worker_pipes_mutex); to_fd = worker_pipes[worker_idx].to_worker_fd; } auto pipe_t0 = std::chrono::steady_clock::now(); @@ -155,7 +155,7 @@ void result_retrieval_thread() } else { std::vector job_data; { - [[maybe_unused]] std::lock_guard lock(pending_data_mutex); + std::lock_guard lock(pending_data_mutex); auto it = pending_job_data.find(job_id); if (it != pending_job_data.end()) { job_data = std::move(it->second); @@ -229,7 +229,7 @@ void result_retrieval_thread() } int from_fd; { - [[maybe_unused]] std::lock_guard wpl(worker_pipes_mutex); + std::lock_guard wpl(worker_pipes_mutex); from_fd = worker_pipes[worker_idx].from_worker_fd; } auto pipe_recv_t0 = std::chrono::steady_clock::now(); @@ -260,7 +260,7 @@ void result_retrieval_thread() } { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { if (success) { @@ -302,12 +302,12 @@ void result_retrieval_thread() } { - [[maybe_unused]] std::lock_guard lock(waiters_mutex); + std::lock_guard lock(waiters_mutex); auto wit = waiting_threads.find(job_id); if (wit != waiting_threads.end()) { auto waiter = wit->second; { - [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); + std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = error_message; waiter->success = success; waiter->ready = true; @@ -343,7 +343,7 @@ void incumbent_retrieval_thread() while (keep_running) { std::vector pfds; { - [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); + std::lock_guard lock(worker_pipes_mutex); pfds.reserve(worker_pipes.size()); for (const auto& wp : worker_pipes) { if (wp.incumbent_from_worker_fd >= 0) { @@ -392,7 +392,7 @@ void incumbent_retrieval_thread() entry.assignment = std::move(assignment); { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { it->second.incumbents.push_back(std::move(entry)); @@ -427,7 +427,7 @@ void session_reaper_thread() auto now = std::chrono::steady_clock::now(); { - [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); + std::lock_guard lock(chunked_uploads_mutex); for (auto it = chunked_uploads.begin(); it != chunked_uploads.end();) { if (now - it->second.last_activity > timeout) { if (config.verbose) { @@ -441,7 +441,7 @@ void session_reaper_thread() } { - [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); + std::lock_guard lock(chunked_downloads_mutex); for (auto it = chunked_downloads.begin(); it != chunked_downloads.end();) { if (now - it->second.created > timeout) { if (config.verbose) { diff --git a/cpp/src/grpc/server/grpc_service_impl.cpp b/cpp/src/grpc/server/grpc_service_impl.cpp index ae153ce136..fe434f39fb 100644 --- a/cpp/src/grpc/server/grpc_service_impl.cpp +++ b/cpp/src/grpc/server/grpc_service_impl.cpp @@ -87,7 +87,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S } { - [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); + std::lock_guard lock(chunked_uploads_mutex); if (chunked_uploads.size() >= kMaxChunkedSessions) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Too many concurrent chunked upload sessions (limit " + @@ -118,7 +118,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S const std::string& upload_id = request->upload_id(); const auto& ac = request->chunk(); - [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); + std::lock_guard lock(chunked_uploads_mutex); auto it = chunked_uploads.find(upload_id); if (it == chunked_uploads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown upload_id: " + upload_id); @@ -237,7 +237,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // Take ownership of the upload session and remove it from the active map. ChunkedUploadState state; { - [[maybe_unused]] std::lock_guard lock(chunked_uploads_mutex); + std::lock_guard lock(chunked_uploads_mutex); auto it = chunked_uploads.find(upload_id); if (it == chunked_uploads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown upload_id: " + upload_id); @@ -312,7 +312,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S int64_t result_size_bytes = 0; if (status == JobStatus::COMPLETED) { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { result_size_bytes = it->second.result_size_bytes; } } @@ -331,7 +331,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S (void)context; std::string job_id = request->job_id(); - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { return Status(StatusCode::NOT_FOUND, "Job not found"); } @@ -404,7 +404,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // client fetch chunks at its own pace without holding the tracker lock. ChunkedDownloadState state; { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { return Status(StatusCode::NOT_FOUND, "Job not found: " + job_id); @@ -425,7 +425,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S response->set_max_message_bytes(server_max_message_bytes()); { - [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); + std::lock_guard lock(chunked_downloads_mutex); if (chunked_downloads.size() >= kMaxChunkedSessions) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Too many concurrent chunked download sessions (limit " + @@ -456,7 +456,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S int64_t elem_offset = request->element_offset(); int64_t max_elements = request->max_elements(); - [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); + std::lock_guard lock(chunked_downloads_mutex); auto it = chunked_downloads.find(download_id); if (it == chunked_downloads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown download_id: " + download_id); @@ -507,7 +507,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S std::string download_id = request->download_id(); response->set_download_id(download_id); - [[maybe_unused]] std::lock_guard lock(chunked_downloads_mutex); + std::lock_guard lock(chunked_downloads_mutex); auto it = chunked_downloads.find(download_id); if (it == chunked_downloads.end()) { return Status(StatusCode::NOT_FOUND, "Unknown download_id: " + download_id); @@ -610,7 +610,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // Fast path: if the job is already in a terminal state, return immediately. { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { response->set_job_status(cuopt::remote::NOT_FOUND); @@ -642,7 +642,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // RPCs for the same job share a single JobWaiter instance. std::shared_ptr waiter; { - [[maybe_unused]] std::lock_guard lock(waiters_mutex); + std::lock_guard lock(waiters_mutex); auto it = waiting_threads.find(job_id); if (it != waiting_threads.end()) { waiter = it->second; @@ -659,7 +659,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S // loop so that cleanup (waiters decrement) happens in one place below. bool client_cancelled = false; { - [[maybe_unused]] std::unique_lock lock(waiter->mutex); + std::unique_lock lock(waiter->mutex); while (!waiter->ready) { if (context->IsCancelled()) { client_cancelled = true; @@ -693,7 +693,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S response->set_job_status(cuopt::remote::COMPLETED); response->set_message(""); { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto job_it = job_tracker.find(job_id); response->set_result_size_bytes( (job_it != job_tracker.end()) ? job_it->second.result_size_bytes : 0); @@ -711,7 +711,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S case JobStatus::COMPLETED: { response->set_job_status(cuopt::remote::COMPLETED); response->set_message(""); - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto job_it = job_tracker.find(job_id); response->set_result_size_bytes( (job_it != job_tracker.end()) ? job_it->second.result_size_bytes : 0); @@ -873,7 +873,7 @@ class CuOptRemoteServiceImpl final : public cuopt::remote::CuOptRemoteService::S if (from_index < 0) { from_index = 0; } - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it == job_tracker.end()) { return Status(StatusCode::NOT_FOUND, "Job not found"); } diff --git a/cpp/src/grpc/server/grpc_worker_infra.cpp b/cpp/src/grpc/server/grpc_worker_infra.cpp index 911ea6f3b2..139d86b5ff 100644 --- a/cpp/src/grpc/server/grpc_worker_infra.cpp +++ b/cpp/src/grpc/server/grpc_worker_infra.cpp @@ -174,7 +174,7 @@ void close_worker_pipes_child_ends(int worker_id) pid_t spawn_worker(int worker_id, bool is_replacement) { - [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); + std::lock_guard lock(worker_pipes_mutex); if (is_replacement) { close_worker_pipes_server(worker_id); } @@ -211,7 +211,7 @@ pid_t spawn_worker(int worker_id, bool is_replacement) void spawn_workers() { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); // Index i is worker_id: keep failed startups as 0 so monitor/respawn and // pipe tables stay aligned even when some initial forks fail. worker_pids.assign(static_cast(config.num_workers), 0); @@ -223,7 +223,7 @@ void spawn_workers() void kill_all_workers() { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); for (pid_t pid : worker_pids) { if (pid > 0) { kill(pid, SIGKILL); } } @@ -231,7 +231,7 @@ void kill_all_workers() void close_all_server_worker_pipes() { - [[maybe_unused]] std::lock_guard lock(worker_pipes_mutex); + std::lock_guard lock(worker_pipes_mutex); for (auto& wp : worker_pipes) { close_all_worker_pipes(wp); } @@ -248,7 +248,7 @@ void cancel_all_active_jobs_for_shutdown() } { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); for (auto& [job_id, info] : job_tracker) { (void)job_id; if (info.status == JobStatus::QUEUED || info.status == JobStatus::PROCESSING) { @@ -259,11 +259,11 @@ void cancel_all_active_jobs_for_shutdown() } { - [[maybe_unused]] std::lock_guard wlock(waiters_mutex); + std::lock_guard wlock(waiters_mutex); for (auto& [job_id, waiter] : waiting_threads) { (void)job_id; { - [[maybe_unused]] std::lock_guard waiter_lock(waiter->mutex); + std::lock_guard waiter_lock(waiter->mutex); waiter->error_message = "Server shutting down"; waiter->success = false; waiter->ready = true; @@ -291,7 +291,7 @@ void wait_for_workers() while (std::chrono::steady_clock::now() < deadline) { bool any_alive = false; { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); for (pid_t& pid : worker_pids) { if (pid <= 0) continue; int status = 0; @@ -313,7 +313,7 @@ void wait_for_workers() } { - [[maybe_unused]] std::lock_guard lock(worker_pids_mutex); + std::lock_guard lock(worker_pids_mutex); for (pid_t pid : worker_pids) { if (pid > 0) { kill(pid, SIGKILL); @@ -352,7 +352,7 @@ void mark_worker_jobs_failed(pid_t dead_worker_pid) // 1. Drop the buffered request data (no longer needed). { - [[maybe_unused]] std::lock_guard lock(pending_data_mutex); + std::lock_guard lock(pending_data_mutex); pending_job_data.erase(job_id); } @@ -392,7 +392,7 @@ void mark_worker_jobs_failed(pid_t dead_worker_pid) job_queue[i].cancelled = false; { - [[maybe_unused]] std::lock_guard lock(tracker_mutex); + std::lock_guard lock(tracker_mutex); auto it = job_tracker.find(job_id); if (it != job_tracker.end()) { if (was_cancelled) { diff --git a/cpp/src/io/experimental_mps_fast/fast_parser.cpp b/cpp/src/io/experimental_mps_fast/fast_parser.cpp index 07130cf31d..cb2290a8c4 100644 --- a/cpp/src/io/experimental_mps_fast/fast_parser.cpp +++ b/cpp/src/io/experimental_mps_fast/fast_parser.cpp @@ -150,7 +150,7 @@ static std::mutex& get_timer_mutex() static void flush_timers() { #ifdef MPS_FAST_TIMERS - [[maybe_unused]] std::lock_guard lock(get_timer_mutex()); + std::lock_guard lock(get_timer_mutex()); auto& buffer = get_timer_buffer(); for (const auto& entry : buffer) { std::fprintf(stderr, @@ -228,7 +228,7 @@ class scoped_timer_t { nvtx_.end(); if (accumulator_) { *accumulator_ += elapsed_ms; } auto [rss_kb, hwm_kb] = current_process_rss_kb(); - [[maybe_unused]] std::lock_guard lock(get_timer_mutex()); + std::lock_guard lock(get_timer_mutex()); get_timer_buffer().push_back({name_, elapsed_ms, rss_kb, hwm_kb}); #endif } @@ -1901,7 +1901,7 @@ static void parse_columns_section_parallel(parse_state_t& state, perf_snapshots[(size_t)t] = perf_counters.stop(); #endif } catch (...) { - [[maybe_unused]] std::lock_guard lock(error_mutex); + std::lock_guard lock(error_mutex); if (!first_error) { first_error = std::current_exception(); } } } diff --git a/cpp/src/io/experimental_mps_fast/file_reader.hpp b/cpp/src/io/experimental_mps_fast/file_reader.hpp index 7175cdcff8..099cd54d27 100644 --- a/cpp/src/io/experimental_mps_fast/file_reader.hpp +++ b/cpp/src/io/experimental_mps_fast/file_reader.hpp @@ -105,7 +105,7 @@ class parallel_error_latch_t { public: void capture(std::exception_ptr eptr) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (!first_error_) { first_error_ = eptr; stopped_.store(true, std::memory_order_release); diff --git a/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp b/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp index 2615282c70..3ec0182271 100644 --- a/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp +++ b/cpp/src/io/experimental_mps_fast/lz4_file_reader.cpp @@ -402,7 +402,7 @@ std::size_t lz4_input_stream_t::reserve_size_hint() const noexcept void lz4_input_stream_t::commit_up_to(std::size_t bytes) { MPS_NVTX_RANGE("lz4_commit_output", nvtx::colors::alloc); - [[maybe_unused]] std::lock_guard lock(commit_mutex_); + std::lock_guard lock(commit_mutex_); if (bytes <= output_committed_size_) return; if (bytes > output_mapped_size_) { mps_parser_fail(error_type_t::OutOfMemoryError, "LZ4 output exceeded reserved virtual mapping"); @@ -530,7 +530,7 @@ struct lz4_pipeline_t { if (state.decode_refs.load(std::memory_order_acquire) != 0) { return; } uint8_t expected = 0; if (!state.released.compare_exchange_strong(expected, 1, std::memory_order_acq_rel)) { return; } - [[maybe_unused]] std::lock_guard lock(window_release_mutex); + std::lock_guard lock(window_release_mutex); if (windows[index].data) { windows[index].data.reset(); compressed_resident_bytes.fetch_sub(windows[index].size, std::memory_order_relaxed); @@ -576,7 +576,7 @@ struct lz4_pipeline_t { } { MPS_NVTX_RANGE("lz4_window_publish", nvtx::colors::generic); - [[maybe_unused]] std::lock_guard lock(window_mutex); + std::lock_guard lock(window_mutex); window_done[index] = 1; } window_cv.notify_all(); @@ -603,7 +603,7 @@ struct lz4_pipeline_t { std::vector wait_for_decode_batch() { MPS_NVTX_RANGE("lz4_decode_wait_batch", nvtx::colors::io); - [[maybe_unused]] std::unique_lock lock(desc_mutex); + std::unique_lock lock(desc_mutex); desc_cv.wait(lock, [&] { return latch.stopped() || scanner_done || !desc_queue.empty(); }); if (latch.stopped() || desc_queue.empty()) { return {}; } std::vector batch = std::move(desc_queue.front()); @@ -676,7 +676,7 @@ struct lz4_pipeline_t { } for (std::size_t wi = first; wi <= last; ++wi) { MPS_NVTX_RANGE("lz4_metadata_wait_window", nvtx::colors::io); - [[maybe_unused]] std::unique_lock lock(window_mutex); + std::unique_lock lock(window_mutex); window_cv.wait(lock, [&] { return latch.stopped() || window_done[wi] != 0; }); if (latch.stopped() && window_done[wi] == 0) { mps_parser_fail(error_type_t::RuntimeError, @@ -694,7 +694,7 @@ struct lz4_pipeline_t { } { MPS_NVTX_RANGE("lz4_metadata_enqueue_batch", nvtx::colors::generic); - [[maybe_unused]] std::lock_guard lock(desc_mutex); + std::lock_guard lock(desc_mutex); desc_queue.push_back(std::move(batch)); } batch.clear(); @@ -707,13 +707,13 @@ struct lz4_pipeline_t { nvtx::name_current_thread("lz4-metadata-scan"); scan_lz4_metadata(); { - [[maybe_unused]] std::lock_guard lock(desc_mutex); + std::lock_guard lock(desc_mutex); scanner_done = true; } desc_cv.notify_all(); } catch (...) { { - [[maybe_unused]] std::lock_guard lock(desc_mutex); + std::lock_guard lock(desc_mutex); scanner_done = true; } fail_and_notify(std::current_exception()); diff --git a/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp b/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp index cc52204d7c..9923d5ff90 100644 --- a/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp +++ b/cpp/src/io/experimental_mps_fast/mps_section_scanner.cpp @@ -80,7 +80,7 @@ void mps_phase_registry_t::publish(mps_phase_kind phase, mps_phase_range_t range omp_event_handle_t event{}; bool fulfill = false; { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (ready_[idx].load(std::memory_order_acquire)) { return; } ranges_[idx] = range; ready_[idx].store(true, std::memory_order_release); @@ -98,7 +98,7 @@ void mps_phase_registry_t::attach_event(mps_phase_kind phase, omp_event_handle_t std::size_t idx = phase_index(phase); bool fulfill = false; { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); events_[idx] = event; has_event_[idx] = true; if (ready_[idx].load(std::memory_order_acquire) && !event_fulfilled_[idx]) { @@ -124,7 +124,7 @@ mps_phase_range_t mps_phase_registry_t::range(mps_phase_kind phase) const void mps_phase_registry_t::publish_endata(const char* begin, bool present) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (endata_ready_.load(std::memory_order_acquire)) { return; } endata_begin_ = begin; endata_present_ = present; @@ -335,7 +335,7 @@ void mps_section_block_scanner_t::advance_ready_frontier() std::size_t new_ready = 0; bool grew = false; { - [[maybe_unused]] std::lock_guard lock(frontier_mutex_); + std::lock_guard lock(frontier_mutex_); while (next_block_ < block_count_ && block_decoded_[next_block_].load(std::memory_order_acquire)) { new_ready = block_end_offsets_[next_block_].load(std::memory_order_acquire); @@ -366,7 +366,7 @@ void mps_section_block_scanner_t::notify_ready_phases() // publish present=false once a later boundary proves they cannot still appear. // ENDATA, or final ready bytes for truncated/non-newline files, is the final // boundary for the trailing optional/quadratic phases. - [[maybe_unused]] std::lock_guard lock(publish_mutex_); + std::lock_guard lock(publish_mutex_); std::size_t ready = ready_bytes_.load(std::memory_order_acquire); const char* ready_ptr = data_ + ready; const char* rows = diff --git a/cpp/src/linear_algebra/sort_csr.cuh b/cpp/src/linear_algebra/sort_csr.cuh index 1f93b98cd6..1b57bb3163 100644 --- a/cpp/src/linear_algebra/sort_csr.cuh +++ b/cpp/src/linear_algebra/sort_csr.cuh @@ -21,7 +21,7 @@ namespace mathematical_optimization { template void sort_csr(optimization_problem_t& op_problem) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_csr"); + raft::common::nvtx::range fun_scope("sort_csr"); auto stream_view = op_problem.get_handle_ptr()->get_stream(); rmm::device_uvector d_tmp_storage_bytes(0, stream_view); size_t tmp_storage_bytes{0}; diff --git a/cpp/src/math_optimization/solution_writer.cu b/cpp/src/math_optimization/solution_writer.cu index 74c8c09ae3..c22fb46da3 100644 --- a/cpp/src/math_optimization/solution_writer.cu +++ b/cpp/src/math_optimization/solution_writer.cu @@ -22,7 +22,7 @@ void solution_writer_t::write_solution_to_sol_file(const std::string& filename, const std::vector& variable_names, const std::vector& variable_values) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("write final solution to .sol file"); + raft::common::nvtx::range fun_scope("write final solution to .sol file"); std::ofstream file(filename.data()); if (!file.is_open()) { diff --git a/cpp/src/mip_heuristics/diversity/diversity_manager.cu b/cpp/src/mip_heuristics/diversity/diversity_manager.cu index 6625c95dbc..c2c0b85f59 100644 --- a/cpp/src/mip_heuristics/diversity/diversity_manager.cu +++ b/cpp/src/mip_heuristics/diversity/diversity_manager.cu @@ -127,7 +127,7 @@ void diversity_manager_t::consume_staged_simplex_solution(lp_state_t staged_simplex_dual_solution_local; f_t staged_simplex_objective_local = std::numeric_limits::infinity(); { - [[maybe_unused]] std::lock_guard guard(relaxed_solution_mutex); + std::lock_guard guard(relaxed_solution_mutex); cuopt_assert(simplex_solution_exists.load(), "Simplex solution flag set without a staged simplex solution"); staged_simplex_solution_local = staged_simplex_solution; @@ -168,7 +168,7 @@ bool diversity_manager_t::run_local_search(solution_t& solut timer_t& timer, ls_config_t& ls_config) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_local_search"); + raft::common::nvtx::range fun_scope("run_local_search"); i_t ls_mab_option = mab_ls.select_mab_option(); mab_ls_config_t::get_local_search_and_lm_from_config(ls_mab_option, ls_config); ls_hash_map.insert(solution); @@ -181,7 +181,7 @@ bool diversity_manager_t::run_local_search(solution_t& solut template void diversity_manager_t::generate_solution(f_t time_limit, bool random_start) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_solution"); + raft::common::nvtx::range fun_scope("generate_solution"); solution_t sol(*problem_ptr); sol.compute_feasibility(); // if a feasible is found, it is added to the population @@ -193,7 +193,7 @@ template void diversity_manager_t::add_user_given_solutions( std::vector>& initial_sol_vector) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_user_given_solutions"); + raft::common::nvtx::range fun_scope("add_user_given_solutions"); const bool has_papilo = problem_ptr->has_papilo_presolve_data(); const i_t papilo_orig_n = problem_ptr->get_papilo_original_num_variables(); for (size_t sol_idx = 0; sol_idx < context.settings.initial_solutions.size(); ++sol_idx) { @@ -293,7 +293,7 @@ void diversity_manager_t::add_user_given_solutions( template bool diversity_manager_t::run_presolve(f_t time_limit, timer_t global_timer) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_presolve"); + raft::common::nvtx::range fun_scope("run_presolve"); CUOPT_LOG_INFO("\nRunning cuOpt presolve"); timer_t presolve_timer(time_limit); @@ -401,7 +401,7 @@ bool diversity_manager_t::run_presolve(f_t time_limit, timer_t global_ template void diversity_manager_t::generate_quick_feasible_solution() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_quick_feasible_solution"); + raft::common::nvtx::range fun_scope("generate_quick_feasible_solution"); solution_t solution(*problem_ptr); // min 1 second, max 10 seconds const f_t generate_fast_solution_time = @@ -476,7 +476,7 @@ struct ls_cpufj_raii_guard_t { template solution_t diversity_manager_t::run_solver() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_solver"); + raft::common::nvtx::range fun_scope("run_solver"); CUOPT_LOG_DEBUG("Determinism mode: %s", context.settings.determinism_mode == CUOPT_MODE_DETERMINISTIC ? "deterministic" @@ -599,7 +599,7 @@ solution_t diversity_manager_t::run_solver() bool use_staged_simplex_solution = false; { - [[maybe_unused]] std::lock_guard guard(relaxed_solution_mutex); + std::lock_guard guard(relaxed_solution_mutex); use_staged_simplex_solution = simplex_solution_exists.load(); if (!use_staged_simplex_solution && root_lp_usable) { raft::copy(lp_optimal_solution.data(), @@ -780,7 +780,7 @@ template void diversity_manager_t::recombine_and_ls_with_all(solution_t& solution, bool add_only_feasible) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); + raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); // if (population.population_hash_map.check_skip_solution(solution, 1)) { return; } auto population_vector = population.population_to_vector(); for (auto& curr_sol : population_vector) { @@ -813,7 +813,7 @@ template void diversity_manager_t::recombine_and_ls_with_all( std::vector>& solutions, bool add_only_feasible) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); + raft::common::nvtx::range fun_scope("recombine_and_ls_with_all"); if (solutions.size() > 0) { CUOPT_LOG_DEBUG("Running recombiners on B&B solutions with size %lu", solutions.size()); // add all solutions because time limit might have been consumed and we might have exited before @@ -867,7 +867,7 @@ diversity_manager_t::recombine_and_local_search(solution_t& solution_t& sol2, recombiner_enum_t recombiner_type) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine_and_local_search"); + raft::common::nvtx::range fun_scope("recombine_and_local_search"); CUOPT_LOG_DEBUG("Recombining sol cost:feas %f : %d and %f : %d", sol1.get_quality(population.weights), sol1.get_feasible(), @@ -1035,7 +1035,7 @@ void diversity_manager_t::set_simplex_solution(const std::vector& f_t objective) { CUOPT_LOG_DEBUG("Setting simplex solution with objective %f", objective); - [[maybe_unused]] std::lock_guard lock(relaxed_solution_mutex); + std::lock_guard lock(relaxed_solution_mutex); global_concurrent_halt = 1; cuopt_assert(lp_optimal_solution.size() == solution.size(), "Assignment size mismatch"); cuopt_assert(problem_ptr->n_constraints == dual_solution.size(), "Dual assignment size mismatch"); diff --git a/cpp/src/mip_heuristics/diversity/population.cu b/cpp/src/mip_heuristics/diversity/population.cu index 1cf38b949f..16f11b9e76 100644 --- a/cpp/src/mip_heuristics/diversity/population.cu +++ b/cpp/src/mip_heuristics/diversity/population.cu @@ -93,7 +93,7 @@ template std::pair, solution_t> population_t::get_two_random( bool tournament) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_two_random"); + raft::common::nvtx::range fun_scope("get_two_random"); cuopt_assert(indices.size() > 2, "There should be enough solutions"); size_t add = (size_t)(!solutions[0].first); size_t i = add + std::uniform_int_distribution(0, (indices.size() - 2))(rng); @@ -127,7 +127,7 @@ std::pair, solution_t> population_t::ge template void population_t::add_solutions_from_vec(std::vector>&& solutions) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_solution_from_vec"); + raft::common::nvtx::range fun_scope("add_solution_from_vec"); for (auto&& sol : solutions) { add_solution(std::move(sol)); } @@ -136,7 +136,7 @@ void population_t::add_solutions_from_vec(std::vector size_t population_t::get_external_solution_size() { - [[maybe_unused]] std::lock_guard lock(solution_mutex); + std::lock_guard lock(solution_mutex); return external_solution_queue.size(); } @@ -146,7 +146,7 @@ void population_t::add_external_solution(const std::vector& solut solution_origin_t origin) { context.solution_publication.publish_if_better(problem_ptr, solution, objective); - [[maybe_unused]] std::lock_guard lock(solution_mutex); + std::lock_guard lock(solution_mutex); if (origin == solution_origin_t::CPUFJ) { external_solution_queue_cpufj.emplace_back(solution, objective, origin); @@ -197,7 +197,7 @@ void population_t::preempt_heuristic_solver() template std::vector> population_t::get_external_solutions() { - [[maybe_unused]] std::lock_guard lock(solution_mutex); + std::lock_guard lock(solution_mutex); std::vector> return_vector; [[maybe_unused]] i_t counter = 0; f_t new_best_feasible_objective = best_feasible_objective; @@ -398,8 +398,8 @@ void population_t::adjust_weights_according_to_best_feasible() template std::pair population_t::add_solution(solution_t&& sol) { - [[maybe_unused]] std::lock_guard lock(write_mutex); - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_solution"); + std::lock_guard lock(write_mutex); + raft::common::nvtx::range fun_scope("add_solution"); // Sync the input solution's stream to ensure all device data is visible. // The solution might have been created/modified on a different stream, // and we need those operations to complete before reading device data @@ -574,7 +574,7 @@ void population_t::compute_new_weights() template void population_t::update_qualities() { - [[maybe_unused]] std::lock_guard lock(write_mutex); + std::lock_guard lock(write_mutex); if (indices.size() == 1) return; using pr = std::pair; for (size_t i = !is_feasible(); i < indices.size(); i++) @@ -590,7 +590,7 @@ void population_t::update_qualities() template void population_t::update_weights() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("adjust_weight_changes"); + raft::common::nvtx::range fun_scope("adjust_weight_changes"); CUOPT_LOG_DEBUG("Changing the weights"); compute_new_weights(); normalize_weights(); @@ -610,7 +610,7 @@ bool population_t::check_sols_similar(solution_t& sol1, template size_t population_t::best_similar_index(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("best_similar_index"); + raft::common::nvtx::range fun_scope("best_similar_index"); if (indices.size() == 1) return max_solutions; for (size_t i = 1; i < indices.size(); i++) { if (check_sols_similar(sol, solutions[indices[i].first].second)) { return i; } @@ -623,7 +623,7 @@ size_t population_t::best_similar_index(solution_t& sol) template i_t population_t::insert_index(std::pair to_insert) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_index"); + raft::common::nvtx::range fun_scope("insert_index"); // Assert free index is available indices.emplace_back(0, 0.0); size_t start = indices.size() - 1; @@ -640,7 +640,7 @@ template bool population_t::check_if_feasible_similar_exists(size_t start_index, solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_if_feasible_similar_exists"); + raft::common::nvtx::range fun_scope("check_if_feasible_similar_exists"); for (size_t i = start_index; i < indices.size(); i++) { if (check_sols_similar(sol, solutions[indices[i].first].second)) { if (solutions[indices[i].first].second.get_feasible()) { return true; } @@ -652,7 +652,7 @@ bool population_t::check_if_feasible_similar_exists(size_t start_index template void population_t::eradicate_similar(size_t start_index, solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("eradicate_similar"); + raft::common::nvtx::range fun_scope("eradicate_similar"); for (size_t i = start_index; i < indices.size(); i++) { if (check_sols_similar(sol, solutions[indices[i].first].second)) { solutions[indices[i].first].first = false; // mark place as available @@ -673,7 +673,7 @@ void population_t::eradicate_similar(size_t start_index, solution_t std::vector> population_t::population_to_vector() { - [[maybe_unused]] std::lock_guard lock(write_mutex); + std::lock_guard lock(write_mutex); if (solutions.empty()) return {}; std::vector> sol_vec; bool population_feasible = is_feasible(); @@ -686,7 +686,7 @@ std::vector> population_t::population_to_vector() template void population_t::halve_the_population() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("halve_the_population"); + raft::common::nvtx::range fun_scope("halve_the_population"); // try 3/4 here if (current_size() <= (max_solutions * halving_skip_ratio)) { return; } CUOPT_LOG_DEBUG("Halving the population, current size: %lu", current_size()); @@ -696,7 +696,7 @@ void population_t::halve_the_population() constexpr i_t max_adjustments = 4; size_t max_var_threshold = get_max_var_threshold(problem_ptr->n_integer_vars); - [[maybe_unused]] std::lock_guard lock(write_mutex); + std::lock_guard lock(write_mutex); while (current_size() > max_solutions / 2) { clear_except_best_feasible(); var_threshold = std::max(var_threshold * 0.97, 0.5 * problem_ptr->n_integer_vars); @@ -722,7 +722,7 @@ void population_t::halve_the_population() template size_t population_t::find_free_solution_index() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_free_solution_index"); + raft::common::nvtx::range fun_scope("find_free_solution_index"); // ASSERT such index exists for (size_t i = 1; i < solutions.size(); i++) if (solutions[i].first == false) return i; @@ -752,7 +752,7 @@ template void population_t::find_diversity(std::vector>& initial_sol_vector, bool avg) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_diversity"); + raft::common::nvtx::range fun_scope("find_diversity"); i_t n_feasible = 0; size_t average = 0; size_t max = 0; @@ -861,7 +861,7 @@ void population_t::run_all_recombiners(solution_t& sol) template void population_t::diversity_step(i_t max_iterations_without_improvement) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("diversity_step"); + raft::common::nvtx::range fun_scope("diversity_step"); dm.diversity_step(max_iterations_without_improvement); } diff --git a/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh index ddb116215f..2ab743b562 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh @@ -38,7 +38,7 @@ class bound_prop_recombiner_t : public recombiner_t { rmm::device_uvector>& probing_values, i_t n_vars_from_other) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_probing_values_for_infeasible"); + raft::common::nvtx::range fun_scope("get_probing_values_for_infeasible"); auto guiding_view = guiding.view(); auto other_view = other.view(); auto offspring_view = offspring.view(); @@ -102,7 +102,7 @@ class bound_prop_recombiner_t : public recombiner_t { [[maybe_unused]] i_t n_vars_from_other, rmm::device_uvector& variable_map) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_probing_values_for_feasible"); + raft::common::nvtx::range fun_scope("get_probing_values_for_feasible"); cuopt_assert(n_vars_from_other == offspring.problem_ptr->n_integer_vars, "The number of vars from other should match!"); auto guiding_view = guiding.view(); @@ -135,7 +135,7 @@ class bound_prop_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("bound_prop_recombiner"); + raft::common::nvtx::range fun_scope("bound_prop_recombiner"); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; // copy the solution from guiding @@ -197,14 +197,12 @@ class bound_prop_recombiner_t : public recombiner_t { constraint_prop.single_rounding_only = true; constraint_prop.apply_round(offspring, lp_run_time_after_feasible, timer, probing_config); constraint_prop.single_rounding_only = false; - cuopt_func_call(bool feasible_after_bounds_prop = offspring.get_feasible()); offspring.handle_ptr->sync_stream(); offspring.problem_ptr = a.problem_ptr; fixed_assignment = std::move(offspring.assignment); offspring.assignment = std::move(old_assignment); offspring.handle_ptr->sync_stream(); offspring.unfix_variables(fixed_assignment, variable_map); - cuopt_func_call(bool feasible_after_unfix = offspring.get_feasible()); // May be triggered due to numerical issues // TODO: investigate further // cuopt_assert(feasible_after_unfix == feasible_after_bounds_prop, diff --git a/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh index 90f9ffe50c..993a534a38 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/fp_recombiner.cuh @@ -39,7 +39,7 @@ class fp_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("FP recombiner"); + raft::common::nvtx::range fun_scope("FP recombiner"); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; // copy the solution from A diff --git a/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh index 1d81f39976..0cc1684b7a 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/line_segment_recombiner.cuh @@ -34,7 +34,7 @@ class line_segment_recombiner_t : public recombiner_t { i_t n_points_to_search, i_t remaining_variables) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_delta_vector"); + raft::common::nvtx::range fun_scope("generate_delta_vector"); CUOPT_LOG_DEBUG("LS rec: Number of different variables %d MAX_VARS %d", remaining_variables, ls_recombiner_config_t::max_n_of_vars_from_other); @@ -71,7 +71,7 @@ class line_segment_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("line_segment_recombiner"); + raft::common::nvtx::range fun_scope("line_segment_recombiner"); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; // copy the solution from A diff --git a/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh b/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh index af7545b577..866ea43979 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh @@ -42,7 +42,7 @@ class sub_mip_recombiner_t : public recombiner_t { solution_t& b, const weight_t& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Sub-MIP recombiner"); + raft::common::nvtx::range fun_scope("Sub-MIP recombiner"); solution_vector.clear(); auto& guiding_solution = a.get_feasible() ? a : b; auto& other_solution = a.get_feasible() ? b : a; diff --git a/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu b/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu index 22837e804b..66c97d9b7c 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/early_gpufj.cu @@ -63,7 +63,7 @@ void early_gpufj_t::start() #pragma omp task default(none) shared(fj_ptr_) priority(CUOPT_DEFAULT_TASK_PRIORITY) \ depend(out : *fj_ptr_) { - [[maybe_unused]] raft::device_setter guard(this->device_id_); + raft::device_setter guard(this->device_id_); fj_ptr_->solve(*this->solution_ptr_); } } diff --git a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu index 63e5e6b378..450019d415 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu @@ -320,7 +320,7 @@ void fj_t::climber_init(i_t climber_idx) template void fj_t::climber_init(i_t climber_idx, cuda::stream_ref climber_stream) { - [[maybe_unused]] raft::common::nvtx::range scope("climber_init"); + raft::common::nvtx::range scope("climber_init"); cuopt_assert(climber_idx >= 0 && climber_idx < climbers.size(), ""); @@ -664,7 +664,7 @@ void fj_t::run_step_device(cuda::stream_ref climber_stream, i_t climber_idx, bool use_graph) { - [[maybe_unused]] raft::common::nvtx::range scope("run_step_device"); + raft::common::nvtx::range scope("run_step_device"); auto [grid_setval, blocks_setval] = setval_launch_dims; auto [grid_update_changed_constraints, blocks_update_changed_constraints] = update_changed_constraints_launch_dims; @@ -1067,7 +1067,7 @@ void fj_t::resize_vectors(const raft::handle_t* handle_ptr) template i_t fj_t::solve(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range scope("fj_solve"); + raft::common::nvtx::range scope("fj_solve"); timer_t timer(settings.time_limit); handle_ptr = const_cast(solution.handle_ptr); pb_ptr = solution.problem_ptr; diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu index 309495ad0e..23f88f4c3d 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu @@ -1644,7 +1644,7 @@ void finalize_fj_cpu_host_initialization( i_t nnz, const typename mip_solver_settings_t::tolerances_t& tolerances) { - [[maybe_unused]] raft::common::nvtx::range scope("finalize_fj_cpu_host_initialization"); + raft::common::nvtx::range scope("finalize_fj_cpu_host_initialization"); cuopt_assert(n_variables >= 0, "invalid variable count"); cuopt_assert(n_constraints >= 0, "invalid constraint count"); @@ -1898,7 +1898,7 @@ std::unique_ptr> fj_t::create_cpu_climber( fj_settings_t settings, bool randomize_params) { - [[maybe_unused]] raft::common::nvtx::range scope("fj_cpu_init"); + raft::common::nvtx::range scope("fj_cpu_init"); auto fj_cpu = std::make_unique>(preemption_flag); @@ -2110,7 +2110,7 @@ std::unique_ptr> init_fj_cpu_standalone( uint64_t seed, fj_settings_t settings) { - [[maybe_unused]] raft::common::nvtx::range scope("init_fj_cpu_standalone"); + raft::common::nvtx::range scope("init_fj_cpu_standalone"); auto fj_cpu = std::make_unique>(preemption_flag); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh index 15dd0d9ba9..baea5d384d 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh @@ -36,7 +36,7 @@ struct fj_cpu_shared_incumbent_t { { // Unlocked reject first: the publish sites are hot on instances that improve in tiny steps. if (!(candidate_objective < objective.load(std::memory_order_relaxed))) return false; - [[maybe_unused]] std::lock_guard lock(guard); + std::lock_guard lock(guard); if (!(candidate_objective < objective.load(std::memory_order_relaxed))) return false; assignment = candidate; objective.store(candidate_objective, std::memory_order_relaxed); @@ -48,7 +48,7 @@ struct fj_cpu_shared_incumbent_t { bool adopt(f_t local_objective, std::vector& destination, f_t* adopted_objective = nullptr) { if (!(objective.load(std::memory_order_relaxed) < local_objective)) return false; - [[maybe_unused]] std::lock_guard lock(guard); + std::lock_guard lock(guard); const f_t shared_objective = objective.load(std::memory_order_relaxed); if (!(shared_objective < local_objective)) return false; cuopt_assert(assignment.size() == destination.size(), "shared incumbent size mismatch"); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu index 660a900b17..d47714a934 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu @@ -844,7 +844,7 @@ struct fj_bin_engine_t { void init(fj_cpu_climber_t& climber) { - [[maybe_unused]] phase_timer_t timer(climber.bin_setup.engine_init); + phase_timer_t timer(climber.bin_setup.engine_init); const auto& params = climber.settings.parameters; seed = climber.settings.seed; rng = raft::random::PCGenerator((uint64_t)seed, 0, 0); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu index 56ac89cd32..ef7b4d6672 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary_preprocess.cu @@ -96,7 +96,7 @@ static void build_transpose(fj_bin_problem_t& pb) template fj_bin_scan_t fj_bin_scan(const fj_cpu_climber_t& c, fj_bin_setup_times_t& times) { - [[maybe_unused]] phase_timer_t timer(times.scan); + phase_timer_t timer(times.scan); fj_bin_scan_t out; const int32_t n_cols = c.problem->n_variables; const int32_t n_rows = c.problem->n_constraints; @@ -380,7 +380,7 @@ bool fj_bin_encode(const fj_cpu_climber_t& c, int& coefficient_bits, fj_bin_setup_times_t& times) { - [[maybe_unused]] phase_timer_t timer(times.encode); + phase_timer_t timer(times.encode); const int32_t n_cols = c.problem->n_variables; const int32_t n_rows = c.problem->n_constraints; if (n_cols <= 0 || n_rows <= 0) return false; diff --git a/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu b/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu index 2e6150b78f..ddc9f6e44b 100644 --- a/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu +++ b/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu @@ -132,7 +132,7 @@ bool feasibility_pump_t::linear_project_onto_polytope(solution_t::test_fj_feasible(solution_t& soluti template bool feasibility_pump_t::handle_cycle(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("handle_cycle"); + raft::common::nvtx::range fun_scope("handle_cycle"); CUOPT_LOG_DEBUG("running handle cycle"); bool is_feasible = false; fp_fj_cycle_time_begin = timer.remaining_time(); @@ -356,7 +356,7 @@ bool feasibility_pump_t::handle_cycle(solution_t& solution) template bool feasibility_pump_t::restart_fp(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("restart_fp"); + raft::common::nvtx::range fun_scope("restart_fp"); bool is_feasible = handle_cycle(solution); // reset the distance last_distances.resize(0); @@ -393,7 +393,7 @@ void feasibility_pump_t::resize_vectors(problem_t& problem, template bool feasibility_pump_t::check_distance_cycle(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_distance_cycle"); + raft::common::nvtx::range fun_scope("check_distance_cycle"); f_t distance_to_last_rounding = compute_l1_distance( solution.problem_ptr->integer_indices, last_rounding, solution.assignment, solution.handle_ptr); @@ -421,7 +421,7 @@ bool feasibility_pump_t::check_distance_cycle(solution_t& so template void feasibility_pump_t::relax_general_integers(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("relax_general_integers"); + raft::common::nvtx::range fun_scope("relax_general_integers"); orig_variable_types.resize(solution.problem_ptr->n_variables, solution.handle_ptr->get_stream()); auto var_types = make_span(solution.problem_ptr->variable_types); @@ -470,7 +470,7 @@ void feasibility_pump_t::revert_relaxation(solution_t& solut template bool feasibility_pump_t::run_single_fp_descent(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_single_fp_descent"); + raft::common::nvtx::range fun_scope("run_single_fp_descent"); // start by doing nearest rounding solution.round_nearest(rng()); raft::copy(last_rounding.data(), diff --git a/cpp/src/mip_heuristics/local_search/local_search.cu b/cpp/src/mip_heuristics/local_search/local_search.cu index 60a4916d45..945950b350 100644 --- a/cpp/src/mip_heuristics/local_search/local_search.cu +++ b/cpp/src/mip_heuristics/local_search/local_search.cu @@ -378,7 +378,7 @@ bool local_search_t::run_local_search(solution_t& solution, timer_t timer, const ls_config_t& ls_config) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("local search"); + raft::common::nvtx::range fun_scope("local search"); fj_settings_t fj_settings; if (timer.check_time_limit()) return false; // adjust these time limits @@ -440,7 +440,7 @@ bool local_search_t::run_fj_annealing(solution_t& solution, timer_t timer, const ls_config_t& ls_config) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fj_annealing"); + raft::common::nvtx::range fun_scope("run_fj_annealing"); auto prev_settings = fj.settings; solution.compute_feasibility(); @@ -470,7 +470,7 @@ bool local_search_t::run_fj_line_segment(solution_t& solutio timer_t timer, const ls_config_t& ls_config) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fj_line_segment"); + raft::common::nvtx::range fun_scope("run_fj_line_segment"); rmm::device_uvector starting_point(solution.assignment, solution.handle_ptr->get_stream()); line_segment_search.settings.best_of_parents_cost = ls_config.best_objective_of_parents; line_segment_search.settings.parents_infeasible = !ls_config.at_least_one_parent_feasible; @@ -492,7 +492,7 @@ bool local_search_t::check_fj_on_lp_optimal(solution_t& solu bool perturb, timer_t timer) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_fj_on_lp_optimal"); + raft::common::nvtx::range fun_scope("check_fj_on_lp_optimal"); if (lp_optimal_exists) { raft::copy(solution.assignment.data(), lp_optimal_solution.data(), @@ -533,7 +533,7 @@ bool local_search_t::check_fj_on_lp_optimal(solution_t& solu template bool local_search_t::run_fj_on_zero(solution_t& solution, timer_t timer) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fj_on_zero"); + raft::common::nvtx::range fun_scope("run_fj_on_zero"); thrust::fill(solution.handle_ptr->get_thrust_policy(), solution.assignment.begin(), solution.assignment.end(), @@ -553,7 +553,7 @@ bool local_search_t::run_staged_fp(solution_t& solution, timer_t timer, population_t* population_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_staged_fp"); + raft::common::nvtx::range fun_scope("run_staged_fp"); cuopt_assert(population_ptr != nullptr, "Population pointer must not be null"); auto n_vars = solution.problem_ptr->n_variables; auto n_binary_vars = solution.problem_ptr->get_n_binary_variables(); @@ -642,7 +642,7 @@ template void local_search_t::save_solution_and_add_cutting_plane( solution_t& solution, rmm::device_uvector& best_solution, f_t& best_objective) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("save_solution_and_add_cutting_plane"); + raft::common::nvtx::range fun_scope("save_solution_and_add_cutting_plane"); if (solution.get_objective() < best_objective) { raft::copy(best_solution.data(), solution.assignment.data(), @@ -683,7 +683,7 @@ void local_search_t::reset_alpha_and_save_solution( rmm::device_uvector& best_solution, f_t& best_objective) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("reset_alpha_and_save_solution"); + raft::common::nvtx::range fun_scope("reset_alpha_and_save_solution"); fp.config.alpha = default_alpha; solution_t solution_copy(solution); solution_copy.problem_ptr = old_problem_ptr; @@ -719,7 +719,7 @@ void local_search_t::reset_alpha_and_run_recombiners( rmm::device_uvector& best_solution, f_t& best_objective) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("reset_alpha_and_run_recombiners"); + raft::common::nvtx::range fun_scope("reset_alpha_and_run_recombiners"); const auto& hp = context.settings.heuristic_params; const i_t iterations_for_stagnation = hp.stagnation_trigger; const i_t max_iterations_without_improvement = hp.max_iterations_without_improvement; @@ -744,7 +744,7 @@ bool local_search_t::run_fp(solution_t& solution, timer_t timer, population_t* population_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fp"); + raft::common::nvtx::range fun_scope("run_fp"); cuopt_assert(population_ptr != nullptr, "Population pointer must not be null"); const i_t n_fp_iterations = 1000000; bool is_feasible = solution.compute_feasibility(); @@ -837,7 +837,7 @@ bool local_search_t::generate_solution(solution_t& solution, population_t* population_ptr, f_t time_limit) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_solution"); + raft::common::nvtx::range fun_scope("generate_solution"); cuopt_assert(population_ptr != nullptr, "Population pointer must not be null"); timer_t timer(time_limit); auto n_vars = solution.problem_ptr->n_variables; diff --git a/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu b/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu index 45e92a0e51..a638cc7eeb 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu +++ b/cpp/src/mip_heuristics/local_search/rounding/constraint_prop.cu @@ -1065,7 +1065,7 @@ bool constraint_prop_t::apply_round( timer_t& timer, std::optional>> probing_config) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("constraint prop round"); + raft::common::nvtx::range fun_scope("constraint prop round"); max_timer = timer_t{max_time_for_bounds_prop}; if (check_brute_force_rounding(sol)) { return true; } recovery_mode = false; diff --git a/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu b/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu index 30b5dfd3d5..f4ca208843 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu +++ b/cpp/src/mip_heuristics/local_search/rounding/lb_constraint_prop.cu @@ -706,7 +706,7 @@ bool lb_constraint_prop_t::apply_round( timer_t& timer, std::optional>> probing_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("constraint prop round"); + raft::common::nvtx::range fun_scope("constraint prop round"); // this is second timer that can continue but without recovery mode const f_t max_time_for_bounds_prop = 5.; diff --git a/cpp/src/mip_heuristics/mip_scaling_strategy.cu b/cpp/src/mip_heuristics/mip_scaling_strategy.cu index 99f2212bf1..41525a9c65 100644 --- a/cpp/src/mip_heuristics/mip_scaling_strategy.cu +++ b/cpp/src/mip_heuristics/mip_scaling_strategy.cu @@ -493,7 +493,7 @@ size_t dry_run_cub( template void mip_scaling_strategy_t::scale_problem(bool do_objective_scaling) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("mip_scale_problem"); + raft::common::nvtx::range fun_scope("mip_scale_problem"); auto& matrix_values = op_problem_scaled_.get_constraint_matrix_values(); auto& matrix_offsets = op_problem_scaled_.get_constraint_matrix_offsets(); diff --git a/cpp/src/mip_heuristics/presolve/block_bve.cu b/cpp/src/mip_heuristics/presolve/block_bve.cu index 0fb30a8c87..c8d6ea3314 100644 --- a/cpp/src/mip_heuristics/presolve/block_bve.cu +++ b/cpp/src/mip_heuristics/presolve/block_bve.cu @@ -213,8 +213,8 @@ int bve_greedy_prime_cover(const uint8_t* feas, { cuopt_assert(nb >= 1 && nb <= BVE_MAX_BOUNDARY, "nb out of BVE range"); cuopt_assert(cap >= 1, "clause cap leaves no room for a cover"); - int64_t ops = 0; - [[maybe_unused]] auto ops_guard = cuopt::scope_guard([&]() { + int64_t ops = 0; + auto ops_guard = cuopt::scope_guard([&]() { if (ops_out != nullptr) *ops_out += ops; }); diff --git a/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu b/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu index 0263c81425..bf40838279 100644 --- a/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu +++ b/cpp/src/mip_heuristics/presolve/load_balanced_bounds_presolve.cu @@ -491,7 +491,7 @@ void load_balanced_bounds_presolve_t::calculate_constraint_slack_iter( { // writes nans to constraint activities that are infeasible //-> less expensive checks for update bounds step - [[maybe_unused]] raft::common::nvtx::range scope("act_cuda_task_graph"); + raft::common::nvtx::range scope("act_cuda_task_graph"); cudaGraphLaunch(calc_slack_erase_inf_cnst_exec, handle_ptr->get_stream().get()); } infeas_cnst_slack_set_to_nan = true; @@ -505,7 +505,7 @@ void load_balanced_bounds_presolve_t::calculate_constraint_slack( // h_bounds_changed is copied to bounds_changed in calc_slack_exec h_bounds_changed = 0; { - [[maybe_unused]] raft::common::nvtx::range scope("act_cuda_task_graph"); + raft::common::nvtx::range scope("act_cuda_task_graph"); cudaGraphLaunch(calc_slack_exec, handle_ptr->get_stream().get()); } infeas_cnst_slack_set_to_nan = false; @@ -518,7 +518,7 @@ bool load_balanced_bounds_presolve_t::update_bounds_from_slack( { // bounds_changed is copied to h_bounds_changed in upd_bnd_exec { - [[maybe_unused]] raft::common::nvtx::range scope("upd_cuda_task_graph"); + raft::common::nvtx::range scope("upd_cuda_task_graph"); cudaGraphLaunch(upd_bnd_exec, handle_ptr->get_stream().get()); } RAFT_CHECK_CUDA(handle_ptr->get_stream().get()); diff --git a/cpp/src/mip_heuristics/presolve/probing_cache.cu b/cpp/src/mip_heuristics/presolve/probing_cache.cu index 8ed6cf9c5a..afa2887db2 100644 --- a/cpp/src/mip_heuristics/presolve/probing_cache.cu +++ b/cpp/src/mip_heuristics/presolve/probing_cache.cu @@ -193,8 +193,7 @@ void inline insert_current_probing_to_cache(i_t var_idx, } } { - [[maybe_unused]] std::lock_guard lock( - bound_presolve.probing_cache.probing_cache_mutex); + std::lock_guard lock(bound_presolve.probing_cache.probing_cache_mutex); if (!bound_presolve.probing_cache.probing_cache.count(var_original) > 0) { std::array, 2> entries_per_var; entries_per_var[0] = cache_item; @@ -896,7 +895,7 @@ bool compute_probing_cache(bound_presolve_t& bound_presolve, double work_limit, size_t step_size_hint) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_probing_cache"); + raft::common::nvtx::range fun_scope("compute_probing_cache"); cuopt_assert(bound_presolve.probing_cache.probing_cache.empty(), "probing cache is built once per solve"); diff --git a/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp b/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp index ae1e54cc7c..63e4855430 100644 --- a/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp +++ b/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp @@ -105,7 +105,7 @@ papilo::Problem build_papilo_problem(io::mps_data_model_t const& bool maximize, problem_category_t category) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Build papilo::Problem from mps_data_model"); + raft::common::nvtx::range fun_scope("Build papilo::Problem from mps_data_model"); const i_t n_cols = mps.get_n_variables(); const i_t n_rows = mps.get_n_constraints(); @@ -215,7 +215,7 @@ papilo::Problem build_papilo_problem(io::mps_data_model_t const& template papilo::Problem build_papilo_problem(const simplex::user_problem_t& problem) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Build papilo problem"); + raft::common::nvtx::range fun_scope("Build papilo problem"); // Build a papilo problem from a (host-side) dual-simplex user_problem_t. Unlike the // optimization_problem_t overload, all data already lives on the host and the constraint // matrix is stored column-major (CSC), so there are no device copies and no COO step: the @@ -361,7 +361,7 @@ template void build_user_problem(papilo::Problem const& papilo_problem, simplex::user_problem_t& problem) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Build user problem"); + raft::common::nvtx::range fun_scope("Build user problem"); const i_t reduced_rows = papilo_problem.getNRows(); const i_t reduced_cols = papilo_problem.getNCols(); @@ -464,7 +464,7 @@ io::mps_data_model_t build_reduced_mps_from_pslp(Presolver* pslp_preso bool maximize, f_t original_obj_offset) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Build mps_data_model from PSLP"); + raft::common::nvtx::range fun_scope("Build mps_data_model from PSLP"); io::mps_data_model_t mps; if constexpr (std::is_same_v) { @@ -518,7 +518,7 @@ template io::mps_data_model_t build_reduced_mps_from_papilo( papilo::Problem const& papilo_problem, bool maximize) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Reduced mps <- Papilo"); + raft::common::nvtx::range fun_scope("Reduced mps <- Papilo"); io::mps_data_model_t mps; auto obj = papilo_problem.getObjective(); @@ -836,7 +836,7 @@ template third_party_presolve_status_t third_party_presolve_t::apply_pslp( io::mps_data_model_t const& mps, double time_limit) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Apply PSLP presolver on host"); + raft::common::nvtx::range fun_scope("Apply PSLP presolver on host"); if constexpr (std::is_same_v) { const i_t n_cols = mps.get_n_variables(); @@ -914,7 +914,7 @@ third_party_presolve_status_t third_party_presolve_t::apply_papilo( i_t max_rounds, i_t max_badgesize) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Apply Papilo presolve on host"); + raft::common::nvtx::range fun_scope("Apply Papilo presolve on host"); // Capture original dimensions before papilo.apply() mutates papilo_problem // in place into its reduced form. diff --git a/cpp/src/mip_heuristics/problem/presolve_data.cu b/cpp/src/mip_heuristics/problem/presolve_data.cu index d3b36c3767..b6d1efb641 100644 --- a/cpp/src/mip_heuristics/problem/presolve_data.cu +++ b/cpp/src/mip_heuristics/problem/presolve_data.cu @@ -29,7 +29,7 @@ template bool presolve_data_t::pre_process_assignment(problem_t& problem, rmm::device_uvector& assignment) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("pre_process_assignment"); + raft::common::nvtx::range fun_scope("pre_process_assignment"); auto has_nans = cuopt::mathematical_optimization::mip::has_nans(problem.handle_ptr, assignment); if (has_nans) { CUOPT_LOG_DEBUG("Solution discarded due to nans"); @@ -153,7 +153,7 @@ void presolve_data_t::post_process_assignment( bool resize_to_original_problem, cuda::stream_ref stream) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("post_process_assignment"); + raft::common::nvtx::range fun_scope("post_process_assignment"); cuopt_assert(current_assignment.size() == variable_mapping.size(), "size mismatch"); auto assgn = make_span(current_assignment); auto fixed_assgn = make_span(fixed_var_assignment); @@ -196,7 +196,7 @@ template void presolve_data_t::post_process_solution(problem_t& problem, solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("post_process_solution"); + raft::common::nvtx::range fun_scope("post_process_solution"); post_process_assignment(problem, solution.assignment); // this is for resizing other fields such as excess, slack so that we can compute the feasibility solution.resize_to_original_problem(); diff --git a/cpp/src/mip_heuristics/problem/problem.cu b/cpp/src/mip_heuristics/problem/problem.cu index d8f3e7b244..705e034544 100644 --- a/cpp/src/mip_heuristics/problem/problem.cu +++ b/cpp/src/mip_heuristics/problem/problem.cu @@ -500,7 +500,7 @@ void csr_to_csc_transpose(const i_t* csr_offsets, template void problem_t::compute_transpose_of_problem() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_transpose_of_problem"); + raft::common::nvtx::range fun_scope("compute_transpose_of_problem"); csrsort_cusparse(coefficients, variables, offsets, n_constraints, n_variables, handle_ptr); RAFT_CUBLAS_TRY(raft::linalg::detail::cublassetpointermode( handle_ptr->get_cublas_handle(), CUBLAS_POINTER_MODE_DEVICE, handle_ptr->get_stream().get())); @@ -568,8 +568,8 @@ template void problem_t::check_problem_representation(bool check_transposed, bool check_mip_related_data) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_problem_representation"); - [[maybe_unused]] raft::common::nvtx::range scope("check_problem_representation"); + raft::common::nvtx::range fun_scope("check_problem_representation"); + raft::common::nvtx::range scope("check_problem_representation"); cuopt_assert(!offsets.is_empty(), "A_offsets must never be empty."); if (check_transposed) { @@ -832,7 +832,7 @@ template void problem_t::recompute_auxilliary_data(bool check_representation, bool compute_related_vars) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("recompute_auxilliary_data"); + raft::common::nvtx::range fun_scope("recompute_auxilliary_data"); compute_n_integer_vars(); compute_binary_var_table(); compute_vars_with_objective_coeffs(); @@ -849,7 +849,7 @@ void problem_t::recompute_auxilliary_data(bool check_representation, template void problem_t::compute_auxiliary_data() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_auxiliary_data"); + raft::common::nvtx::range fun_scope("compute_auxiliary_data"); // Compute sparsity: nnz / (n_rows * n_cols) sparsity = (n_constraints > 0 && n_variables > 0) @@ -898,7 +898,7 @@ void problem_t::compute_auxiliary_data() template void problem_t::compute_n_integer_vars() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_n_integer_vars"); + raft::common::nvtx::range fun_scope("compute_n_integer_vars"); cuopt_assert(n_variables == variable_types.size(), "size mismatch"); integer_indices.resize(n_variables, handle_ptr->get_stream()); auto end = @@ -931,7 +931,7 @@ bool problem_t::integer_equal(f_t val1, f_t val2) const template void problem_t::compute_binary_var_table() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_binary_var_table"); + raft::common::nvtx::range fun_scope("compute_binary_var_table"); auto pb_view = view(); is_binary_variable.resize(n_variables, handle_ptr->get_stream()); @@ -973,7 +973,7 @@ void problem_t::compute_binary_var_table() template void problem_t::compute_related_variables(double time_limit) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_related_variables"); + raft::common::nvtx::range fun_scope("compute_related_variables"); if (n_variables == 0) { related_variables.resize(0, handle_ptr->get_stream()); related_variables_offsets.resize(0, handle_ptr->get_stream()); @@ -1125,7 +1125,7 @@ typename problem_t::view_t problem_t::view() template void problem_t::resize_variables(size_t size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_variables"); + raft::common::nvtx::range fun_scope("resize_variables"); variable_bounds.resize(size, handle_ptr->get_stream()); variable_types.resize(size, handle_ptr->get_stream()); objective_coefficients.resize(size, handle_ptr->get_stream()); @@ -1139,7 +1139,7 @@ void problem_t::resize_constraints(size_t matrix_size, size_t constraint_size, size_t n_variables) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_constraints"); + raft::common::nvtx::range fun_scope("resize_constraints"); auto prev_dual_size = lp_state.prev_dual.size(); coefficients.resize(matrix_size, handle_ptr->get_stream()); variables.resize(matrix_size, handle_ptr->get_stream()); @@ -1165,7 +1165,7 @@ void problem_t::resize_constraints(size_t matrix_size, template void problem_t::insert_variables(variables_delta_t& h_vars) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_variables"); + raft::common::nvtx::range fun_scope("insert_variables"); CUOPT_LOG_DEBUG("problem added variable size %d prev %d", h_vars.size(), n_variables); // resize the variable arrays if it can't fit the variables resize_variables(n_variables + h_vars.size()); @@ -1197,7 +1197,7 @@ void problem_t::insert_variables(variables_delta_t& h_vars) template void problem_t::insert_constraints(constraints_delta_t& h_constraints) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_constraints"); + raft::common::nvtx::range fun_scope("insert_constraints"); CUOPT_LOG_DEBUG( "added nnz %d constraints %d offset size %d prev nnz %d prev cstr %d prev offset size%d ", h_constraints.matrix_size(), @@ -1249,7 +1249,7 @@ void problem_t::insert_constraints(constraints_delta_t& h_co template void problem_t::set_implied_integers(const std::vector& implied_integer_indices) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("set_implied_integers"); + raft::common::nvtx::range fun_scope("set_implied_integers"); auto d_indices = cuopt::device_copy(implied_integer_indices, handle_ptr->get_stream()); thrust::for_each(handle_ptr->get_thrust_policy(), d_indices.begin(), @@ -1418,7 +1418,7 @@ void problem_t::substitute_variables(const std::vector& var_indic const std::vector& offset_values, const std::vector& coefficient_values) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("substitute_variables"); + raft::common::nvtx::range fun_scope("substitute_variables"); cuopt_assert((are_exclusive(var_indices, var_to_substitute_indices)), "variables and var_to_substitute_indices are not exclusive"); const i_t dummy_substituted_variable = var_indices[0]; @@ -1589,7 +1589,7 @@ void problem_t::fix_given_variables(problem_t& original_prob const rmm::device_uvector& variables_to_fix, const raft::handle_t* handle_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("fix_given_variables"); + raft::common::nvtx::range fun_scope("fix_given_variables"); fixing_helpers.reduction_in_rhs.resize(n_constraints, handle_ptr->get_stream()); fixing_helpers.variable_fix_mask.resize(original_problem.n_variables, handle_ptr->get_stream()); thrust::fill(handle_ptr->get_thrust_policy(), @@ -1688,7 +1688,7 @@ problem_t problem_t::get_problem_after_fixing_vars( rmm::device_uvector& variable_map, const raft::handle_t* handle_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_problem_after_fixing_vars"); + raft::common::nvtx::range fun_scope("get_problem_after_fixing_vars"); auto start_time = std::chrono::high_resolution_clock::now(); cuopt_assert(n_variables == assignment.size(), "Assignment size issue"); problem_t problem(*this, true); @@ -1759,7 +1759,7 @@ void problem_t::remove_given_variables(problem_t& original_p rmm::device_uvector& variable_map, const raft::handle_t* handle_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_given_variables"); + raft::common::nvtx::range fun_scope("remove_given_variables"); thrust::fill(handle_ptr->get_thrust_policy(), offsets.begin(), offsets.end(), 0); cuopt_assert(assignment.size() == n_variables, "Variable size mismatch"); cuopt_assert(variable_map.size() < n_variables, "Too many variables to fix"); @@ -1832,8 +1832,7 @@ template rmm::device_uvector problem_t::get_fixed_assignment_from_integer_fixed_problem( const rmm::device_uvector& assignment) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "get_fixed_assignment_from_integer_fixed_problem"); + raft::common::nvtx::range fun_scope("get_fixed_assignment_from_integer_fixed_problem"); rmm::device_uvector fixed_assignment(integer_fixed_variable_map.size(), handle_ptr->get_stream()); // first remove the assignment and variable related vectors @@ -1859,7 +1858,7 @@ void problem_t::test_problem_fixing_time() template void problem_t::compute_integer_fixed_problem() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_integer_fixed_problem"); + raft::common::nvtx::range fun_scope("compute_integer_fixed_problem"); cuopt_assert(integer_fixed_problem == nullptr, "Integer fixed problem already computed"); if (n_variables == n_integer_vars) { integer_fixed_problem = nullptr; @@ -1890,7 +1889,7 @@ template void problem_t::fill_integer_fixed_problem(rmm::device_uvector& assignment, const raft::handle_t* handle_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("fill_integer_fixed_problem"); + raft::common::nvtx::range fun_scope("fill_integer_fixed_problem"); cuopt_assert(integer_fixed_problem->n_variables > 0, "Integer fixed problem not computed"); copy_rhs_from_problem(handle_ptr); integer_fixed_problem->fix_given_variables(*this, assignment, integer_indices, handle_ptr); @@ -1903,7 +1902,7 @@ template std::vector>> compute_var_to_constraint_map( const problem_t& pb) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_var_to_constraint_map"); + raft::common::nvtx::range fun_scope("compute_var_to_constraint_map"); std::vector>> variable_constraint_map(pb.n_variables); auto stream = pb.handle_ptr->get_stream(); auto h_variables = cuopt::host_copy(pb.variables, stream); @@ -1924,7 +1923,7 @@ template void standardize_bounds(std::vector>>& variable_constraint_map, problem_t& pb) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("standardize_bounds"); + raft::common::nvtx::range fun_scope("standardize_bounds"); auto handle_ptr = pb.handle_ptr; auto stream = handle_ptr->get_stream(); auto h_var_bounds = cuopt::host_copy(pb.variable_bounds, stream); @@ -2003,7 +2002,7 @@ template void compute_csr(const std::vector>>& variable_constraint_map, problem_t& pb) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_csr"); + raft::common::nvtx::range fun_scope("compute_csr"); auto handle_ptr = pb.handle_ptr; std::vector> vars_per_constraint(pb.n_constraints); std::vector> coefficient_per_constraint(pb.n_constraints); @@ -2043,7 +2042,7 @@ void compute_csr(const std::vector>>& variable_c template void problem_t::preprocess_problem() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("preprocess_problem"); + raft::common::nvtx::range fun_scope("preprocess_problem"); auto variable_constraint_map = compute_var_to_constraint_map(*this); standardize_bounds(variable_constraint_map, *this); compute_csr(variable_constraint_map, *this); @@ -2067,7 +2066,7 @@ template void problem_t::set_constraints_from_host_user_problem( const user_problem_t& user_problem) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("set_constraints_from_host_user_problem"); + raft::common::nvtx::range fun_scope("set_constraints_from_host_user_problem"); cuopt_assert(user_problem.handle_ptr == handle_ptr, "handle mismatch"); cuopt_assert(user_problem.num_cols == n_variables, "num cols mismatch"); const i_t num_rows = user_problem.num_rows; @@ -2125,7 +2124,7 @@ void problem_t::set_constraints_from_host_csr(const std::vector& const std::vector& row_upper, const std::vector& names) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("set_constraints_from_host_csr"); + raft::common::nvtx::range fun_scope("set_constraints_from_host_csr"); n_constraints = static_cast(row_lower.size()); cuopt_assert(row_upper.size() == static_cast(n_constraints), "row bound size mismatch"); cuopt_assert(offsets_in.size() == static_cast(n_constraints) + 1, @@ -2215,7 +2214,7 @@ void problem_t::papilo_uncrush_assignment(rmm::device_uvector& as template void problem_t::get_host_user_problem(user_problem_t& user_problem) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_host_user_problem"); + raft::common::nvtx::range fun_scope("get_host_user_problem"); // std::lock_guard lock(problem_mutex); i_t m = n_constraints; i_t n = n_variables; @@ -2359,7 +2358,7 @@ uint32_t problem_t::get_fingerprint() const template void problem_t::compute_vars_with_objective_coeffs() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_vars_with_objective_coeffs"); + raft::common::nvtx::range fun_scope("compute_vars_with_objective_coeffs"); auto h_objective_coefficients = cuopt::host_copy(objective_coefficients, handle_ptr->get_stream()); std::vector vars_with_objective_coeffs_; @@ -2376,7 +2375,7 @@ void problem_t::compute_vars_with_objective_coeffs() template void problem_t::add_cutting_plane_at_objective(f_t objective) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_cutting_plane_at_objective"); + raft::common::nvtx::range fun_scope("add_cutting_plane_at_objective"); CUOPT_LOG_DEBUG("Adding cutting plane at objective %f", objective); if (cutting_plane_added) { // modify the RHS diff --git a/cpp/src/mip_heuristics/problem/problem_helpers.cuh b/cpp/src/mip_heuristics/problem/problem_helpers.cuh index e0de81772b..0c4a27120d 100644 --- a/cpp/src/mip_heuristics/problem/problem_helpers.cuh +++ b/cpp/src/mip_heuristics/problem/problem_helpers.cuh @@ -86,7 +86,7 @@ static void set_variable_bounds(mip::problem_t& op_problem) template static void set_bounds_if_not_set(mip::problem_t& op_problem) { - [[maybe_unused]] raft::common::nvtx::range scope("set_bounds_if_not_set"); + raft::common::nvtx::range scope("set_bounds_if_not_set"); // If an user gave row type instead of lower/upper bounds if (op_problem.constraint_lower_bounds.is_empty() && @@ -135,7 +135,7 @@ struct negate { template static void convert_to_maximization_problem(mip::problem_t& op_problem) { - [[maybe_unused]] raft::common::nvtx::range scope("convert_to_maximization_problem"); + raft::common::nvtx::range scope("convert_to_maximization_problem"); if (op_problem.objective_coefficients.size()) { // Negate objective coefficient @@ -239,7 +239,7 @@ static void check_csr_representation([[maybe_unused]] const rmm::device_uvector< [[maybe_unused]] i_t n_variables, [[maybe_unused]] i_t n_constraints) { - [[maybe_unused]] raft::common::nvtx::range scope("check_csr_representation"); + raft::common::nvtx::range scope("check_csr_representation"); cuopt_assert(variables.size() == coefficients.size(), "A_index and A_values must have same sizes."); @@ -405,7 +405,7 @@ static void csrsort_cusparse(rmm::device_uvector& values, template static void convert_greater_to_less(mip::problem_t& problem) { - [[maybe_unused]] raft::common::nvtx::range scope("convert_greater_to_less"); + raft::common::nvtx::range scope("convert_greater_to_less"); auto* handle_ptr = problem.handle_ptr; diff --git a/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu b/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu index 21d7044d5e..14a56cb903 100644 --- a/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu +++ b/cpp/src/mip_heuristics/relaxed_lp/relaxed_lp.cu @@ -38,7 +38,7 @@ optimization_problem_solution_t get_relaxed_lp_solution( lp_state_t& lp_state, const relaxed_lp_settings_t& settings) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_relaxed_lp_solution"); + raft::common::nvtx::range fun_scope("get_relaxed_lp_solution"); pdlp_solver_settings_t pdlp_settings{}; pdlp_settings.detect_infeasibility = settings.check_infeasibility; pdlp_settings.set_optimality_tolerance(settings.tolerance); diff --git a/cpp/src/mip_heuristics/solution_publication.cuh b/cpp/src/mip_heuristics/solution_publication.cuh index 0a8379cba9..feedc17913 100644 --- a/cpp/src/mip_heuristics/solution_publication.cuh +++ b/cpp/src/mip_heuristics/solution_publication.cuh @@ -50,7 +50,7 @@ class solution_publication_t { void set_published_floor(f_t solver_objective) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); best_published_objective_ = solver_objective; } @@ -64,7 +64,7 @@ class solution_publication_t { cuopt_assert(problem_ptr != nullptr, "Publication problem pointer must not be null"); cuopt_assert(std::isfinite(solver_objective), "Published objective must be finite"); - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); cuopt_assert(assignment.size() == (size_t)problem_ptr->n_variables, "Published assignment size must match the problem"); const auto& objective_variables = problem_ptr->vars_with_objective_coeffs.first; diff --git a/cpp/src/mip_heuristics/solve.cu b/cpp/src/mip_heuristics/solve.cu index 59290cf040..6a6c6d795c 100644 --- a/cpp/src/mip_heuristics/solve.cu +++ b/cpp/src/mip_heuristics/solve.cu @@ -121,7 +121,7 @@ mip_solution_t run_mip_solver( std::unique_ptr> symmetry = nullptr) { try { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_mip"); + raft::common::nvtx::range fun_scope("run_mip"); if (settings.get_mip_callbacks().size() > 0) { auto callback_num_variables = problem.original_problem_ptr->get_n_variables(); const bool has_semi_continuous_callback_translation = @@ -290,7 +290,7 @@ mip_solution_t run_mip_solver( f_t user_obj, const std::vector& assignment, const char* heuristic_name) { - [[maybe_unused]] std::lock_guard lock(papilo_callback_mutex); + std::lock_guard lock(papilo_callback_mutex); if (solver_obj >= papilo_best_solver_obj) { return; } papilo_best_solver_obj = solver_obj; @@ -401,7 +401,7 @@ mip_solution_t solve_mip_helper( : settings.time_limit; // Create log stream for file logging and add it to default logger - [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); + init_logger_t log(settings.log_file, settings.log_to_console); // Init libraies before to not include it in solve time // This needs to be called before pdlp is initialized init_handler(op_problem.get_handle_ptr()); @@ -410,7 +410,7 @@ mip_solution_t solve_mip_helper( if (pre_solve_heuristics) { pre_solve_heuristics->stop(); } - [[maybe_unused]] raft::common::nvtx::range fun_scope("Running solver"); + raft::common::nvtx::range fun_scope("Running solver"); auto timer = timer_t(time_limit); problem_checking_t::check_problem_representation(op_problem); @@ -566,7 +566,7 @@ mip_solution_t solve_mip_helper( f_t user_obj, const std::vector& assignment, const char* heuristic_name) { - [[maybe_unused]] std::lock_guard lock(early_callback_mutex); + std::lock_guard lock(early_callback_mutex); if (solver_obj >= early_best_objective.load()) { return; } early_best_objective.store(solver_obj); early_best_user_obj = user_obj; diff --git a/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh b/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh index b71ae60997..97abcea3fc 100644 --- a/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh +++ b/cpp/src/mip_heuristics/utilities/work_unit_ordered_queue.cuh @@ -36,7 +36,7 @@ class work_unit_ordered_queue_t { */ void push(float timestamp, const T& work) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); queue_.emplace(timestamp, work); } @@ -48,7 +48,7 @@ class work_unit_ordered_queue_t { */ void push(float timestamp, T&& work) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); queue_.emplace(timestamp, std::move(work)); } @@ -57,7 +57,7 @@ class work_unit_ordered_queue_t { */ void pop() { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); queue_.pop(); } @@ -68,7 +68,7 @@ class work_unit_ordered_queue_t { */ entry_t top_with_timestamp() const { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return queue_.top(); } @@ -78,7 +78,7 @@ class work_unit_ordered_queue_t { */ T top() const { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return queue_.top().second; } @@ -89,7 +89,7 @@ class work_unit_ordered_queue_t { */ bool empty() const { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return queue_.empty(); } @@ -98,13 +98,13 @@ class work_unit_ordered_queue_t { */ std::size_t size() const { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return queue_.size(); } void clear() { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); queue_ = std::priority_queue, min_heap_cmp>(); } diff --git a/cpp/src/pdlp/cusparse_view.cu b/cpp/src/pdlp/cusparse_view.cu index 91b8789666..7c63c87c91 100644 --- a/cpp/src/pdlp/cusparse_view.cu +++ b/cpp/src/pdlp/cusparse_view.cu @@ -311,7 +311,7 @@ cusparse_view_t::cusparse_view_t( buffer_transpose_mixed_{0, handle_ptr->get_stream()}, mixed_precision_enabled_{false} { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Initializing cuSparse view"); + raft::common::nvtx::range fun_scope("Initializing cuSparse view"); #ifdef PDLP_DEBUG_MODE RAFT_CUDA_TRY(cudaDeviceSynchronize()); diff --git a/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu b/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu index 2e63fe71ba..51d9f8db84 100644 --- a/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu +++ b/cpp/src/pdlp/distributed_pdlp/distributed_algorithms.cu @@ -53,7 +53,7 @@ void multi_gpu_engine_t::gather_potential_next_solutions_to_master() template void multi_gpu_engine_t::distributed_bound_objective_rescaling(f_t c_scaling_weight) { - [[maybe_unused]] raft::common::nvtx::range scope("distributed_bound_objective_rescaling"); + raft::common::nvtx::range scope("distributed_bound_objective_rescaling"); // 1) + 2) Local raw squared norms on each shard, accumulate on host. // Use compute_sum_bounds_squared / compute_sum_weighted_squares (not @@ -118,7 +118,7 @@ template void multi_gpu_engine_t::distributed_ruiz_inf_scaling(int num_iter, i_t n_global_vars) { if (num_iter <= 0 || n_global_vars <= 0) return; - [[maybe_unused]] raft::common::nvtx::range scope("distributed_ruiz_inf_scaling"); + raft::common::nvtx::range scope("distributed_ruiz_inf_scaling"); for (int it = 0; it < num_iter; ++it) { refresh_halo_cummulative_scalings(); @@ -146,7 +146,7 @@ template void multi_gpu_engine_t::distributed_pock_chambolle_scaling(f_t alpha, i_t n_global_vars) { if (n_global_vars <= 0) return; - [[maybe_unused]] raft::common::nvtx::range scope("distributed_pock_chambolle_scaling"); + raft::common::nvtx::range scope("distributed_pock_chambolle_scaling"); refresh_halo_cummulative_scalings(); @@ -166,7 +166,7 @@ template void multi_gpu_engine_t::distributed_scaling(pdlp_hyper_params_t const& hyper_params, i_t n_global_vars) { - [[maybe_unused]] raft::common::nvtx::range scope("distributed_scaling"); + raft::common::nvtx::range scope("distributed_scaling"); // 1) Matrix scaling passes populate the cumulative row/col scalings on // every shard. Each pass keeps the halo copies refreshed internally. @@ -203,7 +203,7 @@ f_t multi_gpu_engine_t::distributed_max_singular_value_squared(i_t n_g int max_iterations, f_t tolerance) { - [[maybe_unused]] raft::common::nvtx::range scope("distributed_max_singular_value_squared"); + raft::common::nvtx::range scope("distributed_max_singular_value_squared"); // ┌──────────────────────────────────────────────────────────────┐ // │ Setup │ @@ -325,7 +325,7 @@ f_t multi_gpu_engine_t::distributed_max_singular_value_squared(i_t n_g // Convergence check via global residual norm. distributed_l2_norm_bufs(q_owned, residual_norm); auto& s0 = *shards[0]; - [[maybe_unused]] raft::device_setter guard0(s0.device_id); + raft::device_setter guard0(s0.device_id); f_t h_res{}; raft::copy(&h_res, residual_norm[0].data(), 1, s0.stream.view()); s0.stream.synchronize(); @@ -334,7 +334,7 @@ f_t multi_gpu_engine_t::distributed_max_singular_value_squared(i_t n_g // σ_max² is the same on every shard after the last allreduce. auto& s0 = *shards[0]; - [[maybe_unused]] raft::device_setter guard0(s0.device_id); + raft::device_setter guard0(s0.device_id); f_t sigma_sq_h{}; raft::copy(&sigma_sq_h, sigma_sq[0].data(), 1, s0.stream.view()); s0.stream.synchronize(); @@ -355,7 +355,7 @@ void multi_gpu_engine_t::distributed_compute_initial_step_size( int max_iterations, f_t tolerance) { - [[maybe_unused]] raft::common::nvtx::range scope("distributed_compute_initial_step_size"); + raft::common::nvtx::range scope("distributed_compute_initial_step_size"); cuopt_assert(master_pdlp_ != nullptr, "distributed_compute_initial_step_size requires set_master(...)"); cuopt_expects(hyper_params.initial_step_size_max_singular_value, @@ -385,7 +385,7 @@ template void multi_gpu_engine_t::distributed_compute_initial_primal_weight( pdlp_hyper_params_t const& hyper_params) { - [[maybe_unused]] raft::common::nvtx::range scope("distributed_compute_initial_primal_weight"); + raft::common::nvtx::range scope("distributed_compute_initial_primal_weight"); cuopt_assert(master_pdlp_ != nullptr, "distributed_compute_initial_primal_weight requires set_master(...)"); cuopt_expects( diff --git a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu index ea063b7713..40cfa4855d 100644 --- a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu +++ b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.cu @@ -51,7 +51,7 @@ multi_gpu_engine_t::multi_gpu_engine_t( // 3. Construct one shard per rank, pinned to its device. Ownership of each // communicator moves into its shard. for (int r = 0; r < nb_parts; ++r) { - [[maybe_unused]] raft::device_setter guard(devices[r]); // shard ctor needs device set + raft::device_setter guard(devices[r]); // shard ctor needs device set shards.emplace_back(std::make_unique>( devices[r], std::move(rank_data[r]), std::move(comms[r]), mps, sub_solver_settings)); } @@ -334,7 +334,7 @@ void multi_gpu_engine_t::allreduce_sum_inplace_to_master_buf( auto master_stream = master_pdlp_->get_handle_ptr()->get_stream(); sync_await_shards(master_stream); auto& s0 = *shards[0]; - [[maybe_unused]] raft::device_setter guard(s0.device_id); + raft::device_setter guard(s0.device_id); raft::copy(master_dst.data_handle(), shard_scalars[0].data_handle(), 1, master_stream); } @@ -422,7 +422,7 @@ void multi_gpu_engine_t::distributed_l2_norm_to_master_buf( auto master_stream = master_pdlp_->get_handle_ptr()->get_stream(); sync_await_shards(master_stream); auto& s0 = *shards[0]; - [[maybe_unused]] raft::device_setter guard(s0.device_id); + raft::device_setter guard(s0.device_id); raft::copy(master_dst.data_handle(), shard_out[0].data_handle(), 1, master_stream); } diff --git a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp index 2caa23df0d..569d1381fb 100644 --- a/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp +++ b/cpp/src/pdlp/distributed_pdlp/multi_gpu_engine.hpp @@ -103,7 +103,7 @@ struct multi_gpu_engine_t { { for (int r = 0; r < static_cast(shards.size()); ++r) { auto& s = *shards[r]; - [[maybe_unused]] raft::device_setter guard(s.device_id); + raft::device_setter guard(s.device_id); // If the function is invocable with a pdlp_shard_t& and an int, call it with the // shard and the rank. if constexpr (std::is_invocable_v&, int>) { diff --git a/cpp/src/pdlp/distributed_pdlp/shard.hpp b/cpp/src/pdlp/distributed_pdlp/shard.hpp index 495d6e501d..dcca723c3e 100644 --- a/cpp/src/pdlp/distributed_pdlp/shard.hpp +++ b/cpp/src/pdlp/distributed_pdlp/shard.hpp @@ -39,7 +39,7 @@ struct nccl_comm_deleter_t { { if (comm == nullptr) return; cuopt_assert(device_id >= 0, "nccl_comm_deleter_t: device_id not set"); - [[maybe_unused]] raft::device_setter guard(device_id); + raft::device_setter guard(device_id); CUOPT_NCCL_TRY_NO_THROW(ncclCommDestroy(comm)); } }; diff --git a/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu b/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu index d911e94f0b..28f8b47257 100644 --- a/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu +++ b/cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu @@ -91,7 +91,7 @@ pdlp_initial_scaling_strategy_t::pdlp_initial_scaling_strategy_t( cummulative_constraint_matrix_scaling_{static_cast(dual_size_h_), stream_view_}, cummulative_variable_scaling_{static_cast(primal_size_h_), stream_view_} { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Initializing initial_scaling_strategy"); + raft::common::nvtx::range fun_scope("Initializing initial_scaling_strategy"); #ifdef PDLP_DEBUG_MODE RAFT_CUDA_TRY(cudaDeviceSynchronize()); std::cout << "Initializing initial_scaling_strategy" << std::endl; @@ -132,7 +132,7 @@ template void pdlp_initial_scaling_strategy_t::compute_scaling_vectors( i_t number_of_ruiz_iterations, f_t alpha) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_scaling_vectors"); + raft::common::nvtx::range fun_scope("compute_scaling_vectors"); // Skip scaling entirely for a shape-0 problem (distributed PDLP builds the // master pdlp_solver_t from a shape-0 placeholder) @@ -558,7 +558,7 @@ void pdlp_initial_scaling_strategy_t::resize_context(i_t new_size) template void pdlp_initial_scaling_strategy_t::apply_cummulative_scaling_to_problem() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("apply_cummulative_scaling_to_problem"); + raft::common::nvtx::range fun_scope("apply_cummulative_scaling_to_problem"); // scale A i_t number_of_blocks = op_problem_scaled_.n_constraints / block_size; @@ -705,7 +705,7 @@ void pdlp_initial_scaling_strategy_t::apply_bound_objective_rescaling_ template void pdlp_initial_scaling_strategy_t::scale_problem() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("scale_problem"); + raft::common::nvtx::range fun_scope("scale_problem"); apply_cummulative_scaling_to_problem(); @@ -851,7 +851,7 @@ void pdlp_initial_scaling_strategy_t::unscale_solutions( rmm::device_uvector& dual_solution, rmm::device_uvector& dual_slack) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("unscale_solutions"); + raft::common::nvtx::range fun_scope("unscale_solutions"); if (primal_solution.size()) { cuopt_expects(primal_solution.size() % static_cast(primal_size_h_) == 0, diff --git a/cpp/src/pdlp/optimization_problem.cu b/cpp/src/pdlp/optimization_problem.cu index aad1225b7d..43cab04c29 100644 --- a/cpp/src/pdlp/optimization_problem.cu +++ b/cpp/src/pdlp/optimization_problem.cu @@ -73,7 +73,7 @@ optimization_problem_t::optimization_problem_t(raft::handle_t const* h row_types_(0, stream_view_), variable_types_(0, stream_view_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("optimization problem construction"); + raft::common::nvtx::range fun_scope("optimization problem construction"); } template diff --git a/cpp/src/pdlp/pdhg.cu b/cpp/src/pdlp/pdhg.cu index c07284ab40..586444679d 100644 --- a/cpp/src/pdlp/pdhg.cu +++ b/cpp/src/pdlp/pdhg.cu @@ -389,7 +389,7 @@ i_t pdhg_solver_t::get_dual_size() const template void pdhg_solver_t::compute_next_dual_solution(rmm::device_uvector& dual_step_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_next_dual_solution"); + raft::common::nvtx::range fun_scope("compute_next_dual_solution"); // proj(y+sigma(b-K(2x'-x))) // rewritten as proj(y+sigma(b-K(x'+delta_x))) // with the introduction of constraint lower and upper bounds the b @@ -690,7 +690,7 @@ void pdhg_solver_t::compute_next_primal_dual_solution( rmm::device_uvector& dual_step_size, i_t total_pdlp_iterations) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_next_primal_solution"); + raft::common::nvtx::range fun_scope("compute_next_primal_solution"); #ifdef PDLP_DEBUG_MODE std::cout << " compute_next_primal_solution:" << std::endl; #endif @@ -1228,8 +1228,7 @@ void pdhg_solver_t::compute_next_primal_dual_solution_reflected( const rmm::device_uvector& bound_rescaling, bool should_major) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "compute_next_primal_dual_solution_reflected"); + raft::common::nvtx::range fun_scope("compute_next_primal_dual_solution_reflected"); using f_t2 = typename type_2::type; @@ -1498,7 +1497,7 @@ template void pdhg_solver_t::update_solution( cusparse_view_t& current_op_problem_evaluation_cusparse_view_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("update_solution"); + raft::common::nvtx::range fun_scope("update_solution"); // Instead of copying, use a swap (that moves pointers) // It's ok because the next will be overwritten next iteration anyways diff --git a/cpp/src/pdlp/pdlp.cu b/cpp/src/pdlp/pdlp.cu index 775e015661..625e977f2a 100644 --- a/cpp/src/pdlp/pdlp.cu +++ b/cpp/src/pdlp/pdlp.cu @@ -1007,7 +1007,7 @@ template std::optional> pdlp_solver_t::check_batch_termination(const timer_t& timer) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_batch_termination"); + raft::common::nvtx::range fun_scope("check_batch_termination"); // Forced to do it in two lines because of macro template interaction [[maybe_unused]] const bool is_cupdlpx = is_cupdlpx_restart(settings_.hyper_params); @@ -1054,7 +1054,7 @@ pdlp_solver_t::check_batch_termination(const timer_t& timer) // climbers return their latest state if (settings_.first_primal_feasible && current_termination_strategy_.any_primal_feasible_or_optimal()) { - [[maybe_unused]] raft::common::nvtx::range fpf_scope("first_primal_feasible_batch_snapshot"); + raft::common::nvtx::range fpf_scope("first_primal_feasible_batch_snapshot"); for (size_t i = 0; i < current_termination_strategy_.get_terminations_status().size(); ++i) { snapshot_climber_into_return(i); } @@ -1096,13 +1096,13 @@ pdlp_solver_t::check_batch_termination(const timer_t& timer) std::move(current_termination_strategy_.get_terminations_status())); } else if (enable_batch_resizing) // Some might be optimal, let's remove them from the batch { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_done_climbers"); + raft::common::nvtx::range fun_scope("remove_done_climbers"); std::unordered_set to_remove; for (size_t i = 0; i < current_termination_strategy_.get_terminations_status().size(); ++i) { // Found one that is done if (current_termination_strategy_.is_done( current_termination_strategy_.get_termination_status(i), accept_primal_feasible)) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_done_climber"); + raft::common::nvtx::range fun_scope("remove_done_climber"); #ifdef BATCH_VERBOSE_MODE const bool externally_solved = (current_termination_strategy_.get_termination_status(i) == pdlp_termination_status_t::ConcurrentLimit); @@ -1130,7 +1130,7 @@ template std::optional> pdlp_solver_t::check_termination( const timer_t& timer) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Check termination"); + raft::common::nvtx::range fun_scope("Check termination"); // Still need to always compute the termination condition for current even if we don't check them // after for kkt restart @@ -1861,7 +1861,7 @@ void pdlp_solver_t::swap_all_context( { if (swap_pairs.empty()) { return; } - [[maybe_unused]] raft::common::nvtx::range fun_scope("swap_all_context"); + raft::common::nvtx::range fun_scope("swap_all_context"); pdhg_solver_.swap_context(swap_pairs); restart_strategy_.swap_context(swap_pairs); @@ -1880,7 +1880,7 @@ void pdlp_solver_t::swap_all_context( template void pdlp_solver_t::resize_all_context(i_t new_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_all_context"); + raft::common::nvtx::range fun_scope("resize_all_context"); // Resize PDHG and its saddle point pdhg_solver_.resize_context(new_size); @@ -1900,7 +1900,7 @@ template void pdlp_solver_t::resize_and_swap_all_context_loop( const std::unordered_set& climber_strategies_to_remove) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_and_swap_all_context_loop"); + raft::common::nvtx::range fun_scope("resize_and_swap_all_context_loop"); cuopt_assert(climber_strategies_to_remove.size() != climber_strategies_.size(), "We should never remove all climbers"); @@ -2206,7 +2206,7 @@ static void compute_primal_dual_deltas(pdhg_solver_t& pdhg, cuda::stre template void pdlp_solver_t::compute_fixed_error(std::vector& has_restarted) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_fixed_error"); + raft::common::nvtx::range fun_scope("compute_fixed_error"); #ifdef CUPDLP_DEBUG_MODE printf("Computing compute_fixed_point_error \n"); @@ -3175,7 +3175,7 @@ void pdlp_solver_t::take_constant_step(bool is_major_iteration) template void pdlp_solver_t::halpern_update() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("halpern_update"); + raft::common::nvtx::range fun_scope("halpern_update"); if (is_distributed_master()) { multi_gpu_engine->for_each_shard([&](auto& shard) { shard.sub_pdlp->halpern_update(); }); @@ -3261,7 +3261,7 @@ template void pdlp_solver_t::scale_problem() { // Scale problem then free scratch buffers - [[maybe_unused]] raft::common::nvtx::range fun_scope("pdlp_solver_t::scale_problem"); + raft::common::nvtx::range fun_scope("pdlp_solver_t::scale_problem"); if (is_distributed_master()) { multi_gpu_engine->distributed_scaling(settings_.hyper_params, primal_size_h_); @@ -3283,7 +3283,7 @@ void pdlp_solver_t::scale_problem() template void pdlp_solver_t::create_spmv_op_plans() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("pdlp_solver_t::create_spmv_op_plans"); + raft::common::nvtx::range fun_scope("pdlp_solver_t::create_spmv_op_plans"); if (is_distributed_master()) { // Distributed path: fan out the same per-shard cusparse_view call the // single-GPU path would make. @@ -3306,7 +3306,7 @@ void pdlp_solver_t::create_spmv_op_plans() template void pdlp_solver_t::compute_initial_step_size() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_initial_step_size"); + raft::common::nvtx::range fun_scope("compute_initial_step_size"); // Shared knobs for the power-iteration path (both single-GPU and // distributed) @@ -3496,7 +3496,7 @@ __global__ void compute_weights_initial_primal_weight_from_squared_norms( template void pdlp_solver_t::compute_initial_primal_weight() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_initial_primal_weight"); + raft::common::nvtx::range fun_scope("compute_initial_primal_weight"); if (is_distributed_master()) { // Distributed dispatch: diff --git a/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu b/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu index 37b8e3cb9b..5278d13983 100644 --- a/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu +++ b/cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu @@ -211,7 +211,7 @@ pdlp_restart_strategy_t::pdlp_restart_strategy_t( climber_strategies_(climber_strategies), hyper_params_(hyper_params) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Initializing restart strategy"); + raft::common::nvtx::range fun_scope("Initializing restart strategy"); // Init the vectors RAFT_CUDA_TRY(cudaMemsetAsync(last_restart_duality_gap_.primal_solution_.data(), @@ -335,7 +335,7 @@ bool pdlp_restart_strategy_t::run_trust_region_restart( rmm::device_uvector& primal_weight, const rmm::device_uvector& step_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run trust region restart"); + raft::common::nvtx::range fun_scope("run trust region restart"); #ifdef PDLP_VERBOSE_MODE std::cout << "Trust region restart:" << std::endl; #endif @@ -888,7 +888,7 @@ void pdlp_restart_strategy_t::cupdlpx_restart( rmm::device_uvector& best_primal_weight, [[maybe_unused]] const std::vector& should_restart) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("cupdlpx_restart"); + raft::common::nvtx::range fun_scope("cupdlpx_restart"); // TODO later batch mode: remove if you have per climber restart cuopt_assert( @@ -1115,7 +1115,7 @@ void pdlp_restart_strategy_t::compute_restart( [[maybe_unused]] rmm::device_uvector& best_primal_weight, std::vector& has_restarted) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_restart"); + raft::common::nvtx::range fun_scope("compute_restart"); if (hyper_params_.restart_strategy == static_cast(restart_strategy_t::KKT_RESTART)) { cuopt_expects(climber_strategies_.size() == 1, @@ -1229,7 +1229,7 @@ void pdlp_restart_strategy_t::compute_new_primal_weight( rmm::device_uvector& primal_step_size, rmm::device_uvector& dual_step_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_new_primal_weight"); + raft::common::nvtx::range fun_scope("compute_new_primal_weight"); cuopt_assert(!batch_mode_, "compute_new_primal_weight not supported in batch mode"); @@ -1251,8 +1251,7 @@ void pdlp_restart_strategy_t::distance_squared_moved_from_last_restart i_t stride, rmm::device_uvector& distance_moved) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "distance_squared_moved_from_last_restart_period"); + raft::common::nvtx::range fun_scope("distance_squared_moved_from_last_restart_period"); #ifdef PDLP_DEBUG_MODE rmm::device_scalar debuga{stream_view_}; rmm::device_scalar debugb{stream_view_}; @@ -1349,7 +1348,7 @@ template void pdlp_restart_strategy_t::update_last_restart_information( localized_duality_gap_container_t& duality_gap, rmm::device_uvector& primal_weight) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("update_last_restart_information"); + raft::common::nvtx::range fun_scope("update_last_restart_information"); compute_distance_traveled_last_restart_kernel<<<1, 1, 0, stream_view_.get()>>>( duality_gap.view(), primal_weight.data(), last_restart_duality_gap_.distance_traveled_.data()); @@ -1436,8 +1435,7 @@ void pdlp_restart_strategy_t::should_do_adaptive_restart_normalized_du rmm::device_uvector& primal_weight, i_t& restart) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "should_do_adaptive_restart_normalized_duality_gap"); + raft::common::nvtx::range fun_scope("should_do_adaptive_restart_normalized_duality_gap"); #ifdef PDLP_DEBUG_MODE std::cout << "Should do adaptive restart normalized duality gap" << std::endl; #endif @@ -1518,7 +1516,7 @@ void pdlp_restart_strategy_t::compute_localized_duality_gaps( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_localized_duality_gaps"); + raft::common::nvtx::range fun_scope("compute_localized_duality_gaps"); #ifdef PDLP_DEBUG_MODE std::cout << "Compute localized duality gaps:" << std::endl; #endif @@ -1567,7 +1565,7 @@ void pdlp_restart_strategy_t::bound_optimal_objective( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("bound_optimal_objective"); + raft::common::nvtx::range fun_scope("bound_optimal_objective"); #ifdef PDLP_DEBUG_MODE std::cout << "Bound optimal objective:" << std::endl; #endif @@ -1589,7 +1587,7 @@ void pdlp_restart_strategy_t::compute_bound(const rmm::device_uvector< rmm::device_uvector& tmp, rmm::device_scalar& bound) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_bound"); + raft::common::nvtx::range fun_scope("compute_bound"); #ifdef PDLP_DEBUG_MODE std::cout << "Compute bound" << std::endl; #endif @@ -1932,7 +1930,7 @@ void pdlp_restart_strategy_t::solve_bound_constrained_trust_region( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("solve_bound_constrained_trust_region"); + raft::common::nvtx::range fun_scope("solve_bound_constrained_trust_region"); #ifdef PDLP_DEBUG_MODE std::cout << " Solve bound constrained trust region:" << std::endl; #endif @@ -2228,8 +2226,7 @@ void pdlp_restart_strategy_t::compute_distance_traveled_from_last_rest rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "compute_distance_traveled_from_last_restart"); + raft::common::nvtx::range fun_scope("compute_distance_traveled_from_last_restart"); // norm( // new_primal_solution - last_restart.primal_solution, // )^2 @@ -2263,7 +2260,7 @@ void pdlp_restart_strategy_t::compute_primal_gradient( localized_duality_gap_container_t& duality_gap, cusparse_view_t& cusparse_view) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_gradient"); + raft::common::nvtx::range fun_scope("compute_primal_gradient"); #ifdef PDLP_DEBUG_MODE std::cout << " Compute primal gradient:" << std::endl; #endif @@ -2333,7 +2330,7 @@ void pdlp_restart_strategy_t::compute_dual_gradient( cusparse_view_t& cusparse_view, rmm::device_uvector& tmp_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_gradient"); + raft::common::nvtx::range fun_scope("compute_dual_gradient"); #ifdef PDLP_DEBUG_MODE std::cout << " Compute dual gradient:" << std::endl; #endif @@ -2377,7 +2374,7 @@ void pdlp_restart_strategy_t::compute_lagrangian_value( rmm::device_uvector& tmp_primal, rmm::device_uvector& tmp_dual) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_lagrangian_value"); + raft::common::nvtx::range fun_scope("compute_lagrangian_value"); #ifdef PDLP_DEBUG_MODE std::cout << " Compute lagrangian value:" << std::endl; #endif diff --git a/cpp/src/pdlp/solve.cu b/cpp/src/pdlp/solve.cu index 08296f3b40..171f73d9d3 100644 --- a/cpp/src/pdlp/solve.cu +++ b/cpp/src/pdlp/solve.cu @@ -1651,7 +1651,7 @@ optimization_problem_solution_t run_concurrent( }; if (settings.num_gpus > 1) { problem.handle_ptr->sync_stream(); - [[maybe_unused]] raft::device_setter device_setter(1); // Scoped variable + raft::device_setter device_setter(1); // Scoped variable CUOPT_LOG_DEBUG("Barrier device: %d", device_setter.get_current_device()); call_barrier_thread(); } else { @@ -1875,7 +1875,7 @@ optimization_problem_solution_t solve_qcqp( { try { // Create log stream for file logging and add it to default logger - [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); + init_logger_t log(settings.log_file, settings.log_to_console); print_version_info(); // Init libraries before to not include it in solve time @@ -1901,7 +1901,7 @@ optimization_problem_solution_t solve_qcqp( } } - [[maybe_unused]] raft::common::nvtx::range fun_scope("Running QCQP solver"); + raft::common::nvtx::range fun_scope("Running QCQP solver"); const bool has_q_obj = op_problem.has_quadratic_objective(); const bool has_qc = op_problem.has_quadratic_constraints(); if (has_q_obj && has_qc) { @@ -2058,7 +2058,7 @@ optimization_problem_solution_t solve_lp( try { pdlp_solver_settings_t settings(settings_const); // Create log stream for file logging and add it to default logger - [[maybe_unused]] init_logger_t log(settings.log_file, settings.log_to_console); + init_logger_t log(settings.log_file, settings.log_to_console); if (!settings_const.inside_mip) print_version_info(); @@ -2066,10 +2066,10 @@ optimization_problem_solution_t solve_lp( // This needs to be called before pdlp is initialized init_handler(op_problem.get_handle_ptr()); - [[maybe_unused]] raft::common::nvtx::range fun_scope("Running solver"); + raft::common::nvtx::range fun_scope("Running solver"); if (problem_checking) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Check problem representation"); + raft::common::nvtx::range fun_scope("Check problem representation"); // This is required as user might forget to set some fields problem_checking_t::check_problem_representation(op_problem); // In batch PDLP for strong branching, the initial solutions will be by design out of bounds. @@ -2363,7 +2363,7 @@ template cuopt::mathematical_optimization::io::mps_data_model_t op_problem_to_mps_data_model( const optimization_problem_t& op_problem) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("op_problem -> mps_data_model (D->H)"); + raft::common::nvtx::range fun_scope("op_problem -> mps_data_model (D->H)"); cuopt::mathematical_optimization::io::mps_data_model_t mps; mps.set_maximize(op_problem.get_sense()); @@ -2558,7 +2558,7 @@ optimization_problem_solution_t solve_lp_distributed_from_mps( "bound_objective_rescaling=true). Set pdlp_solver_mode = Stable3 (the default) or adjust " "the hyper-params to match."); - [[maybe_unused]] init_logger_t log(settings_resolved.log_file, settings_resolved.log_to_console); + init_logger_t log(settings_resolved.log_file, settings_resolved.log_to_console); print_version_info(visible_device_count); init_handler(handle_ptr); diff --git a/cpp/src/pdlp/solver_solution.cu b/cpp/src/pdlp/solver_solution.cu index a6b0a0cadf..ace97647f1 100644 --- a/cpp/src/pdlp/solver_solution.cu +++ b/cpp/src/pdlp/solver_solution.cu @@ -214,7 +214,7 @@ void optimization_problem_solution_t::write_to_file(std::string_view f cuda::stream_ref stream_view, bool generate_variable_values) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("write final solution to file"); + raft::common::nvtx::range fun_scope("write final solution to file"); cuopt_expects(termination_stats_.size() == 1, error_type_t::ValidationError, diff --git a/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu b/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu index 231a4308f5..245c36f8bf 100644 --- a/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu +++ b/cpp/src/pdlp/step_size_strategy/adaptive_step_size_strategy.cu @@ -340,7 +340,7 @@ void adaptive_step_size_strategy_t::compute_step_sizes( rmm::device_uvector& dual_step_size, i_t total_pdlp_iterations) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_step_sizes"); + raft::common::nvtx::range fun_scope("compute_step_sizes"); cuopt_assert(!batch_mode_, "Batch mode is not supported for compute_step_sizes"); diff --git a/cpp/src/pdlp/termination_strategy/convergence_information.cu b/cpp/src/pdlp/termination_strategy/convergence_information.cu index 4693488f55..f7e2725dc7 100644 --- a/cpp/src/pdlp/termination_strategy/convergence_information.cu +++ b/cpp/src/pdlp/termination_strategy/convergence_information.cu @@ -228,7 +228,7 @@ void convergence_information_t::distributed_init_l2_norms( error_type_t::ValidationError, "distributed_init_l2_norms: only the Stable3-shaped path is " "supported (initial_primal_weight_combined_bounds=false)."); - [[maybe_unused]] raft::common::nvtx::range scope("distributed_init_l2_norms"); + raft::common::nvtx::range scope("distributed_init_l2_norms"); f_t global_rhs_sq = f_t(0); @@ -552,7 +552,7 @@ void convergence_information_t::compute_convergence_information( dual_residual_.size() == primal_size_h_ * climber_strategies_.size(), "dual_residual_ size must be equal to primal_size_h_ * climber_strategies_.size()"); } - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_convergence_information"); + raft::common::nvtx::range fun_scope("compute_convergence_information"); #ifdef CUPDLP_DEBUG_MODE print("primal_iterate", primal_iterate); @@ -714,7 +714,7 @@ void convergence_information_t::compute_primal_residual( rmm::device_uvector& tmp_dual, [[maybe_unused]] const rmm::device_uvector& dual_iterate) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_residual"); + raft::common::nvtx::range fun_scope("compute_primal_residual"); // primal_product if (!batch_mode_) { @@ -802,7 +802,7 @@ template void convergence_information_t::compute_primal_objective_owned_partial( const rmm::device_uvector& primal_solution, i_t n_owned) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_objective_owned_partial"); + raft::common::nvtx::range fun_scope("compute_primal_objective_owned_partial"); cuopt_assert(!batch_mode_, "owned-partial primal objective is only used in non-batch mGPU mode"); cuopt_assert(n_owned <= primal_size_h_, "n_owned must be <= primal_size_h_ (owned slice is a prefix)"); @@ -820,7 +820,7 @@ template void convergence_information_t::compute_primal_objective( rmm::device_uvector& primal_solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_primal_objective"); + raft::common::nvtx::range fun_scope("compute_primal_objective"); if (!batch_mode_) { compute_primal_objective_owned_partial(primal_solution, primal_size_h_); @@ -871,7 +871,7 @@ void convergence_information_t::compute_dual_residual( cuopt_assert(dual_residual_.size() == primal_solution.size(), "dual_residual_ size must be equal to primal_solution size"); - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_residual"); + raft::common::nvtx::range fun_scope("compute_dual_residual"); // compute objective product (Q*x) if QP // gradient is recomputed with the dual solution that has been computed since the gradient was @@ -948,7 +948,7 @@ void convergence_information_t::compute_dual_objective_owned_partial( i_t n_owned_var, i_t n_owned_cstr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_objective_owned_partial"); + raft::common::nvtx::range fun_scope("compute_dual_objective_owned_partial"); cuopt_assert(!batch_mode_, "owned-partial dual objective is only used in non-batch mGPU mode"); cuopt_assert(hyper_params_.use_reflected_primal_dual, "owned-partial dual objective requires use_reflected_primal_dual"); @@ -991,7 +991,7 @@ void convergence_information_t::compute_dual_objective( [[maybe_unused]] const rmm::device_uvector& primal_solution, [[maybe_unused]] const rmm::device_uvector& dual_slack) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_dual_objective"); + raft::common::nvtx::range fun_scope("compute_dual_objective"); // for QP would need to add + problem.objective_constant - 0.5 * objective_product' * // primal_solution @@ -1078,7 +1078,7 @@ template void convergence_information_t::compute_reduced_cost_from_primal_gradient( const rmm::device_uvector& primal_gradient, const rmm::device_uvector& primal_solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_reduced_cost_from_primal_gradient"); + raft::common::nvtx::range fun_scope("compute_reduced_cost_from_primal_gradient"); using f_t2 = typename type_2::type; cub::DeviceTransform::Transform( @@ -1109,8 +1109,7 @@ void convergence_information_t::compute_reduced_cost_from_primal_gradi template void convergence_information_t::compute_reduced_costs_dual_objective_contribution() { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "compute_reduced_costs_dual_objective_contribution"); + raft::common::nvtx::range fun_scope("compute_reduced_costs_dual_objective_contribution"); using f_t2 = typename type_2::type; // if reduced cost is positive -> lower bound, negative -> upper bounds, 0 -> 0 diff --git a/cpp/src/pdlp/termination_strategy/infeasibility_information.cu b/cpp/src/pdlp/termination_strategy/infeasibility_information.cu index cf2229f8c6..100365c366 100644 --- a/cpp/src/pdlp/termination_strategy/infeasibility_information.cu +++ b/cpp/src/pdlp/termination_strategy/infeasibility_information.cu @@ -234,7 +234,7 @@ void infeasibility_information_t::compute_infeasibility_information( rmm::device_uvector& primal_ray, rmm::device_uvector& dual_ray) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_infeasibility_information"); + raft::common::nvtx::range fun_scope("compute_infeasibility_information"); using f_t2 = typename type_2::type; if (is_cupdlpx_restart(hyper_params_)) { diff --git a/cpp/src/pdlp/termination_strategy/termination_strategy.cu b/cpp/src/pdlp/termination_strategy/termination_strategy.cu index 4cee4f88bd..9738675690 100644 --- a/cpp/src/pdlp/termination_strategy/termination_strategy.cu +++ b/cpp/src/pdlp/termination_strategy/termination_strategy.cu @@ -162,7 +162,7 @@ void pdlp_termination_strategy_t::evaluate_termination_criteria( const rmm::device_uvector& combined_bounds, const rmm::device_uvector& objective_coefficients) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Evaluate termination criteria"); + raft::common::nvtx::range fun_scope("Evaluate termination criteria"); convergence_information_.compute_convergence_information(current_pdhg_solver, primal_iterate, diff --git a/cpp/src/pdlp/translate.hpp b/cpp/src/pdlp/translate.hpp index ef168ca829..135d3168f6 100644 --- a/cpp/src/pdlp/translate.hpp +++ b/cpp/src/pdlp/translate.hpp @@ -215,8 +215,7 @@ template static simplex::user_problem_t cuopt_optimization_problem_to_user_problem( raft::handle_t const* handle_ptr, optimization_problem_t& model) { - [[maybe_unused]] raft::common::nvtx::range fun_scope( - "QCQP: cuopt_optimization_problem_to_user_problem"); + raft::common::nvtx::range fun_scope("QCQP: cuopt_optimization_problem_to_user_problem"); simplex::user_problem_t user_problem(handle_ptr); i_t const m = model.get_n_constraints(); diff --git a/cpp/src/pdlp/utilities/cython_solve.cu b/cpp/src/pdlp/utilities/cython_solve.cu index f30983af03..b44c56516c 100644 --- a/cpp/src/pdlp/utilities/cython_solve.cu +++ b/cpp/src/pdlp/utilities/cython_solve.cu @@ -56,7 +56,7 @@ cuopt::mathematical_optimization::lp_solution_interface_t* call_sol cuopt::mathematical_optimization::pdlp_solver_settings_t& solver_settings, bool is_batch_mode) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Call Solve LP"); + raft::common::nvtx::range fun_scope("Call Solve LP"); cuopt_expects(problem_interface->get_problem_category() == cuopt::mathematical_optimization::problem_category_t::LP, error_type_t::ValidationError, @@ -84,7 +84,7 @@ cuopt::mathematical_optimization::mip_solution_interface_t* call_so problem_interface, cuopt::mathematical_optimization::mip_solver_settings_t& solver_settings) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Call Solve MIP"); + raft::common::nvtx::range fun_scope("Call Solve MIP"); cuopt_expects((problem_interface->get_problem_category() == cuopt::mathematical_optimization::problem_category_t::MIP) or (problem_interface->get_problem_category() == @@ -107,7 +107,7 @@ std::unique_ptr call_solve( bool is_batch_mode, barrier_cache_t* cache_in) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Call Solve"); + raft::common::nvtx::range fun_scope("Call Solve"); cuopt_expects( data_model != nullptr, error_type_t::ValidationError, "call_solve: data_model is null."); @@ -309,7 +309,7 @@ std::pair>, double> call_batch_solve( std::vector*> data_models, cuopt::mathematical_optimization::solver_settings_t* solver_settings) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("Call batch solve"); + raft::common::nvtx::range fun_scope("Call batch solve"); if (cuopt::mathematical_optimization::is_remote_execution_enabled()) { return solve_batch_remote(data_models, solver_settings); @@ -317,8 +317,8 @@ std::pair>, double> call_batch_solve( // Hold the logger configuration for the whole batch so that worker-local // init_logger_t instances inside solve_lp() reuse it. - [[maybe_unused]] init_logger_t batch_log(solver_settings->get_pdlp_settings().log_file, - solver_settings->get_pdlp_settings().log_to_console); + init_logger_t batch_log(solver_settings->get_pdlp_settings().log_file, + solver_settings->get_pdlp_settings().log_to_console); const std::size_t size = data_models.size(); diff --git a/cpp/src/routing/adapters/adapted_generator.cu b/cpp/src/routing/adapters/adapted_generator.cu index 294a5ec013..da4027add2 100644 --- a/cpp/src/routing/adapters/adapted_generator.cu +++ b/cpp/src/routing/adapters/adapted_generator.cu @@ -31,7 +31,7 @@ bool adapted_generator_t::make_feasible( costs const& weight, bool clear_scores) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("make_feasible"); + raft::common::nvtx::range fun_scope("make_feasible"); auto [resource, index] = pool_allocator.resource_pool->acquire(); resource.ges.set_solution_ptr(&adapted_solution.sol, clear_scores); resource.ges.start_timer(std::chrono::steady_clock::now(), time_limit); @@ -89,7 +89,7 @@ void adapted_generator_t::generate_solution( const costs& weight, const timer_t& timer) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_solution"); + raft::common::nvtx::range fun_scope("generate_solution"); if (sol.problem->is_tsp) { generate_tsp_solution(sol, desired_vehicle_ids); return; diff --git a/cpp/src/routing/adapters/adapted_modifier.cu b/cpp/src/routing/adapters/adapted_modifier.cu index ba743e71af..4675581a6d 100644 --- a/cpp/src/routing/adapters/adapted_modifier.cu +++ b/cpp/src/routing/adapters/adapted_modifier.cu @@ -26,7 +26,7 @@ template void adapted_modifier_t::perturbate( adapted_sol_t& adapted_solution, costs weight, i_t perturbation_count) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("perturbate"); + raft::common::nvtx::range fun_scope("perturbate"); auto [resource, index] = pool_allocator.resource_pool->acquire(); auto gpu_weight = get_cuopt_cost(weight); // temporarily set it to double max. it is not used anymore @@ -48,7 +48,7 @@ void adapted_modifier_t::improve( f_t time_limit, bool run_cycle_finder) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("improve"); + raft::common::nvtx::range fun_scope("improve"); auto [resource, index] = pool_allocator.resource_pool->acquire(); // set the excess limit to to the total excess with some multiplier auto gpu_weight = get_cuopt_cost(weight); @@ -70,7 +70,7 @@ template void adapted_modifier_t::add_unserviced_request( adapted_sol_t& adapted_solution, costs final_weight) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_unserviced_request"); + raft::common::nvtx::range fun_scope("add_unserviced_request"); // find unserviced requests auto [resource, index] = pool_allocator.resource_pool->acquire(); resource.ges.set_solution_ptr(&adapted_solution.sol); @@ -94,7 +94,7 @@ void adapted_modifier_t::add_selected_unserviced_requests( costs final_weight) { if (unserviced_nodes.empty()) { return; } - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_selected_unserviced_request"); + raft::common::nvtx::range fun_scope("add_selected_unserviced_request"); // find unserviced requests auto [resource, index] = pool_allocator.resource_pool->acquire(); resource.ges.set_solution_ptr(&adapted_solution.sol); @@ -120,7 +120,7 @@ void adapted_modifier_t::equalize_routes_and_nodes( costs final_weight, bool skip_adding_nodes_to_a) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("equalize_routes_and_nodes"); + raft::common::nvtx::range fun_scope("equalize_routes_and_nodes"); // If both solutions have no unserviced nodes (default behavior) // and if they have equal route count we should exit early @@ -167,7 +167,7 @@ template bool adapted_modifier_t::eject_request_infeasible_nodes( adapted_sol_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("eject_request_infeasible_nodes"); + raft::common::nvtx::range fun_scope("eject_request_infeasible_nodes"); helper_set.clear(); helper_nodes.clear(); for (int i = 0; i < (int)sol.problem->get_num_orders(); i++) { @@ -215,7 +215,7 @@ template void adapted_modifier_t::insert_infeasible_nodes( adapted_sol_t& sol, costs& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_infeasible_nodes"); + raft::common::nvtx::range fun_scope("insert_infeasible_nodes"); // add cluster/order infeasible nodes to the solution sol.add_nodes_to_best(helper_nodes, weights); } @@ -224,7 +224,7 @@ template bool adapted_modifier_t::make_cluster_order_feasible_request( adapted_sol_t& sol, costs weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("make_cluster_order_feasible_request"); + raft::common::nvtx::range fun_scope("make_cluster_order_feasible_request"); if constexpr (REQUEST == request_t::VRP) { return true; } if (eject_request_infeasible_nodes(sol)) { insert_infeasible_nodes(sol, weights); diff --git a/cpp/src/routing/adapters/adapted_sol.cuh b/cpp/src/routing/adapters/adapted_sol.cuh index dd1df49bb3..007f083083 100644 --- a/cpp/src/routing/adapters/adapted_sol.cuh +++ b/cpp/src/routing/adapters/adapted_sol.cuh @@ -107,7 +107,7 @@ struct adapted_sol_t { std::vector desired_vehicles = {}) : sol(*problem_, 0, sol_handle_, desired_vehicles), problem(problem_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("adapted_sol_t ctr"); + raft::common::nvtx::range fun_scope("adapted_sol_t ctr"); initialize_host_data(); populate_host_data(true); } @@ -117,7 +117,7 @@ struct adapted_sol_t { adapted_sol_t& operator=(const adapted_sol_t& other_sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("adapted_sol_t assignment"); + raft::common::nvtx::range fun_scope("adapted_sol_t assignment"); if (this == &other_sol) return *this; infeasibility_cost = other_sol.infeasibility_cost; problem = other_sol.problem; @@ -137,7 +137,7 @@ struct adapted_sol_t { void reset_viable_of_problem() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("reset_viable_of_problem"); + raft::common::nvtx::range fun_scope("reset_viable_of_problem"); initialize_incompatible(const_cast&>(*sol.problem_ptr), &sol); } @@ -165,7 +165,7 @@ struct adapted_sol_t { double get_cost(costs& weight) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_cost"); + raft::common::nvtx::range fun_scope("get_cost"); auto cuopt_weight = get_cuopt_cost(weight); sol.compute_cost(); return sol.get_total_cost(cuopt_weight); @@ -176,14 +176,14 @@ struct adapted_sol_t { bool unserviced(int node) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("unserviced"); + raft::common::nvtx::range fun_scope("unserviced"); return (!pred[node].is_valid() && !succ[node].is_valid()); } // adds nodes to best position that minimizes cluster violations void add_nodes_to_best(const std::vector>& nodes_to_insert, costs& weight) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_best"); + raft::common::nvtx::range fun_scope("add_nodes_to_best"); sol.add_nodes_to_best(nodes_to_insert, get_cuopt_cost(weight)); populate_host_data(); check_device_host_coherence(); @@ -194,13 +194,13 @@ struct adapted_sol_t { // routes_to_search array void unset_routes_to_search() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("unset_routes_to_search"); + raft::common::nvtx::range fun_scope("unset_routes_to_search"); sol.unset_routes_to_search(); } void set_routes_to_search() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("set_routes_to_search"); + raft::common::nvtx::range fun_scope("set_routes_to_search"); sol.set_routes_to_search(); } @@ -209,7 +209,7 @@ struct adapted_sol_t { NodeInfo<> prev_node, NodeInfo<> next_node) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_route"); + raft::common::nvtx::range fun_scope("add_nodes_to_route"); i_t route_id, intra_idx; if (!prev_node.is_depot()) { std::tie(route_id, intra_idx) = sol.route_node_map.get_route_id_and_intra_idx(prev_node); @@ -230,7 +230,7 @@ struct adapted_sol_t { // returns false if we encounter an empty route bool remove_nodes(const std::vector>& nodes_to_eject) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_nodes"); + raft::common::nvtx::range fun_scope("remove_nodes"); bool success = sol.remove_nodes(nodes_to_eject); populate_host_data(); check_device_host_coherence(); @@ -251,7 +251,7 @@ struct adapted_sol_t { double calculate_similarity_radius_asymetric(const adapted_sol_t& second) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("calculate_similarity_radius"); + raft::common::nvtx::range fun_scope("calculate_similarity_radius"); // check_device_host_coherence(); int common_edges = 0; int nodes = problem->get_num_orders(); @@ -290,7 +290,7 @@ struct adapted_sol_t { void add_new_routes(const std::vector>>>& routes) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_new_routes"); + raft::common::nvtx::range fun_scope("add_new_routes"); cuopt_assert(routes.size() > 0, "Indices array cannot be empty"); thrust::fill(sol.sol_handle->get_thrust_policy(), sol.routes_to_copy.data() + sol.n_routes, @@ -325,7 +325,7 @@ struct adapted_sol_t { std::vector get_nodes_of_routes(const std::vector& routes_to_copy) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_route"); + raft::common::nvtx::range fun_scope("remove_route"); std::vector copy_nodes; if (routes_to_copy.empty()) { return copy_nodes; } @@ -344,7 +344,7 @@ struct adapted_sol_t { void remove_routes(std::vector routes_to_remove) { if (routes_to_remove.empty()) { return; } - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_route"); + raft::common::nvtx::range fun_scope("remove_route"); std::sort(routes_to_remove.begin(), routes_to_remove.end()); sol.remove_routes(routes_to_remove); for (size_t i = 0; i < routes_to_remove.size(); ++i) { @@ -408,7 +408,7 @@ struct adapted_sol_t { void different_route_ids(std::vector& route_ids, adapted_sol_t const& input) const noexcept { - [[maybe_unused]] raft::common::nvtx::range fun_scope("different_route_ids"); + raft::common::nvtx::range fun_scope("different_route_ids"); route_ids.clear(); for (size_t i = 0; i < routes.size(); i++) { if (routes[i].is_empty()) { continue; } @@ -443,7 +443,7 @@ struct adapted_sol_t { void populate_unserviced_nodes() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_unserviced_nodes"); + raft::common::nvtx::range fun_scope("populate_unserviced_nodes"); has_unserviced_nodes = false; auto h_route_id_per_node = host_copy(sol.route_node_map.route_id_per_node, sol.sol_handle->get_stream()); @@ -467,14 +467,14 @@ struct adapted_sol_t { void clear_solution(std::vector vehicle_ids) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("clear_solution"); + raft::common::nvtx::range fun_scope("clear_solution"); sol.clear_routes(vehicle_ids); initialize_host_data(); } void populate_host_data(bool copy_all = false, bool skip_route_copy = false) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_host_data"); + raft::common::nvtx::range fun_scope("populate_host_data"); sol.compute_cost(); cuopt_func_call(sol.check_cost_coherence(default_weights)); sol.sol_handle->sync_stream(); diff --git a/cpp/src/routing/crossovers/dispose.hpp b/cpp/src/routing/crossovers/dispose.hpp index 671c7d833d..47060b8770 100644 --- a/cpp/src/routing/crossovers/dispose.hpp +++ b/cpp/src/routing/crossovers/dispose.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ @@ -22,7 +22,7 @@ struct dispose { bool recombine(Solution& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("dispose"); + raft::common::nvtx::range fun_scope("dispose"); if (sol.sol.get_n_routes() <= sol.sol.problem_ptr->data_view_ptr->get_min_vehicles()) { return false; } diff --git a/cpp/src/routing/crossovers/eax_recombiner.hpp b/cpp/src/routing/crossovers/eax_recombiner.hpp index 83af2cd6c7..2bb97a6668 100644 --- a/cpp/src/routing/crossovers/eax_recombiner.hpp +++ b/cpp/src/routing/crossovers/eax_recombiner.hpp @@ -56,7 +56,7 @@ struct a_eax { bool asymmetric = true, bool use_perfect_edges_limit = true) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("eax"); + raft::common::nvtx::range fun_scope("eax"); // THIS IS TEMPORARY UNTIL EMPTY ROUTES ARE FIXED if (check_if_routes_empty(a) || check_if_routes_empty(b)) return false; if (!set_recombination_depot(a, b)) { return false; } diff --git a/cpp/src/routing/crossovers/inversion_recombiner.hpp b/cpp/src/routing/crossovers/inversion_recombiner.hpp index c715cc3421..4092782b53 100644 --- a/cpp/src/routing/crossovers/inversion_recombiner.hpp +++ b/cpp/src/routing/crossovers/inversion_recombiner.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ @@ -53,7 +53,7 @@ struct inversion { * } */ bool recombine(Solution& a, const Solution& b) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("inversion"); + raft::common::nvtx::range fun_scope("inversion"); // THIS IS TEMPORARY UNTIL EMPTY ROUTES ARE FIXED if (check_if_routes_empty(a) || check_if_routes_empty(b)) return false; bool relative = next_random() % 2; diff --git a/cpp/src/routing/crossovers/optimal_eax_cycles.cu b/cpp/src/routing/crossovers/optimal_eax_cycles.cu index 61e067f423..1aa8861062 100644 --- a/cpp/src/routing/crossovers/optimal_eax_cycles.cu +++ b/cpp/src/routing/crossovers/optimal_eax_cycles.cu @@ -143,7 +143,7 @@ template void optimal_cycles_t::get_min_delta_and_index( adapted_sol_t& sol, i_t num_items) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_min_delta_and_index"); + raft::common::nvtx::range fun_scope("get_min_delta_and_index"); // Determine temporary device storage requirements size_t temp_storage_bytes = 0; cub::DeviceReduce::ArgMin(static_cast(nullptr), @@ -169,7 +169,7 @@ template bool optimal_cycles_t::insert_cycle_to_found_position( adapted_sol_t& sol, i_t n_rotations) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_cycle_to_found_position"); + raft::common::nvtx::range fun_scope("insert_cycle_to_found_position"); auto& solution = sol.sol; size_t sh_size = solution.check_routes_can_insert_and_get_sh_size(n_rotations); constexpr i_t TPB = 128; @@ -194,7 +194,7 @@ bool optimal_cycles_t::add_cycles_request( std::vector>>& cycles, costs final_weight) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_cycles_request_vrp"); + raft::common::nvtx::range fun_scope("add_cycles_request_vrp"); auto [resource, index] = pool_allocator.resource_pool->acquire(); auto gpu_weight = get_cuopt_cost(final_weight); resource.ls.set_active_weights(gpu_weight, std::numeric_limits::max()); @@ -252,7 +252,7 @@ template void optimal_cycles_t::find_best_rotate_cycle( std::vector>& cycle, adapted_sol_t& s) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_best_rotate_cycle"); + raft::common::nvtx::range fun_scope("find_best_rotate_cycle"); cuopt_assert(REQUEST == request_t::PDP, "A runtime error occurred in find_best_rotate_cycle!"); cuopt_expects(REQUEST == request_t::PDP, error_type_t::RuntimeError, "A runtime error occurred!"); cycle_helper.resize(cycle.size(), NodeInfo<>()); @@ -306,7 +306,7 @@ template void optimal_cycles_t::insert_cycle_to_route_request( std::vector>& cycle, size_t route_id, adapted_sol_t& s) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_cycle_to_route_PDP"); + raft::common::nvtx::range fun_scope("insert_cycle_to_route_PDP"); cuopt_assert(REQUEST == request_t::PDP, "A runtime error occurred in insert_cycle_to_route_request!"); cuopt_expects(REQUEST == request_t::PDP, error_type_t::RuntimeError, "A runtime error occurred!"); diff --git a/cpp/src/routing/crossovers/ox_recombiner.cuh b/cpp/src/routing/crossovers/ox_recombiner.cuh index 0dddea576d..1c4e21ef6b 100644 --- a/cpp/src/routing/crossovers/ox_recombiner.cuh +++ b/cpp/src/routing/crossovers/ox_recombiner.cuh @@ -180,7 +180,7 @@ struct OX { /// count violation, size/memory guards) — A is then left unchanged. bool recombine(Solution& A, Solution& B) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("ox"); + raft::common::nvtx::range fun_scope("ox"); if (check_if_routes_empty(A) || check_if_routes_empty(B)) return false; @@ -566,7 +566,7 @@ struct OX { template void sort_graph_edges(Solution const& A, ox_graph_t& graph) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("ox_sort_graph"); + raft::common::nvtx::range fun_scope("ox_sort_graph"); auto stream_view = A.sol.sol_handle->get_stream(); auto policy = A.sol.sol_handle->get_thrust_policy(); @@ -616,7 +616,7 @@ struct OX { void compute_transpose_graph(Solution const& A) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("transpose_graph"); + raft::common::nvtx::range fun_scope("transpose_graph"); constexpr auto const TPB = 128; auto const n_blocks = n_buckets * d_graph.get_num_vertices(); @@ -632,7 +632,7 @@ struct OX { //! } void bellman_ford(Solution& A) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("bellman_ford"); + raft::common::nvtx::range fun_scope("bellman_ford"); compute_transpose_graph(A); cuopt_func_call(test_transpose_graph(A.sol.sol_handle->get_stream())); @@ -947,7 +947,7 @@ struct OX { //! depots. } void calculate_edge_costs(Solution& A) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("calculate_edge_costs"); + raft::common::nvtx::range fun_scope("calculate_edge_costs"); d_graph.reset(A.sol.sol_handle); diff --git a/cpp/src/routing/crossovers/srex_recombiner.hpp b/cpp/src/routing/crossovers/srex_recombiner.hpp index a012aeba29..58e88f8927 100644 --- a/cpp/src/routing/crossovers/srex_recombiner.hpp +++ b/cpp/src/routing/crossovers/srex_recombiner.hpp @@ -42,7 +42,7 @@ struct srex { * } */ bool recombine(Solution& a, Solution& b, bool& ret) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("srex"); + raft::common::nvtx::range fun_scope("srex"); // different routes from a & b > 1. Set min routes if (a.routes.size() <= 1 || b.routes.size() <= 1) return false; if (check_if_routes_empty(a) || check_if_routes_empty(b)) return false; diff --git a/cpp/src/routing/diversity/diverse_solver.hpp b/cpp/src/routing/diversity/diverse_solver.hpp index 2c0297d835..d519a4a21b 100644 --- a/cpp/src/routing/diversity/diverse_solver.hpp +++ b/cpp/src/routing/diversity/diverse_solver.hpp @@ -250,7 +250,7 @@ struct solve { improvement_timer(timer_), perturbation_count(0) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("solve ctr"); + raft::common::nvtx::range fun_scope("solve ctr"); std::uniform_int_distribution uniform(0, UINT64_MAX); s_xoshiro[0] = uniform(rng); @@ -676,7 +676,7 @@ struct solve { const std::string& path = "./", bool from_dir = false) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_search"); + raft::common::nvtx::range fun_scope("perform_search"); feasible_only = feasible_only_; target_vehicles_ = routes_number; @@ -713,7 +713,7 @@ struct solve { * similar to all other) refill with generated ones } */ void refill_reserve(const std::vector& vehicle_ids, int sols_num = 5) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("refill_reserve"); + raft::common::nvtx::range fun_scope("refill_reserve"); if (timer.check_time_limit()) return; @@ -733,7 +733,7 @@ struct solve { * best initial diversity level. } */ int find_initial_diversity(std::vector& sols, bool avg) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_initial_diversity"); + raft::common::nvtx::range fun_scope("find_initial_diversity"); int threshold_index = 0; double average = 0.0; double max = 0.0; @@ -769,7 +769,7 @@ struct solve { * generations to achieve pool size of at least 3. } */ void generate_initial(int routes_number, int islands_size = -1) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("generate_initial"); + raft::common::nvtx::range fun_scope("generate_initial"); bool first_gen = true; size_t start_index = std::min(3, diversity_levels.size() - 1); auto next_injection = 0; @@ -924,7 +924,7 @@ struct solve { */ void adjust_weights(double best_before_improvement) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("adjust_weights"); + raft::common::nvtx::range fun_scope("adjust_weights"); const auto& best_found = working_population.best(); double cost_of_best_feasible = working_population.is_feasible() @@ -965,7 +965,7 @@ struct solve { int start_threshold_index, bool consider_expensive_recombiners = true) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("improve_population"); + raft::common::nvtx::range fun_scope("improve_population"); if (p.current_size() < 2) return; while (start_threshold_index >= 0) { @@ -1020,7 +1020,7 @@ struct solve { bool consider_expensive_recombiners = true) { // std::cout << "Improve population\n"; - [[maybe_unused]] raft::common::nvtx::range fun_scope("improve_population_fixed_threshold"); + raft::common::nvtx::range fun_scope("improve_population_fixed_threshold"); if (p.current_size() < 2) return; bool improved = true; @@ -1095,7 +1095,7 @@ struct solve { bool& guiding, bool consider_expensive_recombiners = false) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("recombine"); + raft::common::nvtx::range fun_scope("recombine"); guiding = false; bool success = false; diff --git a/cpp/src/routing/diversity/population.hpp b/cpp/src/routing/diversity/population.hpp index f16b73e59a..af52c2cb7c 100644 --- a/cpp/src/routing/diversity/population.hpp +++ b/cpp/src/routing/diversity/population.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ @@ -56,7 +56,7 @@ struct population { allocator& pool_allocator) : max_solutions(max_solutions_), weights(weights_), problem_ptr(P_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("population ctr"); + raft::common::nvtx::range fun_scope("population ctr"); solutions.reserve(max_solutions_); for (size_t i = 0; i < max_solutions_; ++i) { bool occupied = false; @@ -83,7 +83,7 @@ struct population { std::vector get_n_best(int number) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_n_best"); + raft::common::nvtx::range fun_scope("get_n_best"); number = std::min(number, indices.size() - 1); size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); @@ -104,7 +104,7 @@ struct population { * return all availible solutions. } */ std::vector get_n_random(int number, bool tournament = false, int ignore_first_n = 0) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_n_random"); + raft::common::nvtx::range fun_scope("get_n_random"); number = std::min(number, indices.size() - 1 - ignore_first_n); size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); @@ -180,7 +180,7 @@ struct population { /*! \brief { Get random solution. } */ solution get_random_solution(bool tournament) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_random_solution"); + raft::common::nvtx::range fun_scope("get_random_solution"); // Assert size > 1 size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); size_t i = add + next_random() % (indices.size() - 1); @@ -194,7 +194,7 @@ struct population { /*! \brief { Get random solution with strong tournament selection. } */ solution get_random_solution_tournament() const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_random_solution_tournament"); + raft::common::nvtx::range fun_scope("get_random_solution_tournament"); // Assert size > 1 size_t i1 = 1 + next_random() % (indices.size() - 1); for (int i = 0; i < 14; i++) { @@ -206,7 +206,7 @@ struct population { /*! \brief { Get two random solutions. } */ void get_two_random(std::pair& random_pair, bool tournament) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_two_random"); + raft::common::nvtx::range fun_scope("get_two_random"); // Assert size > 2 size_t add = (size_t)(!solutions[0].first || solutions[indices[1].first].second.is_feasible()); size_t i = add + next_random() % (indices.size() - 1); @@ -241,7 +241,7 @@ struct population { */ int add_solution(int elapsed_time, solution& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_solution"); + raft::common::nvtx::range fun_scope("add_solution"); double sol_cost = sol.get_cost(weights); cuopt_func_call(sol.sol.check_cost_coherence(detail::default_weights)); @@ -311,7 +311,7 @@ struct population { */ void change_weights(costs& weights_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("change_weights"); + raft::common::nvtx::range fun_scope("change_weights"); weights = weights_; if (indices.size() == 1) return; using pr = std::pair; @@ -330,7 +330,7 @@ struct population { * found we return max_solutions. }*/ size_t best_similar_index(const solution& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("best_similar_index"); + raft::common::nvtx::range fun_scope("best_similar_index"); if (indices.size() == 1) return max_solutions; for (size_t i = 1; i < indices.size(); i++) { if (sol.calculate_similarity_radius(solutions[indices[i].first].second) > threshold) { @@ -347,7 +347,7 @@ struct population { */ int insert_index(std::pair to_insert) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("insert_index"); + raft::common::nvtx::range fun_scope("insert_index"); // Assert free index is availible indices.emplace_back(0, 0.0); size_t start = indices.size() - 1; @@ -365,7 +365,7 @@ struct population { */ void eradicate_similar(size_t start_index, solution& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("eradicate_similar"); + raft::common::nvtx::range fun_scope("eradicate_similar"); for (size_t i = start_index; i < indices.size(); i++) { if (sol.calculate_similarity_radius(solutions[indices[i].first].second) > threshold) { solutions[indices[i].first].first = false; // mark place as availible @@ -387,7 +387,7 @@ struct population { */ size_t find_free_solution_index() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_free_solution_index"); + raft::common::nvtx::range fun_scope("find_free_solution_index"); // ASSERT such index exists for (size_t i = 1; i < solutions.size(); i++) if (solutions[i].first == false) return i; diff --git a/cpp/src/routing/ges/eject_until_feasible.cu b/cpp/src/routing/ges/eject_until_feasible.cu index f10c58628c..b5cc4dbd93 100644 --- a/cpp/src/routing/ges/eject_until_feasible.cu +++ b/cpp/src/routing/ges/eject_until_feasible.cu @@ -357,7 +357,7 @@ __global__ void populate_ep_with_selected_unserved_kernel( template void solution_t::eject_until_feasible(bool add_slack_to_sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("eject_until_feasible"); + raft::common::nvtx::range fun_scope("eject_until_feasible"); auto stream = sol_handle->get_stream(); const i_t TPB = 32; compute_max_active(); @@ -376,7 +376,7 @@ template void solution_t::populate_ep_with_unserved( ejection_pool_t>& EP) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); + raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); auto stream = sol_handle->get_stream(); rmm::device_scalar ep_index_out(EP.index_, stream); const i_t TPB = 256; @@ -395,7 +395,7 @@ template void solution_t::populate_ep_with_selected_unserved( ejection_pool_t>& EP, const std::vector& unserviced) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); + raft::common::nvtx::range fun_scope("populate_ep_with_unserved"); auto stream = sol_handle->get_stream(); rmm::device_scalar ep_index_out(EP.index_, stream); constexpr auto const TPB = 256; diff --git a/cpp/src/routing/ges/execute_insertion.cu b/cpp/src/routing/ges/execute_insertion.cu index 1d10e6ef66..8dace9832d 100644 --- a/cpp/src/routing/ges/execute_insertion.cu +++ b/cpp/src/routing/ges/execute_insertion.cu @@ -238,7 +238,7 @@ template bool guided_ejection_search_t::execute_best_insertion_ejection_solution( request_info_t* d_request, i_t& counter) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("execute_best_insertion_ejection_solution"); + raft::common::nvtx::range fun_scope("execute_best_insertion_ejection_solution"); counter++; constexpr uint64_t unset_val = static_cast(-1); @@ -353,7 +353,7 @@ template bool guided_ejection_search_t::perform_insertion( const request_info_t* request) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_insertion"); + raft::common::nvtx::range fun_scope("perform_insertion"); // Picks a random one and execute the move const found_sol_t selected_candidate = select_random_initialized(feasible_candidates_data_, solution_ptr); @@ -375,7 +375,7 @@ template i_t guided_ejection_search_t::find_single_insertion( const request_info_t* request) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_single_insertion"); + raft::common::nvtx::range fun_scope("find_single_insertion"); constexpr i_t threads_per_block = 64; i_t grid_size = solution_ptr->get_n_routes(); cuopt_assert(grid_size > 0, "Number of route in solution should be positive."); @@ -419,7 +419,7 @@ template bool guided_ejection_search_t::try_single_insert_with_perturbation( const request_info_t* request) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("try_single_insert_with_perturbation"); + raft::common::nvtx::range fun_scope("try_single_insert_with_perturbation"); i_t const_1, const_2; const_1 = 1; const_2 = 8; diff --git a/cpp/src/routing/ges/guided_ejection_search.cu b/cpp/src/routing/ges/guided_ejection_search.cu index 66f67cc03f..bc127d2462 100644 --- a/cpp/src/routing/ges/guided_ejection_search.cu +++ b/cpp/src/routing/ges/guided_ejection_search.cu @@ -78,7 +78,7 @@ guided_ejection_search_t::guided_ejection_search_t( intermediate_file(file), dump_intermediate(false) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("guided_ejection_search_t"); + raft::common::nvtx::range fun_scope("guided_ejection_search_t"); reset_p_scores(); } @@ -189,7 +189,7 @@ __global__ void incr_p_scores(const request_info_t* request_id, template void guided_ejection_search_t::shuffle_pool() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("shuffle_pool"); + raft::common::nvtx::range fun_scope("shuffle_pool"); // include the ejected request in shuffle ++EP.index_; EP.random_shuffle(solution_ptr->problem_ptr->seed_gen.get_seed()); @@ -202,7 +202,7 @@ bool guided_ejection_search_t::guided_ejection_search_loop(i_ bool minimize_routes, i_t desired_ep_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("guided_ejection_search_loop"); + raft::common::nvtx::range fun_scope("guided_ejection_search_loop"); i_t iteration_limit = 500000; i_t ges_loop_iterations = 0; i_t consecutive_ejection_failure = 1; @@ -322,7 +322,7 @@ bool guided_ejection_search_t::guided_ejection_search_loop(i_ template bool guided_ejection_search_t::greedy_insert(bool insert_all) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("greedy_insert"); + raft::common::nvtx::range fun_scope("greedy_insert"); i_t const n_max_multiple_insertions = std::max( 2 * solution_ptr->get_n_routes(), (i_t)(solution_ptr->get_num_requests() * insertion_rate)); @@ -347,7 +347,7 @@ bool guided_ejection_search_t::greedy_insert(bool insert_all) template void guided_ejection_search_t::init_ejection_pool() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("init_ejection_pool"); + raft::common::nvtx::range fun_scope("init_ejection_pool"); solution_ptr->populate_ep_with_unserved(EP); } @@ -357,7 +357,7 @@ void guided_ejection_search_t::init_ejection_pool() template bool guided_ejection_search_t::fixed_route_loop() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("fixed_route_loop"); + raft::common::nvtx::range fun_scope("fixed_route_loop"); i_t counter = 0; bool all_inserted = greedy_insert(); @@ -483,7 +483,7 @@ bool guided_ejection_search_t::construct_feasible_solution() template void guided_ejection_search_t::route_minimizer_loop() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("route_minimizer_loop"); + raft::common::nvtx::range fun_scope("route_minimizer_loop"); // If ejection pool is not empty first run fixed route loop with if (!EP.empty()) { diff --git a/cpp/src/routing/ges/squeeze.cu b/cpp/src/routing/ges/squeeze.cu index 650a6409c4..c60481b7ee 100644 --- a/cpp/src/routing/ges/squeeze.cu +++ b/cpp/src/routing/ges/squeeze.cu @@ -150,7 +150,7 @@ template i_t guided_ejection_search_t::try_multiple_feasible_insertions( i_t n_insertions, const bool enable_perturbation) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("try_multiple_insert"); + raft::common::nvtx::range fun_scope("try_multiple_insert"); if (enable_perturbation) { i_t const_1, const_2; @@ -186,7 +186,7 @@ i_t guided_ejection_search_t::try_multiple_feasible_insertion template void guided_ejection_search_t::squeeze_all_ep() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze_all_ep"); + raft::common::nvtx::range fun_scope("squeeze_all_ep"); constexpr auto const squeeze_size = 100; constexpr auto const include_objective = false; @@ -230,7 +230,7 @@ void guided_ejection_search_t::squeeze_all_ep() template bool guided_ejection_search_t::squeeze_all_and_save() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze_all_and_save"); + raft::common::nvtx::range fun_scope("squeeze_all_and_save"); // copy current solution state squeeze_save_state.copy_device_solution(*solution_ptr); auto save_ep_size = EP.size(); @@ -284,7 +284,7 @@ template void guided_ejection_search_t::squeeze( const request_info_t* request, bool random_route) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze"); + raft::common::nvtx::range fun_scope("squeeze"); auto stream = solution_ptr->sol_handle->get_stream(); const i_t n_blocks = solution_ptr->n_routes; size_t sh_size = solution_ptr->check_routes_can_insert_and_get_sh_size() + sizeof(cand_t); @@ -330,7 +330,7 @@ template bool guided_ejection_search_t::try_squeeze_feasible( const request_info_t* request, bool random_route) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("try_squeeze"); + raft::common::nvtx::range fun_scope("try_squeeze"); // copy current solution state squeeze_save_state.copy_device_solution(*solution_ptr); squeeze(request, random_route); @@ -365,7 +365,7 @@ bool guided_ejection_search_t::try_squeeze_feasible( template void guided_ejection_search_t::squeeze_breaks() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("squeeze_breaks"); + raft::common::nvtx::range fun_scope("squeeze_breaks"); solution_ptr->global_runtime_checks(false, false, "squeeze_breaks_begin"); auto stream = solution_ptr->sol_handle->get_stream(); size_t n_break_dims = solution_ptr->problem_ptr->get_max_break_dimensions(); @@ -390,7 +390,7 @@ void guided_ejection_search_t::squeeze_breaks() template bool guided_ejection_search_t::try_squeeze_breaks_feasible() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("try_squeeze_breaks_feasible"); + raft::common::nvtx::range fun_scope("try_squeeze_breaks_feasible"); size_t n_break_dims = solution_ptr->problem_ptr->get_max_break_dimensions(); if (n_break_dims == 0) { return solution_ptr->is_feasible(); } diff --git a/cpp/src/routing/local_search/compute_compatible.cu b/cpp/src/routing/local_search/compute_compatible.cu index e6ef560f0d..4953c683e4 100644 --- a/cpp/src/routing/local_search/compute_compatible.cu +++ b/cpp/src/routing/local_search/compute_compatible.cu @@ -438,7 +438,7 @@ template void local_search_t::calculate_route_compatibility( solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("calculate_route_compatibility"); + raft::common::nvtx::range fun_scope("calculate_route_compatibility"); // note that this was allocated for the max size // reset all even though we are not using the full array. thrust::fill(sol.sol_handle->get_thrust_policy(), @@ -460,7 +460,7 @@ template void problem_t::sort_viable_matrix(rmm::device_uvector& viable_from_matrix, rmm::device_uvector& viable_to_matrix) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_viable_matrix"); + raft::common::nvtx::range fun_scope("sort_viable_matrix"); rmm::device_uvector segments(get_num_orders() * get_num_requests(), handle_ptr->get_stream()); const i_t l_n_requests = get_num_requests(); @@ -569,7 +569,7 @@ void problem_t::sort_viable_matrix(rmm::device_uvector& viable_fr template void initialize_incompatible(problem_t& problem, solution_t* sol_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("initialize_incompatible"); + raft::common::nvtx::range fun_scope("initialize_incompatible"); typename solution_t::view_t sol_view; bool is_problem_run = true; raft::handle_t const* handle_ptr = problem.handle_ptr; diff --git a/cpp/src/routing/local_search/compute_insertions.cu b/cpp/src/routing/local_search/compute_insertions.cu index 240196d09b..7ddad980f5 100644 --- a/cpp/src/routing/local_search/compute_insertions.cu +++ b/cpp/src/routing/local_search/compute_insertions.cu @@ -808,7 +808,7 @@ void find_insertions(solution_t& sol, if (search_type == search_type_t::RANDOM) { name = "random_find_insertions"; } constexpr bool insert_unserviced = false; - [[maybe_unused]] raft::common::nvtx::range fun_scope(name); + raft::common::nvtx::range fun_scope(name); i_t TPB = get_n_viable(); // the formula is obtained with a linear regression across different instances move_candidates.number_of_blocks_per_ls_route = @@ -871,7 +871,7 @@ void find_unserviced_insertions(solution_t& sol, constexpr bool insert_unserviced = true; auto name = "find_unserviced_insertions"; - [[maybe_unused]] raft::common::nvtx::range fun_scope(name); + raft::common::nvtx::range fun_scope(name); constexpr auto const TPB = get_n_viable(); // the formula is obtained with a linear regression across different instances move_candidates.number_of_blocks_per_ls_route = diff --git a/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu b/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu index f6a8773668..d8d2d0f3c0 100644 --- a/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu +++ b/cpp/src/routing/local_search/cycle_finder/cycle_finder.cu @@ -25,7 +25,7 @@ namespace detail { template bool ExactCycleFinder::call_init(graph_t& graph) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("call_init"); + raft::common::nvtx::range fun_scope("call_init"); auto n_vertices = graph.get_num_vertices(); auto n_threads = 128; auto n_blocks = n_vertices; @@ -48,7 +48,7 @@ bool ExactCycleFinder::call_init(graph_t& graph) template void ExactCycleFinder::sort_cycle_costs_by_key(int n_items) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_cycle_costs_by_key"); + raft::common::nvtx::range fun_scope("sort_cycle_costs_by_key"); // sort cycle candidates by weight // resize only once if the problem size don't change if (sorted_key_indices.size() < (size_t)n_items) { @@ -104,7 +104,7 @@ void ExactCycleFinder::sort_cycle_costs_by_key(int n_items template bool ExactCycleFinder::call_find(graph_t& graph, i_t level) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("call_find"); + raft::common::nvtx::range fun_scope("call_find"); auto n_threads = 128; auto n_blocks = graph.get_num_vertices(); size_t sh_size = @@ -163,7 +163,7 @@ bool test_empty(typename detail::device_map_t, double>::view_t template bool ExactCycleFinder::find_cycle(graph_t& graph) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_cycle"); + raft::common::nvtx::range fun_scope("find_cycle"); d_valid_paths.clear(handle_ptr->get_stream()); cuopt_assert(test_empty(d_valid_paths.subspan(0), handle_ptr->get_stream()), ""); if (!call_init(graph)) { return false; } @@ -181,7 +181,7 @@ template void ExactCycleFinder::get_cycle(graph_t& graph, ret_cycles_t& d_ret) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_cycle"); + raft::common::nvtx::range fun_scope("get_cycle"); auto n_threads = 256; auto n_blocks = std::min((d_valid_paths.max_available + n_threads - 1) / n_threads, max_blocks); @@ -292,7 +292,7 @@ void ExactCycleFinder::sort_occupied(int level, graph_t& graph, int curr_level_occupied) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("sort_occupied"); + raft::common::nvtx::range fun_scope("sort_occupied"); auto curr_map = d_valid_paths.subspan(level); cuopt_assert(check_occupied_head(level, graph), ""); @@ -344,7 +344,7 @@ void ExactCycleFinder::find_best_cycles( ret_cycles_t& ret, const solution_handle_t* sol_handle) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_best_cycles"); + raft::common::nvtx::range fun_scope("find_best_cycles"); handle_ptr = const_cast*>(sol_handle); best_cycles.reset(handle_ptr->get_stream()); cycle_candidates.reset(graph.get_num_vertices(), handle_ptr); diff --git a/cpp/src/routing/local_search/fill_gpu_graph.cu b/cpp/src/routing/local_search/fill_gpu_graph.cu index fb6a0c9873..c4a79c2e80 100644 --- a/cpp/src/routing/local_search/fill_gpu_graph.cu +++ b/cpp/src/routing/local_search/fill_gpu_graph.cu @@ -150,7 +150,7 @@ __global__ void fill_intra_candidates(typename solution_t::vi template void local_search_t::fill_gpu_graph(solution_t& solution) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("fill_gpu_graph"); + raft::common::nvtx::range fun_scope("fill_gpu_graph"); constexpr i_t TPB = 128; solution.sol_handle->sync_stream(); const auto stream = solution.sol_handle->get_stream(); diff --git a/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu b/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu index 231d112481..f2782704bc 100644 --- a/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu +++ b/cpp/src/routing/local_search/hvrp/vehicle_assignment.cu @@ -176,7 +176,7 @@ bool run_vehicle_assignment(solution_t& sol, move_candidates_t& move_candidates, vehicle_assignment_t& vehicle_assignment) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("vehicle_assignment_heuristic"); + raft::common::nvtx::range fun_scope("vehicle_assignment_heuristic"); sol.global_runtime_checks(false, false, "vehicle_assignment_checks_start"); [[maybe_unused]] double cost_before = 0., cost_after = 0.; diff --git a/cpp/src/routing/local_search/local_search.cu b/cpp/src/routing/local_search/local_search.cu index 75b3a48acf..0585e91f0b 100644 --- a/cpp/src/routing/local_search/local_search.cu +++ b/cpp/src/routing/local_search/local_search.cu @@ -43,7 +43,7 @@ local_search_t::local_search_t(const solution_handle_tget_stream()), locks_(max_routes, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("local_search_t"); + raft::common::nvtx::range fun_scope("local_search_t"); } // sets the search weights and excess values for the local search template @@ -57,7 +57,7 @@ void local_search_t::set_active_weights(const infeasible_cost template bool local_search_t::run_two_opt_search(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_two_opt_search"); + raft::common::nvtx::range fun_scope("run_two_opt_search"); bool move_found = perform_two_opt(sol, move_candidates); sol.sol_handle->sync_stream(); if (move_found) { @@ -71,7 +71,7 @@ bool local_search_t::run_two_opt_search(solution_t bool local_search_t::run_sliding_search(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_sliding_search"); + raft::common::nvtx::range fun_scope("run_sliding_search"); bool move_found = sol.problem_ptr->is_tsp ? perform_sliding_tsp(sol, move_candidates) : perform_sliding_window(sol, move_candidates); sol.sol_handle->sync_stream(); @@ -86,7 +86,7 @@ bool local_search_t::run_sliding_search(solution_t bool local_search_t::run_collect_prizes(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_collect_prizes"); + raft::common::nvtx::range fun_scope("run_collect_prizes"); // don't run prize collection if there is no prize dimension if (!sol.problem_ptr->dimensions_info.has_dimension(dim_t::PRIZE)) { return false; } @@ -103,7 +103,7 @@ bool local_search_t::run_collect_prizes(solution_t bool local_search_t::run_cross_search(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_cross_search"); + raft::common::nvtx::range fun_scope("run_cross_search"); if (sol.n_routes < 2) { return false; } // independent thread scheduling is not present in pascal and we use it in populate_cross_list // kernel @@ -140,7 +140,7 @@ template > bool local_search_t::run_fast_search(solution_t& sol, [[maybe_unused]] bool full_set) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fast_search"); + raft::common::nvtx::range fun_scope("run_fast_search"); std::vector fast_operators{fast_operators_t::SLIDING, fast_operators_t::CROSS}; if (!sol.problem_ptr->fleet_info.is_homogenous_ && !sol.problem_ptr->has_non_uniform_breaks()) { @@ -182,7 +182,7 @@ template > bool local_search_t::run_fast_search(solution_t& sol, bool full_set) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_fast_search"); + raft::common::nvtx::range fun_scope("run_fast_search"); std::vector fast_operators{fast_operators_t::SLIDING}; diff --git a/cpp/src/routing/local_search/move_candidates/move_candidates.cuh b/cpp/src/routing/local_search/move_candidates/move_candidates.cuh index f54a785d9d..913f07de62 100644 --- a/cpp/src/routing/local_search/move_candidates/move_candidates.cuh +++ b/cpp/src/routing/local_search/move_candidates/move_candidates.cuh @@ -54,7 +54,7 @@ struct shared_pool_t { std::tuple acquire() { - [[maybe_unused]] std::unique_lock lock(mutex); + std::unique_lock lock(mutex); while (true) { if (indices.size()) { int index = indices.front(); @@ -67,7 +67,7 @@ struct shared_pool_t { void release(int index) { - [[maybe_unused]] std::unique_lock lock(mutex); + std::unique_lock lock(mutex); indices.push(index); cond.notify_one(); } @@ -270,7 +270,7 @@ class cand_matrix_t { void reset(solution_handle_t const* sol_handle) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("cand_matrix_t reset"); + raft::common::nvtx::range fun_scope("cand_matrix_t reset"); async_fill(cost_counter, cost_counter_t{.cost = std::numeric_limits::max()}, sol_handle->get_stream()); @@ -355,7 +355,7 @@ class move_candidates_t { inline void reset(solution_handle_t const* sol_handle) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("move_candidates reset"); + raft::common::nvtx::range fun_scope("move_candidates reset"); move_candidate_reset_graph.start_capture(sol_handle->get_stream()); cycles.reset(sol_handle); graph.reset(sol_handle); diff --git a/cpp/src/routing/local_search/perform_moves.cu b/cpp/src/routing/local_search/perform_moves.cu index f79a4af378..4cedba85da 100644 --- a/cpp/src/routing/local_search/perform_moves.cu +++ b/cpp/src/routing/local_search/perform_moves.cu @@ -411,7 +411,7 @@ template bool local_search_t::populate_cross_moves( solution_t& solution, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_cross_moves"); + raft::common::nvtx::range fun_scope("populate_cross_moves"); reset_cross_vectors(solution); const i_t TPB = 256; size_t sh_size = solution.n_routes * (sizeof(i_t) + sizeof(cross_cand_t)); @@ -438,7 +438,7 @@ template void local_search_t::populate_move_path( solution_t& solution, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_move_path"); + raft::common::nvtx::range fun_scope("populate_move_path"); auto n_cycles = move_candidates.cycles.n_cycles_.value(solution.sol_handle->get_stream()); if (n_cycles) { populate_move_path_kernel @@ -454,7 +454,7 @@ template void local_search_t::perform_moves(solution_t& solution, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_moves"); + raft::common::nvtx::range fun_scope("perform_moves"); solution.global_runtime_checks(false, false, "perform_moves_start"); auto stream = solution.sol_handle->get_stream(); constexpr i_t TPB = 32; diff --git a/cpp/src/routing/local_search/random_cross.cu b/cpp/src/routing/local_search/random_cross.cu index d5caf5ce96..0769e28c5f 100644 --- a/cpp/src/routing/local_search/random_cross.cu +++ b/cpp/src/routing/local_search/random_cross.cu @@ -268,7 +268,7 @@ i_t sort_random_moves_by_route_pair_idx(solution_t& sol, template void local_search_t::populate_random_moves(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("populate_random_moves"); + raft::common::nvtx::range fun_scope("populate_random_moves"); // extract valid moves constexpr i_t nthreads = 256; auto nblocks = sol.get_num_depot_excluded_orders(); diff --git a/cpp/src/routing/local_search/sliding_tsp.cu b/cpp/src/routing/local_search/sliding_tsp.cu index 1b582e5289..fe2105c194 100644 --- a/cpp/src/routing/local_search/sliding_tsp.cu +++ b/cpp/src/routing/local_search/sliding_tsp.cu @@ -477,7 +477,7 @@ template bool local_search_t::perform_sliding_tsp( solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_sliding_tsp"); + raft::common::nvtx::range fun_scope("perform_sliding_tsp"); sol.global_runtime_checks(false, false, "sliding_tsp_start"); i_t n_moves_found = 0; if (!move_candidates.include_objective) { return false; } diff --git a/cpp/src/routing/local_search/sliding_window.cu b/cpp/src/routing/local_search/sliding_window.cu index 64eefada02..fd37c9b177 100644 --- a/cpp/src/routing/local_search/sliding_window.cu +++ b/cpp/src/routing/local_search/sliding_window.cu @@ -1024,7 +1024,7 @@ template bool local_search_t::perform_sliding_window( solution_t& solution, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_sliding_window"); + raft::common::nvtx::range fun_scope("run_sliding_window"); i_t n_moves_found = 0; size_t shared_for_tmp_route = 0; solution.compute_max_active(); diff --git a/cpp/src/routing/local_search/two_opt.cu b/cpp/src/routing/local_search/two_opt.cu index ead58fe5f6..764a2da39f 100644 --- a/cpp/src/routing/local_search/two_opt.cu +++ b/cpp/src/routing/local_search/two_opt.cu @@ -364,7 +364,7 @@ template bool local_search_t::perform_two_opt( solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("run_two_opt"); + raft::common::nvtx::range fun_scope("run_two_opt"); sol.global_runtime_checks(false, false, "two_opt_start"); i_t n_moves_found = 0; if (!move_candidates.include_objective) { return false; } diff --git a/cpp/src/routing/local_search/vrp/nodes_to_search.cu b/cpp/src/routing/local_search/vrp/nodes_to_search.cu index 2446721076..a3969cebe4 100644 --- a/cpp/src/routing/local_search/vrp/nodes_to_search.cu +++ b/cpp/src/routing/local_search/vrp/nodes_to_search.cu @@ -74,7 +74,7 @@ i_t get_sample_size_vrp(i_t n_of_changed_nodes) template void nodes_to_search_t::restore_found_nodes(solution_t& sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("restore_found_nodes"); + raft::common::nvtx::range fun_scope("restore_found_nodes"); constexpr bool restore_phase = true; // here we are doing a reuse of n_nodes_to_search for the extracted nodes // all other valid nodes to search are already in host side @@ -101,7 +101,7 @@ template bool nodes_to_search_t::sample_nodes_for_recycle( const solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("sample_nodes_for_recycle"); + raft::common::nvtx::range fun_scope("sample_nodes_for_recycle"); raft::copy(h_best_id_per_node.data(), move_candidates.vrp_move_candidates.best_id_per_node.data(), @@ -127,7 +127,7 @@ template bool nodes_to_search_t::sample_nodes_to_search( const solution_t& sol, std::mt19937& rng, bool full_set) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("sample_nodes_to_search"); + raft::common::nvtx::range fun_scope("sample_nodes_to_search"); i_t curr_n_nodes_to_search = h_nodes_to_search.size(); if (curr_n_nodes_to_search == 0) return false; if (!full_set) { @@ -161,7 +161,7 @@ template void extract_nodes_to_search(solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("extract_nodes_to_search"); + raft::common::nvtx::range fun_scope("extract_nodes_to_search"); auto& nodes_to_search = move_candidates.nodes_to_search; nodes_to_search.extract_nodes_graph.start_capture(sol.sol_handle->get_stream()); nodes_to_search.reset(sol.sol_handle); diff --git a/cpp/src/routing/local_search/vrp/vrp_execute.cu b/cpp/src/routing/local_search/vrp/vrp_execute.cu index 881b913ae0..2b6c14f5fe 100644 --- a/cpp/src/routing/local_search/vrp/vrp_execute.cu +++ b/cpp/src/routing/local_search/vrp/vrp_execute.cu @@ -376,7 +376,7 @@ template i_t extract_non_overlapping_moves(solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("extract_non_overlapping_moves"); + raft::common::nvtx::range fun_scope("extract_non_overlapping_moves"); i_t TPB = 128; i_t n_blocks_for_compact = (sol.n_routes * sol.n_routes + TPB - 1) / TPB; compact_best_route_pair_moves @@ -415,7 +415,7 @@ bool execute_vrp_moves(solution_t& sol, move_candidates_t& move_candidates, i_t n_moves_found) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("execute_vrp_moves"); + raft::common::nvtx::range fun_scope("execute_vrp_moves"); cuopt_func_call(sol.compute_cost()); cuopt_func_call(double cost_before = sol.get_cost(move_candidates.include_objective, move_candidates.weights)); @@ -475,7 +475,7 @@ template bool select_and_execute_vrp_move(solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("select_and_execute_vrp_move"); + raft::common::nvtx::range fun_scope("select_and_execute_vrp_move"); cuopt_func_call( move_candidates.debug_delta.set_value_to_zero_async(sol.sol_handle->get_stream())); i_t n_moves_found = extract_non_overlapping_moves(sol, move_candidates); diff --git a/cpp/src/routing/local_search/vrp/vrp_search.cu b/cpp/src/routing/local_search/vrp/vrp_search.cu index ee9d57afa8..56f66a3572 100644 --- a/cpp/src/routing/local_search/vrp/vrp_search.cu +++ b/cpp/src/routing/local_search/vrp/vrp_search.cu @@ -647,7 +647,7 @@ bool find_vrp_moves(solution_t& sol, move_candidates_t& move_candidates, bool recycle = false) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("find_vrp_moves"); + raft::common::nvtx::range fun_scope("find_vrp_moves"); if (sol.n_routes < 2) { return false; } if (sol.problem_ptr->is_cvrp()) { @@ -684,7 +684,7 @@ template bool recycle_unused_moves(solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("recycle_unused_moves"); + raft::common::nvtx::range fun_scope("recycle_unused_moves"); auto& nodes_to_search = move_candidates.nodes_to_search; constexpr bool recycle = true; bool nodes_remained = nodes_to_search.sample_nodes_for_recycle(sol, move_candidates); @@ -698,7 +698,7 @@ template bool perform_vrp_search(solution_t& sol, move_candidates_t& move_candidates) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("perform_vrp_search"); + raft::common::nvtx::range fun_scope("perform_vrp_search"); cuopt_func_call(sol.check_cost_coherence(move_candidates.weights)); if (!find_vrp_moves(sol, move_candidates)) { return false; } bool move_found = select_and_execute_vrp_move(sol, move_candidates); diff --git a/cpp/src/routing/route/break_route.cuh b/cpp/src/routing/route/break_route.cuh index 408a9c1571..f6acaa29bf 100644 --- a/cpp/src/routing/route/break_route.cuh +++ b/cpp/src/routing/route/break_route.cuh @@ -32,7 +32,7 @@ class break_route_t { breaks_forward(0, sol_handle_->get_stream()), breaks_backward(0, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero break_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero break_route_t copy_ctr"); } break_route_t(const break_route_t& break_route, solution_handle_t const* sol_handle_) @@ -40,7 +40,7 @@ class break_route_t { breaks_forward(break_route.breaks_forward, sol_handle_->get_stream()), breaks_backward(break_route.breaks_backward, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("break route copy_ctr"); + raft::common::nvtx::range fun_scope("break route copy_ctr"); } break_route_t& operator=(break_route_t&& break_route) = default; diff --git a/cpp/src/routing/route/capacity_route.cuh b/cpp/src/routing/route/capacity_route.cuh index ade1c0331c..b91acbd30a 100644 --- a/cpp/src/routing/route/capacity_route.cuh +++ b/cpp/src/routing/route/capacity_route.cuh @@ -38,7 +38,7 @@ class capacity_route_t { { cuopt_assert(dim_info.n_capacity_dimensions <= default_max_capacity_dim, "Supplied capacity dimension exceeds limit"); - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero capacity route copy_ctr"); + raft::common::nvtx::range fun_scope("zero capacity route copy_ctr"); } capacity_route_t(const capacity_route_t& capacity_route, @@ -49,7 +49,7 @@ class capacity_route_t { max_after(capacity_route.max_after, sol_handle_->get_stream()), dim_info(capacity_route.dim_info) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("capacity route copy_ctr"); + raft::common::nvtx::range fun_scope("capacity route copy_ctr"); } capacity_route_t& operator=(capacity_route_t&& capacity_route) = default; diff --git a/cpp/src/routing/route/cost_route.cuh b/cpp/src/routing/route/cost_route.cuh index 43fa84b047..23748bdea4 100644 --- a/cpp/src/routing/route/cost_route.cuh +++ b/cpp/src/routing/route/cost_route.cuh @@ -41,7 +41,7 @@ class cost_route_t { excess_backward(0, sol_handle_->get_stream()), distance_break_cost_forward(0, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero cost_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero cost_route_t copy_ctr"); } cost_route_t(const cost_route_t& cost_route, solution_handle_t const* sol_handle_) @@ -59,7 +59,7 @@ class cost_route_t { excess_backward(cost_route.excess_backward, sol_handle_->get_stream()), distance_break_cost_forward(cost_route.distance_break_cost_forward, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("cost route copy_ctr"); + raft::common::nvtx::range fun_scope("cost route copy_ctr"); } cost_route_t& operator=(cost_route_t&& cost_route) = default; diff --git a/cpp/src/routing/route/dimensions_route.cuh b/cpp/src/routing/route/dimensions_route.cuh index f2c567da24..798909306e 100644 --- a/cpp/src/routing/route/dimensions_route.cuh +++ b/cpp/src/routing/route/dimensions_route.cuh @@ -84,7 +84,7 @@ class dimensions_route_t { requests(sol_handle_), dimensions_info(dimensions_info_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero dimensions_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero dimensions_route_t copy_ctr"); } dimensions_route_t(const dimensions_route_t& dim_route) @@ -101,7 +101,7 @@ class dimensions_route_t { requests(dim_route.requests, dim_route.sol_handle), dimensions_info(dim_route.dimensions_info) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("dimensions_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("dimensions_route_t copy_ctr"); } dimensions_route_t& operator=(dimensions_route_t&& route) = default; diff --git a/cpp/src/routing/route/pdp_route.cuh b/cpp/src/routing/route/pdp_route.cuh index 12288f2b3e..f56a87ef38 100644 --- a/cpp/src/routing/route/pdp_route.cuh +++ b/cpp/src/routing/route/pdp_route.cuh @@ -35,7 +35,7 @@ class request_route_tget_stream()), tsp_requests(sol_handle_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); } request_route_t(const request_route_t& request_route, @@ -44,7 +44,7 @@ class request_route_tget_stream()), tsp_requests(request_route.tsp_requests, sol_handle_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("pdp route copy_ctr"); + raft::common::nvtx::range fun_scope("pdp route copy_ctr"); } request_route_t& operator=(request_route_t&& request_route) = default; diff --git a/cpp/src/routing/route/prize_route.cuh b/cpp/src/routing/route/prize_route.cuh index 95baf58f35..c5abf7df8d 100644 --- a/cpp/src/routing/route/prize_route.cuh +++ b/cpp/src/routing/route/prize_route.cuh @@ -33,7 +33,7 @@ class prize_route_t { prize_forward(0, sol_handle_->get_stream()), prize_backward(0, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero prize_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero prize_route_t copy_ctr"); } prize_route_t(const prize_route_t& prize_route, solution_handle_t const* sol_handle_) @@ -42,7 +42,7 @@ class prize_route_t { prize_forward(prize_route.prize_forward, sol_handle_->get_stream()), prize_backward(prize_route.prize_backward, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("prize route copy_ctr"); + raft::common::nvtx::range fun_scope("prize route copy_ctr"); } prize_route_t& operator=(prize_route_t&& prize_route) = default; diff --git a/cpp/src/routing/route/route.cuh b/cpp/src/routing/route/route.cuh index cfe7e0932d..b624acb903 100644 --- a/cpp/src/routing/route/route.cuh +++ b/cpp/src/routing/route/route.cuh @@ -35,7 +35,7 @@ class route_t { n_nodes(sol_handle_->get_stream()), fleet_info_ptr(fleet_info_ptr_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero route_t copy_ctr"); infeasible_cost_t zero_inf; objective_cost_t zero_obj; infeasibility_cost.set_value_async(zero_inf, sol_handle->get_stream()); @@ -59,7 +59,7 @@ class route_t { objective_cost(route.objective_cost, route.sol_handle->get_stream()), fleet_info_ptr(route.fleet_info_ptr) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("route copy_ctr"); + raft::common::nvtx::range fun_scope("route copy_ctr"); } route_t& operator=(route_t&& route) = default; diff --git a/cpp/src/routing/route/time_route.cuh b/cpp/src/routing/route/time_route.cuh index 3b1a32b30d..92d0884e5f 100644 --- a/cpp/src/routing/route/time_route.cuh +++ b/cpp/src/routing/route/time_route.cuh @@ -43,7 +43,7 @@ class time_route_t { unavoidable_wait_backward(0, sol_handle_->get_stream()), actual_arrival(0, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero time_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero time_route_t copy_ctr"); } time_route_t(const time_route_t& time_route, solution_handle_t const* sol_handle_) @@ -62,7 +62,7 @@ class time_route_t { unavoidable_wait_backward(time_route.unavoidable_wait_backward, sol_handle_->get_stream()), actual_arrival(time_route.actual_arrival, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("time route copy_ctr"); + raft::common::nvtx::range fun_scope("time route copy_ctr"); } time_route_t& operator=(time_route_t&& time_route) = default; diff --git a/cpp/src/routing/route/tsp_route.cuh b/cpp/src/routing/route/tsp_route.cuh index 176d161960..310418e7ea 100644 --- a/cpp/src/routing/route/tsp_route.cuh +++ b/cpp/src/routing/route/tsp_route.cuh @@ -29,14 +29,14 @@ class tsp_route_t { tsp_route_t(solution_handle_t const* sol_handle_) : pred(0, sol_handle_->get_stream()), succ(0, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); + raft::common::nvtx::range fun_scope("zero pdp_route_t copy_ctr"); } tsp_route_t(const tsp_route_t& tsp_route, solution_handle_t const* sol_handle_) : pred(tsp_route.pred, sol_handle_->get_stream()), succ(tsp_route.succ, sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("pdp route copy_ctr"); + raft::common::nvtx::range fun_scope("pdp route copy_ctr"); } tsp_route_t& operator=(tsp_route_t&& tsp_route) = default; diff --git a/cpp/src/routing/solution/pool_allocator.cuh b/cpp/src/routing/solution/pool_allocator.cuh index 979f9c1962..cc7f322a99 100644 --- a/cpp/src/routing/solution/pool_allocator.cuh +++ b/cpp/src/routing/solution/pool_allocator.cuh @@ -33,7 +33,7 @@ class routing_resource_t { problem_->viables), ges(dummy_sol, &ls) // the ls will be dangled as this object will be moved to the shared pool { - [[maybe_unused]] raft::common::nvtx::range fun_scope("routing_resource_t"); + raft::common::nvtx::range fun_scope("routing_resource_t"); } local_search_t ls; @@ -49,7 +49,7 @@ class pool_allocator_t { i_t desired_n_routes = -1) : problem(problem_), stream(stream_) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("pool_allocator_t"); + raft::common::nvtx::range fun_scope("pool_allocator_t"); // FIXME:: This is temporary, we should let the diversity manager decide this std::vector desired_vehicle_ids; if (desired_n_routes > 0) { diff --git a/cpp/src/routing/solution/solution.cu b/cpp/src/routing/solution/solution.cu index 1463f30f10..85059ca545 100644 --- a/cpp/src/routing/solution/solution.cu +++ b/cpp/src/routing/solution/solution.cu @@ -20,7 +20,7 @@ route_t& solution_t::get_route(i_t route_i "route_id should be less than total number of routes"); cuopt_assert(route_id < (i_t)routes.size(), "route_id should be less than total number of routes"); - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_route"); + raft::common::nvtx::range fun_scope("get_route"); auto idx = route_id_to_idx[route_id]; return routes[idx]; } @@ -31,7 +31,7 @@ const route_t& solution_t::get_route(i_t r { cuopt_assert(route_id < (i_t)route_id_to_idx.size(), "route_id should be less than total number of routes"); - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_route_const"); + raft::common::nvtx::range fun_scope("get_route_const"); auto idx = route_id_to_idx[route_id]; return routes[idx]; } @@ -75,7 +75,7 @@ void solution_t::add_route(route_t&& route i_t n_nodes, bool check_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_route"); + raft::common::nvtx::range fun_scope("add_route"); cuopt_assert(!check_size || (n_nodes > request_info_t::size()), "There should be at least one request in the route!"); cuopt_expects(!check_size || (n_nodes > request_info_t::size()), @@ -107,7 +107,7 @@ template void solution_t::add_routes( const std::vector>>>& new_routes) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_routes"); + raft::common::nvtx::range fun_scope("add_routes"); cuopt_assert(new_routes.size() > 0, "There should be at least one route in the vector!"); thrust::fill(sol_handle->get_thrust_policy(), routes_to_search.data() + n_routes, @@ -162,7 +162,7 @@ template void solution_t::add_nodes_to_route( const std::vector>& nodes_to_insert, i_t route_id, i_t intra_idx) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_route"); + raft::common::nvtx::range fun_scope("add_nodes_to_route"); cuopt_assert(route_id > -1, "Route id should be valid"); const auto n_nodes_to_insert = nodes_to_insert.size(); raft::copy( @@ -185,7 +185,7 @@ template void solution_t::add_nodes_to_best( const std::vector>& nodes_to_insert, const infeasible_cost_t& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("add_nodes_to_best"); + raft::common::nvtx::range fun_scope("add_nodes_to_best"); i_t TPB = 256; constexpr bool include_objective = true; // TODO check perf and implement parallel insertion @@ -206,7 +206,7 @@ void solution_t::add_nodes_to_best( template bool solution_t::remove_nodes(const std::vector>& nodes_to_eject) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_nodes"); + raft::common::nvtx::range fun_scope("remove_nodes"); const auto n_nodes_to_eject = nodes_to_eject.size(); rmm::device_scalar empty_route_produced(sol_handle->get_stream()); raft::copy(temp_nodes.data(), nodes_to_eject.data(), n_nodes_to_eject, sol_handle->get_stream()); @@ -225,7 +225,7 @@ bool solution_t::remove_nodes(const std::vector>& template void solution_t::clear_routes(std::vector vehicle_ids) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("clear_routes"); + raft::common::nvtx::range fun_scope("clear_routes"); i_t given_n_routes; if (vehicle_ids.empty()) { given_n_routes = problem_ptr->get_fleet_size(); @@ -293,7 +293,7 @@ void solution_t::set_routes_to_search() template void solution_t::set_route_views(i_t start, i_t end) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("set_route_views"); + raft::common::nvtx::range fun_scope("set_route_views"); if (routes.size() > routes_view.size()) { // reserve with the max size routes_view.resize(routes.size(), sol_handle->get_stream()); @@ -323,7 +323,7 @@ void solution_t::set_route_views(i_t start, i_t end) template void solution_t::random_init_routes() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("random_init_routes"); + raft::common::nvtx::range fun_scope("random_init_routes"); auto stream = sol_handle->get_stream(); stream.sync(); const i_t one = 1; @@ -351,7 +351,7 @@ void solution_t::random_init_routes() template void solution_t::compute_initial_data(bool check_feasibility) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_initial_data"); + raft::common::nvtx::range fun_scope("compute_initial_data"); compute_backward_forward(); compute_cost(); eject_until_feasible(); @@ -374,7 +374,7 @@ size_t solution_t::get_temp_route_shared_size(i_t added_size) template i_t solution_t::get_max_active_nodes_for_all_routes() const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_max_active_nodes_for_all_routes"); + raft::common::nvtx::range fun_scope("get_max_active_nodes_for_all_routes"); return max_active_nodes; } @@ -382,7 +382,7 @@ i_t solution_t::get_max_active_nodes_for_all_routes() const template size_t solution_t::check_routes_can_insert_and_get_sh_size(i_t added_nodes) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_routes_can_insert_and_get_sh_size"); + raft::common::nvtx::range fun_scope("check_routes_can_insert_and_get_sh_size"); compute_max_active(); resize_routes(raft::alignTo(max_active_nodes + added_nodes, base_route_size)); return get_temp_route_shared_size(added_nodes); @@ -391,7 +391,7 @@ size_t solution_t::check_routes_can_insert_and_get_sh_size(i_ template void solution_t::resize_routes(i_t new_size) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("resize_routes"); + raft::common::nvtx::range fun_scope("resize_routes"); bool any_resized = false; for (i_t i = 0; i < n_routes; ++i) { @@ -463,7 +463,7 @@ template double solution_t::get_cost(const bool include_objective, const infeasible_cost_t weights) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_cost"); + raft::common::nvtx::range fun_scope("get_cost"); double total_cost = infeasible_cost_t::dot(weights, infeasibility_cost.value(sol_handle->get_stream())); @@ -498,7 +498,7 @@ infeasible_cost_t solution_t::get_infeasibility_cost() const template bool solution_t::is_feasible() const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("is_feasible"); + raft::common::nvtx::range fun_scope("is_feasible"); auto n_cost = infeasibility_cost.value(sol_handle->get_stream()); bool is_feasible = true; for (size_t dim = 0; dim < (size_t)dim_t::SIZE; ++dim) { @@ -511,7 +511,7 @@ bool solution_t::is_feasible() const template f_t solution_t::get_total_excess(const infeasible_cost_t weights) const { - [[maybe_unused]] raft::common::nvtx::range fun_scope("get_total_excess"); + raft::common::nvtx::range fun_scope("get_total_excess"); auto n_cost = infeasibility_cost.value(sol_handle->get_stream()); return infeasible_cost_t::dot(n_cost, weights); } @@ -527,7 +527,7 @@ void solution_t::print() const template void solution_t::copy_device_solution(solution_t& src_sol) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("copy_device_solution"); + raft::common::nvtx::range fun_scope("copy_device_solution"); sol_handle->sync_stream(); src_sol.sol_handle->sync_stream(); @@ -577,7 +577,7 @@ void solution_t::copy_device_solution(solution_t void solution_t::compute_cost() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_cost"); + raft::common::nvtx::range fun_scope("compute_cost"); const i_t TPB = 256; const auto n_blocks = (n_routes + TPB - 1) / TPB; @@ -594,7 +594,7 @@ void solution_t::compute_cost() template void solution_t::check_cost_coherence(const infeasible_cost_t& weights) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("check_cost_coherence"); + raft::common::nvtx::range fun_scope("check_cost_coherence"); [[maybe_unused]] double excess_before = get_total_excess(weights); [[maybe_unused]] double cost_before = get_cost(true, weights); compute_backward_forward(); @@ -610,7 +610,7 @@ void solution_t::shift_move_routes( const std::vector& route_ids, rmm::device_uvector& route_ids_device_copy) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("shift_move_routes"); + raft::common::nvtx::range fun_scope("shift_move_routes"); // shift and swap route slots i_t remove_counter = 0; // this is not super efficient but not significant @@ -657,7 +657,7 @@ void solution_t::remove_routes( ejection_pool_t>& ejection_pool, const std::vector& routes_to_remove) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_routes"); + raft::common::nvtx::range fun_scope("remove_routes"); if (routes_to_remove.empty()) { return; } @@ -695,7 +695,7 @@ void solution_t::remove_routes( template void solution_t::remove_routes(const std::vector& routes_to_remove) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("remove_routes"); + raft::common::nvtx::range fun_scope("remove_routes"); cuopt_assert(routes_to_remove.size() > 0, "There should be at least one route in the vector!"); // reuse temp_int_vector temp_int_vector.resize(routes_to_remove.size(), sol_handle->get_stream()); @@ -717,7 +717,7 @@ void solution_t::remove_routes(const std::vector& routes template void solution_t::keep_only_vehicles(const std::vector& vehicles_to_keep) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("keep_only_vehicles"); + raft::common::nvtx::range fun_scope("keep_only_vehicles"); // Figure out which routes to remove std::vector routes_to_remove; @@ -733,7 +733,7 @@ void solution_t::keep_only_vehicles(const std::vector& v template i_t solution_t::compute_max_active() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_max_active"); + raft::common::nvtx::range fun_scope("compute_max_active"); i_t TPB = 1024; compute_max_active_kernel <<<1, TPB, 0, sol_handle->get_stream().get()>>>(view()); @@ -744,7 +744,7 @@ i_t solution_t::compute_max_active() template void solution_t::compute_route_id_per_node() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_route_id_per_node"); + raft::common::nvtx::range fun_scope("compute_route_id_per_node"); i_t TPB = 256; compute_route_id_kernel<<get_stream().get()>>>( routes_view.data(), route_node_map.view()); diff --git a/cpp/src/routing/solution/solution.cuh b/cpp/src/routing/solution/solution.cuh index 1390e471e9..237b31aa34 100644 --- a/cpp/src/routing/solution/solution.cuh +++ b/cpp/src/routing/solution/solution.cuh @@ -351,7 +351,7 @@ class solution_t { temp_int_vector(std::max(problem_.get_num_orders(), problem_.get_fleet_size()), sol_handle_->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("solution_t"); + raft::common::nvtx::range fun_scope("solution_t"); thrust::fill( sol_handle_->get_thrust_policy(), d_lock_per_route.begin(), d_lock_per_route.end(), 0); @@ -429,7 +429,7 @@ class solution_t { temp_stack_counter(sol.temp_stack_counter, sol.sol_handle->get_stream()), temp_int_vector(sol.temp_int_vector, sol.sol_handle->get_stream()) { - [[maybe_unused]] raft::common::nvtx::range fun_scope("copy ctr solution_t"); + raft::common::nvtx::range fun_scope("copy ctr solution_t"); cuopt_assert(n_routes <= problem_ptr->get_fleet_size(), "Number of routes should be less than the fleet size"); set_routes_to_copy(); @@ -441,7 +441,7 @@ class solution_t { cuopt_assert(routes.size() == route_id_to_idx.size(), "route and ids should have same size!"); { - [[maybe_unused]] raft::common::nvtx::range fun_scope("copy_routes"); + raft::common::nvtx::range fun_scope("copy_routes"); for (i_t i = 0; i < sol.n_routes; ++i) { routes.emplace_back(sol.get_route(i)); route_id_to_idx.emplace_back(i); diff --git a/cpp/src/routing/solution/solution_handle.cuh b/cpp/src/routing/solution/solution_handle.cuh index 8acd34f7a9..e2572d5ca3 100644 --- a/cpp/src/routing/solution/solution_handle.cuh +++ b/cpp/src/routing/solution/solution_handle.cuh @@ -48,7 +48,7 @@ class solution_handle_t { const cudaDeviceProp& get_device_properties() const { - [[maybe_unused]] std::lock_guard _(mutex_); + std::lock_guard _(mutex_); if (!device_prop_initialized_) { RAFT_CUDA_TRY_NO_THROW(cudaGetDeviceProperties(&prop_, dev_id_)); device_prop_initialized_ = true; diff --git a/cpp/src/routing/solve.cu b/cpp/src/routing/solve.cu index 6b15985a95..136d77a8b4 100644 --- a/cpp/src/routing/solve.cu +++ b/cpp/src/routing/solve.cu @@ -17,7 +17,7 @@ assignment_t solve(data_model_view_t const& data_model, solver_settings_t const& settings) { // Without this, CUOPT_LOG_ERROR below sinks into the buffer and is never emitted. - [[maybe_unused]] init_logger_t log("", settings.get_error_logging_mode()); + init_logger_t log("", settings.get_error_logging_mode()); try { cuopt::routing::solver_t solver(data_model, settings); diff --git a/cpp/src/routing/util_kernels/compute_backward_forward.cu b/cpp/src/routing/util_kernels/compute_backward_forward.cu index 87aacb819b..4d8faf4095 100644 --- a/cpp/src/routing/util_kernels/compute_backward_forward.cu +++ b/cpp/src/routing/util_kernels/compute_backward_forward.cu @@ -42,7 +42,7 @@ __global__ void compute_actual_arrival_kernel( template void solution_t::compute_backward_forward() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_backward_forward"); + raft::common::nvtx::range fun_scope("compute_backward_forward"); constexpr i_t TPB = 32; if (n_routes) { compute_backward_forward_kernel @@ -54,7 +54,7 @@ void solution_t::compute_backward_forward() template void solution_t::compute_actual_arrival_times() { - [[maybe_unused]] raft::common::nvtx::range fun_scope("compute_backward_forward"); + raft::common::nvtx::range fun_scope("compute_backward_forward"); constexpr i_t TPB = 32; if (n_routes && problem_ptr->dimensions_info.has_dimension(dim_t::TIME)) compute_actual_arrival_kernel diff --git a/cpp/src/utilities/cuda_helpers.cuh b/cpp/src/utilities/cuda_helpers.cuh index 8505e93506..778dcd5b60 100644 --- a/cpp/src/utilities/cuda_helpers.cuh +++ b/cpp/src/utilities/cuda_helpers.cuh @@ -206,12 +206,12 @@ inline bool set_shmem_of_kernel(Function* function, size_t dynamic_request_size) dynamic_request_size = raft::alignTo(dynamic_request_size, size_t(1024)); { - [[maybe_unused]] std::shared_lock rlock(mtx); + std::shared_lock rlock(mtx); auto it = shmem_sizes.find(function); if (it != shmem_sizes.end() && dynamic_request_size <= it->second) { return true; } } - [[maybe_unused]] std::unique_lock wlock(mtx); + std::unique_lock wlock(mtx); size_t current_size = shmem_sizes.count(function) ? shmem_sizes[function] : 0; if (dynamic_request_size > current_size) { auto err = cudaFuncSetAttribute( diff --git a/cpp/src/utilities/logger.hpp b/cpp/src/utilities/logger.hpp index fc64bb7264..7c9f952d48 100644 --- a/cpp/src/utilities/logger.hpp +++ b/cpp/src/utilities/logger.hpp @@ -137,13 +137,13 @@ inline log_console_callback_t g_console_callback = nullptr; */ inline void set_console_log_callback(log_console_callback_t callback) { - [[maybe_unused]] std::lock_guard lock(g_console_callback_mutex); + std::lock_guard lock(g_console_callback_mutex); g_console_callback = callback; } inline log_console_callback_t console_log_callback() { - [[maybe_unused]] std::lock_guard lock(g_console_callback_mutex); + std::lock_guard lock(g_console_callback_mutex); return g_console_callback; } @@ -155,7 +155,7 @@ class log_buffer { void log(rapids_logger::level_enum lvl, const char* msg) { - [[maybe_unused]] std::lock_guard lock(mutex); + std::lock_guard lock(mutex); if (!msg) return; std::string str(msg); @@ -165,13 +165,13 @@ class log_buffer { size_t size() const { - [[maybe_unused]] std::lock_guard lock(mutex); + std::lock_guard lock(mutex); return messages.size(); } std::vector drain_all() { - [[maybe_unused]] std::lock_guard lock(mutex); + std::lock_guard lock(mutex); std::vector out; out.swap(messages); return out; @@ -333,7 +333,7 @@ inline std::shared_ptr make_logger_config(const std::string& log_file, bool log_to_console, bool truncate) { - [[maybe_unused]] std::lock_guard lock(g_guard_mutex); + std::lock_guard lock(g_guard_mutex); // Reuse the configuration already in place; reconfiguring here would re-truncate the file. if (auto existing = g_active_guard.lock()) { return existing; } diff --git a/cpp/src/utilities/producer_sync.hpp b/cpp/src/utilities/producer_sync.hpp index 08d4979419..129fe665a7 100644 --- a/cpp/src/utilities/producer_sync.hpp +++ b/cpp/src/utilities/producer_sync.hpp @@ -29,14 +29,14 @@ class producer_sync_t { void register_producer(std::atomic* progress_ptr) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); producers_.push_back(progress_ptr); cv_.notify_all(); } void deregister_producer(std::atomic* progress_ptr) { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); auto it = std::find(producers_.begin(), producers_.end(), progress_ptr); if (it != producers_.end()) { producers_.erase(it); } cv_.notify_all(); @@ -48,14 +48,14 @@ class producer_sync_t { */ void registration_complete() { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); registration_complete_ = true; cv_.notify_all(); } bool is_registration_complete() const { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return registration_complete_; } @@ -68,7 +68,7 @@ class producer_sync_t { */ void wait_for_producers(double target_work_units) { - [[maybe_unused]] std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); cv_.wait(lock, [this, target_work_units] { if (!registration_complete_) { return false; } return all_producers_at_or_ahead(target_work_units); @@ -82,7 +82,7 @@ class producer_sync_t { size_t num_producers() const { - [[maybe_unused]] std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return producers_.size(); } diff --git a/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu b/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu index 0c4a81f955..de2f65bbfb 100644 --- a/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu +++ b/cpp/tests/dual_simplex/unit_tests/solve_barrier.cu @@ -42,7 +42,7 @@ static void init_handler(const raft::handle_t* handle_ptr) TEST(barrier, chess_set) { - [[maybe_unused]] cuopt::init_logger_t log("", true); + cuopt::init_logger_t log("", true); namespace simplex = cuopt::mathematical_optimization::simplex; raft::handle_t handle{}; init_handler(&handle); @@ -112,7 +112,7 @@ TEST(barrier, chess_set) TEST(barrier, dual_variable_greater_than) { - [[maybe_unused]] cuopt::init_logger_t log("", true); + cuopt::init_logger_t log("", true); // minimize 3*x0 + 2 * x1 // subject to x0 + x1 >= 1 // x0 + 2x1 >= 3 diff --git a/cpp/tests/linear_programming/pdlp_test.cu b/cpp/tests/linear_programming/pdlp_test.cu index 43005e2eb3..fc8ac30fa0 100644 --- a/cpp/tests/linear_programming/pdlp_test.cu +++ b/cpp/tests/linear_programming/pdlp_test.cu @@ -195,8 +195,7 @@ TEST(pdlp_class, concurrent_null_solver_ptrs_inside_mip) // and sol_barrier_ptr null. const int prev_threads = omp_get_max_threads(); omp_set_num_threads(1); - [[maybe_unused]] const cuopt::scope_guard restore_threads{ - [prev_threads] { omp_set_num_threads(prev_threads); }}; + const cuopt::scope_guard restore_threads{[prev_threads] { omp_set_num_threads(prev_threads); }}; optimization_problem_solution_t solution = solve_lp(&handle_, op_problem, settings); EXPECT_EQ((int)solution.get_termination_status(), CUOPT_TERMINATION_STATUS_OPTIMAL); diff --git a/cpp/tests/mip/incumbent_callback_test.cu b/cpp/tests/mip/incumbent_callback_test.cu index 4c7587931a..cefe4e5bcb 100644 --- a/cpp/tests/mip/incumbent_callback_test.cu +++ b/cpp/tests/mip/incumbent_callback_test.cu @@ -177,8 +177,7 @@ TEST(mip_solve, incumbent_get_set_callback_test) // population stays empty. The fallback in solver.cu must use the OG-space incumbent. TEST(mip_solve, early_heuristic_incumbent_fallback) { - [[maybe_unused]] scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", - "1"); + scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", "1"); const raft::handle_t handle_{}; auto path = make_path_absolute("mip/pk1.mps"); @@ -214,8 +213,7 @@ TEST(mip_solve, early_heuristic_incumbent_fallback) // through PaPILO presolve and accepted into the heuristic population. TEST(mip_solve, initial_solution_survives_papilo_crush) { - [[maybe_unused]] scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", - "1"); + scoped_env_restore_t disable_gpu_heuristics_env("CUOPT_DISABLE_GPU_HEURISTICS", "1"); const raft::handle_t handle_{}; auto path = make_path_absolute("mip/pk1.mps"); diff --git a/cpp/tests/routing/unit_tests/top_k.cu b/cpp/tests/routing/unit_tests/top_k.cu index a0cc95e452..6a4e48b790 100644 --- a/cpp/tests/routing/unit_tests/top_k.cu +++ b/cpp/tests/routing/unit_tests/top_k.cu @@ -241,7 +241,7 @@ class top_cand_test_t : public routing_test_t, public ::testing::TestW double elapsed_ms; this->stream_view_.sync(); { - [[maybe_unused]] time_it t(&elapsed_ms); + time_it t(&elapsed_ms); for (int i = 0; i < iter; ++i) { cub::DeviceSegmentedSort::SortPairs(d_cub_storage_bytes.data(), tmp_storage_bytes, @@ -271,7 +271,7 @@ class top_cand_test_t : public routing_test_t, public ::testing::TestW double elapsed_ms; this->stream_view_.sync(); { - [[maybe_unused]] time_it t(&elapsed_ms); + time_it t(&elapsed_ms); for (int i = 0; i < iter; ++i) { call_top_k(d_input_cost, d_output_cost, d_out_index); } From bafffd97041bedd1de7c3dd47d834079f9a467a3 Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Mon, 21 Sep 2026 14:39:58 -0400 Subject: [PATCH 4/5] Remove unnecessary warning suppressions Signed-off-by: Miles Lubin --- cpp/src/branch_and_bound/branch_and_bound.cpp | 6 +- .../io/experimental_mps_fast/file_reader.hpp | 4 +- .../presolve/conflict_graph/clique_table.cu | 2 +- cpp/tests/linear_programming/pdlp_test.cu | 56 ++++++++----------- .../unit_tests/presolve_test.cu | 42 +++++++------- cpp/tests/mip/incumbent_callback_test.cu | 2 +- cpp/tests/mip/unit_test.cu | 16 +++--- cpp/tests/routing/utilities/data_model.hpp | 12 ++-- 8 files changed, 62 insertions(+), 78 deletions(-) diff --git a/cpp/src/branch_and_bound/branch_and_bound.cpp b/cpp/src/branch_and_bound/branch_and_bound.cpp index ca630f5e26..0ea90baadf 100644 --- a/cpp/src/branch_and_bound/branch_and_bound.cpp +++ b/cpp/src/branch_and_bound/branch_and_bound.cpp @@ -1136,9 +1136,9 @@ struct nondeterministic_policy_t : tree_update_policy_t { return bnb.variable_selection(node, fractional, worker); } - void update_objective_estimate([[maybe_unused]] mip_node_t* node, - [[maybe_unused]] const std::vector& fractional, - [[maybe_unused]] const std::vector& x) override + void update_objective_estimate(mip_node_t* node, + const std::vector& fractional, + const std::vector& x) override { if (worker->search_strategy == search_strategy_t::BEST_FIRST) { node->objective_estimate = diff --git a/cpp/src/io/experimental_mps_fast/file_reader.hpp b/cpp/src/io/experimental_mps_fast/file_reader.hpp index 099cd54d27..c2df168ac6 100644 --- a/cpp/src/io/experimental_mps_fast/file_reader.hpp +++ b/cpp/src/io/experimental_mps_fast/file_reader.hpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights +// reserved. SPDX-License-Identifier: Apache-2.0 // Input layer for the fast MPS parser: turns on-disk bytes (plain or .lz4) into one // contiguous parse buffer and publishes MPS section boundaries as data becomes available. diff --git a/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu b/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu index 7677417b76..0ed0ca298f 100644 --- a/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu +++ b/cpp/src/mip_heuristics/presolve/conflict_graph/clique_table.cu @@ -674,8 +674,8 @@ void find_initial_cliques(user_problem_t& problem, cuopt::timer_t& timer, omp_atomic_t* signal_extend) { - [[maybe_unused]] cuopt::timer_t stage_timer(std::numeric_limits::infinity()); #ifdef DEBUG_CLIQUE_TABLE + cuopt::timer_t stage_timer(std::numeric_limits::infinity()); double t_fill = 0.; double t_coeff = 0.; double t_sort = 0.; diff --git a/cpp/tests/linear_programming/pdlp_test.cu b/cpp/tests/linear_programming/pdlp_test.cu index fc8ac30fa0..cd1d57a50a 100644 --- a/cpp/tests/linear_programming/pdlp_test.cu +++ b/cpp/tests/linear_programming/pdlp_test.cu @@ -2402,8 +2402,8 @@ TEST(pdlp_class, simple_batch_different_objectives) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - [[maybe_unused]] const int n_vars = op_problem.get_n_variables(); - const auto& original_obj = op_problem.get_objective_coefficients(); + const int n_vars = op_problem.get_n_variables(); + const auto& original_obj = op_problem.get_objective_coefficients(); // Create a modified objective: scale by 2.0 std::vector modified_obj(original_obj.begin(), original_obj.end()); @@ -2510,8 +2510,7 @@ TEST(pdlp_class, simple_batch_different_objectives_and_offsets) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - [[maybe_unused]] const int n_vars = op_problem.get_n_variables(); - const auto& original_obj = op_problem.get_objective_coefficients(); + const auto& original_obj = op_problem.get_objective_coefficients(); // Two climbers: (original_obj, offset=3.5) and (2x objective, offset=-7.0) std::vector obj_c1(original_obj.begin(), original_obj.end()); @@ -2568,9 +2567,8 @@ TEST(pdlp_class, simple_batch_different_constraint_bounds) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); - const auto& original_lower_bounds = op_problem.get_constraint_lower_bounds(); - const auto& original_upper_bounds = op_problem.get_constraint_upper_bounds(); + const auto& original_lower_bounds = op_problem.get_constraint_lower_bounds(); + const auto& original_upper_bounds = op_problem.get_constraint_upper_bounds(); // Build 3 climbers with perturbed bounds: // - climber 0: unchanged (scale factor 1.0) @@ -2636,8 +2634,7 @@ TEST(pdlp_class, simple_batch_everything_different) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); + const int n_vars = op_problem.get_n_variables(); const auto& original_obj = op_problem.get_objective_coefficients(); const auto& original_lower_bounds = op_problem.get_constraint_lower_bounds(); @@ -3037,10 +3034,8 @@ TEST(pdlp_class, DISABLED_cupdlpx_batch_infeasible_detection) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - [[maybe_unused]] const std::vector& variable_lower_bounds = - op_problem.get_variable_lower_bounds(); - [[maybe_unused]] const std::vector& variable_upper_bounds = - op_problem.get_variable_upper_bounds(); + const std::vector& variable_lower_bounds = op_problem.get_variable_lower_bounds(); + const std::vector& variable_upper_bounds = op_problem.get_variable_upper_bounds(); for (size_t i = 0; i < batch_size; i++) { solver_settings.new_bounds.push_back( @@ -3091,11 +3086,6 @@ TEST(pdlp_class, DISABLED_cupdlpx_infeasible_detection_batch_afiro_new_bounds) constexpr int batch_size = 5; - [[maybe_unused]] const std::vector& variable_lower_bounds = - op_problem.get_variable_lower_bounds(); - [[maybe_unused]] const std::vector& variable_upper_bounds = - op_problem.get_variable_upper_bounds(); - for (size_t i = 0; i < batch_size; i++) { solver_settings.new_bounds.push_back({static_cast(i), 1, 7.0, 8.0}); } @@ -3336,8 +3326,8 @@ TEST(pdlp_class, strong_branching_test) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const std::vector fractional = {1, 2, 4}; + const std::vector root_soln_x = {0.891, 0.109, 0.636429}; auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -3443,8 +3433,8 @@ TEST(pdlp_class, strong_branching_user_api) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const std::vector fractional = {1, 2, 4}; + const std::vector root_soln_x = {0.891, 0.109, 0.636429}; auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -4249,10 +4239,10 @@ TEST(pdlp_class, shared_sb_view_batch_pre_solved) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; - const int n_fractional = fractional.size(); - const int batch_size = n_fractional * 2; // 6 + const std::vector fractional = {1, 2, 4}; + const std::vector root_soln_x = {0.891, 0.109, 0.636429}; + const int n_fractional = fractional.size(); + const int batch_size = n_fractional * 2; // 6 auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -4381,10 +4371,9 @@ TEST(pdlp_class, shared_sb_view_all_infeasible) cuopt::mathematical_optimization::io::mps_data_model_t op_problem = cuopt::mathematical_optimization::io::read_mps(path, true); - const std::vector fractional = {1, 2, 4}; - [[maybe_unused]] const std::vector root_soln_x = {0.891, 0.109, 0.636429}; - const int n_fractional = fractional.size(); - const int batch_size = n_fractional; + const std::vector fractional = {1, 2, 4}; + const int n_fractional = fractional.size(); + const int batch_size = n_fractional; auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; @@ -4452,8 +4441,8 @@ TEST(pdlp_class, big_batch_fixed_path) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); + const int n_vars = op_problem.get_n_variables(); + const int n_constrs = op_problem.get_n_constraints(); const auto& original_obj = op_problem.get_objective_coefficients(); const auto& original_lb = op_problem.get_constraint_lower_bounds(); @@ -4716,8 +4705,7 @@ TEST(pdlp_class, batch_with_optimal_size_query) solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; solver_settings.presolver = presolver_t::None; - const int n_vars = op_problem.get_n_variables(); - [[maybe_unused]] const int n_constrs = op_problem.get_n_constraints(); + const int n_vars = op_problem.get_n_variables(); const auto& original_obj = op_problem.get_objective_coefficients(); const auto& original_lb = op_problem.get_constraint_lower_bounds(); diff --git a/cpp/tests/linear_programming/unit_tests/presolve_test.cu b/cpp/tests/linear_programming/unit_tests/presolve_test.cu index c6a2ed5c3f..92cb27a42a 100644 --- a/cpp/tests/linear_programming/unit_tests/presolve_test.cu +++ b/cpp/tests/linear_programming/unit_tests/presolve_test.cu @@ -221,17 +221,17 @@ TEST(pslp_presolve, postsolve_accuracy_afiro) auto mps_data_model = cuopt::mathematical_optimization::io::read_mps(path, true); // Store original problem data for later verification - const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); - const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); - const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); - const auto& orig_obj_coeffs = mps_data_model.get_objective_coefficients(); - const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); - const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); - const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); - const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); - const double orig_obj_offset = mps_data_model.get_objective_offset(); - const int orig_n_vars = mps_data_model.get_n_variables(); - [[maybe_unused]] const int orig_n_constraints = mps_data_model.get_n_constraints(); + const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); + const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); + const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); + const auto& orig_obj_coeffs = mps_data_model.get_objective_coefficients(); + const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); + const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); + const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); + const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); + const double orig_obj_offset = mps_data_model.get_objective_offset(); + const int orig_n_vars = mps_data_model.get_n_variables(); + const int orig_n_constraints = mps_data_model.get_n_constraints(); // Solve with PSLP presolve enabled auto solver_settings = pdlp_solver_settings_t{}; @@ -317,15 +317,14 @@ TEST(pslp_presolve, postsolve_accuracy_larger_problem) auto mps_data_model = cuopt::mathematical_optimization::io::read_mps(path, false); // Store original problem dimensions - const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); - const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); - const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); - const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); - const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); - const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); - const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); - const int orig_n_vars = mps_data_model.get_n_variables(); - [[maybe_unused]] const int orig_n_constraints = mps_data_model.get_n_constraints(); + const auto& orig_coefficients = mps_data_model.get_constraint_matrix_values(); + const auto& orig_indices = mps_data_model.get_constraint_matrix_indices(); + const auto& orig_offsets = mps_data_model.get_constraint_matrix_offsets(); + const auto& orig_var_lb = mps_data_model.get_variable_lower_bounds(); + const auto& orig_var_ub = mps_data_model.get_variable_upper_bounds(); + const auto& orig_constr_lb = mps_data_model.get_constraint_lower_bounds(); + const auto& orig_constr_ub = mps_data_model.get_constraint_upper_bounds(); + const int orig_n_vars = mps_data_model.get_n_variables(); // Solve with PSLP presolve auto solver_settings = pdlp_solver_settings_t{}; @@ -471,8 +470,7 @@ TEST(pslp_presolve, postsolve_multiple_problems) auto mps_data_model = cuopt::mathematical_optimization::io::read_mps(path, name == "afiro_original"); - const int orig_n_vars = mps_data_model.get_n_variables(); - [[maybe_unused]] const int orig_n_constraints = mps_data_model.get_n_constraints(); + const int orig_n_vars = mps_data_model.get_n_variables(); auto solver_settings = pdlp_solver_settings_t{}; solver_settings.method = cuopt::mathematical_optimization::method_t::PDLP; diff --git a/cpp/tests/mip/incumbent_callback_test.cu b/cpp/tests/mip/incumbent_callback_test.cu index cefe4e5bcb..68131ed054 100644 --- a/cpp/tests/mip/incumbent_callback_test.cu +++ b/cpp/tests/mip/incumbent_callback_test.cu @@ -147,7 +147,7 @@ void test_incumbent_callback(std::string test_instance, bool include_set_callbac set_solution_callback = std::make_unique(solutions, &user_data); settings.set_mip_callback(set_solution_callback.get(), &user_data); } - [[maybe_unused]] auto solution = solve_mip(op_problem, settings); + auto solution = solve_mip(op_problem, settings); EXPECT_GE(get_solution_callback.n_calls, 1); if (include_set_callback) { EXPECT_GE(set_solution_callback->n_calls, 1); } check_solutions(get_solution_callback, mps_problem, settings); diff --git a/cpp/tests/mip/unit_test.cu b/cpp/tests/mip/unit_test.cu index c9123f22dc..5a55da6e39 100644 --- a/cpp/tests/mip/unit_test.cu +++ b/cpp/tests/mip/unit_test.cu @@ -146,10 +146,10 @@ class MILPTestParams TEST_P(MILPTestParams, TestSampleMILP) { - bool maximize = std::get<0>(GetParam()); - int scaling = std::get<1>(GetParam()); - bool heuristics_only = std::get<2>(GetParam()); - [[maybe_unused]] auto expected_termination_status = std::get<3>(GetParam()); + bool maximize = std::get<0>(GetParam()); + int scaling = std::get<1>(GetParam()); + bool heuristics_only = std::get<2>(GetParam()); + auto expected_termination_status = std::get<3>(GetParam()); raft::handle_t handle; auto problem = create_std_milp_problem(maximize); @@ -167,11 +167,9 @@ TEST_P(MILPTestParams, TestSampleMILP) TEST_P(MILPTestParams, TestSingleVarMILP) { - bool maximize = std::get<0>(GetParam()); - int scaling = std::get<1>(GetParam()); - bool heuristics_only = std::get<2>(GetParam()); - [[maybe_unused]] auto expected_termination_status = std::get<3>(GetParam()); - + bool maximize = std::get<0>(GetParam()); + int scaling = std::get<1>(GetParam()); + bool heuristics_only = std::get<2>(GetParam()); raft::handle_t handle; auto problem = create_single_var_milp_problem(maximize); diff --git a/cpp/tests/routing/utilities/data_model.hpp b/cpp/tests/routing/utilities/data_model.hpp index d0c3c20678..fd1023880e 100644 --- a/cpp/tests/routing/utilities/data_model.hpp +++ b/cpp/tests/routing/utilities/data_model.hpp @@ -1,6 +1,6 @@ /* clang-format off */ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ /* clang-format on */ @@ -343,11 +343,11 @@ struct scross_three_routes { // clang-format on }; -[[maybe_unused]] static test_data_model_t input_; -[[maybe_unused]] static test_data_model_t input_double_; -[[maybe_unused]] static simple_two_routes simple_two_routes_; -[[maybe_unused]] static simple_three_routes simple_three_routes_; -[[maybe_unused]] static scross_three_routes scross_three_routes_; +static test_data_model_t input_; +static test_data_model_t input_double_; +static simple_two_routes simple_two_routes_; +static simple_three_routes simple_three_routes_; +static scross_three_routes scross_three_routes_; } // namespace test } // namespace routing From d513069b51a28a78e353d725affc76cbca635c26 Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Mon, 21 Sep 2026 15:10:08 -0400 Subject: [PATCH 5/5] Keep disabled diagnostic arguments visible --- cpp/src/barrier/barrier.cu | 4 +- cpp/src/branch_and_bound/branch_and_bound.cpp | 8 +-- cpp/src/cuts/cuts.cpp | 69 +++++++++---------- cpp/src/dual_simplex/presolve.cpp | 2 +- .../recombiners/bound_prop_recombiner.cuh | 2 +- .../diversity/recombiners/sub_mip.cuh | 2 +- .../feasibility_jump_kernels.cu | 4 +- .../mip_heuristics/feasibility_jump/fj_cpu.cu | 40 +++++------ .../feasibility_jump/fj_cpu.cuh | 2 +- .../feasibility_jump/fj_cpu_binary.cu | 6 +- .../feasibility_pump/feasibility_pump.cu | 4 +- .../local_search/rounding/simple_rounding.cu | 2 +- cpp/src/mip_heuristics/logger.cuh | 12 ++-- .../presolve/presolve_budget_policy.hpp | 6 +- .../mip_heuristics/presolve/probing_cache.cu | 4 +- .../presolve/third_party_presolve.cpp | 2 +- cpp/src/mip_heuristics/problem/problem.cu | 13 ++-- cpp/src/pdlp/distributed_pdlp/partitioner.cpp | 6 +- cpp/src/routing/adapters/adapted_sol.cuh | 4 +- cpp/src/routing/crossovers/ox_recombiner.cuh | 8 +-- .../lexicographic_search.cu | 4 +- cpp/src/routing/solution/solution.cu | 8 +-- cpp/src/utilities/logger.hpp | 40 +++++++++++ cpp/src/utilities/macros.cuh | 18 ++++- 24 files changed, 157 insertions(+), 113 deletions(-) diff --git a/cpp/src/barrier/barrier.cu b/cpp/src/barrier/barrier.cu index 1367b335a4..f17e53ab98 100644 --- a/cpp/src/barrier/barrier.cu +++ b/cpp/src/barrier/barrier.cu @@ -1960,11 +1960,11 @@ class iteration_data_t { // v = alpha * A * Dinv * A^T * y + beta * v void gpu_adat_multiply(f_t alpha, - [[maybe_unused]] const rmm::device_uvector& y, + const rmm::device_uvector& y, pdlp::cusparse_dn_vec_descr_view cusparse_y, f_t beta, - [[maybe_unused]] rmm::device_uvector& v, + rmm::device_uvector& v, pdlp::cusparse_dn_vec_descr_view cusparse_v, rmm::device_uvector& u, pdlp::cusparse_dn_vec_descr_view cusparse_u, diff --git a/cpp/src/branch_and_bound/branch_and_bound.cpp b/cpp/src/branch_and_bound/branch_and_bound.cpp index 0ea90baadf..136744efd7 100644 --- a/cpp/src/branch_and_bound/branch_and_bound.cpp +++ b/cpp/src/branch_and_bound/branch_and_bound.cpp @@ -50,7 +50,7 @@ #if SUBMIP_VERBOSE #define DEBUG_SUBMIP(fmt, ...) settings_.log.print_format(fmt, __VA_ARGS__); #else -#define DEBUG_SUBMIP(fmt, ...) +#define DEBUG_SUBMIP(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif namespace cuopt::mathematical_optimization::mip { @@ -2374,7 +2374,7 @@ void branch_and_bound_t::solve_submip(diving_worker_t* worke third_party_presolve_status_t presolver_status = presolver.apply_to_subproblem(submip_problem, submip_settings, presolve_time_limit, 1); - [[maybe_unused]] double presolve_time = toc(start_time); + double presolve_time = toc(start_time); if (presolver_status == third_party_presolve_status_t::INFEASIBLE || presolver_status == third_party_presolve_status_t::UNBNDORINFEAS || @@ -2497,8 +2497,8 @@ void branch_and_bound_t::solve_submip(diving_worker_t* worke submip_fj_cpu_worker.run_async(time_limit, work_limit); } - mip_status_t submip_status = submip_bnb.solve(submip_solution); - [[maybe_unused]] f_t submip_time = toc(start_time); + mip_status_t submip_status = submip_bnb.solve(submip_solution); + f_t submip_time = toc(start_time); DEBUG_SUBMIP( "{}Sub-MIP: status={}, iterations={} (total={}), presolve_time={:.2f}, total_time={:.2f} \n", diff --git a/cpp/src/cuts/cuts.cpp b/cpp/src/cuts/cuts.cpp index f71a906515..9ed3ae278e 100644 --- a/cpp/src/cuts/cuts.cpp +++ b/cpp/src/cuts/cuts.cpp @@ -60,9 +60,7 @@ enum class clique_cut_build_status_t : int8_t { NO_CUT = 0, CUT_ADDED = 1, INFEA std::fprintf(stderr, "\n"); \ std::fflush(stderr); \ } while (0) -#define CUTS_DEBUG_NOOP(...) \ - do { \ - } while (0) +#define CUTS_DEBUG_NOOP(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #if DEBUG_CLIQUE_CUTS #define CLIQUE_CUTS_DEBUG(...) CUTS_DEBUG_LOG("[DEBUG_CLIQUE_CUTS]", __VA_ARGS__) @@ -77,19 +75,18 @@ enum class clique_cut_build_status_t : int8_t { NO_CUT = 0, CUT_ADDED = 1, INFEA #endif template -clique_cut_build_status_t build_clique_cut( - const std::vector& clique_vertices, - i_t num_vars, - [[maybe_unused]] const std::vector& var_types, - [[maybe_unused]] const std::vector& lower_bounds, - [[maybe_unused]] const std::vector& upper_bounds, - const std::vector& xstar, - [[maybe_unused]] f_t bound_tol, - f_t min_violation, - sparse_vector_t& cut, - f_t& cut_rhs, - f_t* work_estimate, - f_t max_work_estimate) +clique_cut_build_status_t build_clique_cut(const std::vector& clique_vertices, + i_t num_vars, + const std::vector& var_types, + [[maybe_unused]] const std::vector& lower_bounds, + [[maybe_unused]] const std::vector& upper_bounds, + const std::vector& xstar, + f_t bound_tol, + f_t min_violation, + sparse_vector_t& cut, + f_t& cut_rhs, + f_t* work_estimate, + f_t max_work_estimate) { if (clique_vertices.size() < 2) { return clique_cut_build_status_t::NO_CUT; } const f_t clique_size = static_cast(clique_vertices.size()); @@ -546,20 +543,19 @@ void extend_clique_vertices(std::vector& clique_vertices, // are extra vertices each adjacent to every vertex in cycle_vertices. The // resulting cut is stored in the form a^T x >= rhs to match cut_pool_t. template -clique_cut_build_status_t build_zero_half_cut( - const std::vector& cycle_vertices, - const std::vector& wheel_centers, - i_t num_vars, - [[maybe_unused]] const std::vector& var_types, - const std::vector& lower_bounds, - const std::vector& upper_bounds, - const std::vector& xstar, - [[maybe_unused]] f_t bound_tol, - f_t min_violation, - sparse_vector_t& cut, - f_t& cut_rhs, - f_t* work_estimate, - f_t max_work_estimate) +clique_cut_build_status_t build_zero_half_cut(const std::vector& cycle_vertices, + const std::vector& wheel_centers, + i_t num_vars, + const std::vector& var_types, + const std::vector& lower_bounds, + const std::vector& upper_bounds, + const std::vector& xstar, + f_t bound_tol, + f_t min_violation, + sparse_vector_t& cut, + f_t& cut_rhs, + f_t* work_estimate, + f_t max_work_estimate) { const size_t cycle_size = cycle_vertices.size(); if (cycle_size < 5 || (cycle_size % 2) == 0) { @@ -598,9 +594,8 @@ clique_cut_build_status_t build_zero_half_cut( f_t rhs_acc = -f_m; - auto accumulate = [&](const std::vector& verts, - f_t weight, - [[maybe_unused]] bool is_cycle) -> clique_cut_build_status_t { + auto accumulate = + [&](const std::vector& verts, f_t weight, bool is_cycle) -> clique_cut_build_status_t { ZERO_HALF_DEBUG("build_zero_half_cut accumulate verts.size=%zu weight=%g is_cycle=%d", verts.size(), static_cast(weight), @@ -610,10 +605,10 @@ clique_cut_build_status_t build_zero_half_cut( static_cast(vertex_idx), static_cast(2 * num_vars)); cuopt_assert(vertex_idx >= 0 && vertex_idx < 2 * num_vars, "Zero-half vertex out of range"); - const i_t var_idx = vertex_idx % num_vars; - const bool complement = vertex_idx >= num_vars; - [[maybe_unused]] const f_t lower_bound = lower_bounds[var_idx]; - [[maybe_unused]] const f_t upper_bound = upper_bounds[var_idx]; + const i_t var_idx = vertex_idx % num_vars; + const bool complement = vertex_idx >= num_vars; + const f_t lower_bound = lower_bounds[var_idx]; + const f_t upper_bound = upper_bounds[var_idx]; cuopt_assert(var_types[var_idx] != variable_type_t::CONTINUOUS, "Zero-half cut contains continuous variable"); cuopt_assert(lower_bound >= -bound_tol, "Zero-half variable lower bound below zero"); diff --git a/cpp/src/dual_simplex/presolve.cpp b/cpp/src/dual_simplex/presolve.cpp index ca8dcce8e7..861774f23f 100644 --- a/cpp/src/dual_simplex/presolve.cpp +++ b/cpp/src/dual_simplex/presolve.cpp @@ -15,8 +15,8 @@ #include #include -#include #include +#include namespace cuopt::mathematical_optimization::simplex { diff --git a/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh b/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh index 2ab743b562..a2069498d6 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/bound_prop_recombiner.cuh @@ -99,7 +99,7 @@ class bound_prop_recombiner_t : public recombiner_t { solution_t& other, solution_t& offspring, rmm::device_uvector>& probing_values, - [[maybe_unused]] i_t n_vars_from_other, + i_t n_vars_from_other, rmm::device_uvector& variable_map) { raft::common::nvtx::range fun_scope("get_probing_values_for_feasible"); diff --git a/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh b/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh index 866ea43979..b047f270a5 100644 --- a/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh +++ b/cpp/src/mip_heuristics/diversity/recombiners/sub_mip.cuh @@ -32,7 +32,7 @@ class sub_mip_recombiner_t : public recombiner_t { { } - void solution_callback(std::vector& solution, [[maybe_unused]] f_t objective) + void solution_callback(std::vector& solution, f_t objective) { CUOPT_LOG_DEBUG("SUBMIP added solution with objective %.16e", objective); solution_vector.push_back(solution); diff --git a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu index eebe49bde7..773ac37218 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/feasibility_jump_kernels.cu @@ -414,8 +414,8 @@ DI void check_variable_feasibility(const typename fj_t::climber_data_t bool check_integer) { for (i_t var_idx = threadIdx.x; var_idx < fj.pb.n_variables; var_idx += blockDim.x) { - auto val = fj.incumbent_assignment[var_idx]; - [[maybe_unused]] bool feasible = fj.pb.check_variable_within_bounds(var_idx, val); + auto val = fj.incumbent_assignment[var_idx]; + bool feasible = fj.pb.check_variable_within_bounds(var_idx, val); cuopt_assert(feasible, "invalid variable assignment"); if (check_integer && fj.pb.is_integer_var(var_idx)) diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu index 23f88f4c3d..63c6a344fe 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cu @@ -385,7 +385,7 @@ static void log_regression_features(fj_cpu_climber_t& fj_cpu, i_t n_cstrs = fj_cpu.h_offsets.size() - 1; // Dynamic runtime features - [[maybe_unused]] double violated_ratio = (double)fj_cpu.violated_constraints.size() / n_cstrs; + double violated_ratio = (double)fj_cpu.violated_constraints.size() / n_cstrs; // Compute per-iteration metrics [[maybe_unused]] double nnz_per_move = 0.0; @@ -393,45 +393,44 @@ static void log_regression_features(fj_cpu_climber_t& fj_cpu, fj_cpu.n_lift_moves_window + fj_cpu.n_mtm_viol_moves_window + fj_cpu.n_mtm_sat_moves_window; if (total_moves > 0) { nnz_per_move = (double)fj_cpu.nnz_processed_window / total_moves; } - [[maybe_unused]] double eval_intensity = (double)fj_cpu.nnz_processed_window / 1000.0; + double eval_intensity = (double)fj_cpu.nnz_processed_window / 1000.0; // Cache and locality metrics i_t cache_hits_window = fj_cpu.hit_count - fj_cpu.hit_count_window_start; i_t cache_misses_window = fj_cpu.miss_count - fj_cpu.miss_count_window_start; i_t total_cache_accesses = cache_hits_window + cache_misses_window; - [[maybe_unused]] double cache_hit_rate = + double cache_hit_rate = total_cache_accesses > 0 ? (double)cache_hits_window / total_cache_accesses : 0.0; i_t unique_cstrs = fj_cpu.unique_cstrs_accessed_window.size(); i_t unique_vars = fj_cpu.unique_vars_accessed_window.size(); // Reuse ratios: how many times each constraint/variable was accessed on average - [[maybe_unused]] double cstr_reuse_ratio = + double cstr_reuse_ratio = unique_cstrs > 0 ? (double)fj_cpu.nnz_processed_window / unique_cstrs : 0.0; - [[maybe_unused]] double var_reuse_ratio = + double var_reuse_ratio = unique_vars > 0 ? (double)fj_cpu.n_variable_updates_window / unique_vars : 0.0; // Working set size estimation (KB) // Each constraint: lhs (f_t) + 2 bounds (f_t) + sumcomp (f_t) = 4 * sizeof(f_t) // Each variable: assignment (f_t) = 1 * sizeof(f_t) i_t working_set_bytes = unique_cstrs * 4 * sizeof(f_t) + unique_vars * sizeof(f_t); - [[maybe_unused]] double working_set_kb = working_set_bytes / 1024.0; + double working_set_kb = working_set_bytes / 1024.0; // Coverage: what fraction of problem is actively touched - [[maybe_unused]] double cstr_coverage = (double)unique_cstrs / n_cstrs; - [[maybe_unused]] double var_coverage = (double)unique_vars / n_vars; + double cstr_coverage = (double)unique_cstrs / n_cstrs; + double var_coverage = (double)unique_vars / n_vars; - [[maybe_unused]] double loads_per_iter = 0.0; - [[maybe_unused]] double stores_per_iter = 0.0; - [[maybe_unused]] double l1_miss = -1.0; - [[maybe_unused]] double l3_miss = -1.0; + double loads_per_iter = 0.0; + double stores_per_iter = 0.0; + double l1_miss = -1.0; + double l3_miss = -1.0; // Compute memory statistics - [[maybe_unused]] double mem_loads_mb = mem_loads_bytes / 1e6; - [[maybe_unused]] double mem_stores_mb = mem_stores_bytes / 1e6; - double mem_total_mb = (mem_loads_bytes + mem_stores_bytes) / 1e6; - [[maybe_unused]] double mem_bandwidth_gb_per_sec = - (mem_total_mb / 1000.0) / (time_window_ms / 1000.0); + double mem_loads_mb = mem_loads_bytes / 1e6; + double mem_stores_mb = mem_stores_bytes / 1e6; + double mem_total_mb = (mem_loads_bytes + mem_stores_bytes) / 1e6; + double mem_bandwidth_gb_per_sec = (mem_total_mb / 1000.0) / (time_window_ms / 1000.0); // Build per-wrapper memory statistics string std::stringstream wrapper_stats; @@ -1875,8 +1874,8 @@ static void sanity_checks(fj_cpu_climber_t& fj_cpu) // Check that each constraint is in exactly one of violated_constraints or satisfied_constraints for (i_t cstr_idx = 0; cstr_idx < fj_cpu.view.pb.n_constraints; ++cstr_idx) { - [[maybe_unused]] bool in_viol = fj_cpu.violated_constraints.count(cstr_idx) > 0; - [[maybe_unused]] bool in_sat = fj_cpu.satisfied_constraints.count(cstr_idx) > 0; + bool in_viol = fj_cpu.violated_constraints.count(cstr_idx) > 0; + bool in_sat = fj_cpu.satisfied_constraints.count(cstr_idx) > 0; cuopt_assert( in_viol != in_sat, "Constraint must be in exactly one of violated_constraints or satisfied_constraints"); @@ -2089,8 +2088,7 @@ void cpufj_solve(fj_cpu_climber_t* fj_cpu, f_t in_time_limit, double w auto loop_end = std::chrono::high_resolution_clock::now(); double total_time = std::chrono::duration_cast>(loop_end - loop_start).count(); - [[maybe_unused]] double avg_time_per_iter = - fj_cpu->iterations > 0 ? total_time / fj_cpu->iterations : 0; + double avg_time_per_iter = fj_cpu->iterations > 0 ? total_time / fj_cpu->iterations : 0; CUOPT_LOG_TRACE("%sCPUFJ Average time per iteration: %.8fms", fj_cpu->log_prefix.c_str(), avg_time_per_iter * 1000.0); diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh index baea5d384d..b9efd193d1 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu.cuh @@ -31,7 +31,7 @@ template struct fj_cpu_shared_incumbent_t { // True when the candidate beat the shared best, in which case it was stored. bool publish(f_t candidate_objective, - [[maybe_unused]] f_t candidate_user_objective, + f_t candidate_user_objective, const std::vector& candidate) { // Unlocked reject first: the publish sites are hot on instances that improve in tiny steps. diff --git a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu index d47714a934..a0ec2c509f 100644 --- a/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu +++ b/cpp/src/mip_heuristics/feasibility_jump/fj_cpu_binary.cu @@ -27,7 +27,7 @@ namespace cuopt::mathematical_optimization::mip { -[[maybe_unused]] static const char* fj_binary_reject_name(fj_binary_reject_t reason) +static const char* fj_binary_reject_name(fj_binary_reject_t reason) { switch (reason) { case fj_binary_reject_t::none: return "none"; @@ -59,8 +59,8 @@ constexpr int32_t fj_bin_obj_escalate_max = 10; constexpr int32_t fj_bin_2opt_candidates = 64; // bounds for the components of the packed score -[[maybe_unused]] constexpr int32_t fj_bin_base_limit = 1 << 16; -[[maybe_unused]] constexpr int32_t fj_bin_bonus_limit = 1 << 14; +constexpr int32_t fj_bin_base_limit = 1 << 16; +constexpr int32_t fj_bin_bonus_limit = 1 << 14; // tuned values for the argmax tile // tile size is set relative to L1$ if available diff --git a/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu b/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu index ddc9f6e44b..c2ef6299c7 100644 --- a/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu +++ b/cpp/src/mip_heuristics/local_search/feasibility_pump/feasibility_pump.cu @@ -501,7 +501,7 @@ bool feasibility_pump_t::run_single_fp_descent(solution_t& s is_feasible = round(solution); cuopt_func_call(solution.test_variable_bounds(true)); if (is_feasible) { - [[maybe_unused]] bool res = solution.compute_feasibility(); + bool res = solution.compute_feasibility(); cuopt_assert(res, "Feasibility issue"); return true; } @@ -553,7 +553,7 @@ bool feasibility_pump_t::run_single_fp_descent(solution_t& s return false; } if (is_feasible) { - [[maybe_unused]] bool res = solution.compute_feasibility(); + bool res = solution.compute_feasibility(); cuopt_assert(res, "Feasibility issue"); return true; } diff --git a/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu b/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu index 2d8fc56fa4..48b4559772 100644 --- a/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu +++ b/cpp/src/mip_heuristics/local_search/rounding/simple_rounding.cu @@ -66,7 +66,7 @@ bool check_brute_force_rounding(solution_t& solution) <<<1, TPB, 0, solution.handle_ptr->get_stream().get()>>>( solution.view(), n_integers_to_round, cuopt::make_span(var_map), best_config.data()); solution.handle_ptr->sync_stream(); - [[maybe_unused]] bool feas = solution.compute_feasibility(); + bool feas = solution.compute_feasibility(); cuopt_assert(feas, "Solution must be feasible!"); return true; } diff --git a/cpp/src/mip_heuristics/logger.cuh b/cpp/src/mip_heuristics/logger.cuh index d202fe5a1f..70c43e44c6 100644 --- a/cpp/src/mip_heuristics/logger.cuh +++ b/cpp/src/mip_heuristics/logger.cuh @@ -20,37 +20,37 @@ namespace cuopt::mathematical_optimization::mip { #if (CUOPT_LOG_ACTIVE_LEVEL <= RAPIDS_LOGGER_LOG_LEVEL_TRACE) #define DEVICE_LOG_TRACE(...) printf(__VA_ARGS__) #else -#define DEVICE_LOG_TRACE(...) void(0) +#define DEVICE_LOG_TRACE(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif #if (CUOPT_LOG_ACTIVE_LEVEL <= RAPIDS_LOGGER_LOG_LEVEL_DEBUG) #define DEVICE_LOG_DEBUG(...) printf(__VA_ARGS__) #else -#define DEVICE_LOG_DEBUG(...) void(0) +#define DEVICE_LOG_DEBUG(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif #if (CUOPT_LOG_ACTIVE_LEVEL <= RAPIDS_LOGGER_LOG_LEVEL_INFO) #define DEVICE_LOG_INFO(...) printf(__VA_ARGS__) #else -#define DEVICE_LOG_INFO(...) void(0) +#define DEVICE_LOG_INFO(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif #if (CUOPT_LOG_ACTIVE_LEVEL <= RAPIDS_LOGGER_LOG_LEVEL_WARN) #define DEVICE_LOG_WARN(...) printf(__VA_ARGS__) #else -#define DEVICE_LOG_WARN(...) void(0) +#define DEVICE_LOG_WARN(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif #if (CUOPT_LOG_ACTIVE_LEVEL <= RAPIDS_LOGGER_LOG_LEVEL_ERROR) #define DEVICE_LOG_ERROR(...) printf(__VA_ARGS__) #else -#define DEVICE_LOG_ERROR(...) void(0) +#define DEVICE_LOG_ERROR(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif #if (CUOPT_LOG_ACTIVE_LEVEL <= RAPIDS_LOGGER_LOG_LEVEL_CRITICAL) #define DEVICE_LOG_CRITICAL(...) printf(__VA_ARGS__) #else -#define DEVICE_LOG_CRITICAL(...) void(0) +#define DEVICE_LOG_CRITICAL(...) CUOPT_LOG_DISABLED(__VA_ARGS__) #endif } // namespace cuopt::mathematical_optimization::mip diff --git a/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp b/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp index e248d10614..1b18fdec96 100644 --- a/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp +++ b/cpp/src/mip_heuristics/presolve/presolve_budget_policy.hpp @@ -141,9 +141,9 @@ presolve_budget_t evaluate_presolve_budget(const mip_heuristics_hyper_params_t compute_prioritized_integer_indices( 0); // compute min and max activity first bound_presolve.calculate_activity_on_problem_bounds(problem); - [[maybe_unused]] bool res = bound_presolve.calculate_infeasible_redundant_constraints(problem); + bool res = bound_presolve.calculate_infeasible_redundant_constraints(problem); cuopt_assert(res, "The activity computation must be feasible during probing cache!"); CUOPT_LOG_DEBUG("prioritized integer_indices n_integer_vars %d", problem.n_integer_vars); // compute the min var slack @@ -1018,7 +1018,7 @@ bool compute_probing_cache(bound_presolve_t& bound_presolve, } // end of step apply_substitution_queue_to_problem(substitution_vector_pool, problem); - [[maybe_unused]] const double probing_wall = + const double probing_wall = std::chrono::duration(std::chrono::steady_clock::now() - probing_t0).count(); CUOPT_LOG_DEBUG( "PRESOLVE_PROBING probes=%zu candidates=%zu iters=%.0f work=%.3f work_limit=%.3f step=%zu " diff --git a/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp b/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp index 63e4855430..316e06e290 100644 --- a/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp +++ b/cpp/src/mip_heuristics/presolve/third_party_presolve.cpp @@ -940,7 +940,7 @@ third_party_presolve_status_t third_party_presolve_t::apply_papilo( const auto papilo_t0 = std::chrono::steady_clock::now(); auto result = papilo_presolver.apply(papilo_problem); - [[maybe_unused]] const double papilo_wall = + const double papilo_wall = std::chrono::duration(std::chrono::steady_clock::now() - papilo_t0).count(); // The effective badge is what set_presolve_parameters actually installed; the cap alone is // misleading because it only binds once ncols/2 exceeds it. diff --git a/cpp/src/mip_heuristics/problem/problem.cu b/cpp/src/mip_heuristics/problem/problem.cu index 705e034544..e7ffec35e2 100644 --- a/cpp/src/mip_heuristics/problem/problem.cu +++ b/cpp/src/mip_heuristics/problem/problem.cu @@ -1704,13 +1704,12 @@ problem_t problem_t::get_problem_after_fixing_vars( handle_ptr->get_thrust_policy(), variables_to_fix.begin(), variables_to_fix.end())), "variables_to_fix should be sorted!"); - [[maybe_unused]] i_t* result_end = - thrust::set_difference(handle_ptr->get_thrust_policy(), - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(0) + n_variables, - variables_to_fix.begin(), - variables_to_fix.end(), - variable_map.begin()); + i_t* result_end = thrust::set_difference(handle_ptr->get_thrust_policy(), + thrust::make_counting_iterator(0), + thrust::make_counting_iterator(0) + n_variables, + variables_to_fix.begin(), + variables_to_fix.end(), + variable_map.begin()); RAFT_CHECK_CUDA(handle_ptr->get_stream().get()); cuopt_assert(result_end - variable_map.data() == variable_map.size(), "Size issue in set_difference"); diff --git a/cpp/src/pdlp/distributed_pdlp/partitioner.cpp b/cpp/src/pdlp/distributed_pdlp/partitioner.cpp index 2c57afafeb..8bff6503b3 100644 --- a/cpp/src/pdlp/distributed_pdlp/partitioner.cpp +++ b/cpp/src/pdlp/distributed_pdlp/partitioner.cpp @@ -150,11 +150,11 @@ std::vector kaminpar_partitioner_t::partition( // The actual partition computation auto t0 = std::chrono::high_resolution_clock::now(); - [[maybe_unused]] const kaminpar::shm::EdgeWeight edge_cut = + const kaminpar::shm::EdgeWeight edge_cut = engine.compute_partition(std::span(block_of)); - auto t1 = std::chrono::high_resolution_clock::now(); - [[maybe_unused]] const double dt = std::chrono::duration(t1 - t0).count(); + auto t1 = std::chrono::high_resolution_clock::now(); + const double dt = std::chrono::duration(t1 - t0).count(); CUOPT_LOG_TRACE( "KaMinPar partitioned bipartite graph: nvtx=%d nnz=%d nb_parts=%d nthreads=%d edge_cut=%lld " diff --git a/cpp/src/routing/adapters/adapted_sol.cuh b/cpp/src/routing/adapters/adapted_sol.cuh index 007f083083..b152da3d95 100644 --- a/cpp/src/routing/adapters/adapted_sol.cuh +++ b/cpp/src/routing/adapters/adapted_sol.cuh @@ -145,8 +145,8 @@ struct adapted_sol_t { bool inline check_device_host_coherence_() { [[maybe_unused]] const auto copy_infeasibility_cost = infeasibility_cost; - [[maybe_unused]] const auto copy_succ = succ; - [[maybe_unused]] const auto copy_pred = pred; + const auto copy_succ = succ; + const auto copy_pred = pred; const auto copy_nodes = nodes; const auto copy_routes = routes; sol.compute_backward_forward(); diff --git a/cpp/src/routing/crossovers/ox_recombiner.cuh b/cpp/src/routing/crossovers/ox_recombiner.cuh index 1c4e21ef6b..c5a570aefc 100644 --- a/cpp/src/routing/crossovers/ox_recombiner.cuh +++ b/cpp/src/routing/crossovers/ox_recombiner.cuh @@ -552,8 +552,8 @@ struct OX { auto edge = tmp_transpose.indices[transpose_offset + x]; auto veh = tmp_transpose.buckets[transpose_offset + x]; if (edge == ref_edge && veh == ref_veh) { - found = true; - [[maybe_unused]] auto weight = tmp_transpose.weights[transpose_offset + x]; + found = true; + auto weight = tmp_transpose.weights[transpose_offset + x]; cuopt_assert(std::abs(ref_weight - weight) < 0.01, "Mismatch weights"); } } @@ -934,8 +934,8 @@ struct OX { for (size_t i = 0; i < graph.size(); ++i) { cuopt_assert(graph[i].size() == h_graph[i].size(), "Mismatch number of edges"); for (size_t j = 0; j < graph[i].size(); ++j) { - [[maybe_unused]] auto [ref_edge, ref_weight, ref_veh] = graph[i][j]; - [[maybe_unused]] auto [edge, weight, veh] = h_graph[i][j]; + auto [ref_edge, ref_weight, ref_veh] = graph[i][j]; + auto [edge, weight, veh] = h_graph[i][j]; cuopt_assert(ref_edge == edge, "Edge mismatch"); cuopt_assert(std::abs(ref_weight - weight) < 0.01, "Weight mismatch"); cuopt_assert(ref_veh == veh, "Vehicle type mismatch"); diff --git a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu index 093f9cdc25..d3d621dfbe 100644 --- a/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu +++ b/cpp/src/routing/ges/lexicographic_search/lexicographic_search.cu @@ -578,8 +578,8 @@ __global__ void execute_lexico_move( cuopt_assert(request_id != nullptr, "Request id should not be nullptr"); cuopt_assert(request_id->is_valid(solution.problem.order_info.depot_included), "Request id should be positive"); - [[maybe_unused]] p_val_seq_t p_val_seq = bit_cast(*global_min_p); - i_t original_block_idx = global_sequence[0]; + p_val_seq_t p_val_seq = bit_cast(*global_min_p); + i_t original_block_idx = global_sequence[0]; i_t route_id, pickup_insert_idx; get_route_id_and_insertion_idx( route_id, pickup_insert_idx, original_block_idx, solution); diff --git a/cpp/src/routing/solution/solution.cu b/cpp/src/routing/solution/solution.cu index 85059ca545..db6b7ff4b8 100644 --- a/cpp/src/routing/solution/solution.cu +++ b/cpp/src/routing/solution/solution.cu @@ -595,12 +595,12 @@ template void solution_t::check_cost_coherence(const infeasible_cost_t& weights) { raft::common::nvtx::range fun_scope("check_cost_coherence"); - [[maybe_unused]] double excess_before = get_total_excess(weights); - [[maybe_unused]] double cost_before = get_cost(true, weights); + double excess_before = get_total_excess(weights); + double cost_before = get_cost(true, weights); compute_backward_forward(); compute_cost(); - [[maybe_unused]] double excess_after = get_total_excess(weights); - [[maybe_unused]] double cost_after = get_cost(true, weights); + double excess_after = get_total_excess(weights); + double cost_after = get_cost(true, weights); cuopt_assert(abs(excess_before - excess_after) < 0.00001, "Excess mismatch!"); cuopt_assert(abs(cost_before - cost_after) < 0.00001, "Cost mismatch!"); } diff --git a/cpp/src/utilities/logger.hpp b/cpp/src/utilities/logger.hpp index 7c9f952d48..cd84c46ada 100644 --- a/cpp/src/utilities/logger.hpp +++ b/cpp/src/utilities/logger.hpp @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -24,6 +26,44 @@ #include #include +// The generated logger macros discard arguments for compile-time-disabled levels. Keep those +// expressions in an unreachable branch so they are parsed and count as uses without being +// evaluated, matching the behavior of Abseil's compile-time-disabled logging. +#define CUOPT_LOG_DISABLED(...) \ + do { \ + if (false) { ::cuopt::detail::ignore_unused(__VA_ARGS__); } \ + } while (false) + +#if CUOPT_LOG_ACTIVE_LEVEL > RAPIDS_LOGGER_LOG_LEVEL_TRACE +#undef CUOPT_LOG_TRACE +#define CUOPT_LOG_TRACE(...) CUOPT_LOG_DISABLED(__VA_ARGS__) +#endif + +#if CUOPT_LOG_ACTIVE_LEVEL > RAPIDS_LOGGER_LOG_LEVEL_DEBUG +#undef CUOPT_LOG_DEBUG +#define CUOPT_LOG_DEBUG(...) CUOPT_LOG_DISABLED(__VA_ARGS__) +#endif + +#if CUOPT_LOG_ACTIVE_LEVEL > RAPIDS_LOGGER_LOG_LEVEL_INFO +#undef CUOPT_LOG_INFO +#define CUOPT_LOG_INFO(...) CUOPT_LOG_DISABLED(__VA_ARGS__) +#endif + +#if CUOPT_LOG_ACTIVE_LEVEL > RAPIDS_LOGGER_LOG_LEVEL_WARN +#undef CUOPT_LOG_WARN +#define CUOPT_LOG_WARN(...) CUOPT_LOG_DISABLED(__VA_ARGS__) +#endif + +#if CUOPT_LOG_ACTIVE_LEVEL > RAPIDS_LOGGER_LOG_LEVEL_ERROR +#undef CUOPT_LOG_ERROR +#define CUOPT_LOG_ERROR(...) CUOPT_LOG_DISABLED(__VA_ARGS__) +#endif + +#if CUOPT_LOG_ACTIVE_LEVEL > RAPIDS_LOGGER_LOG_LEVEL_CRITICAL +#undef CUOPT_LOG_CRITICAL +#define CUOPT_LOG_CRITICAL(...) CUOPT_LOG_DISABLED(__VA_ARGS__) +#endif + /* * Defined inline with hidden visibility so each library that links this header owns its own * logger instance. This is not optional: an inline function's static local is emitted as an diff --git a/cpp/src/utilities/macros.cuh b/cpp/src/utilities/macros.cuh index 53eb98ae55..d26a9824cb 100644 --- a/cpp/src/utilities/macros.cuh +++ b/cpp/src/utilities/macros.cuh @@ -12,11 +12,17 @@ // 1) light // 2) medium // 3) heavy -#ifdef ASSERT_MODE -#include #include namespace cuopt::detail { +// Keep expressions in disabled diagnostics visible to the compiler without evaluating them. +// constexpr functions are callable from CUDA device code with --expt-relaxed-constexpr, which is +// enabled for cuOpt builds. +template +constexpr void ignore_unused(Ts&&...) +{ +} + // handle the argument processing through the C++ parser instead of the preprocessor // since it chokes on colons in template arguments. // (e.g. cuopt_assert(std::is_same_v, "message")). @@ -28,10 +34,16 @@ constexpr bool assert_msg(T&& cond, const char (&)[N]) } } // namespace cuopt::detail +#ifdef ASSERT_MODE +#include + #define cuopt_assert(...) assert(::cuopt::detail::assert_msg(__VA_ARGS__)) #define cuopt_func_call(...) __VA_ARGS__; #else -#define cuopt_assert(...) +#define cuopt_assert(...) \ + do { \ + if (false) { ::cuopt::detail::ignore_unused(__VA_ARGS__); } \ + } while (false) #define cuopt_func_call(...) ; #endif