Skip to main content

Parallelization utilities for JAX

Project description

Parajax

Automagic parallelization of calls to JAX-based functions

CI Codecov Ruff ty uv Publish PyPI PyPI - Python Version

Features

  • 🚀 Device-parallel execution: run across multiple CPUs, GPUs or TPUs automatically
  • Fully composable with jax.jit, jax.vmap, and other JAX transformations
  • 🪄 Automatic handling of input shapes not divisible by the number of devices
  • 🎯 Simple interface: just decorate your function with autopmap

Installation

pip install parajax

Example

import multiprocessing

import jax
import jax.numpy as jnp
from parajax import autopmap

jax.config.update("jax_num_cpu_devices", multiprocessing.cpu_count())
# ^ Only needed on CPU: allow JAX to use all CPU cores

@autopmap
def square(x):
    return x**2

xs = jnp.arange(97)
ys = square(xs)

That's it! Invocations of square will now be automatically parallelized across all available devices.

Documentation

For more details, check out the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parajax-0.2.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parajax-0.2.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file parajax-0.2.1.tar.gz.

File metadata

  • Download URL: parajax-0.2.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.22

File hashes

Hashes for parajax-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f218bbd7fb3668de915bcfc038a75dcf78cfc17c5ee913f6b5b894b5471c17c4
MD5 0ad64f688ada32febc8454d5341d8383
BLAKE2b-256 f1eaf298d9b5fcfe2e23ab4471e7ae00963fc3a102eb6fe26904765b9a5fe7ad

See more details on using hashes here.

File details

Details for the file parajax-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: parajax-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.22

File hashes

Hashes for parajax-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8810246aab0b0bcf867dafd155814290296ea3740668a2798cc83fc03446e834
MD5 62216e5bbff9363c9574d7444afde097
BLAKE2b-256 9f58c0617ff403727f07790b3e89b05fe740afd4277256f141471ae7bf1bb731

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page