Solved by mrshenli in post #2 
              
              
                multiprocessing.spawn will feed the process id as the first argument to the target function. Here is the API doc: https://pytorch.org/docs/stable/multiprocessing.html#torch.multiprocessing.spawn