@@ -513,8 +513,12 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
513513
514514 // --- 1. Initialization ---
515515 restart_scheme_.passLogOptions (&working_params.log_options_ );
516+
517+ #ifdef PDLP_DEBUG_LOG
516518 restart_scheme_.passDebugPdlpLogFile (debug_pdlp_log_file_);
517519 restart_scheme_.passDebugPdlpData (&debug_pdlp_data_);
520+ #endif
521+
518522 initialize (); // Sets initial x, y and results_
519523 restart_scheme_.passParams (&working_params);
520524 restart_scheme_.Initialize (results_);
@@ -550,17 +554,22 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
550554 logger_.print_iteration_header ();
551555
552556 // --- 2. Main PDHG Loop ---
557+ #ifdef PDLP_DEBUG_LOG
553558 debugPdlpIterHeaderLog (debug_pdlp_log_file_);
554559 debugPdlpDataInitialise (&debug_pdlp_data_);
555560 debug_pdlp_data_.ax_average_norm = 0.0 ;
556561 debug_pdlp_data_.aty_average_norm = 0.0 ;
557562 debug_pdlp_data_.x_average_norm = 0.0 ;
558563 debug_pdlp_data_.ax_norm = linalg::vector_norm (Ax_cache_);
564+ #endif
559565
560566 for (int iter = 0 ; iter < params_.max_iterations ; ++iter) {
567+ std::cout << " PDHG Iteration " << iter << std::endl;
568+ #ifdef PDLP_DEBUG_LOG
561569 debugPdlpIterLog (debug_pdlp_log_file_, iter, &debug_pdlp_data_,
562570 restart_scheme_.getBeta (), stepsize_.primal_step ,
563571 stepsize_.dual_step );
572+ #endif
564573
565574 // Check time limit
566575 if (solver_timer.read () > params_.time_limit ) {
@@ -809,6 +818,7 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
809818 cudaMemcpyDeviceToDevice));
810819 CUDA_CHECK (cudaMemcpy (d_y_next_, d_y_current_, a_num_rows_ * sizeof (double ),
811820 cudaMemcpyDeviceToDevice));
821+ #ifdef PDLP_DEBUG_LOG
812822 // Copy Ax and ATy cache to host
813823 CUDA_CHECK (cudaMemcpy (Ax_cache_.data (), d_ax_current_,
814824 a_num_rows_ * sizeof (double ),
@@ -818,11 +828,15 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
818828 cudaMemcpyDeviceToHost));
819829 debug_pdlp_data_.ax_norm = linalg::vector_norm (Ax_cache_);
820830 debug_pdlp_data_.aty_norm = linalg::vector_norm (ATy_cache_);
831+ #endif
821832#else
822833 x_next_ = x_current_;
823834 y_next_ = y_current_;
835+
836+ #ifdef PDLP_DEBUG_LOG
824837 debug_pdlp_data_.ax_norm = linalg::vector_norm (Ax_cache_);
825838 debug_pdlp_data_.aty_norm = linalg::vector_norm (ATy_cache_);
839+ #endif
826840#endif
827841
828842 switch (params_.step_size_strategy ) {
@@ -992,7 +1006,9 @@ void PDLPSolver::computeAverageIterate(std::vector<double>& ax_avg,
9921006 for (size_t i = 0 ; i < y_avg_.size (); ++i) y_avg_[i] = y_sum_[i] * dDualScale;
9931007 hipdlpTimerStop (kHipdlpClockAverageIterateComputeY );
9941008
1009+ #ifdef PDLP_DEBUG_LOG
9951010 debug_pdlp_data_.x_average_norm = linalg::vector_norm_squared (x_avg_);
1011+ #endif
9961012
9971013 hipdlpTimerStart (kHipdlpClockAverageIterateMatrixMultiply );
9981014 linalg::Ax (lp_, x_avg_, ax_avg);
@@ -1002,8 +1018,10 @@ void PDLPSolver::computeAverageIterate(std::vector<double>& ax_avg,
10021018 linalg::ATy (lp_, y_avg_, aty_avg);
10031019 hipdlpTimerStop (kHipdlpClockAverageIterateMatrixTransposeMultiply );
10041020
1021+ #ifdef PDLP_DEBUG_LOG
10051022 debug_pdlp_data_.ax_average_norm = linalg::vector_norm_squared (ax_avg);
10061023 debug_pdlp_data_.aty_average_norm = linalg::vector_norm_squared (aty_avg);
1024+ #endif
10071025}
10081026
10091027// lambda = c - proj_{\Lambda}(c - K^T y)
@@ -1224,10 +1242,12 @@ bool PDLPSolver::checkConvergence(
12241242 std::abs (duality_gap) / (1.0 + std::abs (primal_obj) + std::abs (dual_obj));
12251243 results.relative_obj_gap = relative_obj_gap;
12261244
1245+ #ifdef PDLP_DEBUG_LOG
12271246 debugPdlpFeasOptLog (debug_pdlp_log_file_, iter, primal_obj, dual_obj,
12281247 relative_obj_gap,
12291248 primal_feasibility / (1.0 + unscaled_rhs_norm_),
12301249 dual_feasibility / (1.0 + unscaled_c_norm_), type);
1250+ #endif
12311251
12321252 // Check convergence criteria (matching cuPDLP)
12331253 bool primal_feasible =
@@ -1673,6 +1693,9 @@ void PDLPSolver::updateIteratesFixed() {
16731693 vecDiff (ax_next_gpu, Ax_next_, 1e-10 , " UpdateIteratesFixed Ax" );
16741694 bool aty_match =
16751695 vecDiff (aty_next_gpu, ATy_next_, 1e-10 , " UpdateIteratesFixed ATy" );
1696+
1697+ #else
1698+
16761699#endif
16771700}
16781701
@@ -2237,11 +2260,13 @@ bool PDLPSolver::checkConvergenceGpu(const int iter, const double* d_x,
22372260 results.relative_obj_gap =
22382261 std::abs (duality_gap) / (1.0 + std::abs (primal_obj) + std::abs (dual_obj));
22392262
2263+ #ifdef PDLP_DEBUG_LOG
22402264 debugPdlpFeasOptLog (debug_pdlp_log_file_, iter, primal_obj, dual_obj,
22412265 results.relative_obj_gap ,
22422266 results.primal_feasibility / (1.0 + unscaled_rhs_norm_),
22432267 results.dual_feasibility / (1.0 + unscaled_c_norm_),
22442268 type);
2269+ #endif
22452270
22462271 bool primal_feasible =
22472272 results.primal_feasibility < epsilon * (1.0 + unscaled_rhs_norm_);
@@ -2300,12 +2325,13 @@ void PDLPSolver::computeAverageIterateGpu() {
23002325 // Recompute Ax_avg and ATy_avg on GPU
23012326 linalgGpuAx (d_x_avg_, d_ax_avg_);
23022327 linalgGpuATy (d_y_avg_, d_aty_avg_);
2328+
2329+ #ifdef PDLP_DEBUG_LOG
23032330 // copy x_avg to host
23042331 CUDA_CHECK (cudaMemcpy (x_avg_.data (), d_x_avg_, a_num_cols_ * sizeof (double ),
23052332 cudaMemcpyDeviceToHost));
23062333 debug_pdlp_data_.x_average_norm = linalg::vector_norm_squared (x_avg_);
2307-
2308- // debug_pdlp_data_.ax_average_norm = computeDiffNormCuBLAS;
2334+ #endif
23092335}
23102336
23112337double PDLPSolver::computeMovementGpu (const double * d_x_new,
0 commit comments