Doca Programming Guide
NVIDIAOfficialCreated by NVIDIA
- Skill
- Guidelines
- Software development
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a standardized approach for developers to program against NVIDIA DOCA libraries. It focuses on library-agnostic workflows, including the canonical build process using pkg-config and meson, the universal DOCA object lifecycle (create, configure, start, connect, use, stop, destroy), and cross-library error handling. It is designed for developers who have already set up their environment and are ready to write, build, or debug their own DOCA-based applications. The skill emphasizes using existing shipped samples as a foundation for new projects and provides guidance for both C/C++ developers and those using FFI/bindings from other languages.
What it does
- Provides the canonical build pattern for DOCA applications using pkg-config and meson.
- Defines the universal lifecycle for all DOCA objects.
- Explains the cross-library DOCA_ERROR_* taxonomy and debugging ladder.
- Outlines the workflow for deriving custom applications from shipped samples.
- Offers guidance on language-neutral programming patterns for FFI and bindings.
- Establishes a program-side safety policy and observability surface.
When to use it
- When you are ready to write your first DOCA application after the environment is set up.
- When you need to understand the standard lifecycle of a DOCA object.
- When you encounter a DOCA_ERROR_* and need to debug it.
- When you need to integrate DOCA libraries into a project using FFI or language bindings.
- When you want to build a DOCA program using the canonical meson and pkg-config workflow.
Advantages
- Standardizes the development workflow across different DOCA libraries.
- Reduces development time by leveraging existing shipped samples.
- Provides a clear, library-agnostic path for debugging and error handling.
- Supports both native C/C++ development and FFI-based integration.
- Ensures consistent application structure and lifecycle management.
Usage examples
- “How do I write my first DOCA program?”
- The agent will guide you through selecting a shipped sample, modifying it for your needs, and using the canonical build pattern to compile your application.
- “What is the correct lifecycle for a DOCA object?”
- The agent will explain the required sequence: create, configure, start, connect, use, stop, and destroy.
- “My code returned DOCA_ERROR_BAD_STATE, what should I do?”
- The agent will help you interpret the error using the cross-library taxonomy and guide you through the program-class debug ladder.
- “How do I compile a program that calls doca_rdma functions?”
- The agent will provide the necessary pkg-config and meson build lines required to link against the DOCA RDMA library.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/nvidia/doca-programming-guide/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip doca-programming-guide.zip -d .agents/skills
Documentation by NVIDIA
DOCA programming guide
Examples
"How do I write my first DOCA program?" — copy a shipped sample and follow the modify workflow, then the canonical pkg-config + meson build. Docker / NGC can compile and link; runtime needs a real BlueField or ConnectX.
"What's the lifecycle every DOCA object follows?" — create → configure → start → connect → use → stop → destroy. Configuration finishes before start.
Instructions
Follow Loading order below. Open the tasks companion for how-to and the capabilities companion for coverage. Do not open every companion file.
Where to start: Read ## Audience to confirm the user
is consuming DOCA, not contributing to it. Then jump to the H2
that matches the verb (## modify for first-app derivation,
## build for the canonical build pattern, ## test for the test
loop, ## debug for the program-class debug ladder). Docker / NGC
is the build half, not the runtime half. The NGC container can
compile and link. Flow pipe creation, RDMA QP ops, and any call
that needs a doca_dev on a port need a real BlueField or
ConnectX. Do not promise the app will work entirely inside docker.
Example questions this skill answers well
These are the CLASSES of program-class questions the skill is built to answer, each with one worked example. Library-specific overlays (Flow / DMS / Caps / …) live in the matching library skill; this skill answers the library-agnostic shape.
"How do I write my first DOCA program for <any library>?" — worked example: "I have docker; help me build my first DOCA Flow app." Answered by the modify-a-shipped-sample workflow in
modify plus the canonical build
pattern in ## build. Say that docker / NGC builds and links, but runtime needs a real NIC or DPU.
"What's the right build line for any DOCA library?" — worked example: "How do I compile a program that calls
doca_rdma_*?" Answered by thepkg-config doca-<library>pattern inbuild (C/C++ Track 1) and the
FFI/bindings pattern in Track 2.
"What's the lifecycle every DOCA object follows?" — worked example: "What's the right order of
doca_flow_pipe_*calls in my program?" Answered by the Core order create → configure → start → connect → use → stop → destroy in ## Capabilities and modes (cfg-create/initimplement configure and finish before start)."
DOCA_ERROR_*came back — what does it mean and what do I do?" — worked example: "My code gotDOCA_ERROR_BAD_STATE." Answered by the cross-librarydoca_error_get_descr()rule inError taxonomy
the program-class debug order in
debug.
"My program built and started, but does nothing on the wire." — worked example: "My Flow program runs cleanly but no traffic is matched." Answered by the validate-before-commit rule in
Safety policy
and the layered program-class debug ladder in
debug.
"What does <language> consumer of DOCA look like (FFI / bindings)?" — worked example: "How do I call DOCA Comch from Rust without writing C?" Answered by Track 2 of
build (FFI against the public C
ABI) and the language-neutral lifecycle in
Capabilities and modes.
"How should I classify and build all the shipped DOCA samples and applications? What's the difference between a sample and an application?" — worked example: "I tried to build all DOCA apps and some failed — which ones are real regressions vs missing optional stacks?" Answered by the sample-vs-application model and the category / dependency / skip-vs-fail taxonomy in
sample-and-app-categorization,
which separates "the SDK is broken" from "the optional GPU / RMAX / MPI stack is not on this BlueField".
If the question is env-class (install / build env / hugepages /
devices), route to doca-setup/SKILL.md. If it is
library-specific (Flow pipe topology, RDMA QP setup, DMS service
deploy), layer the matching library skill on top.
Audience
This skill serves external developers building applications that
consume DOCA libraries — i.e., users whose code calls one or more
doca_<library>_* symbols (directly in C/C++, or through FFI /
bindings from another language). It is programming with DOCA,
not programming of DOCA: it is not for NVIDIA developers
contributing to DOCA itself, and it does not assume access to the
DOCA source tree, internal NVIDIA tooling, or any non-public
information. The only inputs it ever points the agent at are the
ones any external user has: the public docs at
docs.nvidia.com/doca/sdk/,
the public catalog at
catalog.ngc.nvidia.com, the
public GitHub repos under
github.com/NVIDIA /
github.com/NVIDIA-DOCA, the
public developer forum, and the on-disk /opt/mellanox/doca tree
that the public DOCA install (or the public NGC DOCA container,
nvcr.io/nvidia/doca/doca) puts on the user's host. Where to find
and how to install questions are routed elsewhere — see Related
skills below.
Language scope. DOCA itself is a C library family; every shipped
sample in /opt/mellanox/doca/samples/ and every shipped reference
application in /opt/mellanox/doca/applications/ is C. C and C++
consumers are the canonical case for every prescriptive workflow in
this skill. Other-language consumers (Rust, Go, Python, …) consume the
same *.so libraries through FFI or language-specific bindings against
the public C ABI; the skill keeps the lifecycle, capability, error,
observability, and safety guidance language-neutral, and routes the
language-specific build / FFI work back to the consumer's own toolchain
without authoring wrappers.
When to load this skill
Load this skill when the user has DOCA installed and the env-class
preconditions are already satisfied (i.e.,
doca-setup/SKILL.md has produced a clean install
where pkg-config doca-<library> resolves, hugepages are mounted, and
devices are visible), and is now asking a question about how to
actually program against DOCA in a library-agnostic way:
Understanding what DOCA's pieces are (libraries, apps, services, tools) and which side of the wire they run on.
The canonical
pkg-config+ meson build pattern any DOCA application follows, regardless of which library it consumes.The universal derive a custom first application from a shipped sample workflow that every library skill extends with library-specific overrides — moved here from
doca-setupbecause it is a programming verb, not an env verb.The universal DOCA Core lifecycle (
create → configure (including permissions and taskset_conf) → start → connect → use → stop → destroy) and how it manifests across libraries. Configuration MUST finish beforedoca_ctx_start(). Connect is its own step after start; do not writeconnect/useas one token.The general
DOCA_ERROR_*pattern,doca_error_t, anddoca_error_get_descr()— the cross-library shape, not Flow- or RDMA-specific overlays.The validate-before-commit rule and the program-side safety policy that every library skill inherits.
Programming patterns that apply to consumers in any language (C/C++ directly, FFI / bindings for Rust / Go / Python / …) — the skill keeps the patterns language-neutral and points the agent at the public C ABI as the authoritative surface.
Do not load this skill for:
"Is my install healthy? Why does
pkg-confignot finddoca-flow? How do I mount hugepages? I don't have DOCA installed yet — can I use a container?" — env-class questions belong indoca-setup/SKILL.md, which owns install verification, env preparation, env-class debugging, and the no-install → NGC container fallback path for any user on macOS, Windows, or Linux without DOCA."What is DOCA? Where is the Flow programming guide? Which package do I install?" — routing / orientation questions belong in
doca-public-knowledge-map/SKILL.md."How do I construct a Flow pipe / set up an RDMA queue / use Comch to send a message?" — library-internal API questions belong in the matching library skill (e.g.
doca-flow/SKILL.md).
What this skill provides
This is a thin loader. The body keeps only the orientation needed to pick the right next file. The substantive material lives in two companion files:
the capabilities companion — what every DOCA program looks like in the abstract: the shape of DOCA (host / DPU / switch, libraries / apps / services / tools, build flavor selection rationale), the universal program lifecycle, the unified version-compat rule that applies to any program linking DOCA, the cross-library
DOCA_ERROR_*taxonomy, the program-side observability surface (DOCA logging, capability snapshots), and the program-side safety policy that every library skill inherits.the tasks companion — step-by-step workflows for the six in-scope programming verbs:
configure,build,modify,run,test,debug. The## modifyverb owns the universal derive a custom first app from a sample pattern that every DOCA library skill extends with library-specific overrides; the## buildverb owns the canonicalpkg-config doca-<library>build pattern in two language tracks (C/C++ direct, non-C via FFI).
This skill assumes doca-setup/SKILL.md has already
produced a clean install. It does not cover env preparation; that
is doca-setup's job, including the no-install → NGC container
(nvcr.io/nvidia/doca/doca) fallback for users on macOS, Windows, or
Linux without DOCA.
What this skill deliberately does not ship
This skill is agent guidance, not a samples or templates bundle. It deliberately does not contain — and pull requests should not add:
Pre-written DOCA application source code, in any language. This includes C / C++ files, Rust crates, Go packages, Python modules, and wrapper code for any other language. The DOCA API surface evolves between releases and code written from documentation prose cannot be verified without compiling / linking / FFI-loading it against the live library on a real install. The verified DOCA application source code is the shipped C samples on the user's installed system; the agent's job is to route the user to that file and prescribe a minimum-diff modification on it (## modify) — for C/C++ users — or to route non-C users to the public C ABI surface that their bindings will call (## build Track 2), not to author the wrapper.
Standalone build manifests (
meson.build,CMakeLists.txt,Cargo.toml,setup.py,go.mod, …) parked inside the skill. The agent constructs the build manifest in the user's project directory against the user's installed DOCA, wherepkg-config --modversion doca-<library>is the source of truth.A
samples/,bindings/, orreference/subtree of any kind. A mock or incomplete artifact in this skill's tree, even one labeled "reference", is misleading: users will read it as buildable.
Loading order
Read this skill first to confirm the user's question is a programming-class question (not env, not routing, not library-API).
For the DOCA shape, the universal lifecycle, the cross-library error taxonomy, the program-side observability surface, and the safety policy that every library skill inherits, see the capabilities companion.
For step-by-step programming workflows —
configure,build,modify,run,test,debug— see the tasks companion.
If the user is asking for a first app in a specific library, walk
through ## modify for the universal
copy-and-edit pattern, then hand off to the library skill (e.g.
doca-flow/SKILL.md) for the library-specific values
to swap.
Related skills
doca-public-knowledge-map/SKILL.md— public DOCA documentation routing and the on-disk layout of an installed DOCA package. This skill defers all "where is X documented", "where on disk is Y", and "how do I check the installed version" questions to the knowledge-map.doca-setup/SKILL.md— env preparation, install verification, env-class debugging, and the I have no install yet procedure with the NGC container (nvcr.io/nvidia/doca/doca) as the universal Stage-1 fallback for any user on macOS, Windows, or Linux without DOCA. This skill assumesdoca-setup's preconditions are already satisfied.doca-flow/SKILL.md— DOCA Flow on BlueField. Extends this skill's## modify(universal first-app derivation) with the Flow-specific list of fields to swap.doca-container-deployment/SKILL.md— shipping an application that already builds: container manifests, rollout, and service-readiness verification. This skill ends once the program compiles and runs locally; it does not cover deploying it.
Files
- ATTRIBUTION.mdAdded by AutoGineer924 B
- BENCHMARK.md10.1 KiB
- CAPABILITIES.md17.5 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md14.0 KiB
- TASKS.md44.8 KiB
- evals/evals.json3.1 KiB
- skill-card.md4.9 KiB
- skill.oms.sig4.9 KiB
CAPABILITIES.md
DOCA programming guide — capabilities, version compatibility, errors, observability, safety
Where to start: Read ## Pattern overview
first to pick the family; then drill into the matching H2. Every
prescriptive section below stays library-agnostic — overlays for a
specific library live in that library's CAPABILITIES.md.
Read this file when the loader sent you here from SKILL.md. For the step-by-step workflows that use the surface described here, see TASKS.md. For env-class equivalents (install profiles, env-class errors, env observability), see doca-setup/SKILL.md. For where to find official documentation, the on-disk install layout, or the Installation Guide, route through doca-public-knowledge-map/SKILL.md.
This file describes the shape every DOCA program shares — the architecture every library plugs into, the lifecycle every library follows, the error pattern every library returns, the observability surface every library emits into, and the safety rules every program must respect. Library-specific overlays live in the matching library skill.
Note: this file references
/opt/mellanox/docaanddocs.nvidia.compaths several times on purpose — the canonical install tree and the canonical docs tree are the two coordinate systems every prescription is anchored against.
Pattern overview
Every program-class question this skill teaches reduces to one of FIVE patterns. Reach for the pattern first; the H2 below it carries the substance.
| Pattern | Class shape | Where it lives |
|---|---|---|
| 1. Plug into the right slot | Host / DPU / Switch; library / app / service / tool — orient the program | ## Capabilities and modes |
| 2. Follow the universal lifecycle | create → configure → start → connect → use → stop → destroy for every DOCA Core context (cfg-create / init implement configure) | ## Capabilities and modes lifecycle subsection |
| 3. Build / link the program | pkg-config doca-<library> (C/C++ direct) OR FFI/bindings against the public C ABI | TASKS.md ## build |
4. Handle DOCA_ERROR_* correctly | doca_error_get_descr() first; never paper over | ## Error taxonomy |
| 5. Validate before commit, observe before "fixing" | Pre-commit validation, log levels, sample-counter discipline | ## Safety policy + ## Observability |
Two principles cut across all five:
Library-agnostic shape, library-specific overlay. This skill prescribes the shape; the matching library skill (e.g.
doca-flow/SKILL.md) overlays the library-specific specifics (Flow pipe topology, RDMA QP semantics, …). Both must be loaded for a complete answer.Programs run with DOCA, not of DOCA. Everything below assumes the user is calling
doca_*from their own code. Patches to DOCA itself are out of scope for this bundle.
Capabilities and modes
DOCA is structured into a small set of orthogonal pieces. The agent must clarify which piece the user is touching before recommending any code or command.
Where the code runs. The same DOCA library can be linked from a program running in any of three locations. Which modes are available on the user's host is an env property and lives in doca-setup CAPABILITIES.md ## Capabilities and modes (doca-setup/CAPABILITIES.md#capabilities-and-modes); which mode the program selects at init time is a programming property and is described here.
| Location | What it is | When the user's program is here |
|---|---|---|
| Host | x86 / Arm host with a BlueField as a SmartNIC, or a host with a ConnectX NIC | Most C / C++ first-app development; building, linking, and running on a developer workstation. The program sees physical ports of the BlueField from the host's view, via PF/VF representors. |
| DPU | Inside the BlueField OS itself (Arm). | Workloads that have to run on the DPU rather than across PCIe. The program sees local network interfaces and (in switch mode) representors of the host's PF/VF. |
| Switch | DPU-side, with the BlueField in switch (DPU) mode. | Multi-tenant steering, full virtual switch on the DPU. The program takes ownership of representors; library-imposed constraints apply (e.g. Flow forbids rte_eth_dev_* configure/start on representors in switch mode — Flow takes them over). |
The library guides describe which mode is meaningful for that library; the agent must clarify which of the three the user's program is in before recommending any port-id, representor, or queue naming.
What kind of artifact you're building. DOCA ships four categories of code; the build / run / debug pattern depends on which one the user's project is.
| Category | Where it lives in an installed tree | What the user does with it |
|---|---|---|
| Library | /opt/mellanox/doca/lib/<arch>-linux-gnu/libdoca_<library>.so | The user's program links against this via pkg-config doca-<library>. The first-app workflow (TASKS.md ## modify) almost always derives from a sample that consumes one library. |
| Sample | /opt/mellanox/doca/samples/doca_<library>/<sample_name>/ | One library, minimal scaffolding. The canonical modify-a-shipped-sample starting point. |
| Reference application | /opt/mellanox/doca/applications/<app>/ | Larger, integrated example combining multiple libraries (e.g. Flow + Telemetry). Useful as a read-only worked example; rarely the right starting point for a first app. |
| Service / tool | /opt/mellanox/doca/services/, /opt/mellanox/doca/tools/ | Long-running processes (services) or CLIs (tools like doca_caps). Not the user's program; the user's program consumes their output. |
The agent's rule: when the user says "first app", the answer always starts from a sample, not from an application or a service. Applications are for reading; samples are for modifying.
Build flavor selection. The pkg-config module name selects which library variant your program links against — same library, different runtime properties. The env-side mechanics (where the trace *.so lives on disk, how to set LD_LIBRARY_PATH) are in doca-setup CAPABILITIES.md ## Capabilities and modes (doca-setup/CAPABILITIES.md#capabilities-and-modes); the program-side rationale for which flavor to pick is here.
pkg-config module | Variant | When to pick it |
|---|---|---|
doca-<library> (e.g. doca-flow) | Release. Optimized, no extra sanitation. | Production and benchmarking. |
doca-<library>-trace (e.g. doca-flow-trace) | Trace build. Enables additional input sanitation, slower, much louder logs. | First-app development. First-time-user errors are caught earlier and surfaced with explicit reasons; switch to release only after the staged run succeeds and you're moving to a performance reading. |
The universal lifecycle. Every DOCA Core context follows
create → configure → start → connect → use → stop → destroy.
The cfg-object calls (cfg-create → cfg-set-* → init) are how
configure is implemented and MUST finish before doca_ctx_start().
Connect is its own step after start; do not mash it into use.
Library skills name which specific API calls correspond to each phase.
| Phase | What it means | What goes wrong if you skip it |
|---|---|---|
cfg-create | Allocate a configuration object (doca_<library>_cfg_*). Part of configure. | NULL deref on the cfg pointer. |
cfg-set-* | Populate the configuration with the user's settings (mode, capabilities, callbacks). Part of configure. | The library defaults what you didn't set — usually not what you meant. |
init / create | Materialize the actual library object from the populated cfg. Completes configure. | Calls that need the object return DOCA_ERROR_BAD_STATE. |
start | Move the object into a started state. | connect / use-phase calls return DOCA_ERROR_BAD_STATE. |
connect | For Core contexts with a peer: establish the connection after start, before use. | use-phase tasks fail; answers that write connect/use as one token skip this step. |
use | The library-specific work — pipe entries, queue ops, channel sends, etc. | Library-specific symptoms (no traffic, dropped packets, hung sends). |
stop + destroy | Reverse-order tear-down; release in the inverse order of acquisition. | Resource leaks; on next run, capability discovery may report exhausted budgets. |
The agent's rule: never recommend a use-phase call before confirming the object is in started state, and never recommend re-creating an object that hasn't been destroyed. For a DOCA Core context the named order is create → configure → start → connect → use → stop → destroy. Task configuration and permission setting belong in configure (cfg-set-*) and MUST complete before doca_ctx_start(). Libraries with a peer add connect after start and before use — name it as its own step.
Version compatibility
For the canonical DOCA version-detection chain, the four-way match rule, NGC container semantics, the headers-win-over-docs rule, and the routing to the DOCA Compatibility Policy, see doca-version/SKILL.md. The body lives there; this skill does not duplicate it.
The program-side overlay layers on top of the verified version:
Quote the version observed, never "latest" and never agent memory. API names, sample filenames, and capability availability all depend on the user's installed version. Per the safety policy in
doca-version CAPABILITIES.md ## Safety policy(doca-version/CAPABILITIES.md#safety-policy), a recommendation that quotes a version-pinned URL or invents a feature based on agent memory is the bundle's primary hallucination failure mode.For non-C consumers (FFI / bindings). The binding tooling generates declarations from the headers at build time. Re-generate after any DOCA upgrade — bindings pinned to a stale header will compile but call into the new
*.sowith mismatched signatures, returningDOCA_ERROR_INVALID_VALUEor, worse, silent corruption.Use the per-library
doca_<library>_cap_*query family at runtime as the authoritative answer for "is this capability supported on this device + this install". The version-matrix is the promise; the cap query is the reality. When they disagree, the cap query wins — seedoca-version TASKS.md ## test(doca-version/TASKS.md#test) step 3.
Error taxonomy
Every DOCA library returns a doca_error_t from any call that can fail. The error family is library-agnostic at the type level; library-specific overlays (e.g. which DOCA_ERROR_* Flow returns from which call, with what recovery) live in the matching library skill.
The general taxonomy the agent must recognize:
doca_error_t value | Meaning | Programming-side response |
|---|---|---|
DOCA_SUCCESS | The call succeeded. | Continue. |
DOCA_ERROR_INVALID_VALUE | One of the arguments is malformed (NULL where required, out-of-range, mismatched type). | The bug is in the program, not the library. Check the call's documentation in the library guide; correct the argument; re-validate. |
DOCA_ERROR_BAD_STATE | The object is not in a state where this call is meaningful (e.g. start before init, use before start). | Lifecycle order is wrong. Walk the call sequence against the universal lifecycle in ## Capabilities and modes; fix the order. |
DOCA_ERROR_NOT_SUPPORTED | The hardware / firmware / mode does not implement this feature on this host. | Re-run capability discovery (doca_caps, the library's own capability-query API). The agent must not attempt code workarounds; either change the program's intent, switch hardware/mode, or escalate. |
DOCA_ERROR_NO_MEMORY | Allocation failed. | Out-of-memory at the system level (rare during first-app development) or out of a library-managed pool. The library skill names the relevant pool / budget. |
DOCA_ERROR_TIME_OUT | An async operation did not complete in time. | Increase the timeout if intended; investigate why the underlying operation is slow if not. |
DOCA_ERROR_INITIALIZATION | Library / object initialization itself failed. | Almost always a missing prerequisite (driver, capability, peer). Walk through the library's ## configure workflow; do not retry blindly. |
DOCA_ERROR_DRIVER | The underlying driver / firmware reported failure. | Capture state and route to env-class debug (doca-setup ## debug (doca-setup/TASKS.md#debug)) — the layer below DOCA is the suspect, not the program. |
DOCA_ERROR_UNKNOWN | Internal error not mappable to the taxonomy. | Capture state and escalate through doca-debug ## debug (doca-debug/TASKS.md#debug); do not paper over with a retry loop. |
For any returned doca_error_t other than DOCA_SUCCESS, the agent's first step is to call doca_error_get_descr(err) and quote the actual descriptor string — never paraphrase from memory. The descriptor is the library's own statement of what went wrong; library-specific guides can refine it but cannot contradict it.
The env-class error surface (missing *.pc, hugepages not mounted, representor not visible) is separate and lives in doca-setup CAPABILITIES.md ## Error taxonomy (doca-setup/CAPABILITIES.md#error-taxonomy). The agent's debug order is always env first (doca-setup ## debug (doca-setup/TASKS.md#debug) layers 1–4), then program (TASKS.md ## debug layers 2–5).
Observability
Every DOCA program has access to the same shared observability surface; library-specific surfaces (Flow counters, RDMA queue stats, …) extend it.
Logging. DOCA libraries log via the doca_log_register_* API and emit to stderr by default. The CLI flag --sdk-log-level <level> (or the equivalent programmatic call doca_log_backend_set_sdk_level()) controls verbosity:
30(DOCA_LOG_LEVEL_INFO) — quiet, production default.50(DOCA_LOG_LEVEL_DEBUG) — useful debug detail.70(DOCA_LOG_LEVEL_TRACE) — every call traced; the right setting for any first run of any new code path.
The trace build flavor enables additional sanitation that surfaces as log lines at DEBUG / TRACE level the release flavor would not emit.
Capability snapshots. doca_caps (CLI) and the library's own capability-query API (programmatic) are the source of truth for what this program can attempt on this host. Capture both at the start of any debugging session; a stale capability picture is a leading cause of "it worked yesterday".
Library-specific surfaces. Pipe counters, queue statistics, channel send / recv counters, and tracing dumps are owned by each library. The library skill names the call (e.g. doca_flow_pipe_query) and the right cadence to query it; this skill does not duplicate that.
Where logs go in long-running services. DOCA services (DTS, telemetry exporter, etc.) configure their own log paths. Check /var/log/doca* or the service's own README before assuming output is missing; do not assume stderr.
Safety policy
DOCA programs share state with the system, the device, and (in production) other tenants on the same fabric. The cross-library safety rules every library skill inherits:
Validate before commit. Every library that programs hardware exposes a validate call separate from the commit / start / program call. Use validate first; never enter a commit path with an un-validated spec. Library skills extend this with library-specific what to validate (Flow validates pipe specs; RDMA validates queue-pair attributes; Comch validates channel cfg).
Stage first, widen later. Run any new program against the smallest possible scope first — one representor, one queue, one channel. Read the output. Only after the staged run succeeds may the user widen the scope. The library's unit of damage (a representor for Flow, a QP for RDMA, a channel for Comch) defines what "smallest scope" means; the library skill names it.
Trace flavor for development; release flavor for performance. The
-tracebuild variant adds runtime sanitation that is invaluable while learning the API surface but introduces measurable overhead. Make the switch to release a deliberate, documented step before any performance reading is taken seriously.Quote the version on every API claim. Capability availability changes between releases. Statements of the form "this works in DOCA 3.3" must come from the user's installed
pkg-config --modversion doca-<library>, not from agent memory or a public docs page that may describe a different release.Respect the env-side safety policy. Hugepage changes, eswitch mode changes,
mlxconfigresets, BFB updates — all are global system state. The env-side rules indoca-setup CAPABILITIES.md ## Safety policy(doca-setup/CAPABILITIES.md#safety-policy) bind every program; no library override changes them.Never auto-modify the install tree.
/opt/mellanox/doca/lib*/is the release. Programs link against it; programs do not rewrite it. Build flavor changes go viaLD_LIBRARY_PATHor the-tracepkg-configmodule, never by editinglib/.Trust the C ABI as the source of truth, even from non-C languages. Wrappers, FFI bindings, and codegen toolchains all eventually call the same
libdoca_<library>.sothe C samples link against. A binding-side decision that contradicts the public C ABI's lifecycle, error handling, or capability gate is wrong even if the binding compiles cleanly; the symptoms surface at runtime asDOCA_ERROR_BAD_STATEorDOCA_ERROR_INVALID_VALUEfrom the underlying C call.
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.
The author says: No DOCA install required to read this skill (it is an overlay loaded against any DOCA artifact skill); the validation steps within DO require a live DOCA install at /opt/mellanox/doca.
Security
What our scanner noticed· Medium risk
- Large base64-encoded blobs
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
- Publisher
- NVIDIA (Official)
- Source
- NVIDIA/skills · skills/doca-programming-guide · 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.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download doca-programming-guide.zip