@@ -582,7 +582,6 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
582582 restart_scheme_.getBeta (), stepsize_.primal_step ,
583583 stepsize_.dual_step );
584584#endif
585-
586585 // Check time limit
587586 if (solver_timer.read () > params_.time_limit ) {
588587 logger_.info (" Time limit reached." );
@@ -596,17 +595,6 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
596595 bool_checking = (bool_checking || iter % PDHG_CHECK_INTERVAL == 0 );
597596 if (bool_checking) {
598597#ifdef CUPDLP_GPU
599- // **VERIFICATION**: Before checking, copy GPU state to host
600- /*
601- CUDA_CHECK(cudaMemcpy(x_current_.data(), d_x_current_, a_num_cols_ *
602- sizeof(double), cudaMemcpyDeviceToHost));
603- CUDA_CHECK(cudaMemcpy(y_current_.data(), d_y_current_, a_num_rows_ *
604- sizeof(double), cudaMemcpyDeviceToHost));
605- CUDA_CHECK(cudaMemcpy(Ax_cache_.data(), d_ax_current_, a_num_rows_ *
606- sizeof(double), cudaMemcpyDeviceToHost));
607- CUDA_CHECK(cudaMemcpy(ATy_cache_.data(), d_aty_current_, a_num_cols_
608- * sizeof(double), cudaMemcpyDeviceToHost));
609- */
610598 computeAverageIterateGpu ();
611599#else
612600#if PDLP_PROFILE
@@ -636,9 +624,9 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
636624 params_.tolerance , average_results, " [A-GPU]" );
637625#else
638626 // === CPU Convergence Check ===//
639- #if PDLP_PROFILE
640- hipdlpTimerStart (kHipdlpClockConvergenceCheck );
641- #endif
627+ #if PDLP_PROFILE
628+ hipdlpTimerStart (kHipdlpClockConvergenceCheck );
629+ #endif
642630 // Compute residuals for current iterate
643631 bool current_converged = checkConvergence (
644632 iter, x_current_, y_current_, Ax_cache_, ATy_cache_,
@@ -648,10 +636,11 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
648636 bool average_converged = checkConvergence (
649637 iter, x_avg_, y_avg_, Ax_avg, ATy_avg, params_.tolerance ,
650638 average_results, " [A]" , dSlackPosAvg_, dSlackNegAvg_);
651- #if PDLP_PROFILE
652- hipdlpTimerStop (kHipdlpClockConvergenceCheck );
653- #endif
639+ #if PDLP_PROFILE
640+ hipdlpTimerStop (kHipdlpClockConvergenceCheck );
641+ #endif
654642#endif
643+
655644#if PDLP_DEBUG_LOG
656645 debugPdlpIterHeaderLog (debug_pdlp_log_file_);
657646#endif
@@ -799,38 +788,21 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
799788 linalgGpuAx (d_x_next_, d_ax_next_);
800789 launchKernelUpdateY (stepsize_.dual_step );
801790 linalgGpuATy (d_y_next_, d_aty_next_);
802-
803- std::vector<double > x_next_gpu (a_num_cols_);
804- std::vector<double > y_next_gpu (a_num_rows_);
805- std::vector<double > ax_next_gpu (a_num_rows_);
806- std::vector<double > aty_next_gpu (a_num_cols_);
807- CUDA_CHECK (cudaMemcpy (x_next_gpu.data (), d_x_next_,
808- a_num_cols_ * sizeof (double ),
809- cudaMemcpyDeviceToHost));
810- CUDA_CHECK (cudaMemcpy (y_next_gpu.data (), d_y_next_,
811- a_num_rows_ * sizeof (double ),
812- cudaMemcpyDeviceToHost));
813- CUDA_CHECK (cudaMemcpy (ax_next_gpu.data (), d_ax_next_,
814- a_num_rows_ * sizeof (double ),
815- cudaMemcpyDeviceToHost));
816- CUDA_CHECK (cudaMemcpy (aty_next_gpu.data (), d_aty_next_,
817- a_num_cols_ * sizeof (double ),
818- cudaMemcpyDeviceToHost));
819791#else
820- #if PDLP_PROFILE
821- hipdlpTimerStart (kHipdlpClockMatrixMultiply );
822- #endif
792+ #if PDLP_PROFILE
793+ hipdlpTimerStart (kHipdlpClockMatrixMultiply );
794+ #endif
823795 linalg::Ax (lp, x_current_, Ax_cache_);
824- #if PDLP_PROFILE
825- hipdlpTimerStop (kHipdlpClockMatrixMultiply );
826- #endif
827- #if PDLP_PROFILE
828- hipdlpTimerStart (kHipdlpClockMatrixTransposeMultiply );
829- #endif
796+ #if PDLP_PROFILE
797+ hipdlpTimerStop (kHipdlpClockMatrixMultiply );
798+ #endif
799+ #if PDLP_PROFILE
800+ hipdlpTimerStart (kHipdlpClockMatrixTransposeMultiply );
801+ #endif
830802 linalg::ATy (lp, y_current_, ATy_cache_);
831- #if PDLP_PROFILE
832- hipdlpTimerStop (kHipdlpClockMatrixTransposeMultiply );
833- #endif
803+ #if PDLP_PROFILE
804+ hipdlpTimerStop (kHipdlpClockMatrixTransposeMultiply );
805+ #endif
834806#endif
835807 restart_scheme_.SetLastRestartIter (iter);
836808 }
@@ -1753,31 +1725,6 @@ void PDLPSolver::updateIteratesFixed() {
17531725 std::cerr << " Error2: d_x_next_ is null!" << std::endl;
17541726 return ;
17551727 }
1756-
1757- std::vector<double > x_next_gpu (a_num_cols_);
1758- std::vector<double > y_next_gpu (a_num_rows_);
1759- std::vector<double > ax_next_gpu (a_num_rows_);
1760- std::vector<double > aty_next_gpu (a_num_cols_);
1761- CUDA_CHECK (cudaMemcpy (x_next_gpu.data (), d_x_next_,
1762- a_num_cols_ * sizeof (double ), cudaMemcpyDeviceToHost));
1763- CUDA_CHECK (cudaMemcpy (y_next_gpu.data (), d_y_next_,
1764- a_num_rows_ * sizeof (double ), cudaMemcpyDeviceToHost));
1765- CUDA_CHECK (cudaMemcpy (ax_next_gpu.data (), d_ax_next_,
1766- a_num_rows_ * sizeof (double ), cudaMemcpyDeviceToHost));
1767- CUDA_CHECK (cudaMemcpy (aty_next_gpu.data (), d_aty_next_,
1768- a_num_cols_ * sizeof (double ), cudaMemcpyDeviceToHost));
1769-
1770- #if PDLP_DEBUG_LOG
1771- bool x_match = vecDiff (x_next_gpu, x_next_, 1e-10 , " UpdateIteratesFixed x" );
1772- bool y_match = vecDiff (y_next_gpu, y_next_, 1e-10 , " UpdateIteratesFixed y" );
1773- bool ax_match =
1774- vecDiff (ax_next_gpu, Ax_next_, 1e-10 , " UpdateIteratesFixed Ax" );
1775- bool aty_match =
1776- vecDiff (aty_next_gpu, ATy_next_, 1e-10 , " UpdateIteratesFixed ATy" );
1777- #endif
1778-
1779- #else
1780-
17811728#endif
17821729}
17831730
0 commit comments