Move worker name collection code from Python to C++ (#24260)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/24260
This also simplifies ProcessGroupAgent constructor signature.
Test Plan: Imported from OSS
Differential Revision: D16789219
Pulled By: mrshenli
fbshipit-source-id: bbb69022435467fbb1c28da21dd03d3ab52fc521