You are given a cluster of GPUs represented as a graph:
gpuId
and belongs to a physical machine identified by
nodeId
.
(u, v)
indicates GPU
u
and
v
have a direct high-speed connection.
nodeIdReturn a grouping of GPUs such that all GPUs belonging to the same nodeId appear in the same output group.
Input (one possible representation)
gpus
: list of GPU objects, each with fields
{gpuId, nodeId}
links
: list of undirected edges
(gpuId1, gpuId2)
Output
gpuId
s with the same
nodeId
.
Notes
X groups to maximize internal linksNow ignore nodeId for grouping, and instead partition all GPUs into exactly X disjoint groups.
Goal: maximize the total number of links whose endpoints fall within the same group (i.e., maximize intra-group edges).
Output
group[gpuId] in {1..X}
(or
X
lists of
gpuId
s).
Clarifications/constraints to discuss