This document is relevant for: Trn2, Trn3
nki.collectives.self_index_in_replica_group#
- nki.collectives.self_index_in_replica_group(replica_group: ReplicaGroup, name: Optional[str] = None)[source]#
Get the caller’s index within its own rank list of
replica_group.With
replica_group = [[0, 1, 2, 3], [4, 5, 6, 7]], the caller on global rank 6 sits at position 2 of its rank list, so the API returns 2.It is an error if the caller appears in no rank list of
replica_group.- Parameters:
replica_group – the replica group to resolve the caller’s index within
name – (optional) name for the instruction.
- Returns:
The caller’s index within its own rank list, as an
NkiScalar
This document is relevant for: Trn2, Trn3