Skip to main content

mps-watch

The Apple Silicon equivalent of nvidia-smi or gpustat for PyTorch. Monitor your MPS (Metal Performance Shaders) memory usage in real-time.

Features

  • Python API: Context manager and decorator for tracking VRAM usage of specific code blocks.
  • CLI Tool: Terminal-based dashboard for system unified memory monitoring.
  • Safe Fallbacks: Graceful handling on non-Mac systems or without MPS.

Installation

pip install mps-watch

Usage

Python API

Monitor memory usage of specific blocks or functions:

from mps_watch import monitor
import torch

# As context manager
with monitor("Training Block"):
    # Your MPS code here
    model.to("mps")
    output = model(input)

# As decorator
@monitor("Inference")
def predict(x):
    return model(x)

# Get current usage directly
from mps_watch import get_current_memory_usage, get_system_memory

allocated, reserved = get_current_memory_usage()
print(f"Current Allocated: {allocated} bytes")

# Get system-wide unified memory
sys_mem = get_system_memory()
print(f"System Total: {sys_mem['total']} bytes")
print(f"System Used: {sys_mem['used']} bytes")

Output: It will print a table showing Initial, Final, and Delta memory usage (Allocated vs Reserved).

CLI Tool

Run the dashboard in your terminal:

mps-watch

This will show a live-updating dashboard of your System Unified Memory and MPS availability status.

Requirements

  • macOS 12.3+ (for MPS support)
  • Python 3.8+
  • PyTorch
  • rich
  • psutil

Understanding the Stats

CLI vs Python API

  • The CLI Tool (mps-watch): Shows System-wide memory usage. Since Apple Silicon uses Unified Memory, this reflects the total RAM used by the OS and all applications combined. It gives you an idea of the overall system pressure.
  • The Python API (monitor / get_current_memory_usage): Shows Process-specific MPS memory usage. This is the amount of memory specifically allocated by PyTorch on the Metal device for your script.

Why are they different? The CLI shows the whole pie (System RAM). The Python API shows just your slice (PyTorch MPS Usage).

License

MIT

Metadata

Release files for mps-watch 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mps-watch 0.1.2
File Size Uploaded Provenance
mps_watch-0.1.2.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mps-watch 0.1.2
File Interpreter ABI Platform
mps_watch-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / mps_watch-0.1.2.tar.gz

Download URL mps_watch-0.1.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8617b89bd2d5e5ad7a4e8cb45f81bc244d05f38cd3e750b7d90e548303486dc8
BLAKE2b-256 checksum
How to use checksums
f3c13defbe392b8fa06aa34ceacb45a65e41c9e512f4aae175e4eed30ae710bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / mps_watch-0.1.2-py3-none-any.whl

Download URL mps_watch-0.1.2-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c10e34fcfedbaae3b29572ea50462584e08fb18cfc47ccd656f536a34514483
BLAKE2b-256 checksum
How to use checksums
78b03858375e3cb158d2e11e9c5c60afdce99201c22baa41c8a3362d07754a8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for mps-watch 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page