Function opensn::SelectDeviceIndex

Function Documentation

int opensn::SelectDeviceIndex(const std::vector<std::vector<std::string>> &visible_gpus, int node_rank)

Returns the index, in the device order of node-local rank node_rank, of the GPU that the rank uses, or -1 when it sees none.

visible_gpus[i] lists the identifiers, as GetVisibleGPUIDs() returns them, of the GPUs that node-local rank i sees, in its device order. Ranks that see the same set of GPUs, in any order, share them round-robin in node-local rank order, taking them in the order the first of those ranks lists them. An identifier listed more than once counts as one GPU, and a rank uses its first device with the identifier it selects.