Skip to content
aminmsalimiPublic

About

Safe operations, planning, validation, and troubleshooting CLI for NVIDIA MIG environments.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

MIGOps

MIGOps is a Python CLI for safe NVIDIA Multi-Instance GPU (MIG) operations on Linux GPU hosts.

It complements NVIDIA's native MIG tooling with workload-aware safety checks, smart partition recommendations, configuration planning, snapshots, drift detection, and safe apply workflows.

Demo

⚡ Real Hardware Demo

MIGOps running on a real NVIDIA H100 GPU host on a bare-metal Dell PowerEdge R770 running Ubuntu 26.04 LTS 🐧.

MIGOps demo

Features

  • GPU and MIG status
  • MIG profile discovery
  • Active GPU/MIG workload detection
  • Smart equal-memory MIG splitting
  • Easy MIG creation and destruction
  • MIG mode enable/disable
  • Advanced GI and CI management
  • YAML desired-state configuration
  • Validate, diff, and plan workflows
  • Snapshots and restore
  • Safe apply with workload checks and dry-run
  • JSON output for automation
  • Automated tests and GitHub Actions CI

Requirements

  • Linux for real MIG operations
  • Python 3.9+
  • NVIDIA driver
  • nvidia-smi
  • NVIDIA MIG-capable GPU for MIG operations

Development and parser tests can run without an NVIDIA GPU.

Quick Install

Install MIGOps with a single command:

curl -fsSL https://raw.githubusercontent.com/aminmsalimi/migops/main/install.sh | bash

The installer downloads MIGOps, creates an isolated Python virtual environment, installs the CLI, and makes migops available from the command line. When sudo is available, it also exposes the command through /usr/local/bin so privileged MIG operations work directly.

Manual Installation

git clone https://github.com/aminmsalimi/migops.git
cd migops

python3 -m venv .venv
source .venv/bin/activate

python -m pip install -e .

Quick Start

Inspect the system:

migops status
migops profiles
migops users

Recommend an equal MIG split:

migops recommend gpu 0 4

Preview applying it:

sudo migops split gpu 0 4 --dry-run

Apply it:

sudo migops split gpu 0 4 --yes

MIGOps selects from MIG profiles reported by the installed NVIDIA driver rather than inventing unsupported partition sizes.

MIG Management

Enable or disable MIG mode:

sudo migops enable gpu 0
sudo migops disable gpu 0

Create complete MIG instances:

sudo migops create gpu 0 3g.40gb
sudo migops create gpu 0 3g.40gb --count 2

Destroy them safely:

sudo migops destroy gpu 0 --gi 2
sudo migops destroy gpu 0 --all

Advanced GI and CI commands are also available through:

migops gi --help
migops ci --help

Desired-State Configuration

Example:

version: 1

gpus:
  - gpu: "0"
    mig_enabled: true

    instances:
      - profile: "3g.40gb"
        count: 1

      - profile: "2g.20gb"
        count: 1

Validate, compare, and plan:

migops validate config.yaml
migops diff config.yaml
migops plan config.yaml

Preview and apply:

sudo migops apply config.yaml --dry-run
sudo migops apply config.yaml

Snapshots

Save the current MIG configuration:

migops snapshot

Restore a previous snapshot:

sudo migops restore snapshot.yaml --dry-run
sudo migops restore snapshot.yaml

Safety

MIGOps is intentionally conservative:

  • detects active GPU workloads before destructive changes
  • supports --dry-run
  • requires --yes for desired-state changes
  • creates a snapshot before real apply operations
  • removes CIs before GIs
  • verifies the final configuration after apply
  • leaves final hardware validation to the NVIDIA driver

Tests

python -m unittest discover -s tests -v

GitHub Actions runs the test suite automatically on pushes and pull requests.

Status

MIGOps v0.1.0 is an early alpha release.

Core workflows are implemented and covered by automated tests. Real-world validation across different NVIDIA MIG-capable GPU generations and driver versions is still ongoing.

About

Safe operations, planning, validation, and troubleshooting CLI for NVIDIA MIG environments.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages