Hi, your understanding is correct. Here are the definitions we also refer to in documentation (torch.distributed.run (Elastic Launch) — PyTorch master documentation 22)
I assume you are using torch.distributed.launch which is why you are reading from args.local_rank. If you don’t use this launcher then the local_rank will not exist in args.
As of torch 1.9 we have a improved and updated launcher (torch.distributed.run (Elastic Launch) — PyTorch master documentation 11) in which you can read local_rank and rank from the environment variables. If you need the node id you’re code is on you can identify it through its hostname?