Generated banner for Nvshmem Configure Nic Pe Mapping
Generated logo for Nvshmem Configure Nic Pe Mapping

Nvshmem Configure Nic Pe Mapping

NVIDIAOfficialCreated by NVIDIA NVSHMEM Team

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

From the author

Recommend NVSHMEM NIC-to-PE mappings and environment exports. Use for HCA selection, multi-NIC configuration, or topology-based mapping diagnostics.
— the description by NVIDIA NVSHMEM Team

From the skill’s files

Taken from the skill’s own files (its description, section headings and stated usage). Not an AutoGineer summary, and not written by the author as one.

Recommend NVSHMEM NIC-to-PE mappings and environment exports. Use for HCA selection, multi-NIC configuration, or topology-based mapping diagnostics. Produce a reproducible recommendation from the target node's actual GPU/NIC topology. Do not promise a performance improvement; present the mapping as a topology-informed starting point that must be validated.

What it does

  • Purpose
  • Requirements
  • Inputs
  • Scripts
  • Read the Required References
  • Instructions

When to use it

  • Use for HCA selection, multi-NIC configuration, or topology-based mapping diagnostics.

Advantages

The skill’s files do not state this.

Usage examples

“My 4 local PEs are bound to GPUs 0–3. Given this target-node collector output and NVSHMEM 3.8.0 IBRC, recommend the closest balanced InfiniBand port mapping and exact exports.”
The agent follows the skill's steps for this request, as the skill's files describe.
“We have 2 PEs and 5 active Ethernet/RoCE ports. Use this PE-to-GPU binding and initialization log to show the supported subset and multi-NIC alternatives without selecting one silently.”
The agent follows the skill's steps for this request, as the skill's files describe.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/nvshmem-configure-nic-pe-mapping/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip nvshmem-configure-nic-pe-mapping.zip -d .agents/skills

Documentation by NVIDIA NVSHMEM Team

Tune NVSHMEM NIC-to-PE Mapping

Purpose

Produce a reproducible recommendation from the target node's actual GPU/NIC topology. Do not promise a performance improvement; present the mapping as a topology-informed starting point that must be validated.

Requirements

  • Use an allocated target compute node with visible GPUs and RDMA devices; do not use login-node topology as evidence.

  • Make nvidia-smi and /sys/class/infiniband readable on that node. If /sys is unavailable, make ibv_devinfo available or provide equivalent per-port evidence.

  • Provide the NVSHMEM installation prefix, make nvshmem-info available on the target node, or supply the installed NVSHMEM version explicitly.

  • Use the bundled read-only collector when possible. It requires no API keys, credentials, package installation, or writable filesystem access.

Inputs

Resolve every required input before emitting exact exports. If values from different sources conflict, identify the conflict and request clarification rather than selecting a value silently.

Required inputs
  • NVSHMEM version: Prefer the user-confirmed installed version; otherwise use the collector's [nvshmem-version] output, then nvshmem-info -n on the target node. Retain the complete reported version after normalizing a leading v.

  • Remote transport: Prefer the explicitly selected transport for the target run; otherwise use the target node's NVSHMEM initialization log. Do not infer a transport from topology; request a log when automatic selection is ambiguous.

  • Local PE count: Prefer observed per-rank logs, then launcher configuration, then an explicit user-provided count. Confirm that all evidence describes the same node allocation.

  • Ordered local PE -> GPU index or PCI BDF binding: Prefer observed per-rank binding logs, then launcher binding configuration, then an explicit user mapping. Use CUDA_VISIBLE_DEVICES only when its rank order is explicitly established.

  • Target-node GPU/NIC and HCA-port topology: Prefer the newest complete output from scripts/collect-nic-topology.sh on the target node. Otherwise use the listed nvidia-smi commands plus per-port /sys/class/infiniband or ibv_devinfo evidence. Include GPU and NIC PCI BDFs, port state, and link layer.

Optional inputs
  • Requested link layer: Use the user's explicit InfiniBand or Ethernet/RoCE preference. If absent, choose from observed active ports as described in step 5.

  • Excess-port policy: Use the user's explicit request to select a closest subset or use multiple NICs per PE. If absent, present supported alternatives conditionally and make no selection.

  • Current official documentation or citations: Obtain only when the user requests them or the version/transport matrix is insufficient. Use $nvshmem-docs for that check.

Scripts

ScriptUseInvocation
scripts/collect-nic-topology.shCollect read-only NVSHMEM version, GPU PCI, GPU/NIC topology, and RDMA-port evidence. It emits all evidence to stdout and may exit nonzero after producing useful partial output.Resolve the script from this skill directory and invoke run_script("scripts/collect-nic-topology.sh", "--prefix", "/absolute/nvshmem/prefix") when the prefix is known, or omit --prefix to use environment/PATH discovery.

Read the Required References

  • Read references/version-transport-matrix.md before interpreting or emitting any mapping variable.

  • Read references/topology-and-output.md before ranking NICs or formatting a recommendation.

  • Treat the bundled NVSHMEM 3.8 or later BLOCK contract as authoritative within its recorded transport scope. Do not invoke $nvshmem-docs merely to revalidate behavior that this contract resolves, including for releases later than 3.8.

Instructions

1. Resolve the NVSHMEM Version and Transport

Obtain the version from the user first. Otherwise use the collector's [nvshmem-version] evidence or run nvshmem-info -n when it is already available on the target node. Normalize a leading v and retain the complete reported version.

Classify the release as:

  • 3.7 or earlier;

  • 3.8 or later.

Do not assume latest or silently treat an unknown version as 3.8. If the version remains unknown, request the installed version before continuing.

Determine the selected remote transport: IBRC, IBDevX, IBGDA, GPUNetIO, UCX, or libfabric. If automatic selection makes the transport ambiguous, ask for the relevant initialization log or the intended transport.

2. Resolve Documentation Uncertainty

Use references/version-transport-matrix.md as the default authority for mapping behavior. Do not invoke $nvshmem-docs when the matrix or the bundled NVSHMEM 3.8 or later BLOCK contract resolves the version, transport, feature gate, and required mapping controls, including for a release later than 3.8.

Invoke the sibling $nvshmem-docs skill at ../nvshmem-docs/SKILL.md only when the matrix and bundled contract are insufficient or conflicting, exact feature-version applicability remains unclear, or the user explicitly requests live official documentation or citations. Follow that skill's version and citation workflow.

If a documentation check is needed but the sibling skill, an HTTPS retrieval tool, or the live official pages are unavailable:

  • continue from the matrix only when it resolves the needed behavior;

  • otherwise withhold final exports and identify the unresolved behavior;

  • label Documentation freshness: unverified only when a documentation check was attempted;

  • state which official routes could not be checked; and

  • never invent a behavior that the matrix does not establish.

When a documentation check is performed, report the exact documentation edition consulted and any remaining uncertainty. Otherwise identify the applicable matrix section as the basis for the recommendation.

3. Collect Topology Evidence

When already running on the target compute node, tell the user that the skill is running a read-only collector. Before its first invocation in the current checkout, inspect the complete bundled collector script. Run only that inspected file; if it is unavailable or incomplete, do not execute it. Then run:

run_script("scripts/collect-nic-topology.sh")

When the NVSHMEM installation prefix is known, pass its absolute path explicitly:

run_script("scripts/collect-nic-topology.sh", "--prefix", "/opt/nvshmem")

Replace the example path with the absolute prefix. Without --prefix, discovery uses NVSHMEM_PREFIX, then nvshmem-info on PATH. Prefix libraries are scoped to that query. Exit 2 indicates incomplete evidence.

When not on the target node, ask the user for the collector's complete output from the target node. If the script is unavailable remotely, request all of:

nvshmem-info -n
nvidia-smi --query-gpu=index,pci.bus_id,name --format=csv,noheader
nvidia-smi topo -m

Also request, for every candidate HCA port, its HCA name, port number, PCI BDF, state, and link layer from /sys/class/infiniband or ibv_devinfo.

Do not run a collector from a login node and treat that topology as compute-node evidence.

4. Establish PE Placement

Obtain the number of local PEs per node. Assume nodes are homogeneous only after stating that assumption.

Obtain the ordered local PE -> GPU index or PCI BDF binding from explicit user input, launcher configuration, CUDA_VISIBLE_DEVICES, or per-rank logs. Do not infer a local PE's GPU solely from PE count or the order displayed by nvidia-smi topo -m.

If the binding is ambiguous, request it before producing an exact closest-NIC mapping. A conditional table is acceptable, but final exports are not. Do not bypass the missing binding by duplicating every usable NIC for every PE; that adds non-closest paths and is a different multi-port policy. Consider such an all-ports assignment only after the user explicitly requests it and accepts the distance tradeoff.

5. Filter and Rank Candidate Ports

Treat an HCA port, not merely an HCA device, as the selectable NIC unit.

  • Exclude inactive or physically down ports and record why each was excluded.

  • Partition active ports by link layer. Do not mix InfiniBand with Ethernet/RoCE by default.

  • Honor an explicitly requested link layer. Otherwise choose the larger active partition; prefer InfiniBand on an exact tie. Ask the user if that default conflicts with their fabric or provider intent.

  • Rank each bound GPU-to-port pair by PIX < PXB < PHB < NODE < SYS from nvidia-smi topo -m.

  • Break equal-distance choices by lower assigned-port load, then canonical hca:port order.

  • Share a port when fewer usable ports than PEs makes sharing necessary, while preserving distance first and balance second.

6. Resolve Excess NICs Explicitly

When usable NIC ports outnumber local PEs, stop before final exports and ask whether to:

  1. select the closest balanced subset; or

  2. use multiple NICs per PE.

Offer option 2 only when the resolved version and transport support it according to the matrix. Explain whether multi-NIC requires automatic distance assignment or supports an explicit BLOCK mapping. If the user does not answer, show both supported alternatives as conditional recommendations and do not choose silently.

If the user asked to use all NICs but the resolved version/transport does not support multi-NIC, explain the restriction and request approval to use the closest subset. Do not treat the unsupported request as implicit approval for a subset, and do not emit final exports until the user confirms it. When only the subset is supported, present that single supported choice for confirmation instead of offering a disabled multi-NIC option.

7. Synthesize Exactly One Selection Mechanism

Prefer NVSHMEM_HCA_PE_MAPPING for exact assignments. Use NVSHMEM_HCA_LIST only when selecting an eligible set and accepting transport-canonical ordering. Never set both variables.

Apply the version/transport rules in the matrix exactly:

  • For 3.7 and earlier, preserve one expanded mapping slot per PE for explicit IB mappings. Use automatic distance assignment for supported multi-NIC paths.

  • For 3.8 or later, apply the bundled BLOCK contract: set NVSHMEM_ENABLE_NIC_PE_MAPPING=1 for explicit assignments and NVSHMEM_ENABLE_MULTI_PORT=1 whenever recommending more than one NIC per PE.

  • For UCX and libfabric, explain the provider-controlled boundary and do not fabricate common-HCA exact mappings.

Build NVSHMEM_HCA_PE_MAPPING with explicit hca:port:count entries. Expand every count before explaining which slots each PE receives. Preserve duplicates when intentional sharing is required.

Keep a mapping-only export block limited to NIC-assignment controls. Do not add NVSHMEM_REMOTE_TRANSPORT or provider/launcher settings merely because the transport is known; include them only when the user separately asks to select the transport and the matrix, or documentation when needed, verifies the value.

8. Return the Recommendation

Execute the Output Contract in order; that reference is the single authority for output fields, formatting, withholding messages, and validation guidance.

Treat its Mapping and Exact Exports sections as mandatory gates. Do not return until each gate is either completed or explicitly withheld for the reason allowed by the contract. Do not duplicate or paraphrase the contract in this file.

Examples

  • “My 4 local PEs are bound to GPUs 0–3. Given this target-node collector output and NVSHMEM 3.8.0 IBRC, recommend the closest balanced InfiniBand port mapping and exact exports.”

  • “Interpret this nvidia-smi topo -m and per-port state/link-layer output. NVSHMEM is 3.7 with IBGDA; identify whether multiple NICs per PE are supported and what extra evidence is needed before emitting exports.”

  • “We have 2 PEs and 5 active Ethernet/RoCE ports. Use this PE-to-GPU binding and initialization log to show the supported subset and multi-NIC alternatives without selecting one silently.”

Troubleshooting

SymptomResponse
The collector reports status=partial, an unknown NVSHMEM version, missing GPUs, or no HCA ports.Re-run it on an allocated target compute node with the intended NVSHMEM installation and NVIDIA/RDMA device visibility. Paste the complete labeled output; a nonzero exit may still contain usable evidence.
No exact mapping can be produced.Obtain the NVSHMEM version, resolved remote transport, local PE-to-GPU binding, and active-port evidence. Give only conditional guidance until all are available.
Ports have mixed link layers or a requested port is inactive.Exclude inactive ports and select one link-layer partition unless the user explicitly requests another supported fabric.
NVSHMEM behavior is unclear for the selected version or transport.Check the version/transport matrix first, then invoke $nvshmem-docs only if it remains insufficient or the user requires current official citations.
Logs select unexpected ports after applying the mapping.Verify the export block, PE binding, selected transport, and provider constraints; compare against the unforced automatic configuration before changing other settings.

Limitations

  • Limit recommendations to the observed target-node topology and port state; repeat evidence collection after hardware, fabric, launcher, or binding changes.

  • Treat topology proximity as a selection heuristic, not a performance guarantee; validate with a representative workload.

  • Do not produce an exact mapping until the NVSHMEM version, transport, local PE-to-GPU binding, and usable-port evidence are resolved.

  • For UCX and libfabric, remain within the provider-controlled boundary and do not fabricate common-HCA mapping settings.

Guardrails

  • Do not select inactive ports or silently mix link layers.

  • Do not assume that a numerically matching GPU and NIC index implies proximity.

  • Do not turn an unknown PE-to-GPU binding into an all-ports-per-PE mapping.

  • Do not emit 3.8-or-later BLOCK behavior for 3.7 or earlier.

  • Do not emit legacy IBGDA multi-port controls as the primary 3.8-or-later control.

  • Do not generate provider-native UCX or libfabric settings; explain them without inventing values.

  • Do not overwrite user files or change the system while collecting evidence.

<!-- ci trigger -->

Files

LICENSE

Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.


                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

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 an API key, Needs Node.js

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

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 NVSHMEM Team
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/nvshmem-configure-nic-pe-mapping · 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 NVSHMEM Team or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nvshmem-configure-nic-pe-mapping.zip