Skip to content

Commit f9bf1fd

Browse files
Fix synchronization issue originated from non-blocking stream (#740)
<!-- Thank you for contributing to cuOpt :) Here are some guidelines to help the review process go smoothly. Many thanks in advance for your cooperation! Note: The pull request title will be included in the CHANGELOG. --> ## Checklist - [x] I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/cuopt/blob/HEAD/CONTRIBUTING.md). - Testing - [x] New or existing tests cover these changes - [ ] Added tests - [ ] Created an issue to follow-up - [ ] NA - Documentation - [ ] The documentation is up to date with these changes - [ ] Added new documentation - [x] NA <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved GPU synchronization behavior in the linear programming solver for more reliable GPU execution. * Switched routing data handling to a direct GPU-backed conversion pathway for more consistent numeric types. * **Tests** * Updated routing tests to align with the new GPU data conversion approach. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a0da8b6 commit f9bf1fd

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

cpp/src/linear_programming/utilities/cython_solve.cu

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,12 @@ std::unique_ptr<solver_ret_t> call_solve(
230230
{
231231
raft::common::nvtx::range fun_scope("Call Solve");
232232

233-
cudaStream_t stream;
234-
RAFT_CUDA_TRY(cudaStreamCreateWithFlags(&stream, flags));
235-
const raft::handle_t handle_{stream};
233+
// FIX: Use default handle constructor like CLI does, instead of explicit stream creation
234+
// Original code created a non-blocking stream which causes synchronization issues with PDLP
235+
// This is a workaround to fix the synchronization issues, please fix this in the future and
236+
// remove this workaround. cudaStream_t stream; RAFT_CUDA_TRY(cudaStreamCreateWithFlags(&stream,
237+
// flags)); // flags=cudaStreamNonBlocking const raft::handle_t handle_{stream};
238+
const raft::handle_t handle_{};
236239

237240
auto op_problem = data_model_to_optimization_problem(data_model, solver_settings, &handle_);
238241
solver_ret_t response;

python/cuopt/cuopt/routing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def create_pickup_delivery_data(
367367
matrix[i][j] = matrix_pdf[my_ix][my_iy] / vehicle_constraints.speed
368368

369369
pdf = pd.DataFrame(matrix)
370-
matrix_df = cudf.DataFrame.from_pandas(pdf).astype("float32")
370+
matrix_df = cudf.from_pandas(pdf).astype("float32")
371371

372372
pickup_indices = cudf.Series(
373373
i for i in range(0, int(len(raw_order_df) / 2))

python/cuopt/cuopt/tests/routing/test_pickup_delivery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def data_prep(order_pdf, matrix_pdf, depot):
6363
matrix[i][j] = matrix_pdf[my_ix][my_iy]
6464

6565
pdf = pd.DataFrame(matrix)
66-
matrix_df = cudf.DataFrame.from_pandas(pdf).astype("float32")
66+
matrix_df = cudf.from_pandas(pdf).astype("float32")
6767

6868
# Prepare pickup and delivery indices
6969
delivery_indices = cudf.Series(i for i in range(0, int(len(order_df) / 2)))

0 commit comments

Comments
 (0)