From bf5171eb40a4b9e3c357d6e74bab011c3bbb9386 Mon Sep 17 00:00:00 2001 From: Alex Barghi <105237337+alexbarghi-nv@users.noreply.github.com> Date: Fri, 6 Nov 2026 13:25:24 -0800 Subject: [PATCH 1/3] Add cuGraph workflow acceleration skill and distributed walkthroughs Signed-off-by: Alex Barghi <105237337+alexbarghi-nv@users.noreply.github.com> --- docs/cugraph-development/README.md | 46 ++++++ docs/cugraph-development/VALIDATION.md | 23 +++ .../tests/test_smoke_fixture.py | 62 ++++++++ .../BENCHMARK.md | 10 ++ skills/accelerated-computing-cugraph/SKILL.md | 49 +++++++ .../evals/evals.json | 101 ++++++++++++++ .../references/distributed-dask.md | 72 ++++++++++ .../references/distributed-pylibcugraph.md | 92 ++++++++++++ .../references/gnn-routing.md | 18 +++ .../references/single-gpu.md | 79 +++++++++++ .../references/sources.md | 26 ++++ .../scripts/pagerank_dask.py | 60 ++++++++ .../scripts/pagerank_mg.py | 132 ++++++++++++++++++ .../scripts/smoke_fixture.py | 59 ++++++++ .../skill-card.md | 48 +++++++ 15 files changed, 877 insertions(+) create mode 100644 docs/cugraph-development/README.md create mode 100644 docs/cugraph-development/VALIDATION.md create mode 100644 docs/cugraph-development/tests/test_smoke_fixture.py create mode 100644 skills/accelerated-computing-cugraph/BENCHMARK.md create mode 100644 skills/accelerated-computing-cugraph/SKILL.md create mode 100644 skills/accelerated-computing-cugraph/evals/evals.json create mode 100644 skills/accelerated-computing-cugraph/references/distributed-dask.md create mode 100644 skills/accelerated-computing-cugraph/references/distributed-pylibcugraph.md create mode 100644 skills/accelerated-computing-cugraph/references/gnn-routing.md create mode 100644 skills/accelerated-computing-cugraph/references/single-gpu.md create mode 100644 skills/accelerated-computing-cugraph/references/sources.md create mode 100644 skills/accelerated-computing-cugraph/scripts/pagerank_dask.py create mode 100644 skills/accelerated-computing-cugraph/scripts/pagerank_mg.py create mode 100644 skills/accelerated-computing-cugraph/scripts/smoke_fixture.py create mode 100644 skills/accelerated-computing-cugraph/skill-card.md diff --git a/docs/cugraph-development/README.md b/docs/cugraph-development/README.md new file mode 100644 index 000000000..9861aa945 --- /dev/null +++ b/docs/cugraph-development/README.md @@ -0,0 +1,46 @@ + + + +# cuGraph skill development and upstream handoff + +The implementation is staged at `skills/accelerated-computing-cugraph/` in a private standalone copy of NVIDIA/skills. GitHub does not allow a private fork of a public repository. Keep NVIDIA/skills as the upstream remote; this copy is for review and development, not a public catalog source. + +## Repository requirements observed on 2026-11-06 + +NVIDIA/skills is a **catalog**, with skill content synchronized from product-owned source repositories. See root CONTRIBUTING.md, components.d/README.md, .github/PULL_REQUEST_TEMPLATE.md, and .github/scripts/verify_source_onboarding.py. + +The implementation uses the required flat directory layout, name/description frontmatter, permitted licenses, a skill card, and an evaluation dataset. Its measured benchmark and signature are deliberately pending. Do not copy an old signature or mark a benchmark PASS without measurements. + +Before upstream onboarding: + +1. The owning team selects a **public NVIDIA-owned GitHub source repository** and clears the derived content and roadmap statements for open-source release. The internal reference and this private personal copy are not eligible catalog sources. +2. Move this skill into that source repository's root `skills/` directory. Keep attribution and licenses. Confirm dependencies and licensing with the owning team; this draft does not attest approvals on their behalf. +3. Run CPU tests and Linux GPU validation: single-GPU semantics, 2-GPU direct and Dask fixtures, 2-node/4-GPU fixtures, empty partitions, and coordinated failure handling. Add a nonuniform weighted graph with dangling/isolated vertices and compare to CPU/SG oracles. Record the exact package lock, GPU/network hardware, commands, logs and tolerances. +4. Run the agent evaluations in `evals/evals.json` through the source team's current NVSkills pipeline. Update the skill card and measured BENCHMARK.md. Obtain a real `skill.oms.sig` covering the final files. The catalog gate requires a measured PASS verdict, eval data, card, and valid signature/content hashes. +5. Register `components.d/cugraph.yml` with the actual public source repository/ref/path and unique `catalog_dir: accelerated-computing-cugraph`. The catalog generates its README, marketplace metadata, versions, and plugin copies. Do not hand-edit generated copies or invent a source location now. +6. Sign off commits with DCO. For fork-based source PRs, follow CONTRIBUTING.md's current NVSkills workflow, service-account access, and maintainer `/nvskills-ci` trigger requirements. A catalog-only registration PR has different signing setup requirements. + +This private draft is intentionally not added to components.d or catalog-exceptions.yml. An unregistered directory would be pruned by the catalog sync workflow. **Do not enable inherited catalog automation in this private development copy.** Its workflows are disabled when creating the private repository. Product onboarding, signing, benchmark PASS, and public-release approval remain required before claiming repository compliance. + +## Local validation + +From the repository root: + +```bash +python3 -m unittest discover -s docs/cugraph-development/tests -v +python3 -m compileall -q skills/accelerated-computing-cugraph/scripts +python3 skills/accelerated-computing-cugraph/scripts/pagerank_mg.py --help +python3 skills/accelerated-computing-cugraph/scripts/pagerank_dask.py --help +python3 skills/skill-card-generator/scripts/validate_submission.py \ + skills/accelerated-computing-cugraph/skill-card.md +``` + +The skill-creator `quick_validate.py` can also check frontmatter when available. The script checks are intentionally GPU-free; they do not validate CUDA, NCCL, cuGraph results, or distributed runtime behavior. Follow both distributed references for hardware checks. + +## Design decisions + +- Explicit cuGraph/pylibcugraph acceleration, no nx-cuGraph dispatch path. +- Kumo Engine recommended for GNNs; cuGraph-PyG scoped to distributed training and existing-stack maintenance. +- Dask shown as transitional, with a direct communicator-backed alternative. +- 26.10 source-verified APIs, including the optional-edge-ID MGGraph expensive-check workaround. +- Fresh examples and evaluations; no inherited benchmark success or signature. diff --git a/docs/cugraph-development/VALIDATION.md b/docs/cugraph-development/VALIDATION.md new file mode 100644 index 000000000..6ab4aad23 --- /dev/null +++ b/docs/cugraph-development/VALIDATION.md @@ -0,0 +1,23 @@ + + + +# Validation record — 2026-11-06 + +Base NVIDIA/skills commit: `c663e5799366d945a70a40b1ab18cedfc817495c`. +API source: cuGraph v26.10.00, `8ff922fabf4521cf540a7ac3cfae857f7edc6f10`. +Internal reference: RAPIDS/rapids-agent-skills `4672643da793932d4c8351f0bea35c724f4c1710`. + +Passed locally on macOS (CPU only): + +- Four unittest cases: disjoint fixture coverage at 1/2/4/16 ranks including empty ranks; order-independent correct result acceptance; missing/duplicate/nonfinite/wrong-result rejection; existing input directory protection. +- All three Python scripts compile; both GPU runners expose help without importing GPU packages. +- Python code blocks parse; all local Markdown links resolve. +- Eleven evaluation records parse and have unique IDs (ten positive, one negative). +- Skill frontmatter validation and repository skill-card unresolved-marker check. +- Whitespace/diff checks. + +Not run: Linux CUDA execution, SG/MG numerical equivalence, Dask runtime, NCCL transport, multi-node launch, failure injection, performance measurement, agent effectiveness benchmark, or NVSkills signing. The cycle fixture checker was tested with synthetic expected outputs; this is not a claim that GPU PageRank produced those outputs. + +Initial validation encountered missing PyYAML and a system Python cache path outside the writable workspace. PyYAML was installed in an isolated workspace venv; compilation was rerun with a temporary cache prefix. No system Python configuration was changed. + +Catalog submission is not yet eligible: public NVIDIA-owned source placement, release clearance, measured benchmark PASS and final signed manifest remain pending. See README.md for the handoff. diff --git a/docs/cugraph-development/tests/test_smoke_fixture.py b/docs/cugraph-development/tests/test_smoke_fixture.py new file mode 100644 index 000000000..e547e3fc4 --- /dev/null +++ b/docs/cugraph-development/tests/test_smoke_fixture.py @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +import csv +import importlib.util +from pathlib import Path +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[3] +spec = importlib.util.spec_from_file_location( + "smoke_fixture", ROOT / "skills/accelerated-computing-cugraph/scripts/smoke_fixture.py" +) +fixture = importlib.util.module_from_spec(spec) +spec.loader.exec_module(fixture) + + +class FixtureTests(unittest.TestCase): + def test_partition_coverage_and_empty_ranks(self): + for ranks in (1, 2, 4, 16): + with self.subTest(ranks=ranks), tempfile.TemporaryDirectory() as temp: + directory = Path(temp) / "input" + fixture.write_fixture(directory, ranks, 12) + edges = [] + for rank in range(ranks): + with (directory / f"edges-{rank}.csv").open() as file: + for row in csv.DictReader(file): + src, dst = int(row["src"]), int(row["dst"]) + self.assertEqual(src % ranks, rank) + edges.append((src, dst)) + self.assertEqual(sorted(edges), [(i, (i + 1) % 12) for i in range(12)]) + + def write_results(self, directory, rows): + with (directory / "part-0.csv").open("w", newline="") as file: + writer = csv.writer(file) + writer.writerow(["vertex", "pagerank"]) + writer.writerows(rows) + + def test_exact_solution_and_reordered_ids(self): + with tempfile.TemporaryDirectory() as temp: + directory = Path(temp) + self.write_results(directory, [(i, 1 / 12) for i in reversed(range(12))]) + fixture.check_results(directory, 12) + + def test_rejects_incomplete_duplicate_nonfinite_and_wrong_results(self): + good = [(i, 1 / 12) for i in range(12)] + cases = [good[:-1], good + [good[0]], [(0, float("nan"))] + good[1:], + [(0, 0.5)] + good[1:], []] + for rows in cases: + with self.subTest(rows=rows), tempfile.TemporaryDirectory() as temp: + directory = Path(temp) + self.write_results(directory, rows) + with self.assertRaises(ValueError): + fixture.check_results(directory, 12) + + def test_does_not_overwrite_existing_fixture(self): + with tempfile.TemporaryDirectory() as temp: + with self.assertRaises(FileExistsError): + fixture.write_fixture(Path(temp), 2, 12) + + +if __name__ == "__main__": + unittest.main() diff --git a/skills/accelerated-computing-cugraph/BENCHMARK.md b/skills/accelerated-computing-cugraph/BENCHMARK.md new file mode 100644 index 000000000..1114a9f55 --- /dev/null +++ b/skills/accelerated-computing-cugraph/BENCHMARK.md @@ -0,0 +1,10 @@ + + + +# Evaluation status + +**Overall verdict: NOT RUN** + +This is a new implementation. The prior RAPIDS skill's measurements and signature do not apply to it. No agent-effectiveness benchmark or NVIDIA GPU integration test has been run. No speedup is claimed. + +Before catalog submission, run the owning team's NVSkills evaluation pipeline on this exact content and replace this file with its measured results. Sign only after all evaluated artifacts, including this file and skill-card.md, are final. See `docs/cugraph-development/README.md` in the development repository for onboarding gates and runtime validation commands. diff --git a/skills/accelerated-computing-cugraph/SKILL.md b/skills/accelerated-computing-cugraph/SKILL.md new file mode 100644 index 000000000..7fcc667a1 --- /dev/null +++ b/skills/accelerated-computing-cugraph/SKILL.md @@ -0,0 +1,49 @@ +--- +name: accelerated-computing-cugraph +description: Accelerate existing graph analytics workflows with NVIDIA cuGraph and pylibcugraph, preserving graph semantics and validating GPU results. Use for PageRank, traversal, community detection, centrality, similarity, and single- or multi-node GPU graph analytics; route GNN training requests to the appropriate engine. +license: CC-BY-4.0 AND Apache-2.0 +metadata: + author: NVIDIA +--- + +# Accelerate graph workflows with cuGraph + + + + +Move the expensive graph operations in an existing workflow onto GPUs while preserving its input IDs, graph semantics, algorithm parameters, and downstream output contract. Prefer a small explicit migration over rewriting unrelated stages. + +## Choose the execution path + +| Workload | Path | +|---|---| +| Existing CPU/NetworkX analytics; cuDF edge lists | Explicit `cugraph` graph construction and algorithms | +| Device arrays, control over resources, integration into GPU pipelines | `pylibcugraph.SGGraph` and algorithms | +| Graph distributed across GPUs or nodes | `pylibcugraph.MGGraph` with one process per GPU and initialized cuGraph communicators | +| Maintaining a current Dask graph analytics deployment | `cugraph.dask`, as a transitional compatibility path | +| GNN training or relational ML without a distributed-training requirement | Recommend Kumo Engine; verify the requested model/task is supported | +| GNN training requiring multiple GPUs and/or nodes | Consider cuGraph-PyG for that requirement; verify the pinned release and plan migration | + +Do not introduce nx-cuGraph, NetworkX backend dispatch, or autoconfiguration as an acceleration path. NetworkX remains useful as a small-graph CPU correctness oracle. Do not treat distributed analytics as GNN training or redirect PageRank to Kumo Engine. + +Roadmap guidance supplied for this skill on 2026-11-06: nx-cuGraph and the cuGraph Dask API are approaching deprecation; cuGraph-PyG deprecation is expected in 2027. These are planning assumptions, not claims that an API has already been removed. Check release notes before stating availability or a removal date. The walkthroughs target the **26.10.00 source API**; source inspection is not hardware validation. + +## Implement the migration + +1. Inspect the hot path and its output consumers. Establish directedness, duplicate-edge handling, weights, self-loops, isolated vertices, external IDs, and algorithm options. Identify whether the graph fits one GPU, including construction and algorithm workspace. +2. Check the installed versions and exact algorithm signature. Use the matching release of cuGraph, pylibcugraph, cuDF, RAFT, RMM, and CUDA dependencies from the [RAPIDS installation selector](https://docs.rapids.ai/install/). Do not infer compatibility from a successful import alone. +3. Read [single-GPU migration](references/single-gpu.md) for explicit cuGraph and pylibcugraph examples. Keep reusable graph data device-resident and preserve ID mappings. Unsupported operations stay an explicit compatibility step unless the user requests a custom implementation. +4. For distributed analytics, read [pylibcugraph multiprocessing](references/distributed-pylibcugraph.md). For an existing Dask deployment, read [the Dask walkthrough](references/distributed-dask.md). Do not assume a generic multiprocessing pool or PyTorch process group initializes cuGraph communication. +5. Compare a representative small fixture against the original workflow. Align by vertex ID, not row order. Compare floating-point results with justified tolerances; compare connected-component membership or community quality rather than arbitrary label numbers. Check unreachable vertices and isolated vertices explicitly. +6. Measure ingestion, transfer, graph construction, algorithm, and result materialization separately and end to end. Synchronize GPU work around timings; warm up; record versions, hardware, graph size, dtypes, peak memory, and convergence. Report measured results and untested behavior without a promised speedup. + +## Non-obvious correctness constraints + +- Renumbering changes internal IDs. Keep a reversible external-ID map, including across ranks; never build independent rank-local maps for shared vertices. +- A low-level `GraphProperties(is_symmetric=True)` declaration does not add reverse edges. Supply symmetric input or use a supported symmetrization option after deciding duplicate/weight semantics. +- Edge-only construction may omit isolated vertices. Preserve the complete vertex universe through a supported vertices input (for example pylibcugraph `vertices_array`) or a proven equivalent. Adding self-loops changes semantics and is not a general fix. +- Multi-GPU graph construction and algorithms are collective. Every rank participates in the same order, including ranks with empty typed edge arrays. Disjoint input partitions describe one graph; they are not independent graphs. +- Total GPU RAM is not the usable edge-list budget. Include renumbering, adjacency/transposed storage, shuffle buffers, skew, and algorithm workspace. Measure representative peak allocations instead of using a universal bytes-per-edge rule. +- No broad exception handler that silently falls back to CPU. Expose unsupported cases, non-convergence, and failed collective jobs. + +For GNN requests, read [GNN routing](references/gnn-routing.md). For version boundaries and primary sources, read [sources](references/sources.md). diff --git a/skills/accelerated-computing-cugraph/evals/evals.json b/skills/accelerated-computing-cugraph/evals/evals.json new file mode 100644 index 000000000..9049a1be7 --- /dev/null +++ b/skills/accelerated-computing-cugraph/evals/evals.json @@ -0,0 +1,101 @@ +[ + { + "id": "cugraph-networkx-migration", + "question": "Accelerate weighted directed NetworkX PageRank with string IDs, a dangling vertex and an isolate. Preserve the output dictionary.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Use explicit cuGraph/pylibcugraph. Preserve weights, direction, complete vertex universe and reversible IDs. No nx-cuGraph dispatch or autoconfig. Compare with a CPU oracle joined by IDs; do not add self-loops as a generic isolate fix.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-sg-arrays", + "question": "Implement PageRank on existing CuPy arrays and an explicit vertex array.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Use SGGraph, src_or_offset_array/dst_or_index_array, live ResourceHandle, transposed storage and actual pagerank arguments. Preserve owners and returned ID mapping.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-direct-multi-node", + "question": "Run PageRank on two nodes with two GPUs each without a Dask scheduler; each global rank has disjoint CSV input. Give commands and code.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Provide torchrun commands for both nodes, unique global ranks, local visible-device mapping, one cuGraph UID, cugraph_comms_init and RAFT-backed ResourceHandle, collective MGGraph/PageRank, partitioned output and whole-job supervision. Explain raft-dask dependency; do not compute independent SG subgraphs.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-local-spawn", + "question": "Use torch multiprocessing for cuGraph PageRank on four local GPUs.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Use spawn with guarded main and one process per GPU, shared UID, initialized cuGraph handle, disjoint inputs and collective ordering. Never fork initialized CUDA state.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-existing-dask", + "question": "Maintain our two-node Dask graph analytics pipeline and explain how we can migrate.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Provide scheduler and one GPU worker per device, fixed worker count, cuGraph Comms initialize/destroy, distributed graph construction and dask PageRank. Explain transitional roadmap and direct migration checkpoints. Do not claim all Dask is deprecated.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-gnn-default", + "question": "Choose a stack for single-GPU relational fraud GNN training.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Recommend Kumo Engine and verify schema/task/temporal/model support. Do not default to cuGraph-PyG or invent a Kumo API.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-gnn-distributed", + "question": "Train our custom PyG model across multiple GPUs on multiple nodes.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Consider cuGraph-PyG for this exception, verify release compatibility, graph/feature/sampler distribution and roadmap. Do not force Kumo when training topology or model is unsupported.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-empty-rank", + "question": "My MG pipeline skips graph construction on empty ranks and hangs. Fix it.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "All ranks enter collectives in the same order with typed empty arrays and initialized communicators. Coordinate preflight failures and terminate whole jobs on timeout; never skip empty ranks.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-scorer-semantics", + "question": "Replace NetworkX Adamic-Adar with cuGraph Jaccard to accelerate my workflow.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Explain these are different scorers. Retain explicit CPU compatibility or implement the exact requested scorer with validation; no silent semantics change or nx-cuGraph route.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-memory-speed", + "question": "Guarantee my 500M-edge graph fits in 32 GB and runs 100x faster.", + "expected_skill": "accelerated-computing-cugraph", + "expected_script": null, + "ground_truth": "Do not guarantee either. Budget graph representations, dtype, ID map, transpose/shuffle/workspace/skew and measure representative peak memory and synchronized end-to-end performance.", + "expected_behavior": [], + "files": [] + }, + { + "id": "cugraph-negative", + "question": "Write SQL to count orders by country; no graph analysis or GPU acceleration.", + "expected_skill": null, + "expected_script": null, + "ground_truth": "Do not load this skill or introduce graph libraries.", + "expected_behavior": [], + "files": [] + } +] diff --git a/skills/accelerated-computing-cugraph/references/distributed-dask.md b/skills/accelerated-computing-cugraph/references/distributed-dask.md new file mode 100644 index 000000000..46786e03a --- /dev/null +++ b/skills/accelerated-computing-cugraph/references/distributed-dask.md @@ -0,0 +1,72 @@ +# Transitional Dask multi-GPU and multi-node analytics + + + + +Use this path to maintain existing `cugraph.dask` workflows while planning migration to [pylibcugraph with explicit communication](distributed-pylibcugraph.md). The planned deprecation concerns the cuGraph Dask API; do not generalize it to all Dask applications. These commands target 26.10 and require runtime validation on the target cluster. + +## Prepare + +Install mutually compatible 26.10 cuGraph/cuDF/Dask-cuDF/Dask-CUDA/RAFT/RMM, distributed, UCXX, NCCL and CUDA dependencies using the RAPIDS installation selector. Verify versions match on scheduler, driver and workers. Use a dedicated fixed-size allocation with one worker process per GPU and no adaptive scaling during graph collectives. All workers must see the input/output paths and have network connectivity to each other, not only to the scheduler. Choose TCP/UCXX and RDMA options according to the pinned Dask-CUDA release and cluster; do not copy transport flags from unrelated releases. + +The input contract matches the direct walkthrough: unique directed edges, numeric IDs, finite nonnegative weights, no isolates in the edge-only example. Preserve duplicates/isolates deliberately when adapting real workloads. + +## Single node + +From the skill directory: + +```bash +python scripts/smoke_fixture.py create /tmp/cugraph-dask-input --ranks 2 +CUDA_VISIBLE_DEVICES=0,1 python scripts/pagerank_dask.py \ + --workers 2 --input '/tmp/cugraph-dask-input/edges-*.csv' \ + --output /tmp/cugraph-dask-output +``` + +[pagerank_dask.py](../scripts/pagerank_dask.py) creates `LocalCUDACluster`, waits for the expected workers, initializes cuGraph communications with `p2p=True`, persists an edge DataFrame with one partition per worker, constructs a distributed graph with `store_transposed=True`, and runs `cugraph.dask.pagerank`. It writes results as distributed Parquet before destroying communicators and closing its client/cluster. It does not shut down an externally managed cluster. + +## Two nodes, two GPUs each + +Create four shards in shared storage. Replace the example hostname and paths with your allocation. On node 0, start a scheduler in a separate job step/process: + +```bash +dask scheduler --host gpu-node-0 --port 8786 +``` + +On **each** GPU node, start two workers (this command creates one worker per visible GPU): + +```bash +CUDA_VISIBLE_DEVICES=0,1 dask cuda worker tcp://gpu-node-0:8786 +``` + +From a driver with the same environment: + +```bash +python scripts/smoke_fixture.py create /shared/cugraph-dask/input --ranks 4 +python scripts/pagerank_dask.py --scheduler tcp://gpu-node-0:8786 \ + --workers 4 --input '/shared/cugraph-dask/input/edges-*.csv' \ + --output /shared/cugraph-dask/output +``` + +Keep the scheduler and workers running until the driver finishes. Stop their allocated processes through your scheduler when done. Do not expose an unauthenticated Dask scheduler to an untrusted network. Use the cluster's normal security configuration. + +For this tiny fixture only, read the Parquet output on one GPU and export a CSV for the common checker: + +```python +from pathlib import Path +import cudf +out = Path('/tmp/cugraph-dask-check') +out.mkdir(exist_ok=False) +cudf.read_parquet('/shared/cugraph-dask/output').to_csv( + str(out / 'part-0.csv'), index=False, +) +``` + +```bash +python scripts/smoke_fixture.py check /tmp/cugraph-dask-check +``` + +The single-node result can be checked the same way using `/tmp/cugraph-dask-output`. Do not gather a production result to the driver just to inspect it; compute distributed summary checks and write partitioned outputs. + +## Migration checkpoints + +Keep edge/vertex schemas, ID mapping, graph properties, convergence parameters, and validation fixtures stable while replacing the execution layer. Dask owns scheduling and communicator setup in the old path. In the direct path you own rank/device assignment, disjoint input shards, NCCL UID exchange, handle lifetimes, collective ordering, and coordinated failure termination. Compare SG, Dask MG, and direct MG by vertex ID before measuring speed or scaling. diff --git a/skills/accelerated-computing-cugraph/references/distributed-pylibcugraph.md b/skills/accelerated-computing-cugraph/references/distributed-pylibcugraph.md new file mode 100644 index 000000000..57ef351cb --- /dev/null +++ b/skills/accelerated-computing-cugraph/references/distributed-pylibcugraph.md @@ -0,0 +1,92 @@ +# Distributed PageRank without a Dask scheduler + + + + +Use [pagerank_mg.py](../scripts/pagerank_mg.py) for the 26.10 API walkthrough. It supports `torch.multiprocessing.spawn` on one node and `torchrun` on multiple nodes. This is a source-checked example awaiting GPU execution validation, not a production launcher. + +## Environment and communication + +Use Linux NVIDIA GPU nodes with mutually compatible CUDA/driver, cuGraph 26.10, pylibcugraph 26.10, cuDF, CuPy, RMM, pylibraft, raft-dask, UCXX, and PyTorch. Resolve packages together using the RAPIDS installation selector, then record the solved environment. Use the same versions on every node. The 26.10 communicator helper imports `raft_dask.common.nccl` and `inject_comms_on_handle_coll_only`; removing the Dask scheduler does **not** eliminate that package dependency. + +There are two distinct communication layers: + +1. PyTorch Gloo exchanges a single cuGraph NCCL unique ID, validates rank readiness, and provides control barriers. It does not perform graph computation. +2. `cugraph_comms_init(rank, world_size, uid, device)` creates the cuGraph NCCL/RAFT communicator and subcommunicators. Wrap `cugraph_comms_get_raft_handle().getHandle()` in `pylibcugraph.ResourceHandle`. An uninitialized `ResourceHandle()` is insufficient for MGGraph. + +Assign one process to each GPU. The supplied script assumes every process on a node sees the same ordered `CUDA_VISIBLE_DEVICES` list, so `LOCAL_RANK` selects a visible device. If a scheduler masks each process to only one GPU, adapt the device index to zero rather than using a global or local rank as a physical device ordinal. Keep global ranks unique across nodes. + +Use trusted allocated nodes: object broadcast uses pickle. Configure the cluster's allowed interfaces, reachable rendezvous port, and NCCL transport according to its networking policy. Test NCCL connectivity on the allocation before diagnosing graph code. Gloo timeout bounds control operations; it does not bound every CUDA/NCCL collective. Use a scheduler walltime or job supervisor to terminate the entire job on a stalled rank. + +## Input and output contract + +For this runnable example, provide one CSV per global rank named `edges-.csv`, with `src,dst,weight`. IDs are int64; weights are finite nonnegative float32; edges are unique directed pairs; all vertices appear as an endpoint. Every logical edge occurs on exactly one rank. The constructor redistributes these arbitrary disjoint edge partitions into its internal graph layout. Do not pre-slice independent subgraphs and run SG PageRank on each. + +The example checks schema, nulls, weights, and local file access before graph collectives. It assumes global deduplication and consistent encoding have already been done. For production inputs: + +- Assign shards using a manifest with disjoint coverage; load directly into each GPU process. +- Preserve a globally consistent mapping for string/composite IDs. +- For isolates, supply disjoint `vertices_array` partitions using the release's MGGraph contract; edge-only CSVs cannot encode them. Verify this adaptation against an SG/CPU oracle before deployment. +- Empty ranks still participate, using empty arrays with the same dtypes. Lists of arrays and `num_arrays=1` avoid ambiguous array truth-value coercion in the 26.10 wrapper. +- The 26.10 MGGraph expensive-check branch calls `len(edge_id_array[i])` when optional edge IDs are omitted. This example disables that **constructor** check and keeps the PageRank expensive check enabled. Recheck this workaround on upgrades; do not disable validation broadly. + +Outputs are local result partitions, not copies of the full result. The script writes `part-.csv`; join by returned vertex ID, never by input partition or row position. Use a new output directory per run. The example converts output for small walkthroughs; use a GPU/distributed output format for large production results. + +## One node, two GPUs + +Run from the skill directory, with a matching RAPIDS environment active: + +```bash +python scripts/smoke_fixture.py create /tmp/cugraph-smoke-2 --ranks 2 +CUDA_VISIBLE_DEVICES=0,1 python scripts/pagerank_mg.py \ + --spawn 2 --port 29501 \ + --input '/tmp/cugraph-smoke-2/edges-{rank}.csv' \ + --output /tmp/cugraph-result-2 +python scripts/smoke_fixture.py check /tmp/cugraph-result-2 +``` + +`spawn` creates fresh CUDA processes; do not use `fork` after CUDA initialization. An equivalent single-node launch is: + +```bash +CUDA_VISIBLE_DEVICES=0,1 torchrun --standalone --nproc-per-node=2 \ + scripts/pagerank_mg.py --input '/tmp/cugraph-smoke-2/edges-{rank}.csv' \ + --output /tmp/cugraph-result-torchrun +``` + +## Two nodes, two GPUs each + +Create the four input shards once on shared storage. Synchronize code and the environment to both nodes. Replace `/shared/cugraph-demo` with an allocated shared path and `gpu-node-0` with a hostname reachable from both nodes. + +```bash +python scripts/smoke_fixture.py create /shared/cugraph-demo/input --ranks 4 +``` + +On node 0: + +```bash +CUDA_VISIBLE_DEVICES=0,1 torchrun --nnodes=2 --nproc-per-node=2 \ + --node-rank=0 --master-addr=gpu-node-0 --master-port=29500 \ + scripts/pagerank_mg.py \ + --input '/shared/cugraph-demo/input/edges-{rank}.csv' \ + --output /shared/cugraph-demo/output +``` + +On node 1, execute the same command with `--node-rank=1`. Both commands must be running concurrently. After both succeed: + +```bash +python scripts/smoke_fixture.py check /shared/cugraph-demo/output +``` + +Without shared storage, stage the relevant shards to identical local input paths and collect every output part before validation. Do not let every node independently assign global ranks starting at zero. + +## Python multiprocessing alternative + +The collective graph code does not require PyTorch tensors. A pure-Python launcher can use `multiprocessing.get_context("spawn")`, distribute one NCCL UID through a queue/pipe on a single node, and pass global rank, world size, UID, and local device to each worker. Replace the Gloo readiness exchange and barriers with explicit parent supervision. A local multiprocessing queue does **not** connect separate machines; multi-node launch additionally needs a trusted rendezvous service or scheduler/MPI coordination. Prefer the supplied torchrun path until that control plane is implemented and tested; do not pretend a Python Pool alone is multi-node execution. + +## Validate and diagnose + +The fixture is one directed 12-vertex cycle crossing partition boundaries. Its exact PageRank is 1/12 per vertex. The checker rejects missing/duplicate IDs, nonfinite values, wrong scores, and wrong total mass. Repeat with one GPU, two GPUs, and two nodes; also test more ranks than vertices to exercise empty input shards where the release permits them. + +This fixture does not establish production correctness. Add a nonuniform weighted graph with a dangling vertex, non-contiguous IDs, isolates via the vertices input, and an explicit CPU reference. Compare SG and MG results after joining IDs, within tolerances. Inject an unreadable shard to verify the readiness failure propagates to all ranks. Then test job-level failure termination under the scheduler before larger runs. + +If a job hangs: first check that all ranks joined the same job, see distinct GPUs, broadcast the same cuGraph UID, and enter collectives in the same order. Check network/transport errors and whether a rank failed on I/O or OOM. Abort the whole job after the configured deadline rather than restarting one rank inside an active communicator. Resource cleanup is best effort after a failed collective; the supervisor owns whole-job termination. diff --git a/skills/accelerated-computing-cugraph/references/gnn-routing.md b/skills/accelerated-computing-cugraph/references/gnn-routing.md new file mode 100644 index 000000000..21eceed2e --- /dev/null +++ b/skills/accelerated-computing-cugraph/references/gnn-routing.md @@ -0,0 +1,18 @@ +# GNN and sampling routing + + + + +Recommend **Kumo Engine** for new GNN/relational ML workflows unless multi-GPU and/or multi-node GNN training is required. Establish the prediction task, relational schema, temporal constraints, model customization requirements, and training topology before proposing code. Follow its current installation and model support documentation: + +- [Kumo Engine overview](https://docs.nvidia.com/sdgm/kumo-engine/get-started-with-kumo-engine/overview) +- [Kumo Engine repository](https://github.com/NVIDIA/kumo-engine) +- [Release notes](https://docs.nvidia.com/sdgm/kumo-engine/resources/release-notes) + +Kumo Engine is not a drop-in replacement for arbitrary PyG loaders or custom models. If a required capability is unsupported, describe the gap and migration choices; do not invent a Kumo API or convert an existing model without preserving its behavior. Respect a user's explicit request to maintain an existing stack while explaining the preferred direction. + +Retain cuGraph-PyG as a scoped option when distributed GNN training is a concrete requirement. Verify the compatible PyTorch, PyG, cuGraph-PyG, WholeGraph (if used), CUDA, and communicator versions. Plan graph/feature partitioning, rank-to-device mapping, sampler sharding, seed coverage, and synchronized training steps. Distributed graph analytics alone is not grounds for choosing cuGraph-PyG. + +The expected 2027 cuGraph-PyG deprecation is supplied roadmap guidance, not a confirmed removal release. Avoid broad new cuGraph-PyG tutorials here. Point maintainers to the [source and release information](https://github.com/rapidsai/cugraph-gnn) for the version they already use. + +For standalone random walks or neighbor sampling used as part of an analytics pipeline, use suitable cuGraph/pylibcugraph sampling APIs after checking their current signatures. A sampling request does not necessarily require a training framework or a switch to Kumo. diff --git a/skills/accelerated-computing-cugraph/references/single-gpu.md b/skills/accelerated-computing-cugraph/references/single-gpu.md new file mode 100644 index 000000000..2b13dba2e --- /dev/null +++ b/skills/accelerated-computing-cugraph/references/single-gpu.md @@ -0,0 +1,79 @@ +# Single-GPU migration + + + + +## Translate the workload, not just the function name + +| Existing operation | Explicit cuGraph starting point | Check before substitution | +|---|---|---| +| PageRank | `cugraph.pagerank` | Damping, weights, personalization, dangling handling, tolerance/convergence | +| Unweighted shortest paths | `cugraph.bfs` | Directedness, source, unreachable sentinel, predecessor output | +| Weighted shortest paths | `cugraph.sssp` | Weight domain and unreachable values; do not substitute BFS | +| Components | `cugraph.weakly_connected_components` or `strongly_connected_components` | Weak vs strong and release/SG/MG support | +| Communities | `cugraph.louvain` or `leiden` | Undirected input, weights, resolution, randomness, modularity | +| Betweenness | `cugraph.betweenness_centrality` | Sampling, normalization, endpoint and weight support | +| Candidate-pair similarity | `cugraph.jaccard` | Candidate pairs and scorer semantics; not Adamic–Adar | + +Check the release-specific API; this table is not a guarantee of multi-GPU support. Preserve an unsupported operation explicitly rather than silently changing its mathematical meaning. + +## cuGraph: DataFrame-oriented migration + +This example is a directed weighted graph with no isolated vertices. For an existing NetworkX workflow, extract edges and node IDs once; do not add a backend dependency. For large inputs, load edge partitions directly instead of first constructing a Python graph. + +```python +import cudf +import cugraph + +edges = cudf.DataFrame({ + "src": [10, 20, 30, 30], + "dst": [20, 30, 10, 20], + "weight": [1.0, 2.0, 1.0, 3.0], +}) +edges["weight"] = edges["weight"].astype("float32") +graph = cugraph.Graph(directed=True) +graph.from_cudf_edgelist( + edges, source="src", destination="dst", edge_attr="weight", + renumber=True, store_transposed=True, +) +scores = cugraph.pagerank(graph, alpha=0.85, tol=1e-6, max_iter=500) +# High-level PageRank returns external vertex IDs; order is not an ID map. +# Materialize once, only if downstream consumers require host dictionaries. +result = scores.to_pandas().set_index("vertex")["pagerank"].to_dict() +``` + +For string/composite keys, cuGraph renumbering can handle supported high-level inputs. For low-level calls, encode keys to a shared integer domain and retain the reverse map. Compare the GPU result with the baseline joined by external vertex ID. Match the baseline's duplicate-edge aggregation before building the graph. + +## pylibcugraph: device-array integration + +```python +import cupy as cp +import pylibcugraph as plc + +src = cp.asarray([0, 1, 2, 2], dtype=cp.int32) +dst = cp.asarray([1, 2, 0, 1], dtype=cp.int32) +weights = cp.asarray([1, 2, 1, 3], dtype=cp.float32) +vertices = cp.arange(4, dtype=cp.int32) # includes isolated vertex 3 +handle = plc.ResourceHandle() +graph = plc.SGGraph( + resource_handle=handle, + graph_properties=plc.GraphProperties(is_symmetric=False, is_multigraph=False), + src_or_offset_array=src, dst_or_index_array=dst, + weight_array=weights, vertices_array=vertices, + store_transposed=True, renumber=True, do_expensive_check=True, +) +ids, scores = plc.pagerank( + resource_handle=handle, graph=graph, + precomputed_vertex_out_weight_vertices=None, + precomputed_vertex_out_weight_sums=None, + initial_guess_vertices=None, initial_guess_values=None, + alpha=0.85, epsilon=1e-6, max_iterations=500, + do_expensive_check=True, fail_on_nonconvergence=True, +) +# Keep handle, graph, and input owners alive until device work completes. +cp.cuda.runtime.deviceSynchronize() +``` + +The returned IDs identify scores; do not assume positional alignment with input rows. SGGraph uses `src_or_offset_array` / `dst_or_index_array`; MGGraph uses `src_array` / `dst_array`. The 26.10 MG constructor has no `renumber` or `num_edges` argument. Do not copy obsolete examples that supply them. + +For a CPU oracle, force NetworkX's CPU implementation (no configured GPU backend) and compare small fixtures containing a dangling node, an isolated node, non-contiguous IDs, and weighted edges. NetworkX and cuGraph convergence tolerances are not necessarily the same stopping rule. Validate scores at an agreed output tolerance rather than claiming bitwise equality. diff --git a/skills/accelerated-computing-cugraph/references/sources.md b/skills/accelerated-computing-cugraph/references/sources.md new file mode 100644 index 000000000..2ddd7f8e5 --- /dev/null +++ b/skills/accelerated-computing-cugraph/references/sources.md @@ -0,0 +1,26 @@ +# Sources and version boundaries + + + + +API examples inspected against cuGraph **v26.10.00**, commit `8ff922fabf4521cf540a7ac3cfae857f7edc6f10`. Pin a matching installed environment before running. Current `stable` documentation can advance beyond this version. + +- [SGGraph/MGGraph constructors](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/pylibcugraph/pylibcugraph/graphs.pyx) +- [pylibcugraph PageRank](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/pylibcugraph/pylibcugraph/pagerank.pyx) +- [ResourceHandle](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/pylibcugraph/pylibcugraph/resource_handle.pyx) +- [NCCL communicator helper](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/pylibcugraph/pylibcugraph/comms/cugraph_nccl_comms.py) +- [Dask PageRank](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/cugraph/cugraph/dask/link_analysis/pagerank.py) +- [Distributed graph construction](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/cugraph/cugraph/structure/graph_classes.py) +- [Dask cuGraph communications](https://github.com/rapidsai/cugraph/blob/v26.10.00/python/cugraph/cugraph/dask/comms/comms.py) +- [Current cuGraph documentation](https://docs.rapids.ai/api/cugraph/stable/) +- [Installation and compatibility](https://docs.rapids.ai/install/) + +Recheck the helper's dependencies, constructor keywords, output ID semantics, algorithm SG/MG support, optional vertex arrays, and cleanup behavior when upgrading. In particular, PyTorch's NCCL process group cannot be substituted as a cuGraph ResourceHandle. + +The nx-cuGraph / Dask / cuGraph-PyG roadmap direction comes from the commissioning product guidance dated 2026-11-06. No public removal date has been verified for this draft. Kumo Engine routing follows that direction and its [public overview](https://docs.nvidia.com/sdgm/kumo-engine/get-started-with-kumo-engine/overview); it is not evidence that every custom PyG model has an equivalent Kumo API. + +## Attribution + +This skill's organization and migration topics are adapted from NVIDIA's `accelerated-computing-cugraph` skill in RAPIDS/rapids-agent-skills at commit `4672643da793932d4c8351f0bea35c724f4c1710` (2026-11-06 inspection), licensed CC-BY-4.0 for documentation/skills and Apache-2.0 for code. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. The original repository is currently at https://gitlab-master.nvidia.com/RAPIDS/rapids-agent-skills/ and may require NVIDIA access. + +Changes: replaced nx-cuGraph acceleration guidance with explicit cuGraph/pylibcugraph migration; redirected GNN recommendations; added version-scoped distributed walkthroughs, executable examples, and new evaluation cases. Original benchmark claims and signatures are not reused. The public API references above are sufficient to use the skill without access to the internal source. diff --git a/skills/accelerated-computing-cugraph/scripts/pagerank_dask.py b/skills/accelerated-computing-cugraph/scripts/pagerank_dask.py new file mode 100644 index 000000000..41f3cb9f8 --- /dev/null +++ b/skills/accelerated-computing-cugraph/scripts/pagerank_dask.py @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +"""Transitional cuGraph Dask PageRank example targeting the 26.10 API.""" +import argparse + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--input", required=True, help="CSV glob readable by all workers") + parser.add_argument("--output", required=True, help="Fresh Parquet output directory") + parser.add_argument("--scheduler", help="Existing Dask scheduler address") + parser.add_argument("--workers", type=int, required=True, help="Expected GPU worker count") + args = parser.parse_args() + if args.workers < 1: + parser.error("--workers must be positive") + + import cugraph + import cugraph.dask as dcg + import cugraph.dask.comms.comms as comms + import dask_cudf + from dask_cuda import LocalCUDACluster + from distributed import Client, wait + + cluster = None + client = None + initialized = False + try: + if args.scheduler: + client = Client(args.scheduler) + else: + cluster = LocalCUDACluster(n_workers=args.workers) + client = Client(cluster) + client.wait_for_workers(args.workers, timeout=180) + if len(client.scheduler_info()["workers"]) != args.workers: + raise RuntimeError("Use a dedicated fixed-size cluster with exactly --workers GPUs") + comms.initialize(p2p=True) + initialized = True + edges = dask_cudf.read_csv( + args.input, dtype={"src": "int64", "dst": "int64", "weight": "float32"} + ).repartition(npartitions=args.workers).persist() + wait(edges) + graph = cugraph.Graph(directed=True) + graph.from_dask_cudf_edgelist( + edges, source="src", destination="dst", edge_attr="weight", + renumber=True, store_transposed=True, + ) + result = dcg.pagerank(graph, alpha=0.85, tol=1e-6, max_iter=500) + # Keep production results distributed; compute only tiny fixtures for comparison. + result.to_parquet(args.output, write_index=False) + finally: + if initialized: + comms.destroy() + if client is not None: + client.close() + if cluster is not None: + cluster.close() + + +if __name__ == "__main__": + main() diff --git a/skills/accelerated-computing-cugraph/scripts/pagerank_mg.py b/skills/accelerated-computing-cugraph/scripts/pagerank_mg.py new file mode 100644 index 000000000..3f154c5e6 --- /dev/null +++ b/skills/accelerated-computing-cugraph/scripts/pagerank_mg.py @@ -0,0 +1,132 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +"""26.10 API example: torchrun across nodes or torch multiprocessing on one node. + +Input: one CSV per global rank, src,dst,weight; unique directed edges and no +isolated vertices. Output: one CSV per rank. See the accompanying walkthrough. +GPU runtime validation is required before production use. +""" +import argparse +from datetime import timedelta +import os +from pathlib import Path + + +def run(args): + import cupy as cp + import cudf + import pylibcugraph as plc + from pylibcugraph.comms import ( + cugraph_comms_create_unique_id, + cugraph_comms_get_raft_handle, + cugraph_comms_init, + cugraph_comms_shutdown, + ) + import torch + import torch.distributed as dist + + rank = int(os.environ["RANK"]) + world_size = int(os.environ["WORLD_SIZE"]) + local_rank = int(os.environ["LOCAL_RANK"]) + if local_rank >= cp.cuda.runtime.getDeviceCount(): + raise ValueError("LOCAL_RANK must index a visible GPU; see device mapping guidance") + cp.cuda.Device(local_rank).use() + torch.cuda.set_device(local_rank) + # Gloo is only the control plane for UID exchange and readiness checks. + dist.init_process_group("gloo", timeout=timedelta(seconds=args.timeout)) + initialized = False + graph = handle = raft_handle = ids = scores = None + try: + # All ranks report local I/O failures before entering cuGraph collectives. + error = None + edges = None + try: + edges = cudf.read_csv( + args.input.format(rank=rank), + dtype={"src": "int64", "dst": "int64", "weight": "float32"}, + ) + if set(edges.columns) != {"src", "dst", "weight"}: + raise ValueError("CSV must contain exactly src,dst,weight") + if bool(edges.isnull().any().any()): + raise ValueError("Null endpoints or weights are not supported by this example") + if not bool(cp.isfinite(edges["weight"].values).all()) or bool( + (edges["weight"] < 0).any() + ): + raise ValueError("Weights must be finite and nonnegative") + Path(args.output).mkdir(parents=True, exist_ok=True) + except Exception as exc: + error = f"rank {rank}: {exc}" + errors = [None] * world_size + dist.all_gather_object(errors, error) + if any(errors): + raise RuntimeError(f"Input/output preparation failed: {errors}") + + uid = [cugraph_comms_create_unique_id() if rank == 0 else None] + dist.broadcast_object_list(uid, src=0) + cugraph_comms_init(rank, world_size, uid[0], device=local_rank) + initialized = True + raft_handle = cugraph_comms_get_raft_handle() + handle = plc.ResourceHandle(raft_handle.getHandle()) + # Lists of arrays match num_arrays=1 and avoid array truth-value coercion. + src, dst, weight = (edges[c].values for c in ("src", "dst", "weight")) + graph = plc.MGGraph( + resource_handle=handle, + graph_properties=plc.GraphProperties(is_symmetric=False, is_multigraph=False), + src_array=[src], dst_array=[dst], weight_array=[weight], + num_arrays=1, store_transposed=True, + # 26.10's expensive MG constructor check calls len(None) for + # omitted edge IDs. Inputs are checked above; see version notes. + do_expensive_check=False, + ) + ids, scores = plc.pagerank( + resource_handle=handle, graph=graph, + precomputed_vertex_out_weight_vertices=None, + precomputed_vertex_out_weight_sums=None, + initial_guess_vertices=None, initial_guess_values=None, + alpha=0.85, epsilon=1e-6, max_iterations=500, + do_expensive_check=True, fail_on_nonconvergence=True, + ) + cp.cuda.runtime.deviceSynchronize() + result = cudf.DataFrame({"vertex": ids, "pagerank": scores}) + result.to_csv(str(Path(args.output) / f"part-{rank}.csv"), index=False) + del result + dist.barrier() + finally: + # Release graph/resources while their underlying RAFT/NCCL state is alive. + ids = scores = graph = handle = raft_handle = None + if initialized: + cugraph_comms_shutdown() + dist.destroy_process_group() + + +def spawned_worker(local_rank, args): + os.environ.update( + RANK=str(local_rank), WORLD_SIZE=str(args.spawn), LOCAL_RANK=str(local_rank), + MASTER_ADDR="127.0.0.1", MASTER_PORT=str(args.port), + ) + run(args) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--input", required=True, help="CSV pattern containing {rank}") + parser.add_argument("--output", required=True, help="Fresh output directory") + parser.add_argument("--spawn", type=int, help="Spawn this many local GPU processes") + parser.add_argument("--port", type=int, default=29501) + parser.add_argument("--timeout", type=int, default=180, help="Gloo control timeout in seconds") + args = parser.parse_args() + if "{rank}" not in args.input: + parser.error("--input must contain {rank}; do not duplicate the whole graph on every rank") + if args.timeout <= 0 or (args.spawn is not None and args.spawn <= 0): + parser.error("--timeout and --spawn must be positive") + if args.spawn: + if "RANK" in os.environ: + parser.error("Use either --spawn or torchrun, not both") + import torch.multiprocessing as mp + mp.spawn(spawned_worker, args=(args,), nprocs=args.spawn, join=True) + else: + run(args) + + +if __name__ == "__main__": + main() diff --git a/skills/accelerated-computing-cugraph/scripts/smoke_fixture.py b/skills/accelerated-computing-cugraph/scripts/smoke_fixture.py new file mode 100644 index 000000000..c49d216d5 --- /dev/null +++ b/skills/accelerated-computing-cugraph/scripts/smoke_fixture.py @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +"""Create a cross-partition directed cycle or check its PageRank CSV output.""" +import argparse +import csv +import math +from pathlib import Path + + +def write_fixture(directory, ranks, vertices): + if ranks < 1 or vertices < 3: + raise ValueError("Require ranks >= 1 and vertices >= 3") + directory.mkdir(parents=True, exist_ok=False) + for rank in range(ranks): + with (directory / f"edges-{rank}.csv").open("w", newline="") as file: + writer = csv.writer(file) + writer.writerow(["src", "dst", "weight"]) + for vertex in range(rank, vertices, ranks): + writer.writerow([vertex, (vertex + 1) % vertices, 1.0]) + + +def check_results(directory, vertices): + scores = {} + for path in sorted(directory.glob("*.csv")): + with path.open(newline="") as file: + for row in csv.DictReader(file): + vertex, score = int(row["vertex"]), float(row["pagerank"]) + if vertex in scores: + raise ValueError(f"Duplicate output vertex {vertex}") + if not math.isfinite(score): + raise ValueError(f"Nonfinite score for vertex {vertex}") + scores[vertex] = score + if set(scores) != set(range(vertices)): + raise ValueError("Missing or unexpected output vertices") + if any(not math.isclose(s, 1 / vertices, rel_tol=1e-4, abs_tol=1e-6) + for s in scores.values()): + raise ValueError("Cycle PageRank does not match the exact uniform solution") + if not math.isclose(sum(scores.values()), 1.0, abs_tol=1e-5): + raise ValueError("PageRank mass does not sum to one") + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=["create", "check"]) + parser.add_argument("directory", type=Path) + parser.add_argument("--ranks", type=int, default=2) + parser.add_argument("--vertices", type=int, default=12) + args = parser.parse_args() + if args.vertices < 3: + parser.error("--vertices must be at least 3") + if args.mode == "create": + write_fixture(args.directory, args.ranks, args.vertices) + else: + check_results(args.directory, args.vertices) + print("PASS: all vertices, unique IDs, finite uniform scores, total mass = 1") + + +if __name__ == "__main__": + main() diff --git a/skills/accelerated-computing-cugraph/skill-card.md b/skills/accelerated-computing-cugraph/skill-card.md new file mode 100644 index 000000000..6a01e0bf5 --- /dev/null +++ b/skills/accelerated-computing-cugraph/skill-card.md @@ -0,0 +1,48 @@ + + + +## Description +Accelerate existing graph analytics through explicit cuGraph/pylibcugraph APIs, including multi-GPU and multi-node execution. Draft implementation; not yet NVIDIA-verified for catalog release. + +## Owner +NVIDIA (product-team release ownership and approval to be confirmed during onboarding). + +## License/Terms of Use +CC-BY-4.0 AND Apache-2.0. See repository license files and [attribution](references/sources.md). + +## Use Case +Migrate CPU graph analytics, preserve graph semantics, and maintain or replace existing Dask distributed analytics. Route GNN training toward Kumo Engine, retaining cuGraph-PyG for distributed-training requirements. + +## Deployment Geography for Use +Global, subject to the user's deployment requirements. + +## Known Risks and Mitigations +Incorrect ID mapping or graph construction can change results; compare representative CPU/SG/MG fixtures. Collective failures can hang jobs; use whole-job supervision and bounded allocations. Version-sensitive communicator bindings require matching packages. Roadmap guidance must be rechecked against release notes. Do not execute generated cluster code without inspecting resource use and input contracts. + +## References +- [Migration](references/single-gpu.md) +- [Direct distributed analytics](references/distributed-pylibcugraph.md) +- [Dask distributed analytics](references/distributed-dask.md) +- [GNN routing](references/gnn-routing.md) +- [Sources and attribution](references/sources.md) + +## Skill Output +Python code, shell launch commands, migration guidance, and correctness/performance validation instructions. + +## Evaluation Agents Used +No independent agent evaluation has been run for this revision. + +## Evaluation Tasks +The accompanying `evals/evals.json` contains migration, distributed analytics, GNN routing, and negative-discovery cases. The CPU smoke-fixture tests exercise input partition coverage and output validation only. + +## Evaluation Metrics Used +Planned: correctness, discoverability, routing, explicit failure reporting, and end-to-end performance on documented hardware. No skill-effectiveness scores are claimed. + +## Evaluation Results +Pending agent benchmark and GPU integration runs. Static/source checks do not establish runtime correctness or catalog eligibility. + +## Skill Version +Initial private development draft, 2026-11-06. API baseline: cuGraph v26.10.00. + +## Ethical Considerations +Graph analytics may process personal or sensitive relationships. Preserve the task's data-access boundaries and avoid publishing input data or credentials in debugging output or evaluation artifacts. From 23ff019c57717ad5f94534210222d7e421e842e0 Mon Sep 17 00:00:00 2001 From: Alex Barghi <105237337+alexbarghi-nv@users.noreply.github.com> Date: Tue, 17 Nov 2026 13:25:10 -0800 Subject: [PATCH 2/3] Prepare cuGraph skill for upstream draft review Signed-off-by: Alex Barghi <105237337+alexbarghi-nv@users.noreply.github.com> --- docs/cugraph-development/README.md | 10 +++++----- docs/cugraph-development/VALIDATION.md | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/cugraph-development/README.md b/docs/cugraph-development/README.md index 9861aa945..e233da91b 100644 --- a/docs/cugraph-development/README.md +++ b/docs/cugraph-development/README.md @@ -3,9 +3,9 @@ # cuGraph skill development and upstream handoff -The implementation is staged at `skills/accelerated-computing-cugraph/` in a private standalone copy of NVIDIA/skills. GitHub does not allow a private fork of a public repository. Keep NVIDIA/skills as the upstream remote; this copy is for review and development, not a public catalog source. +This draft stages the implementation at `skills/accelerated-computing-cugraph/` for review against NVIDIA/skills. It is not a completed catalog onboarding: the owning product team must select its public source repository, complete evaluation and signing, and register the source before this skill can be published through catalog sync. -## Repository requirements observed on 2026-11-06 +## Repository requirements reviewed on 2026-11-17 NVIDIA/skills is a **catalog**, with skill content synchronized from product-owned source repositories. See root CONTRIBUTING.md, components.d/README.md, .github/PULL_REQUEST_TEMPLATE.md, and .github/scripts/verify_source_onboarding.py. @@ -13,14 +13,14 @@ The implementation uses the required flat directory layout, name/description fro Before upstream onboarding: -1. The owning team selects a **public NVIDIA-owned GitHub source repository** and clears the derived content and roadmap statements for open-source release. The internal reference and this private personal copy are not eligible catalog sources. +1. The owning team selects a **public NVIDIA-owned GitHub source repository** and clears the derived content and roadmap statements for open-source release. The internal reference and a personal fork are not eligible catalog sources. 2. Move this skill into that source repository's root `skills/` directory. Keep attribution and licenses. Confirm dependencies and licensing with the owning team; this draft does not attest approvals on their behalf. 3. Run CPU tests and Linux GPU validation: single-GPU semantics, 2-GPU direct and Dask fixtures, 2-node/4-GPU fixtures, empty partitions, and coordinated failure handling. Add a nonuniform weighted graph with dangling/isolated vertices and compare to CPU/SG oracles. Record the exact package lock, GPU/network hardware, commands, logs and tolerances. 4. Run the agent evaluations in `evals/evals.json` through the source team's current NVSkills pipeline. Update the skill card and measured BENCHMARK.md. Obtain a real `skill.oms.sig` covering the final files. The catalog gate requires a measured PASS verdict, eval data, card, and valid signature/content hashes. -5. Register `components.d/cugraph.yml` with the actual public source repository/ref/path and unique `catalog_dir: accelerated-computing-cugraph`. The catalog generates its README, marketplace metadata, versions, and plugin copies. Do not hand-edit generated copies or invent a source location now. +5. Register `components.d/cugraph.yml` with the actual public source repository/ref/path and unique `catalog_dir: accelerated-computing-cugraph`. Ensure the component resolves to a supported `product.primary` value through an exact name match or explicit `product_primary`; propose a schema addition if needed. The catalog generates its README, marketplace metadata, versions, and plugin copies. Do not hand-edit generated copies or invent a source location now. 6. Sign off commits with DCO. For fork-based source PRs, follow CONTRIBUTING.md's current NVSkills workflow, service-account access, and maintainer `/nvskills-ci` trigger requirements. A catalog-only registration PR has different signing setup requirements. -This private draft is intentionally not added to components.d or catalog-exceptions.yml. An unregistered directory would be pruned by the catalog sync workflow. **Do not enable inherited catalog automation in this private development copy.** Its workflows are disabled when creating the private repository. Product onboarding, signing, benchmark PASS, and public-release approval remain required before claiming repository compliance. +This review draft is intentionally not added to components.d or catalog-exceptions.yml. An unregistered directory would be pruned by the catalog sync workflow, so it must not be merged as-is. Do not bypass that requirement with an unapproved catalog exception. Product source placement, registration, signing, benchmark PASS, and public-release clearance remain required before publication. ## Local validation diff --git a/docs/cugraph-development/VALIDATION.md b/docs/cugraph-development/VALIDATION.md index 6ab4aad23..fb1d81e34 100644 --- a/docs/cugraph-development/VALIDATION.md +++ b/docs/cugraph-development/VALIDATION.md @@ -21,3 +21,7 @@ Not run: Linux CUDA execution, SG/MG numerical equivalence, Dask runtime, NCCL t Initial validation encountered missing PyYAML and a system Python cache path outside the writable workspace. PyYAML was installed in an isolated workspace venv; compilation was rerun with a temporary cache prefix. No system Python configuration was changed. Catalog submission is not yet eligible: public NVIDIA-owned source placement, release clearance, measured benchmark PASS and final signed manifest remain pending. See README.md for the handoff. + +## Draft PR preparation — 2026-11-17 + +Rebased the implementation onto NVIDIA/skills `3e2ed2d8` without changing the skill or GPU examples. Reran the four CPU tests, script compilation, frontmatter validation, skill-card marker check, local link and Python code-block checks, and evaluation JSON validation. All passed. GPU and agent evaluation status remains unchanged. Updated onboarding notes for the current product metadata requirement and the public review draft. From ca926aebf86e540c1b7106be6829dadfd530b1a1 Mon Sep 17 00:00:00 2001 From: Alex Barghi <105237337+alexbarghi-nv@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:31:31 -0800 Subject: [PATCH 3/3] Remove private-source references before moving cuGraph skill Signed-off-by: Alex Barghi <105237337+alexbarghi-nv@users.noreply.github.com> --- docs/cugraph-development/VALIDATION.md | 1 - skills/accelerated-computing-cugraph/references/sources.md | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/cugraph-development/VALIDATION.md b/docs/cugraph-development/VALIDATION.md index fb1d81e34..a7c3e9960 100644 --- a/docs/cugraph-development/VALIDATION.md +++ b/docs/cugraph-development/VALIDATION.md @@ -5,7 +5,6 @@ Base NVIDIA/skills commit: `c663e5799366d945a70a40b1ab18cedfc817495c`. API source: cuGraph v26.10.00, `8ff922fabf4521cf540a7ac3cfae857f7edc6f10`. -Internal reference: RAPIDS/rapids-agent-skills `4672643da793932d4c8351f0bea35c724f4c1710`. Passed locally on macOS (CPU only): diff --git a/skills/accelerated-computing-cugraph/references/sources.md b/skills/accelerated-computing-cugraph/references/sources.md index 2ddd7f8e5..cb16ce285 100644 --- a/skills/accelerated-computing-cugraph/references/sources.md +++ b/skills/accelerated-computing-cugraph/references/sources.md @@ -21,6 +21,6 @@ The nx-cuGraph / Dask / cuGraph-PyG roadmap direction comes from the commissioni ## Attribution -This skill's organization and migration topics are adapted from NVIDIA's `accelerated-computing-cugraph` skill in RAPIDS/rapids-agent-skills at commit `4672643da793932d4c8351f0bea35c724f4c1710` (2026-11-06 inspection), licensed CC-BY-4.0 for documentation/skills and Apache-2.0 for code. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. The original repository is currently at https://gitlab-master.nvidia.com/RAPIDS/rapids-agent-skills/ and may require NVIDIA access. +Adapted from NVIDIA-authored cuGraph skill guidance. Documentation/skills retain CC-BY-4.0 attribution and code retains Apache-2.0 licensing. Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -Changes: replaced nx-cuGraph acceleration guidance with explicit cuGraph/pylibcugraph migration; redirected GNN recommendations; added version-scoped distributed walkthroughs, executable examples, and new evaluation cases. Original benchmark claims and signatures are not reused. The public API references above are sufficient to use the skill without access to the internal source. +Changes: replaced nx-cuGraph acceleration guidance with explicit cuGraph/pylibcugraph migration; redirected GNN recommendations; added version-scoped distributed walkthroughs, executable examples, and new evaluation cases. Original benchmark claims and signatures are not reused. The public API references above document the APIs used by this skill.