diff --git a/CMakeLists.txt b/CMakeLists.txt index 4034e9a504..f142917627 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,8 +394,9 @@ if(NOT(${HIGHS_NO_DEFAULT_THREADS} STREQUAL "OFF")) message(STATUS "Default multithreading: disabled") endif() -add_compile_options("$<$,$>:-G>") -add_compile_options("-g3") +# For debug of cuda locally +# add_compile_options("$<$,$>:-G>") +# add_compile_options("-g3") # If Visual Studio targets are being built. if(MSVC) diff --git a/src/HConfig.h.in b/src/HConfig.h.in index b4e6d6cb5f..13470d465f 100644 --- a/src/HConfig.h.in +++ b/src/HConfig.h.in @@ -5,6 +5,7 @@ #cmakedefine ZLIB_FOUND #cmakedefine CUPDLP_CPU #cmakedefine CUPDLP_GPU +#cmakedefine CUPDLP_FORCE_NATIVE #cmakedefine CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" #cmakedefine CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" #cmakedefine HIGHSINT64 diff --git a/src/pdlp/CupdlpWrapper.h b/src/pdlp/CupdlpWrapper.h index 46d9f22d7c..e7ad8387d2 100644 --- a/src/pdlp/CupdlpWrapper.h +++ b/src/pdlp/CupdlpWrapper.h @@ -39,9 +39,6 @@ typedef enum CONSTRAINT_TYPE { EQ = 0, LEQ, GEQ, BOUND } constraint_type; #define cupdlp_init_vec_double(var, size) \ { (var) = (double*)malloc((size) * sizeof(double)); } -// #define cupdlp_init_zero_vec_double(var, size) \ -// { (var) = (double*)calloc(size, sizeof(double)); } - #define cupdlp_copy_vec(dst, src, type, size) \ memcpy(dst, src, sizeof(type) * (size)) diff --git a/src/pdlp/cupdlp/cuda/CMakeLists.txt b/src/pdlp/cupdlp/cuda/CMakeLists.txt index ad60caae20..0aed888f16 100644 --- a/src/pdlp/cupdlp/cuda/CMakeLists.txt +++ b/src/pdlp/cupdlp/cuda/CMakeLists.txt @@ -10,18 +10,10 @@ add_library(cudalin SHARED target_compile_options(cudalin PRIVATE "$<$,$>:-G>") -# target_compile_options(cudalin PRIVATE "-G") -# target_compile_options(cudalin -# PUBLIC -# $<$: "-g") -# target_compile_options(cudalin -# PUBLIC -# $<$: "-G") - -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - target_compile_options(cudalin PRIVATE $<$:-G>) - -endif() +# Just testing locally +# if(CMAKE_BUILD_TYPE STREQUAL "Debug") +# target_compile_options(cudalin PRIVATE $<$:-G>) +# endif() set_target_properties(cudalin PROPERTIES CUDA_SEPARABLE_COMPILATION ON) # target_include_directories(cudalin PUBLIC "/usr/local/cuda/include") diff --git a/src/pdlp/cupdlp/cupdlp_linalg.c b/src/pdlp/cupdlp/cupdlp_linalg.c index 596f0c9984..e42c8b10f4 100644 --- a/src/pdlp/cupdlp/cupdlp_linalg.c +++ b/src/pdlp/cupdlp/cupdlp_linalg.c @@ -789,25 +789,26 @@ void cupdlp_compute_interaction_and_movement(CUPDLPwork *w, cupdlp_dot(w, nCols, w->buffer2, w->buffer3, dInteraction); } -double get_fabs_value(double* vec, int index, int N) { -#ifdef CUPDLP_CPU - return vec[index]; -#else - int success = -1; +// WIP iinfnormabslocaltermination +// double get_fabs_value(double* vec, int index, int N) { +// #ifdef CUPDLP_CPU +// return vec[index]; +// #else +// int success = -1; - // double result = 0; - // get_gpu_vec_element(vec, index, &result, &success); +// // double result = 0; +// // get_gpu_vec_element(vec, index, &result, &success); - double * b; - b = (double *)malloc (N * sizeof (*b)); - get_gpu_vec(vec, index, b, &success); +// double * b; +// b = (double *)malloc (N * sizeof (*b)); +// get_gpu_vec(vec, index, b, &success); - if (!success) - return 0; +// if (!success) +// return 0; - // return result; +// // return result; - return b[index]; +// return b[index]; -#endif -} \ No newline at end of file +// #endif +// } \ No newline at end of file diff --git a/src/pdlp/cupdlp/cupdlp_linalg.h b/src/pdlp/cupdlp/cupdlp_linalg.h index 68bb92c0fc..c3a62abece 100644 --- a/src/pdlp/cupdlp/cupdlp_linalg.h +++ b/src/pdlp/cupdlp/cupdlp_linalg.h @@ -182,7 +182,8 @@ void cupdlp_compute_interaction_and_movement(CUPDLPwork *w, cupdlp_float *dMovement, cupdlp_float *dIteraction); +// WIP // double get_fabs_value(double* vec, int index); -double get_fabs_value(double* vec, int index, int N); +// double get_fabs_value(double* vec, int index, int N); #endif // CUPDLP_CUPDLP_LINALG_H diff --git a/src/pdlp/cupdlp/cupdlp_solver.c b/src/pdlp/cupdlp/cupdlp_solver.c index dc9a08486d..65db3183d6 100644 --- a/src/pdlp/cupdlp/cupdlp_solver.c +++ b/src/pdlp/cupdlp/cupdlp_solver.c @@ -55,12 +55,16 @@ void PDHG_Compute_Primal_Feasibility(CUPDLPwork *work, double *primalResidual, if (work->settings->iInfNormAbsLocalTermination) { cupdlp_int index; cupdlp_infNormIndex(work, lp->nRows, primalResidual, &index); -#ifdef CUPDLP_CPU *dPrimalFeasibility = fabs(primalResidual[index]); -#else - double res_value = get_fabs_value(primalResidual, index, lp->nRows); - *dPrimalFeasibility = fabs(res_value); -#endif + +// WIP only allow native for the moment +// #ifdef CUPDLP_CPU +// *dPrimalFeasibility = fabs(primalResidual[index]); +// #else +// double res_value = get_fabs_value(primalResidual, index, lp->nRows); +// *dPrimalFeasibility = fabs(res_value); +// #endif + } else { cupdlp_twoNorm(work, lp->nRows, primalResidual, dPrimalFeasibility); } @@ -168,12 +172,16 @@ void PDHG_Compute_Dual_Feasibility(CUPDLPwork *work, double *dualResidual, if (work->settings->iInfNormAbsLocalTermination) { cupdlp_int index; cupdlp_infNormIndex(work, lp->nCols, dualResidual, &index); -#ifdef CUPDLP_CPU *dDualFeasibility = fabs(dualResidual[index]); -#else - double res_value = get_fabs_value(dualResidual, index, lp->nCols); - *dDualFeasibility = fabs(res_value); -#endif + +// WIP only allow native for the moment +// #ifdef CUPDLP_CPU +// *dDualFeasibility = fabs(dualResidual[index]); +// #else +// double res_value = get_fabs_value(dualResidual, index, lp->nCols); +// *dDualFeasibility = fabs(res_value); +// #endif + } else { cupdlp_twoNorm(work, lp->nCols, dualResidual, dDualFeasibility); } diff --git a/src/pdlp/cupdlp/glbopts.h b/src/pdlp/cupdlp/glbopts.h index 98ff7395e0..62c9c6f9f0 100644 --- a/src/pdlp/cupdlp/glbopts.h +++ b/src/pdlp/cupdlp/glbopts.h @@ -3,7 +3,7 @@ #include "HConfig.h" -// #ifdef CUPDLP_GPU +// #ifndef CUPDLP_CPU // #include // cublas // #include // cudaMalloc, cudaMemcpy, etc. // #include // cusparseSpMV