Perhaps this answer should be revised?
I read the source code and found that this has now been changed.
  

      github.com
  

  
    pytorch/pytorch/blob/master/torch/distributed/elastic/agent/server/api.py#L580



      
      
              start_idx: int = 0,
              end_idx: int = -1,
          ) -> Tuple[int, List[int]]:
              if end_idx == -1:
                  end_idx = len(role_infos)
              prefix_sum = 0
              total_sum = 0
              for idx in range(start_idx, end_idx):
                  if role_idx > idx:
                      prefix_sum += role_infos[idx].local_world_size
                  total_sum += role_infos[idx].local_world_size
              return (
                  total_sum,
                  list(range(prefix_sum, prefix_sum + role_infos[role_idx].local_world_size)),
              )
          
          
# pyre-fixme[56]: Pyre was not able to infer the type of the decorator
          #  `torch.distributed.elastic.metrics.prof`.
          @prof
          def _assign_worker_ranks(
              self, store, group_rank: int, group_world_size: int, spec: WorkerSpec