Skip to content

Commit 93dac86

Browse files
committed
update Wrapper, scaling and cuda/
1 parent 7aa3f47 commit 93dac86

File tree

11 files changed

+1113
-590
lines changed

11 files changed

+1113
-590
lines changed

src/pdlp/CupdlpWrapper.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
150150
memcpy(csc_cpu->colMatElem, csc_val, nnz * sizeof(double));
151151

152152
cupdlp_float scaling_time = getTimeStamp();
153-
H_PDHG_Scale_Data_cuda(local_log_level, csc_cpu, ifScaling, scaling, cost,
153+
PDHG_Scale_Data(local_log_level, csc_cpu, ifScaling, scaling, cost,
154154
lower, upper, rhs);
155155
scaling_time = getTimeStamp() - scaling_time;
156156

@@ -239,24 +239,20 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
239239
// free(csc_idx);
240240
// free(csc_val);
241241
// free(rhs);
242-
243242
// free(constraint_new_idx);
244243

245244
// Scaling
246-
#ifdef CUPDLP_CPU
245+
// #ifdef CUPDLP_CPU
247246

248-
if (scaling->rowScale != nullptr) free(scaling->rowScale);
249-
if (scaling->colScale != nullptr) free(scaling->colScale);
250-
free(scaling);
247+
// if (scaling->rowScale != nullptr) free(scaling->rowScale);
248+
// if (scaling->colScale != nullptr) free(scaling->colScale);
249+
// free(scaling);
251250

252-
#else
253-
// free problem
254-
if (scaling) {
255-
scaling_clear(scaling);
256-
}
257-
#endif
251+
// #else
258252

259-
#ifdef CUPDLP_CPU
253+
// #endif
254+
255+
// #ifdef CUPDLP_CPU
260256
// free(prob->cost);
261257
// free(prob->lower);
262258
// free(prob->upper);
@@ -284,7 +280,12 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
284280
// free(csc_cpu->colMatElem);
285281

286282
// free(csc_cpu);
287-
#endif
283+
// #endif
284+
285+
// free problem
286+
if (scaling) {
287+
scaling_clear(scaling);
288+
}
288289

289290
if (cost != NULL) cupdlp_free(cost);
290291
if (csc_beg != NULL) cupdlp_free(csc_beg);
@@ -294,13 +295,14 @@ HighsStatus solveLpCupdlp(const HighsOptions& options, HighsTimer& timer,
294295
if (lower != NULL) cupdlp_free(lower);
295296
if (upper != NULL) cupdlp_free(upper);
296297
if (constraint_new_idx != NULL) cupdlp_free(constraint_new_idx);
297-
298-
// constraint type is std::vector
299-
// if (constraint_type != NULL) cupdlp_free(constraint_type);
298+
if (constraint_type != NULL) cupdlp_free(constraint_type);
300299

301300
// free memory
302-
csc_clear(csc_cpu);
301+
csc_clear_host(csc_cpu);
303302
problem_clear(prob);
303+
#if !(CUPDLP_CPU)
304+
CHECK_CUDA(cudaDeviceReset())
305+
#endif
304306

305307
return HighsStatus::kOk;
306308
}

src/pdlp/cupdlp/cuda/CMakeLists.txt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,12 @@ add_library(cudalin SHARED
66
${CUPDLP_INCLUDE_DIR}/cuda/cupdlp_cudalinalg.cuh
77
${CUPDLP_INCLUDE_DIR}/cuda/cupdlp_cudalinalg.cu
88
)
9-
10-
target_compile_options(cudalin PRIVATE
11-
"$<$<AND:$<CONFIG:Debug,RelWithDebInfo>,$<COMPILE_LANGUAGE:CUDA>>:-G>")
12-
13-
# Just testing locally
14-
# if(CMAKE_BUILD_TYPE STREQUAL "Debug")
15-
# target_compile_options(cudalin PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-G>)
16-
# endif()
17-
189
set_target_properties(cudalin PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
19-
20-
target_include_directories(cudalin PUBLIC "${CMAKE_CUDA_PATH}/include")
21-
22-
# target_include_directories(cudalin PUBLIC "/usr/local/cuda/include")
10+
target_include_directories(cudalin PUBLIC "/usr/local/cuda/include")
2311
target_compile_definitions(cudalin
2412
PUBLIC
2513
# If the debug configuration pass the DEBUG define to the compiler
26-
$<$<CONFIG:Debug>:CUPDLP_DEBUG>
14+
$<$<CONFIG:Debug>:-DCUPDLP_DEBUG=1>
2715
)
2816

2917
target_link_libraries(cudalin ${CUDA_LIBRARY} m)

0 commit comments

Comments
 (0)