Generated banner for Cuopt Developer
Generated logo for Cuopt Developer

Cuopt Developer

NVIDIAOfficialCreated by NVIDIA cuOpt Team

  • Skill
  • Workflow
  • Software development
  • Apache-2.0
  • Medium risk

From the author

Modify, build, test, debug, and contribute to NVIDIA cuOpt (C++/CUDA, Python, server, CI). Use for solver internals, PRs, DCO, and code conventions.
— the description by NVIDIA cuOpt Team

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The cuOpt-developer skill provides a structured environment for engineers to contribute to the NVIDIA cuOpt project. It covers the full development lifecycle, including environment setup via conda, building C++/CUDA and Python components, running tests, and following project-specific coding and contribution conventions. The skill enforces strict development patterns, such as using pre-commit hooks, maintaining minimal diffs, and adhering to specific GPU memory management practices, while providing guidance on navigating the project architecture and CI/CD workflows.

What it does

  • Guides the setup of local development environments using conda.
  • Provides commands for building C++, Python, and server components.
  • Facilitates running C++ and Python test suites.
  • Enforces project-specific coding conventions and style guidelines.
  • Supports the contribution workflow including DCO sign-off and fork-based PRs.
  • Assists with debugging solver internals and numerical issues.

When to use it

  • When you need to modify or extend the cuOpt source code.
  • When setting up a new local development environment for cuOpt.
  • When preparing a contribution or pull request for the cuOpt repository.
  • When debugging solver algorithms or Python bindings.
  • When running local builds or tests for specific cuOpt components.

Advantages

  • Ensures consistency with project-wide coding and architectural patterns.
  • Provides a clear, reproducible path for environment setup.
  • Integrates directly with project CI/CD and pre-commit requirements.
  • Reduces common pitfalls related to CUDA driver and dataset dependencies.
  • Maintains high standards for code quality and commit hygiene.

Usage examples

“How do I set up my environment to start developing on cuOpt?”
The agent will guide you through cloning the repository, selecting the correct conda environment file based on your CUDA driver version, and installing the necessary dependencies.
“I need to add a new solver parameter. What is the process?”
The agent will provide a checklist covering the C++ settings struct, Python binding exposure, server schema updates, and required testing steps.
“How do I run the C++ unit tests for my changes?”
The agent will verify your environment is active, confirm datasets are downloaded, and provide the correct ctest command for the cpp/build directory.
“I am getting a numerical error in the solver. How should I debug it?”
The agent will direct you to the numerical debugging resources to instrument the code and identify potential catastrophic cancellation sites.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/nvidia/cuopt-developer/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip cuopt-developer.zip -d .agents/skills

Documentation by NVIDIA cuOpt Team

cuOpt Developer Skill

Contribute to the NVIDIA cuOpt codebase. This skill is for modifying cuOpt itself, not for using it.

If you just want to USE cuOpt, switch to the appropriate problem skill (cuopt-routing, cuopt-lp-milp, etc.)

First-time dev environment setup? See references/first_time_setup.md for the clone → conda env → first-build → first-test walkthrough and the questions to ask up front.


Refusal Rules — Read First

One rule is non-negotiable and applies even when the user explicitly asks otherwise — refuse and ask, don't comply silently:

Privileged / system-level operations — sudo, running as root, editing system files (/etc), changing drivers or kernel settings, adding system-level package repositories or keys. Do not run these. Reply:

I won't run sudo or change system-level state for cuOpt. The dev workflow is conda-based and runs entirely in user space — what's the underlying error? It's usually fixable without root.

Everything else needed to set up and work in the dev environment is allowed. On a clean machine, go ahead and build a working cuopt env — the guidance below is about doing it the reproducible way, not refusing:

  • Environment setup is allowed. You may create and activate the conda env from the checked-in conda/environments/all_cuda-*.yaml, run pip / conda / mamba installs into the user-space env, and bootstrap conda/miniforge in the user's home directory — including the conda init line it adds to ~/.bashrc. Bootstrapping conda must not require sudo; install it into $HOME, not a system path.

  • A new permanent project dependency is different from a one-off install. A package the project should always ship belongs in dependencies.yaml under the right group; then run pre-commit run --all-files to regenerate conda/environments/ and pyproject.toml so other contributors get it too. A throwaway install to unblock your own build doesn't need this round-trip.

  • Don't bypass CI checks (--no-verify, skipping pre-commit or tests). If hooks feel slow, diagnose with pre-commit run --all-files --verbose or tune the offending hook — don't skip it.

  • Be careful with destructive commands (rm -rf, git reset --hard, git push --force, killing processes, dropping data). Confirm intent before running and prefer the safer alternative (e.g. ./build.sh clean for a stale build dir).


Developer Behavior Rules

These rules are specific to development tasks. They differ from user rules.

1. Ask Before Assuming

Clarify before implementing:

  • What component? (C++/CUDA, Python, server, docs, CI)

  • What's the goal? (bug fix, new feature, refactor, docs)

  • Is this for contribution or local modification?

2. Verify Understanding

Before making changes, confirm:

"Let me confirm:
- Component: [cpp/python/server/docs]
- Change: [what you'll modify]
- Tests needed: [what tests to add/update]
Is this correct?"
3. Follow Codebase Patterns
  • Read existing code in the area you're modifying

  • Match naming conventions, style, and patterns

  • Don't invent new patterns without discussion

4. Ask Before Running — Modified for Dev

OK to run without asking (expected for dev work):

  • ./build.sh and build commands

  • pytest, ctest (running tests)

  • pre-commit run, ./ci/check_style.sh (formatting)

  • git status, git diff, git log (read-only git)

  • Environment setup: create/activate the conda env from conda/environments/*.yaml, and pip/conda/mamba installs into that env

Set up pre-commit hooks (once per clone):

  • pre-commit install — hooks then run automatically on every git commit. If a hook fails, the commit is blocked until you fix the issue.

Still ask before:

  • git commit, git push (write operations)

  • Any destructive or irreversible commands

5. No Privileged Operations

sudo/system-level changes are the one non-negotiable refusal; user-space installs and conda env setup are allowed. See Refusal Rules — Read First.


Before You Start: Required Questions

Ask these if not already clear:

  1. What are you trying to change?

    • Solver algorithm/performance?

    • Python API?

    • Server endpoints?

    • Documentation?

    • CI/build system?

  2. Do you have the development environment set up?

    • Built the project successfully?

    • Ran tests?

  3. Is this for contribution or local modification?

    • If contributing: will need to follow DCO signoff

  4. Which branch should this target?

    • During development phase: main

    • During burn down: release/YY.MM (e.g., release/26.06) for the current release, main for the next

    • Check if a release branch exists: git branch -r | grep release

    • For current timelines, see the RAPIDS Maintainers Docs

Project Architecture

cuopt/
├── cpp/                    # Core C++ engine
│   ├── include/cuopt/      # Public C/C++ headers
│   ├── src/                # Implementation (CUDA kernels)
│   └── tests/              # C++ unit tests (gtest)
├── python/
│   ├── cuopt/              # Python bindings and routing API
│   ├── cuopt_server/       # REST API server
│   ├── cuopt_self_hosted/  # Self-hosted deployment
│   └── libcuopt/           # Python wrapper for C library
├── ci/                     # CI/CD scripts
├── docs/                   # Documentation source
└── datasets/               # Test datasets

Supported APIs

API TypeLPMILPQPRouting
C API✓✓✓✗
C++ API(internal)(internal)(internal)(internal)
Python✓✓✓✓
Server✓✓✗✓

Safety Rules (Non-Negotiable)

Minimal Diffs
  • Change only what's necessary

  • Avoid drive-by refactors

  • No mass reformatting of unrelated code

No API Invention
  • Don't invent new APIs without discussion

  • Align with existing patterns in docs/cuopt/source/

  • Server schemas must match OpenAPI spec

Don't Bypass CI
  • Never suggest --no-verify or skipping checks

  • All PRs must pass CI

CUDA/GPU Hygiene
  • Keep operations stream-ordered

  • Follow existing RAFT/RMM patterns

  • No raw new/delete - use RMM allocators

Build & Test

Pre-flight Checks (Required Before First Build or Test)

Skipping any of these surfaces as confusing runtime errors later. Run them in order:

  1. Check CUDA driver compatibility. Run nvidia-smi and read the CUDA Version in the top-right corner — that's the maximum CUDA your driver supports. Pick a conda env file from conda/environments/all_cuda-<ver>_arch-<arch>.yaml whose CUDA major version is ≤ that. A mismatch builds successfully but fails at runtime inside RMM with cudaMallocAsync not supported with this CUDA driver/runtime version — verify this before the build, not after.

  2. Create and activate the conda env before any build, test, or pre-commit command — this is allowed and expected (see Refusal Rules). Use a local prefix env (./.cuopt_env) per CONTRIBUTING.md, with the env file you picked in step 1 (swap conda→mamba if available):

    conda env create -p ./.cuopt_env --file conda/environments/all_cuda-<ver>_arch-$(uname -m).yaml
    conda activate ./.cuopt_env

    Tests link against libraries compiled inside that env; a fresh shell without conda activate ./.cuopt_env hits cryptic linker errors.

  3. Set PARALLEL_LEVEL if RAM is constrained — see references/build_and_test.md. The default $(nproc) can OOM mid-build because CUDA compilation needs ~4–8 GB per job.

  4. For tests, fetch datasets first. cuOpt tests need MPS files not in the repo — follow the dataset download steps in CONTRIBUTING.md ("Building for development" section) and export RAPIDS_DATASET_ROOT_DIR.

Quick Reference
./build.sh             # Build everything
./build.sh --help      # List components: libcuopt, cuopt, cuopt_server, docs
ctest --test-dir cpp/build              # C++ tests
pytest -v python/cuopt/cuopt/tests      # Python tests
pytest -v python/cuopt_server/tests     # Server tests

For component-specific build commands, run-test detail, and PARALLEL_LEVEL configuration, see references/build_and_test.md.

Download test datasets before running tests

cuOpt tests depend on MPS/data files that are not checked into the repo. A missing dataset surfaces as a MPS_PARSER_ERROR ... Error opening MPS file test failure at 0ms — it is not a build or logic failure.

Before running any C++ or Python tests, follow the dataset download and RAPIDS_DATASET_ROOT_DIR export steps in the repo's CONTRIBUTING.md ("Building for development" section) — that is the canonical list and mapping.

If a test fails with a missing-file error, run the matching download step from CONTRIBUTING.md and re-run the test. Do not report missing-dataset failures back to the user as the task outcome.

Python Bindings

cuOpt uses Cython to bridge Python and C++. See references/python_bindings.md for the full architecture, parameter flow walkthrough, key files, and Cython patterns.

Contributing — Commits, PRs, Common Tasks

For pre-commit setup, DCO sign-off (git commit -s), the fork-based PR workflow, the draft-PR rule for agents, PR-description rules (keep it short — no "how it works" walkthroughs or file tables), script and CI/workflow authoring principles (extend existing files before adding new ones; no speculative flags, restated defaults, or silent fallbacks), and step-by-step common-task recipes (adding a solver parameter, dependency, server endpoint, or CUDA kernel), see references/contributing.md.

Coding Conventions

For C++ naming (snake_case, d_/h_ prefixes, _t suffix), file extensions (.hpp/.cpp/.cu/.cuh and which compiler each uses), include order, Python style, error handling (CUOPT_EXPECTS, RAFT_CUDA_TRY), memory management (RMM patterns, no raw new/delete), and test-impact rules, see references/conventions.md.

Troubleshooting & CI

For build/test pitfalls (Cython rebuild, OOM, CUDA driver mismatch, missing nvcc) and CI failure diagnostics (style checks, DCO failures, dependency drift), see references/troubleshooting.md.

Key Files Reference

PurposeLocation
Main build scriptbuild.sh
Dependenciesdependencies.yaml
C++ formatting.clang-format
Conda environmentsconda/environments/
Test datadatasets/
CI scriptsci/

Canonical Documentation

  • Contributing/build/test: CONTRIBUTING.md

  • CI scripts: ci/README.md

  • Release scripts: ci/release/README.md

  • Docs build: docs/cuopt/README.md

  • Python binding architecture: references/python_bindings.md

Shell-execution, install, conda-env, and sudo policies are covered by Refusal Rules — Read First at the top of this skill.

VRP dimension internals (routing engine)

When implementing or debugging VRP dimensions (constraints, objectives, forward/backward propagation, combine, local-search deltas), read:

  • references/vrp_skills.md — architecture contracts, required interfaces, and implementation checklist.

Read it before adding a new dimension or changing combine semantics.

Numerical issues in non-routing solver internals

When a bug surfaces as wrong-but-plausible solver output (invalid lower bound, unexpectedly large duals, 10× iteration blow-up after a small change) rather than a crash, read:

  • resources/numerical_debugging.md — methodology for locating catastrophic-cancellation sites, the cancellation patterns endemic to cMIR / flow-cover / MIR-style cut construction, and threshold guidance for numerical guards.

Apply the instrument-first, guard-at-the-exact-site workflow it describes before patching — speculative fixes on these symptoms usually miss.

Files

references/vrp_skills.md

cuOpt VRP Dimension Developer Skills


cuopt-dimension-architecture

When to use: Before implementing any new constraint or objective in cuOpt.

The forward/backward propagation model

Each node stores accumulated state (fwd_X, bwd_X) so that combining any two adjacent fragments is O(1). This is the core design contract that makes cuOpt fast:

  • fwd_X[k] = contribution of the prefix [0..k]

  • bwd_X[k] = contribution of the suffix [k..n]

  • No recomputation is needed when a move splits a route at any point

The combine invariant

combine(node[k], node[k+1]) must return the same value for every split point k in a route (within floating-point tolerance — small differences from order of operations are acceptable; large gaps indicate a bug). This is the fundamental correctness contract. Violating it breaks local search delta evaluation (the solver computes cost_after - cost_before using combine; if combine is materially inconsistent, deltas are wrong).

Why boundaries double-count

fwd_excess[k] accumulates violations from [0..k]. bwd_excess[k+1] accumulates violations from [k+1..n]. At the join point k → k+1, both sides have already "seen" the in-transit state at that boundary — so their sum overcounts the boundary contribution once. The correction term excess(fwd_state[k]) subtracts the double-counted boundary:

combine(k, k+1) = fwd_excess[k] + bwd_excess[k+1] - excess(fwd_state[k])
Required interface for every dimension
MethodDescription
calculate_forward(next)Propagate fwd state from this to next; update next.fwd_excess
calculate_backward(prev)Propagate bwd state from this to prev; update prev.bwd_excess
combine(prev, next)O(1) total cost for joining two fragments; must satisfy the invariant
get_cost(prev, this)Same formula as combine, called from next's perspective
compute_cost(n_nodes)Full-route cost; must equal combine(last_node, return_depot)
forward_excessReturns fwd_excess as double
backward_excessReturns bwd_excess as double
forward_feasibleTrue if fwd_excess <= excess_limit
backward_feasibleTrue if bwd_excess <= excess_limit

cuopt-implement-dimension

When to use: When given a constraint/objective description to implement as a new cuOpt dimension.

Step-by-step recipe

Step 1 — Define per-node state Identify the minimal set of scalars needed for O(1) propagation:

  • What is "in transit" at each route position? (e.g. load, type counts, time)

  • What accumulated violation measure can be updated incrementally? (e.g. excess load, incompatibility excess)

  • Separate: fixed data (set once from problem input), forward data, backward data

Step 2 — Write calculate_forward(next)

propagate accumulated fwd_state from this → next
apply next node's demand to fwd_state
compute positional_excess = f(fwd_state_at_next)
next.fwd_excess = this.fwd_excess + positional_excess   // depot nodes: no positional contribution

Step 3 — Write calculate_backward(prev) Mirror of forward, applied in reverse direction. Backward demand direction is opposite to forward (e.g. a pickup that adds +1 forward subtracts -1 backward).

Step 4 — Derive combine(prev, next)

combine is the core cost computation for every local search move: operators evaluate candidate edits by differencing combined fragment costs (cost_after - cost_before). It is called extremely often, so keep it as fast as possible.

  • Typical dimensions (capacity, distance, simple time windows, etc.): combine is O(1) — only prefix/suffix scalars and a boundary correction. This is what all current VRP operators assume.

  • Richer dimensions can be much more expensive — e.g. O(log n) in route size n when the join cost needs a non-trivial lookup (time-dependent travel times, multiple time windows, profile queries). Prefer precomputed tables or cached state so combine stays hot-path friendly; if it must be superlinear, document it and expect fewer applicable operators or higher move-evaluation cost.

Write out the invariant formula and verify it equals the total route cost for a complete route:

total = prev.fwd_excess + next.bwd_excess - boundary_correction(prev.fwd_state)

where boundary_correction removes the double-counted overlap at the join point.

Step 5 — Derive get_cost(prev, this) from combine

get_cost is on the same hot path as combine: local search operators call it constantly when scoring edges and fragments. It must stay as fast as combine — same O(1) target for typical dimensions, same risk of O(log n) or worse for time-dependent travel, multiple time windows, etc. Do not put a separate heavy computation here.

get_cost is called on the next node with prev passed in. It must be identical to combine — substitute this for next:

get_cost(prev, this) == combine(prev, this)

Implement by delegating to combine (or inlining the same formula). Do not derive an independent formula; any deviation breaks coherence assertions and can hide a slower code path.

Step 6 — Write compute_cost(n_nodes) Must equal combine(last_service_node, fresh_return_depot) within the same floating-point tolerance:

compute_cost = fwd_excess[n_nodes] - boundary_correction(fwd_state[n_nodes])

(For a balanced route, bwd_excess at the return depot is 0 and bwd_state is 0, so the depot term drops out.)

Step 7 — Create the node class File: cpp/src/routing/node/your_node.cuh

  • Fixed data fields (problem input)

  • fwd_state[], fwd_excess, bwd_state[], bwd_excess

  • All 9 interface methods listed in cuopt-dimension-architecture

Step 8 — Create the route class File: cpp/src/routing/route/your_route.cuh

  • Host-side: rmm::device_uvector for each array (fixed, fwd, bwd)

  • Device-side view_t: raft::device_span members, get_node, set_node, set_forward_data, set_backward_data, copy_forward_data, copy_backward_data, copy_fixed_route_data, compute_cost, create_shared_route, get_shared_size

  • Stride layout: all arrays use stride = n_nodes_route + 1; multi-type arrays are row-major [n_types * stride]


cuopt-dimension-wiring-checklist

When to use: After writing node/route logic, to ensure the dimension is fully integrated into the framework.

Files to create
  • [ ] cpp/src/routing/node/your_node.cuh

  • [ ] cpp/src/routing/route/your_route.cuh

Files to modify

cpp/src/routing/routing_helpers.cuh (or dimensions_info)

  • [ ] Add new dim_t enum value

  • [ ] enabled_dimensions_t::has_dimension covers it

  • [ ] enabled_dimensions_t::get_dimension<dim> covers it

  • [ ] loop_over_dimensions range covers it (check Start/End bounds)

cpp/src/routing/route/dimensions_route.cuh

  • [ ] Add to route_from_dim<I> type alias chain

  • [ ] Add member your_route_t<i_t, f_t> your_dim to dimensions_route_t

  • [ ] Initialize in constructor: your_dim(sol_handle_, dimensions_info_.get_dimension<dim_t::YOUR_DIM>())

  • [ ] Copy constructor copies your_dim

  • [ ] view_t has typename your_route_t<i_t, f_t>::view_t your_dim member

  • [ ] view() calls get_dimension_of<I>(v) = get_dimension_of<I>(*this).view() via loop — automatic if wired into enum

cpp/src/routing/node/node.cuh

  • [ ] get_dimension<dim_t::YOUR_DIM>() returns your_dim member — add to the accessor chain

cpp/src/routing/problem/problem.cuh

  • [ ] Add storage for input data (e.g. std::vector<int> order_incompatible_types)

  • [ ] Add setter method

cpp/src/routing/problem/problem.cu

  • [ ] populate_dimensions_info(): enable dimension when input data is non-empty

cpp/src/routing/util_kernels/set_nodes_data.cuh

  • [ ] Depot boundary initialization in set_route_data: set fwd_state[0] = 0, fwd_excess[0] = 0, bwd_state[n_nodes] = 0, bwd_excess[n_nodes] = 0

cpp/src/routing/fleet_info.hpp (if dimension has vehicle-level parameters)

  • [ ] Add vehicle-level constraint data

Python/C API

  • [ ] Expose setter in C API header

  • [ ] Python binding in the routing data class


cuopt-dimension-testing

When to use: After implementing a new dimension, to write tests that validate correctness end-to-end.

C++ unit tests (cpp/tests/routing/)
  • Add a simple unit test with less than 10 nodes/orders

Python integration tests (python/cuopt/cuopt/tests/routing/)
  • Add a similar test in python to test the Python APIs and end-to-end testing

What every test should verify
  • is_feasible() for the final solution when feasibility is expected

  • Infeasibility cost for the new dimension is 0 in a feasible solution

  • Optimal objective value is obtained for curated tests

  • Edge cases: empty route, single-node route, all nodes same type/value

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs
  • Instructions that use the network
  • Downloads piped into a shell

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA cuOpt Team
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/cuopt-developer · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA cuOpt Team or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cuopt-developer.zip