IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

dcp_ranks

dcp_ranks()​

max.nn.common_layers.context_parallel.dcp_ranks(mesh, dcp)

source

Returns each device’s rank in its DCP group, for call_on_mesh.

A device’s rank is its coordinate along the DCP axis (dcp_axis()). That axis is innermost, so DCP groups are runs of dcp consecutive devices in the mesh’s row-major order, and device i is rank i % dcp.

Parameters:

Return type:

PerShard[int]