Skip to content

Commit ed3c91a

Browse files
committed
Renamed and methods names to debug_pdlp_log_file_ to stress its nature; also renamed pdlpIterLog etc to debugPdlpIterLog
1 parent 7862f74 commit ed3c91a

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

highs/pdlp/cupdlp/cupdlp_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ struct CUPDLP_WORK {
424424
// cusparseDnVecDescr_t vecbuffer;
425425
cublasHandle_t cublashandle;
426426
#endif
427-
FILE* pdlp_log_file;
427+
FILE* debug_pdlp_log_file;
428428
};
429429

430430
#ifdef __cplusplus

highs/pdlp/cupdlp/cupdlp_solver.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,8 @@ cupdlp_retcode PDHG_Solve(const cupdlp_int* has_variables, CUPDLPwork *pdhg) {
897897
timers->nIter = 0;
898898
timers->dSolvingBeg = getTimeStamp();
899899

900-
pdhg->pdlp_log_file = fopen("cuPDLP.log", "w");
901-
assert(pdhg->pdlp_log_file);
900+
pdhg->debug_pdlp_log_file = fopen("cuPDLP.log", "w");
901+
assert(pdhg->debug_pdlp_log_file);
902902

903903
// PDHG_Init_Data does nothing!
904904
PDHG_Init_Data(pdhg);
@@ -918,7 +918,7 @@ cupdlp_retcode PDHG_Solve(const cupdlp_int* has_variables, CUPDLPwork *pdhg) {
918918
const int iter_log_between_header = 50;
919919
int iter_log_since_header = iter_log_between_header;
920920
for (timers->nIter = 0; timers->nIter < settings->nIterLim; ++timers->nIter) {
921-
pdlpIterLog(pdhg->pdlp_log_file, timers->nIter, pdhg->stepsize->dBeta);
921+
debugPdlpIterLog(pdhg->debug_pdlp_log_file, timers->nIter, pdhg->stepsize->dBeta);
922922
PDHG_Compute_SolvingTime(pdhg);
923923
#if CUPDLP_DUMP_ITERATES_STATS && CUPDLP_DEBUG
924924
PDHG_Dump_Stats(pdhg);
@@ -1154,7 +1154,7 @@ cupdlp_retcode PDHG_Solve(const cupdlp_int* has_variables, CUPDLPwork *pdhg) {
11541154
#endif
11551155

11561156
exit_cleanup:
1157-
fclose(pdhg->pdlp_log_file);
1157+
fclose(pdhg->debug_pdlp_log_file);
11581158
return retcode;
11591159
}
11601160

highs/pdlp/cupdlp/cupdlp_step.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void PDHG_primalGradientStep(CUPDLPwork *work, CUPDLPvec *xUpdate,
2121
// print norm of A'y
2222
double aty_norm = 0.0;
2323
cupdlp_twoNorm(work, problem->nCols, ATy->data, &aty_norm);
24-
pdlpAtyNormLog(work->pdlp_log_file, aty_norm);
24+
debugPdlpAtyNormLog(work->debug_pdlp_log_file, aty_norm);
2525

2626
#if !defined(CUPDLP_CPU) && USE_KERNELS
2727
cupdlp_pgrad_cuda(xUpdate->data, x->data, problem->cost,
@@ -200,7 +200,7 @@ void PDHG_Update_Iterate_Constant_Step_Size(CUPDLPwork *pdhg) {
200200
double ax_norm = 0.0;
201201
cupdlp_twoNorm(pdhg, problem->nRows, ax->data,
202202
&ax_norm);
203-
pdlpAxNormLog(pdhg->pdlp_log_file, ax_norm);
203+
debugPdlpAxNormLog(pdhg->debug_pdlp_log_file, ax_norm);
204204
ATy(pdhg, aty, y);
205205

206206
// x^{k+1} = proj_{X}(x^k - dPrimalStep * (c - A'y^k))

highs/pdlp/cupdlp/cupdlp_utils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,14 +1782,14 @@ void writeSol(const char *fout, cupdlp_int nCols, cupdlp_int nRows,
17821782
fclose(fptr);
17831783
}
17841784

1785-
void pdlpIterLog(FILE* file, const int iter_num, const double beta) {
1785+
void debugPdlpIterLog(FILE* file, const int iter_num, const double beta) {
17861786
fprintf(file, "Iter %6d; beta = %g\n", iter_num, beta);
17871787
}
17881788

1789-
void pdlpAxNormLog(FILE* file, const double ax_norm) {
1789+
void debugPdlpAxNormLog(FILE* file, const double ax_norm) {
17901790
fprintf(file, "||Ax|| = %g\n", ax_norm);
17911791
}
17921792

1793-
void pdlpAtyNormLog(FILE* file, const double aty_norm) {
1793+
void debugPdlpAtyNormLog(FILE* file, const double aty_norm) {
17941794
fprintf(file, "||A^Ty|| = %g\n", aty_norm);
17951795
}

highs/pdlp/cupdlp/cupdlp_utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ void writeSol(const char *fout, cupdlp_int nCols, cupdlp_int nRows,
193193
cupdlp_float *col_value, cupdlp_float *col_dual,
194194
cupdlp_float *row_value, cupdlp_float *row_dual);
195195

196-
void pdlpIterLog(FILE* file, const int iter_num, const double beta);
197-
void pdlpAxNormLog(FILE* file, const double ax_norm);
198-
void pdlpAtyNormLog(FILE* file, const double aty_norm);
196+
void debugPdlpIterLog(FILE* file, const int iter_num, const double beta);
197+
void debugPdlpAxNormLog(FILE* file, const double ax_norm);
198+
void debugPdlpAtyNormLog(FILE* file, const double aty_norm);
199199

200200
#ifdef __cplusplus
201201
}

highs/pdlp/hipdlp/pdhg.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,16 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
273273

274274
const HighsLp& lp = lp_;
275275

276-
pdlp_log_file_ = fopen("HiPDLP.log", "w");
277-
assert(pdlp_log_file_);
276+
debug_pdlp_log_file_ = fopen("HiPDLP.log", "w");
277+
assert(debug_pdlp_log_file_);
278278

279279
// --- 0.Using PowerMethod to estimate the largest eigenvalue ---
280280
const double op_norm_sq = PowerMethod();
281281
// Set step sizes based on the operator norm to ensure convergence
282282
// A safe choice satisfying eta * omega * ||A||^2 < 1
283283
step_.passLp(&lp_);
284284
step_.passLogOptions(&params_.log_options_);
285-
step_.passDebugLogFile(pdlp_log_file_);
285+
step_.passDebugLogFile(debug_pdlp_log_file_);
286286
StepSizeConfig step_size =
287287
step_.InitializeStepSizesPowerMethod(lp, op_norm_sq);
288288
const double fixed_eta = 0.99 / sqrt(op_norm_sq);
@@ -329,11 +329,11 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
329329
// A single loop handles max iterations, convergence, and restarts.
330330
for (int iter = 0; iter < params_.max_iterations; ++iter) {
331331
const double dummy_beta = 0.0;
332-
pdlpIterLog(pdlp_log_file_, iter, dummy_beta);
332+
debugPdlpIterLog(debug_pdlp_log_file_, iter, dummy_beta);
333333
linalg::Ax(lp, x_current_, Ax_current);
334334
// print norm of Ax
335335
double ax_norm = linalg::vector_norm(Ax_current);
336-
pdlpAxNormLog(pdlp_log_file_, ax_norm);
336+
debugPdlpAxNormLog(debug_pdlp_log_file_, ax_norm);
337337

338338
linalg::ATy(lp, y_current_, ATy_current);
339339
if (solver_timer.read() > params_.time_limit) {
@@ -487,7 +487,7 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
487487
}
488488

489489
void PDLPSolver::solveReturn() {
490-
if (pdlp_log_file_) fclose(pdlp_log_file_);
490+
if (debug_pdlp_log_file_) fclose(debug_pdlp_log_file_);
491491
}
492492

493493
void PDLPSolver::Initialize(const HighsLp& lp, std::vector<double>& x,

highs/pdlp/hipdlp/pdhg.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class PDLPSolver {
9393
std::vector<double> dSlackPos_;
9494
std::vector<double> dSlackNeg_;
9595

96-
FILE* pdlp_log_file_ = nullptr;
96+
FILE* debug_pdlp_log_file_ = nullptr;
9797
Timer total_timer;
9898

9999
// Helper functions

highs/pdlp/hipdlp/step.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void PdlpStep::UpdateX(std::vector<double>& x_new,
101101
linalg::ATy(lp, y_current, ATy_cache);
102102
// print the norm of ATy_cache
103103
double aty_norm = linalg::vector_norm(ATy_cache);
104-
pdlpAtyNormLog(pdlp_log_file_, aty_norm);
104+
debugPdlpAtyNormLog(debug_pdlp_log_file_, aty_norm);
105105
for (HighsInt i = 0; i < lp.num_col_; i++) {
106106
double gradient = lp.col_cost_[i] - ATy_cache[i];
107107
x_new[i] = linalg::project_box(x_current[i] - (eta / omega) * gradient,

highs/pdlp/hipdlp/step.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ class PdlpStep {
7777
void passLogOptions(const HighsLogOptions* log_options) {
7878
log_options_ = log_options;
7979
};
80-
void passDebugLogFile(FILE* pdlp_log_file) {
81-
pdlp_log_file_ = pdlp_log_file;
80+
void passDebugLogFile(FILE* debug_pdlp_log_file) {
81+
debug_pdlp_log_file_ = debug_pdlp_log_file;
8282
};
8383

8484
private:
8585
const HighsLp* lp_;
8686
// JAJH has only passed log_options_ into PdlpStep, leaving YZ to
8787
// handle "params" as she sees fit.
8888
const HighsLogOptions* log_options_;
89-
// JAJH has passed pdlp_log_file_ into PdlpStep separately, as it's
89+
// JAJH has passed debug_pdlp_log_file_ into PdlpStep separately, as it's
9090
// only temporary.
91-
FILE* pdlp_log_file_;
91+
FILE* debug_pdlp_log_file_;
9292
};
9393

9494
#endif // PDLP_HIPDLP_STEP_HPP

0 commit comments

Comments
 (0)