I studied the tutorial post about torch.distributed (examples are in the gitHub repository). I see the initialzation is
def init_process(rank, size, fn, backend='gloo'):
""" Initialize the distributed environment. """
os.environ['MASTER_ADDR'] = '127.0.0.1'
os.environ['MASTER_PORT'] = '29500'
dist.init_process_group(backend, rank=rank, world_size=size)
fn(rank, size)
I don't know the internal design of master. What is the functionality of master in torch.distributed init_process_group? For example, if there are 4 processes to do distributed training. Rank 0 is set as the master. And I send a tensor from Rank 1 to Rank 3. What is the communication rule defined inside the torch.distributed? Is it like
Rank 1 -> Rank 0 -> Rank 3, where -> is communication or say handshake to make a connection.
Or Rank 0 (master) is used to store all ips of Rank 0-3 in a table so that any process (Rank 0-3) can immediately check the destination ip address so to make a connection like
Rank 1 -> Rank 3, where the setting is the same as the above example.