Skip to content

Benchmarks: Add pytorch-simplenet model and support CPU-only DDP over gloo - #907

Draft
Nguyen Vuong (normanvuong) wants to merge 3 commits into
microsoft:mainfrom
normanvuong:nguyenvuong/manifold_simplenet
Draft

Nguyen Vuong (normanvuong) wants to merge 3 commits into
microsoft:mainfrom
normanvuong:nguyenvuong/manifold_simplenet

Conversation

@normanvuong

@normanvuong Nguyen Vuong (normanvuong) commented Nov 30, 2026 •

Copy link
Copy Markdown

Description
Adds a lightweight pytorch-simplenet model benchmark and makes torch.distributed mode work for CPU-only
training over gloo. Together they allow a small PyTorch DDP check that runs on CPU-only nodes (multi-node,
gloo) as well as on GPU nodes (single node, NCCL/RCCL), using the standard sb run flow.

Today, torch.distributed mode always passes distributed_backend=nccl, and PytorchBase always passes
device_ids to DDP. Both break CPU-only training.

Major Revision

  • Add the pytorch-simplenet model benchmark: the small CNN from the PyTorch CIFAR-10 tutorial (2 conv + 3 FC
    layers), trained on synthetic 3x32x32 images with 10 classes. Image size is fixed at 32; other sizes fail with
    MODEL_CREATION_FAILURE.
  • Runner: in torch.distributed mode, use the distributed_backend set in the benchmark's parameters,
    defaulting to nccl, instead of always forcing nccl.
  • PytorchBase: only pass device_ids/output_device to DistributedDataParallel when a GPU is used. DDP rejects
    them for CPU modules.

Minor Revision

  • Docs: list simplenet in the model list and document distributed_backend: gloo + no_gpu: yes for CPU-only
    torch.distributed runs.
  • Tests: SimpleNet on GPU, on CPU, CPU DDP over gloo, invalid image size, and the runner backend selection
    (gloo / default nccl / missing benchmark). The new CPU DDP test fails with PyTorch's device_ids error without
    the pytorch_base.py fix.

Validation

  • Unit tests: 20 passed, 1 skipped (GPU-only); flake8 and yapf clean.
  • Container check: installed this branch over superbench/main:cuda13.0 and ran sb run -l localhost --no-docker
    in two containers as a 2-node gloo DDP job. Rank 0 reported training throughput, both nodes returned 0, and
    sb result diagnosis with a failure_check rule passed.

Example config:

model-benchmarks:simplenet-cpu:
  modes:
    - name: torch.distributed
      proc_num: 1
      node_num: all
  frameworks: [pytorch]
  models: [simplenet]
  parameters:
    no_gpu: yes
    distributed_backend: gloo
    precision: [float32]
    model_action: [train]

Nguyen Vuong (from Dev Box) and others added 2 commits November 23, 2026 17:45
…r gloo

Add the pytorch-simplenet model benchmark: the small CIFAR-10 CNN from the
PyTorch tutorial on synthetic 3x32x32 images, used for lightweight DDP
smoke tests.

Make torch.distributed DDP work on CPU-only nodes:
- runner: use distributed_backend from the benchmark parameters in
  torch.distributed mode instead of always forcing nccl.
- pytorch_base: do not pass device_ids/output_device to
  DistributedDataParallel for CPU modules, which PyTorch rejects.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 18:59
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Distributed mode now fails on previously supported null parameters or null backend values instead of preserving the NCCL default.

1 open issue
What changed in this PR

Adds a lightweight SimpleNet benchmark to SuperBench’s PyTorch model suite and enables CPU-only distributed training with Gloo.

Changes:

  • Implements and registers SimpleNet for synthetic 32×32 images with 10 classes.
  • Honors the configured distributed backend and omits GPU device arguments for CPU DDP.
  • Adds benchmark and runner regression tests, plus configuration documentation.
File Description
tests/​runner/​test_runner.py Tests configured backends and the NCCL fallback.
tests/​benchmarks/​model_benchmarks/​test_pytorch_simplenet.py Tests CPU, GPU, Gloo DDP, metrics, and image-size validation.
superbench/​runner/​runner.py Uses the benchmark’s configured distributed backend.
superbench/​benchmarks/​model_benchmarks/​pytorch_simplenet.py Implements and registers the SimpleNet benchmark.
superbench/​benchmarks/​model_benchmarks/​pytorch_base.py Supports wrapping CPU models in DDP.
superbench/​benchmarks/​model_benchmarks/​__init__.py Exports the new benchmark class.
docs/​user-tutorial/​benchmarks/​model-benchmarks.md Describes SimpleNet and CPU-only distributed usage.
docs/​superbench-config.mdx Lists SimpleNet and documents backend selection.

Review effort: Balanced

Comment thread superbench/runner/runner.py Resolved
@normanvuong Nguyen Vuong (normanvuong) changed the title Add Manifold Simplenet setup Benchmarks: Add pytorch-simplenet model and support CPU-only DDP over gloo Nov 30, 2026
…istributed mode

Null benchmark parameters or a null distributed_backend now default to nccl instead of raising AttributeError or passing distributed_backend=None, matching the executor skipping null values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 22:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Invalid image sizes in inference leave the model unset, causing a runtime exception instead of MODEL_CREATION_FAILURE and skipping normal cleanup; the failure path also lacks inference test coverage.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Handle model creation failures in inference

superbench/​benchmarks/​model_benchmarks/​pytorch_simplenet.py:65

With --model_action inference --image_size 64 --precision float32 --no_gpu, returning False here does not produce MODEL_CREATION_FAILURE: the inherited ModelBenchmark.__inference ignores the return value, and PytorchCNN._inference_step calls .eval() on the still-None model. This produces RUNTIME_EXCEPTION_ERROR instead and skips normal cleanup. Please make the inference launcher handle _create_model failure as the training launcher does, and extend the invalid-image-size test to cover inference.

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants