Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion benchmarks/linear_programming/run_mps_files.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0


Expand Down Expand Up @@ -74,6 +74,7 @@ Optional Arguments:
--n-batches Number of batches
--log-to-console Log to console
--model-list File containing a list of models to run
--pdlp-tolerances Tolerances for PDLP solver (default: 1e-4)
-h, --help Show this help message and exit

Examples:
Expand Down Expand Up @@ -187,6 +188,11 @@ while [[ $# -gt 0 ]]; do
MODEL_LIST="$2"
shift 2
;;
--pdlp-tolerances)
echo "PDLP_TOLERANCES: $2"
PDLP_TOLERANCES="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
print_help
Expand Down Expand Up @@ -214,6 +220,7 @@ BATCH_NUM=${BATCH_NUM:-0}
N_BATCHES=${N_BATCHES:-1}
LOG_TO_CONSOLE=${LOG_TO_CONSOLE:-true}
MODEL_LIST=${MODEL_LIST:-}
PDLP_TOLERANCES=${PDLP_TOLERANCES:-1e-4}

# Validate GPUS_PER_INSTANCE
if [[ "$GPUS_PER_INSTANCE" != "1" && "$GPUS_PER_INSTANCE" != "2" ]]; then
Expand Down Expand Up @@ -413,6 +420,9 @@ worker() {
if [ -n "$METHOD" ]; then
args="$args --method $METHOD"
fi
if [ -n "$PDLP_TOLERANCES" ]; then
args="$args --absolute-primal-tolerance $PDLP_TOLERANCES --absolute-dual-tolerance $PDLP_TOLERANCES --relative-primal-tolerance $PDLP_TOLERANCES --relative-dual-tolerance $PDLP_TOLERANCES --absolute-gap-tolerance $PDLP_TOLERANCES --relative-gap-tolerance $PDLP_TOLERANCES"
fi

CUDA_VISIBLE_DEVICES=$gpu_devices cuopt_cli "$mps_file" --time-limit $TIME_LIMIT $args
done
Expand Down
28 changes: 27 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,24 @@ option(LUSOL "Disable LUSOL" OFF)

FetchContent_MakeAvailable(papilo)

# PSLP - Lightweight C presolver for linear programs
# https://github.com/dance858/PSLP
FetchContent_Declare(
pslp
GIT_REPOSITORY "https://github.com/dance858/PSLP.git"
GIT_TAG "v0.0.4"
GIT_PROGRESS TRUE
EXCLUDE_FROM_ALL
SYSTEM
)

# Build PSLP as static to embed in cuopt (avoids runtime library path issues)
set(BUILD_SHARED_LIBS_SAVED ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
FetchContent_MakeAvailable(pslp)
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_SAVED})


include(${rapids-cmake-dir}/cpm/rapids_logger.cmake)
# generate logging macros
rapids_cpm_rapids_logger(BUILD_EXPORT_SET cuopt-exports INSTALL_EXPORT_SET cuopt-exports)
Expand Down Expand Up @@ -287,7 +305,11 @@ add_library(cuopt::cuopt ALIAS cuopt)
# - include paths ---------------------------------------------------------------------------------
message(STATUS "target include directories CUDSS_INCLUDES = ${CUDSS_INCLUDE}")

target_include_directories(cuopt SYSTEM PRIVATE "${papilo_SOURCE_DIR}/src" "${papilo_BINARY_DIR}")
target_include_directories(cuopt SYSTEM PRIVATE
"${papilo_SOURCE_DIR}/src"
"${papilo_BINARY_DIR}"
"${pslp_SOURCE_DIR}/include"
)

target_include_directories(cuopt
PRIVATE
Expand All @@ -303,6 +325,10 @@ target_include_directories(cuopt
${CUDSS_INCLUDE}
)

# Link PSLP by file to avoid export dependency tracking
target_link_libraries(cuopt PRIVATE $<TARGET_FILE:PSLP>)
add_dependencies(cuopt PSLP)

# ##################################################################################################
# - link libraries --------------------------------------------------------------------------------

Expand Down
5 changes: 5 additions & 0 deletions cpp/include/cuopt/linear_programming/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,9 @@
#define CUOPT_OUT_OF_MEMORY 5
#define CUOPT_RUNTIME_ERROR 6

#define CUOPT_PRESOLVE_DEFAULT -1
#define CUOPT_PRESOLVE_OFF 0
#define CUOPT_PRESOLVE_PAPILO 1
#define CUOPT_PRESOLVE_PSLP 2

#endif // CUOPT_CONSTANTS_H
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class mip_solver_settings_t {
/** Initial primal solutions */
std::vector<std::shared_ptr<rmm::device_uvector<f_t>>> initial_solutions;
bool mip_scaling = false;
bool presolve = true;
presolver_t presolver{presolver_t::Default};
// this is for extracting info from different places of the solver during
// benchmarks
benchmark_info_t* benchmark_info_ptr = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <cuopt/linear_programming/constants.h>
#include <cuopt/linear_programming/pdlp/pdlp_hyper_params.cuh>
#include <cuopt/linear_programming/pdlp/pdlp_warm_start_data.hpp>
#include <cuopt/linear_programming/utilities/internals.hpp>
#include <optional>
#include <raft/core/device_span.hpp>
#include <rmm/device_uvector.hpp>
Expand Down Expand Up @@ -225,7 +226,7 @@ class pdlp_solver_settings_t {
bool eliminate_dense_columns{true};
bool save_best_primal_so_far{false};
bool first_primal_feasible{false};
bool presolve{false};
presolver_t presolver{presolver_t::Default};
bool dual_postsolve{true};
int num_gpus{1};
method_t method{method_t::Concurrent};
Expand Down
19 changes: 19 additions & 0 deletions cpp/include/cuopt/linear_programming/utilities/internals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <string_view>
#include <type_traits>

#include <cuopt/linear_programming/constants.h>
namespace cuopt {
namespace internals {

Expand Down Expand Up @@ -111,5 +112,23 @@ struct parameter_info_t<std::string> {
std::string default_value;
};

/**
* @brief Enum representing the different presolvers that can be used to solve the
* linear programming problem.
*
* Default: Use the default presolver.
* None: No presolver.
* Papilo: Use the Papilo presolver.
* PSLP: Use the PSLP presolver.
*
* @note Default presolver is None.
*/
enum presolver_t : int {
Default = CUOPT_PRESOLVE_DEFAULT,
None = CUOPT_PRESOLVE_OFF,
Papilo = CUOPT_PRESOLVE_PAPILO,
PSLP = CUOPT_PRESOLVE_PSLP
};

} // namespace linear_programming
} // namespace cuopt
4 changes: 2 additions & 2 deletions cpp/src/dual_simplex/barrier.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1153,14 +1153,14 @@ class iteration_data_t {
}
#ifdef HISTOGRAM
settings.log.printf("Row Nz # rows\n");
for (i_t k = 0; k < m; k++) {
for (i_t k = 0; k < n; k++) {
if (histogram_row[k] > 0) { settings.log.printf("%6d %6d\n", k, histogram_row[k]); }
}
#endif

n_dense_rows = 0;
for (i_t k = 0; k < m; k++) {
if (histogram_row[k] > .1 * n) { n_dense_rows++; }
if (row_nz[k] > .1 * n) { n_dense_rows++; }
}

for (i_t k = 0; k < m; k++) {
Expand Down
Loading
Loading