Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jax-smi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jax-smi

JAX Synergistic Memory Inspector

  • 1.0.4
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc