Skip to content

Add missing thrust headers across C++ sources#997

Merged
rapids-bot[bot] merged 4 commits intoNVIDIA:mainfrom
bdice:fix/add-missing-thrust-headers
Mar 30, 2026
Merged

Add missing thrust headers across C++ sources#997
rapids-bot[bot] merged 4 commits intoNVIDIA:mainfrom
bdice:fix/add-missing-thrust-headers

Conversation

@bdice
Copy link
Copy Markdown
Contributor

@bdice bdice commented Mar 28, 2026

Description

Fixes CI build failure where thrust::make_transform_output_iterator was not found in infeasibility_information.cu when building with CUDA 13.1.1 (CI log).

The codebase relied on transitive includes to resolve thrust symbols. This PR applies the Include What You Use (IWYU) principle: each of the 45 affected .cu/.cuh/.hpp files now directly includes the thrust headers for symbols it uses (transform_iterator.h, transform_output_iterator.h, zip_iterator.h, tuple.h, device_ptr.h, transform_reduce.h, extrema.h).

Issue

Closes #996

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • 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
    • NA

@bdice bdice requested a review from a team as a code owner March 28, 2026 03:27
@bdice bdice requested review from Kh4ster and chris-maes March 28, 2026 03:27
@bdice bdice added bug Something isn't working non-breaking Introduces a non-breaking change labels Mar 28, 2026
@bdice
Copy link
Copy Markdown
Contributor Author

bdice commented Mar 28, 2026

Separately from this PR, cuOpt should move to using the newer fancy iterator classes from cuda:: instead of thrust::. We've been refactoring most of RAPIDS in this way. cuOpt should also adopt cuda::std::tuple and cuda::std::pair and other classes instead of their thrust:: counterparts.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d509841b-c630-4d1b-99d1-052e31ec3d5a

📥 Commits

Reviewing files that changed from the base of the PR and between d80c581 and 56beb5c.

📒 Files selected for processing (1)
  • cpp/CMakeLists.txt

📝 Walkthrough

Walkthrough

This PR adds missing Thrust header includes and a few SPDX year updates across many CUDA source and header files to restore direct dependencies (zip/transform iterators, tuple, extrema, transform_reduce, device_ptr, etc.). It also makes the cuopt_cli target PIE in CMake and updates a docs manifest entry. No runtime logic or public APIs were changed.

Changes

Cohort / File(s) Summary
Barrier
cpp/src/barrier/barrier.cu, cpp/src/barrier/iterative_refinement.hpp
Added Thrust iterator/algorithm headers (transform_iterator.h, zip_iterator.h, extrema.h).
MIP Heuristics — Feasibility Jump
cpp/src/mip_heuristics/feasibility_jump/feasibility_jump.cu, .../feasibility_jump_kernels.cu, .../fj_cpu.cu
Added transform_iterator.h, tuple.h for transform/tuple utilities.
MIP Heuristics — Local Search / Rounding
cpp/src/mip_heuristics/local_search/rounding/bounds_repair.cu, .../bounds_repair.cuh, .../constraint_prop.cu, .../lb_bounds_repair.cu
Added zip_iterator.h, tuple.h to satisfy zip-iterator and tuple usage.
MIP Heuristics — Presolve
cpp/src/mip_heuristics/presolve/... (bounds_presolve.cu, conditional_bound_strengthening.cu, lb_probing_cache.cu, load_balanced_bounds_presolve.cu, .../load_balanced_bounds_presolve_helpers.cuh, multi_probe.cu, probing_cache.cu, trivial_presolve.cuh)
Added transform/zip iterator, tuple, extrema, and transform_reduce.h; one SPDX year update.
MIP Heuristics — Problem & Helpers
cpp/src/mip_heuristics/problem/problem.cu, .../problem_helpers.cuh
Added transform_iterator.h, zip_iterator.h, transform_reduce.h, tuple.h.
MIP Heuristics — Solution
cpp/src/mip_heuristics/solution/solution.cu
Added extrema.h for Thrust extrema usage.
PDLP — Core & Helpers
cpp/src/pdlp/initial_scaling_strategy/initial_scaling.cu, cpp/src/pdlp/pdhg.cu, cpp/src/pdlp/pdlp.cu, cpp/src/pdlp/utils.cuh
Added transform_iterator.h and/or zip_iterator.h for iterator utilities.
PDLP — Strategies & Termination
cpp/src/pdlp/restart_strategy/pdlp_restart_strategy.cu, .../adaptive_step_size_strategy.cu, .../convergence_information.cu, .../infeasibility_information.cu
Added device_ptr.h, extrema.h, iterator headers, transform_reduce.h, tuple.h (addresses missing transform_output_iterator and related utilities).
Routing — Local Search & Utilities
cpp/src/routing/local_search/compute_compatible.cu, cpp/src/routing/utilities/check_input.cu
Added extrema.h, zip_iterator.h; SPDX year update in one file.
Routing — Route Headers
cpp/src/routing/route/... (break_route.cuh, capacity_route.cuh, dimensions_route.cuh, distance_route.cuh, mismatch_route.cuh, pdp_route.cuh, prize_route.cuh, route.cuh, service_time_route.cuh, tasks_route.cuh, time_route.cuh, tsp_route.cuh, vehicle_fixed_cost_route.cuh)
Added tuple.h for thrust::tuple/tie/make_tuple; multiple SPDX year updates.
Routing — Solution Helpers
cpp/src/routing/solution/route_node_map.cuh
Added tuple.h and updated SPDX year.
Utilities
cpp/src/utilities/copy_helpers.hpp
Added zip_iterator.h for zip-iterator composition.
Docs manifest
docs/cuopt/source/versions1.json
Updated preferred docs version from 26.04.0026.06.00 and re-added 26.04.00 entry.
Build / CMake
cpp/CMakeLists.txt
Enabled POSITION_INDEPENDENT_CODE for cuopt_cli and added -pie link option (produce PIE executable).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes are in-scope header additions following IWYU principles. However, the PR includes scope creep: updating copyright years (2025→2026) across multiple files and making CMakeLists.txt changes for position-independent code (PIE), which are unrelated to fixing missing Thrust headers. Consider separating copyright year updates and CMakeLists.txt PIE changes into separate PRs to maintain focus on the specific issue of missing Thrust headers.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add missing thrust headers across C++ sources' accurately describes the main change: adding explicit Thrust header includes across multiple C++ files to fix a CI build failure and follow IWYU principles.
Description check ✅ Passed The description clearly explains the fix for CI build failure in CUDA 13.1.1, identifies the root cause (transitive includes), and describes the solution (adding explicit Thrust header includes across 45 files following IWYU principles).
Linked Issues check ✅ Passed The PR directly addresses issue #996 by adding explicit Thrust header includes across all affected files, resolving the namespace resolution error for thrust::make_transform_output_iterator and other symbols that were previously available through transitive includes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

bdice added 2 commits March 30, 2026 12:21
Direct #include directives for thrust iterator, tuple, functional,
and algorithm headers that were previously resolved only through
transitive includes. The immediate failure was
make_transform_output_iterator in infeasibility_information.cu
(CI build error with CUDA 13.1.1); this commit adds the explicit
includes for every thrust symbol used across all .cu/.cuh/.hpp
files to prevent similar breakage when transitive paths change.

Signed-off-by: Bradley Dice <bdice@bradleydice.com>
@bdice bdice force-pushed the fix/add-missing-thrust-headers branch from 4c3b1d8 to d80c581 Compare March 30, 2026 17:21
@bdice bdice requested a review from a team as a code owner March 30, 2026 17:21
@bdice bdice requested a review from rgsl888prabhu March 30, 2026 17:21
{
"version": "26.04.00",
"url": "https://docs.nvidia.com/cuopt/user-guide/26.04.00/",
"version": "26.06.00",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended? Seems unrelated and I don't know what this json conf does

Copy link
Copy Markdown
Collaborator

@rgsl888prabhu rgsl888prabhu Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used for switching docs from one release version to another. Somehow, it was missed or this branch was outdated in some way. And check style ensures all these versions are upto-date per release version.

Copy link
Copy Markdown
Contributor Author

@bdice bdice Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was required by cuOpt's pre-commit hooks. Without this, the style checks failed on main.

I would have expected main to already contain these changes, since #975 bumped VERSION to 26.06.00.

Perhaps developers are still targeting release/26.04 and haven't noticed that main has been broken?

@anandhkb anandhkb added the P0 label Mar 30, 2026
@rgsl888prabhu rgsl888prabhu requested a review from a team as a code owner March 30, 2026 20:48
Copy link
Copy Markdown

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the switch of cuopt_cli to compiling with position independent code.

@rgsl888prabhu
Copy link
Copy Markdown
Collaborator

/merge

@rapids-bot rapids-bot bot merged commit d03e197 into NVIDIA:main Mar 30, 2026
302 of 312 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change P0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI build failure: missing thrust headers in CUDA 13.1.1 build

5 participants