liveBook · Manning

Device mesh

As explained in Deep Learning with R, Third Edition

A device mesh is a multidimensional logical arrangement of computational devices organized along named axes.

A device mesh is a grid of computational devices organized along named axes. One axis can support data parallelism while another supports model parallelism. section 18.2.2

A 2 × 4 GPU mesh

An eight-GPU arrangement can use two devices along the data axis and four along the model axis. Keras then makes two copies of a model split across four GPUs, processing separate sub-batches in parallel. section 18.2.2

device_mesh <- keras$distribution$DeviceMesh(
  shape = shape(2, 4),  #1
  axis_names = c("data", "model")  #2
)

Create a named two-dimensional mesh in Keras by specifying its shape and axis names. section 18.2.2

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines device grids, named axes, and a 2 × 4 construction before assigning variable layouts with LayoutMap.
Examples
Uses an eight-GPU grid, a 2 × 4 DeviceMesh, and explicit GPU device names.
What you can do after
Operate/configure Keras distribution with a device mesh for model-parallel training and mixed parallel strategies.
How it connects
Connects data parallelism and model parallelism through named mesh axes and variable layouts.

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 R, Third Edition. The section links point to the parts of the book it draws on.