Skip to content

Commit 65fc061

Browse files
authored
Merge pull request ERGO-Code#1773 from ERGO-Code/fix-1694
Fix 1694
2 parents ecef70a + f378107 commit 65fc061

File tree

5 files changed

+52
-27
lines changed

5 files changed

+52
-27
lines changed

check/TestMipSolver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ TEST_CASE("IP-with-fract-bounds-no-presolve", "[highs_test_mip_solver]") {
665665
lp.col_cost_ = {1, -2, 3};
666666
lp.col_lower_ = {2.5, 2.5, 2.5};
667667
lp.col_upper_ = {6.5, 5.5, 7.5};
668-
lp.integrality_ = {HighsVarType::kInteger, HighsVarType::kInteger, HighsVarType::kInteger};
668+
lp.integrality_ = {HighsVarType::kInteger, HighsVarType::kInteger,
669+
HighsVarType::kInteger};
669670

670671
// Solve
671672
highs.passModel(lp);

src/pdlp/CupdlpWrapper.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,18 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
7373
void* presolvedmodel = NULL;
7474
void* model2solve = NULL;
7575

76+
// WIP on zbook?
77+
//
78+
// HighsInt size_of_CUPDLPscaling = sizeof(CUPDLPscaling);
79+
//
7680
CUPDLPscaling* scaling = (CUPDLPscaling*)cupdlp_malloc(sizeof(CUPDLPscaling));
7781

82+
// WIP on zbook?
83+
//
84+
// printf("size_of_CUPDLPscaling = %d\n", size_of_CUPDLPscaling);
85+
// scaling->ifRuizScaling = 1;
86+
// printf("scaling->ifRuizScaling = %d\n", scaling->ifRuizScaling);
87+
7888
// claim solvers variables
7989
// prepare pointers
8090
CUPDLP_MATRIX_FORMAT src_matrix_format = CSC;
@@ -103,7 +113,7 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
103113
const cupdlp_int local_log_level = getCupdlpLogLevel(options);
104114
if (local_log_level) cupdlp_printf("Solving with cuPDLP-C\n");
105115

106-
Init_Scaling(local_log_level, scaling, nCols, nRows, cost, rhs);
116+
H_Init_Scaling(local_log_level, scaling, nCols, nRows, cost, rhs);
107117
cupdlp_int ifScaling = 1;
108118

109119
CUPDLPwork* w = cupdlp_NULL;
@@ -125,8 +135,8 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
125135
memcpy(csc_cpu->colMatElem, csc_val, nnz * sizeof(double));
126136

127137
cupdlp_float scaling_time = getTimeStamp();
128-
PDHG_Scale_Data_cuda(local_log_level, csc_cpu, ifScaling, scaling, cost,
129-
lower, upper, rhs);
138+
H_PDHG_Scale_Data_cuda(local_log_level, csc_cpu, ifScaling, scaling, cost,
139+
lower, upper, rhs);
130140
scaling_time = getTimeStamp() - scaling_time;
131141

132142
cupdlp_float alloc_matrix_time = 0.0;

src/pdlp/cupdlp/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,21 @@ The `cuPDLP-c` iteration count is held in `pdhg->timers->nIter`, but `pdhg` is d
101101

102102
- Make CupldlpWrapper.cpp look more like C++ than C
103103

104-
105-
106-
107-
104+
+## Using a GPU
105+
+
106+
+### Install CUDA
107+
+
108+
+* sudo apt update && sudo apt upgrade
109+
+* sudo apt autoremove nvidia* --purge
110+
+* sudo apt update && sudo apt upgrade
111+
+* nvcc --version
112+
+* sudo apt install nvidia-cuda-toolkit
113+
+
114+
+### Building PDLP
115+
+
116+
+export HIGHS_HOME=/home/jajhall/install
117+
+export CUDA_HOME=/usr/lib/cuda
118+
+
119+
+
120+
+
121+
+

src/pdlp/cupdlp/cupdlp_scaling_cuda.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ cupdlp_retcode cupdlp_pc_scaling_cuda(CUPDLPcsc *csc, cupdlp_float *cost,
228228
return retcode;
229229
}
230230

231-
cupdlp_retcode PDHG_Scale_Data_cuda(cupdlp_int log_level,
232-
CUPDLPcsc *csc, cupdlp_int ifScaling,
233-
CUPDLPscaling *scaling, cupdlp_float *cost,
234-
cupdlp_float *lower, cupdlp_float *upper,
235-
cupdlp_float *rhs) {
231+
cupdlp_retcode H_PDHG_Scale_Data_cuda(cupdlp_int log_level,
232+
CUPDLPcsc *csc, cupdlp_int ifScaling,
233+
CUPDLPscaling *scaling, cupdlp_float *cost,
234+
cupdlp_float *lower, cupdlp_float *upper,
235+
cupdlp_float *rhs) {
236236
cupdlp_retcode retcode = RETCODE_OK;
237237
// scaling->dObjScale = 1.0;
238238

@@ -395,10 +395,10 @@ cupdlp_retcode PDHG_Scale_Data_cuda(cupdlp_int log_level,
395395
return retcode;
396396
}
397397

398-
cupdlp_retcode Init_Scaling(cupdlp_int log_level,
399-
CUPDLPscaling *scaling, cupdlp_int ncols,
400-
cupdlp_int nrows, cupdlp_float *cost,
401-
cupdlp_float *rhs) {
398+
cupdlp_retcode H_Init_Scaling(cupdlp_int log_level,
399+
CUPDLPscaling *scaling, cupdlp_int ncols,
400+
cupdlp_int nrows, cupdlp_float *cost,
401+
cupdlp_float *rhs) {
402402
cupdlp_retcode retcode = RETCODE_OK;
403403

404404
scaling->ifRuizScaling = 1;

src/pdlp/cupdlp/cupdlp_scaling_cuda.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
extern "C" {
1212
#endif
1313

14-
cupdlp_retcode PDHG_Scale_Data_cuda(cupdlp_int log_level,
15-
CUPDLPcsc *csc, cupdlp_int ifScaling,
16-
CUPDLPscaling *scaling, cupdlp_float *cost,
17-
cupdlp_float *lower, cupdlp_float *upper,
18-
cupdlp_float *rhs);
19-
20-
cupdlp_retcode Init_Scaling(cupdlp_int log_level,
21-
CUPDLPscaling *scaling, cupdlp_int ncols,
22-
cupdlp_int nrows, cupdlp_float *cost,
23-
cupdlp_float *rhs);
14+
cupdlp_retcode H_PDHG_Scale_Data_cuda(cupdlp_int log_level,
15+
CUPDLPcsc *csc, cupdlp_int ifScaling,
16+
CUPDLPscaling *scaling, cupdlp_float *cost,
17+
cupdlp_float *lower, cupdlp_float *upper,
18+
cupdlp_float *rhs);
2419

20+
cupdlp_retcode H_Init_Scaling(cupdlp_int log_level,
21+
CUPDLPscaling *scaling, cupdlp_int ncols,
22+
cupdlp_int nrows, cupdlp_float *cost,
23+
cupdlp_float *rhs);
24+
2525
#ifdef __cplusplus
2626
}
2727
#endif

0 commit comments

Comments
 (0)