You have to use torchrun to connect them. I had the same problem and also asked about it (RPC + Torchrun hangs in ProcessGroupGloo). In my question you have a minimal example and also the torchrun command
EDIT: Omg, Iām seeing now your question was from 2022