In addition to the above response, standard multiprocessing communication methods such as Queue or mp.Manager should work as well: https://docs.python.org/3/library/multiprocessing.html 5, assuming your processes are on the same machine.
If your particular use case is around data sampling, you could also look into DistributedSampler, which will automatically partition data out to DDP ranks for you: https://github.com/pytorch/pytorch/blob/c1e6592964261d2856c84e166a0989684f946697/torch/utils/data/distributed.py#L12 4
Finally, we have also have APIs such as all_gather_object and broadcast_object_list which can be used to communicate general picklable python objects across ranks: https://github.com/pytorch/pytorch/blob/master/torch/distributed/distributed_c10d.py#L1279 17. These APIs are quite new and subject to significant changes, but may be useful for your use case.