Skip to main content

JAX Synergistic Memory Inspector

jax-smi is a tool for real-time inspection of the memory usage of a JAX process. It is similar to nvidia-smi for GPU, but works on multiple platforms including CPU, GPU and TPU.

On TPU platforms, jax-smi is the only way to monitor TPU memory usage. On GPU platforms, jax-smi is also preferable to nvidia-smi. The latter is unable to report real-time memory usage of JAX processes, as JAX always pre-allocates 90% of the GPU memory by default.

This project is supported by Cloud TPUs from Google's TPU Research Cloud (TRC).

Installation

Install go. On Ubuntu, this is usually done by:

sudo apt-get install golang

If you followed tpu-starter to set up the TPU environment, go should be already installed.

Then install jax-smi with:

pip install jax-smi

Usage

In your JAX script:

from jax_smi import initialise_tracking
initialise_tracking()
# some computation...

Open a shell and run:

jax-smi

Approach

Save the memory profile to /dev/shm/memory.prof in a separate thread every 1 second using jax.profiler.save_device_memory_profile().

Inspect the memory profile with go tool pprof -tags /dev/shm/memory.prof.

See https://twitter.com/ayaka14732/status/1565013139594551296 for more details.

Limitations

Tracing can only be performed by one process at a time. If tracing is performed by multiple JAX processes, they will write the memory profiles to the same file, which will lead to conflicts.

The jax-smi command line tool cannot detect if a memory profile file is out of date. Therefore, even if no JAX process is running, the tool will still read the outdated memory profile and report outdated memory usage information.

Metadata

Release files for jax-smi 1.0.4

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

Source distribution (sdist)

Source distribution for jax-smi 1.0.4
File Size Uploaded Provenance Actions
jax_smi-1.0.4.tar.gz 3.8 kB Without provenance Details for jax_smi-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jax-smi 1.0.4
File Interpreter ABI Platform Actions
jax_smi-1.0.4-py3-none-any.whl Python 3 none any Details for jax_smi-1.0.4-py3-none-any.whl

Total release size: 8.3 kB

Release files / jax_smi-1.0.4.tar.gz

Download URL jax_smi-1.0.4.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f0bfc1b5bd9b90a6f2a638d934c4076b12bba0b94998894c7eb07058a68d5472
BLAKE2b-256 checksum
How to use checksums
66ed8e6fe7488e7118e4108fd577162ce54132924399af60a42080a296ab51b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / jax_smi-1.0.4-py3-none-any.whl

Download URL jax_smi-1.0.4-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c55e7ccd638bd884b1920370eaffe6cb8841b18cec36236a3e87a6eabc6fc06
BLAKE2b-256 checksum
How to use checksums
51f41b51781413cab18213f88692be2ddc3c2422ff9e319264db8ef8da945875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for jax-smi 1.0.4

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