liveBook · Manning

Jax.distributed.initialize()

As explained in Deep Learning with JAX

The JAX API call that initializes distributed execution across multiple processes and hosts.

Need JAX computations to span multiple hosts? Call jax.distributed.initialize() after starting the cluster and before any JAX computation. It establishes distributed execution for JAX’s multicontroller model, where the same Python program runs independently on every host. section 7.4

Keep these operational rules in mind:

  • Run the program manually on each host; a single Colab notebook does not currently provide a good process-management path. section 7.4
  • Initialization is required for GPU systems and optional but recommended for TPU systems. section 7.4
  • Use jax.process_index() to identify a process, then distinguish its local devices from global devices used through collective operations. section 7.4

Initialize every TPU worker

Place jax.distributed.initialize() at the top of the worker program, then print jax.process_index(). In a v2-32 TPU Pod slice, four workers report 32 global devices and eight local devices per host.

How Deep Learning with JAX covers it

How deep it goes
Defines initialization timing, process independence, and local-versus-global device visibility without detailing API internals.
Examples
Demonstrates a four-host v2-32 TPU Pod slice reporting process indices, global device counts, and local device counts.
What it assumes
Assumes a provisioned cluster and separately launched JAX processes; teaches the distinction between local and global devices.
What you can do after
Operate/configure multihost JAX programs by initializing each worker before computation and identifying process-local resources.
How it connects
Connects multicontroller execution with process_index(), pmap(), collective operations, local devices, and global devices.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.