liveBook · Manning

Device mesh

As explained in Deep Learning with Python, Third Edition

A grid-like arrangement of devices used to assign different parallelism roles along named axes.

A device mesh is a grid of devices whose named axes assign different parallelism roles. One axis commonly handles data parallelism, while another handles model parallelism. section 18.2.2

An eight-GPU mesh

Arrange eight GPUs as a 2 × 4 mesh with axes named data and model. The four model-axis devices split computation across the model, while the two data-axis positions run separate sub-batches in parallel. section 18.2.2

Practical rules:

  • Use one-dimensional or two-dimensional meshes in common practice; higher-dimensional shapes are possible. section 18.2.2
  • Name axes according to their intended roles, then use a LayoutMap to assign variables across those axes. section 18.2.2

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines grid shapes, axis roles, and a 2 × 4 example before handing variable placement to LayoutMap.
Examples
Uses an eight-GPU 2 × 4 grid, named data and model axes, and Keras DeviceMesh construction.
What you can do after
Configure a Keras DeviceMesh that assigns separate axes to data and model parallelism.
How it connects
Connects device meshes with data parallelism, model parallelism, LayoutMap, and variable sharding.

Also explained in

Compare how 3 books explain device mesh →

Related concepts

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