I also copied the code sample from pytorch official tutorials
#!/usr/bin/env python
import os
import torch
import torch.distributed as dist
from torch.multiprocessing import Process

def run(rank, size):
    """ Distributed function to be implemented later. """
    pass

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)


if __name__ == "__main__":
    size = 2
    processes = []
    for rank in range(size):
        p = Process(target=init_process, args=(rank, size, run))
        p.start()
        processes.append(p)

    for p in processes:
        p.join()

this tutorial link is here distributed_tutorial_link 2
But, I still got error.
And this code can only run a part  by setting the init_method = ‘file://./sharedfile’.
I got the error
Process Process-1:
Traceback (most recent call last):
  File "C:\Anaconda3\envs\pt\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Anaconda3\envs\pt\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Kevin\Documents\Scripts\inpaint\test.py", line 13, in init_process
    dist.init_process_group('gloo',rank=rank,world_size=size,init_method='file://./sharedfile')
  File "C:\Anaconda3\envs\pt\lib\site-packages\torch\distributed\distributed_c10d.py", line 433, in init_process_group
    timeout=timeout)
  File "C:\Anaconda3\envs\pt\lib\site-packages\torch\distributed\distributed_c10d.py", line 508, in _new_process_group_helper
    timeout=timeout)
RuntimeError
Process Process-2:
Traceback (most recent call last):
  File "C:\Anaconda3\envs\pt\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Anaconda3\envs\pt\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Kevin\Documents\Scripts\inpaint\test.py", line 13, in init_process
    dist.init_process_group('gloo',rank=rank,world_size=size,init_method='file://./sharedfile')
  File "C:\Anaconda3\envs\pt\lib\site-packages\torch\distributed\distributed_c10d.py", line 433, in init_process_group
    timeout=timeout)
  File "C:\Anaconda3\envs\pt\lib\site-packages\torch\distributed\distributed_c10d.py", line 508, in _new_process_group_helper
    timeout=timeout)
RuntimeError

Process finished with exit code 0


Is there anything wrong with  this  code sample or my laptop?