Skip to content

Commit ef68d50

Browse files
authored
Hot fix 25.10 (#552)
Hot fix with the following commits: - #541 - #544 - #550
1 parent ce29919 commit ef68d50

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

benchmarks/linear_programming/utils/get_datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ def extract(file, dir, type):
693693
raise Exception(f"Unknown file extension found for extraction {file}")
694694
# download emps and compile
695695
# Disable emps for now
696-
if type == "netlib":
696+
if type == "netlib" and False:
697697
url = MittelmannInstances["emps"]
698698
file = os.path.join(dir, "emps.c")
699699
download(url, file)

cpp/src/dual_simplex/barrier.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,6 +3575,9 @@ lp_status_t barrier_solver_t<i_t, f_t>::solve(f_t start_time,
35753575
} catch (const raft::cuda_error& e) {
35763576
settings.log.debug("Error in barrier_solver_t: %s\n", e.what());
35773577
return lp_status_t::NUMERICAL_ISSUES;
3578+
} catch (const rmm::out_of_memory& e) {
3579+
settings.log.debug("Out of memory in barrier_solver_t: %s\n", e.what());
3580+
return lp_status_t::NUMERICAL_ISSUES;
35783581
}
35793582
}
35803583

cpp/src/dual_simplex/cusparse_view.cu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ cusparse_view_t<i_t, f_t>::cusparse_view_t(raft::handle_t const* handle_ptr,
138138
d_minus_one_(f_t(-1), handle_ptr->get_stream()),
139139
d_zero_(f_t(0), handle_ptr->get_stream())
140140
{
141+
RAFT_CUBLAS_TRY(raft::linalg::detail::cublassetpointermode(
142+
handle_ptr->get_cublas_handle(), CUBLAS_POINTER_MODE_DEVICE, handle_ptr->get_stream()));
143+
RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsesetpointermode(
144+
handle_ptr->get_cusparse_handle(), CUSPARSE_POINTER_MODE_DEVICE, handle_ptr->get_stream()));
141145
// TMP matrix data should already be on the GPU
142146
constexpr bool debug = false;
143147
if (debug) { printf("A hash: %zu\n", A.hash()); }

cpp/src/linear_programming/solve.cu

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ optimization_problem_solution_t<i_t, f_t> run_barrier(
444444
{
445445
// Convert data structures to dual simplex format and back
446446
dual_simplex::user_problem_t<i_t, f_t> dual_simplex_problem =
447-
cuopt_problem_to_simplex_problem<i_t, f_t>(problem);
447+
cuopt_problem_to_simplex_problem<i_t, f_t>(problem.handle_ptr, problem);
448448
auto sol_dual_simplex = run_barrier(dual_simplex_problem, settings, timer);
449449
return convert_dual_simplex_sol(problem,
450450
std::get<0>(sol_dual_simplex),
@@ -515,7 +515,7 @@ optimization_problem_solution_t<i_t, f_t> run_dual_simplex(
515515
{
516516
// Convert data structures to dual simplex format and back
517517
dual_simplex::user_problem_t<i_t, f_t> dual_simplex_problem =
518-
cuopt_problem_to_simplex_problem<i_t, f_t>(problem);
518+
cuopt_problem_to_simplex_problem<i_t, f_t>(problem.handle_ptr, problem);
519519
auto sol_dual_simplex = run_dual_simplex(dual_simplex_problem, settings, timer);
520520
return convert_dual_simplex_sol(problem,
521521
std::get<0>(sol_dual_simplex),
@@ -671,16 +671,13 @@ optimization_problem_solution_t<i_t, f_t> run_concurrent(
671671
// Initialize the dual simplex structures before we run PDLP.
672672
// Otherwise, CUDA API calls to the problem stream may occur in both threads and throw graph
673673
// capture off
674-
auto barrier_handle = raft::handle_t(*op_problem.get_handle_ptr());
675-
detail::problem_t<i_t, f_t> d_barrier_problem(problem);
676674
rmm::cuda_stream_view barrier_stream = rmm::cuda_stream_per_thread;
677-
d_barrier_problem.handle_ptr = &barrier_handle;
678-
raft::resource::set_cuda_stream(barrier_handle, barrier_stream);
675+
auto barrier_handle = raft::handle_t(barrier_stream);
679676
// Make sure allocations are done on the original stream
680677
problem.handle_ptr->sync_stream();
681678

682679
dual_simplex::user_problem_t<i_t, f_t> dual_simplex_problem =
683-
cuopt_problem_to_simplex_problem<i_t, f_t>(d_barrier_problem);
680+
cuopt_problem_to_simplex_problem<i_t, f_t>(&barrier_handle, problem);
684681
// Create a thread for dual simplex
685682
std::unique_ptr<
686683
std::tuple<dual_simplex::lp_solution_t<i_t, f_t>, dual_simplex::lp_status_t, f_t, f_t, f_t>>

cpp/src/linear_programming/translate.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ namespace cuopt::linear_programming {
2828

2929
template <typename i_t, typename f_t>
3030
static dual_simplex::user_problem_t<i_t, f_t> cuopt_problem_to_simplex_problem(
31-
detail::problem_t<i_t, f_t>& model)
31+
raft::handle_t const* handle_ptr, detail::problem_t<i_t, f_t>& model)
3232
{
33-
dual_simplex::user_problem_t<i_t, f_t> user_problem(model.handle_ptr);
33+
dual_simplex::user_problem_t<i_t, f_t> user_problem(handle_ptr);
3434

3535
int m = model.n_constraints;
3636
int n = model.n_variables;
3737
int nz = model.nnz;
3838
user_problem.num_rows = m;
3939
user_problem.num_cols = n;
40-
user_problem.objective = cuopt::host_copy(model.objective_coefficients);
40+
user_problem.objective = cuopt::host_copy(model.objective_coefficients, handle_ptr->get_stream());
4141

4242
dual_simplex::csr_matrix_t<i_t, f_t> csr_A(m, n, nz);
43-
csr_A.x = cuopt::host_copy(model.coefficients);
44-
csr_A.j = cuopt::host_copy(model.variables);
45-
csr_A.row_start = cuopt::host_copy(model.offsets);
43+
csr_A.x = cuopt::host_copy(model.coefficients, handle_ptr->get_stream());
44+
csr_A.j = cuopt::host_copy(model.variables, handle_ptr->get_stream());
45+
csr_A.row_start = cuopt::host_copy(model.offsets, handle_ptr->get_stream());
4646

4747
csr_A.to_compressed_col(user_problem.A);
4848

@@ -51,8 +51,10 @@ static dual_simplex::user_problem_t<i_t, f_t> cuopt_problem_to_simplex_problem(
5151
user_problem.range_rows.clear();
5252
user_problem.range_value.clear();
5353

54-
auto model_constraint_lower_bounds = cuopt::host_copy(model.constraint_lower_bounds);
55-
auto model_constraint_upper_bounds = cuopt::host_copy(model.constraint_upper_bounds);
54+
auto model_constraint_lower_bounds =
55+
cuopt::host_copy(model.constraint_lower_bounds, handle_ptr->get_stream());
56+
auto model_constraint_upper_bounds =
57+
cuopt::host_copy(model.constraint_upper_bounds, handle_ptr->get_stream());
5658

5759
// All constraints have lower and upper bounds
5860
// lr <= a_i^T x <= ur
@@ -79,7 +81,7 @@ static dual_simplex::user_problem_t<i_t, f_t> cuopt_problem_to_simplex_problem(
7981
}
8082
user_problem.num_range_rows = user_problem.range_rows.size();
8183
std::tie(user_problem.lower, user_problem.upper) =
82-
extract_host_bounds<f_t>(model.variable_bounds, model.handle_ptr);
84+
extract_host_bounds<f_t>(model.variable_bounds, handle_ptr);
8385
user_problem.problem_name = model.original_problem_ptr->get_problem_name();
8486
if (model.row_names.size() > 0) {
8587
user_problem.row_names.resize(m);
@@ -97,7 +99,7 @@ static dual_simplex::user_problem_t<i_t, f_t> cuopt_problem_to_simplex_problem(
9799
user_problem.obj_scale = model.presolve_data.objective_scaling_factor;
98100
user_problem.var_types.resize(n);
99101

100-
auto model_variable_types = cuopt::host_copy(model.variable_types);
102+
auto model_variable_types = cuopt::host_copy(model.variable_types, handle_ptr->get_stream());
101103
for (int j = 0; j < n; ++j) {
102104
user_problem.var_types[j] =
103105
model_variable_types[j] == var_t::CONTINUOUS

0 commit comments

Comments
 (0)