Add an option to run RPC tests with TCP init (#48248)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48248
We have found a few bugs where initializing/de-initializing/re-initializing RPC, and using RPC along with process groups does not work as expected, usually under TCP/env initialization (which is used over `file` which is the init that we use in our test in multi-machine scenarios).
Due to this motivation, this PR adds an environment variable `RPC_INIT_WITH_TCP` that allows us to run any RPC test with TCP initialization.
To avoid port collisions, we use `common.find_free_port()`.
ghstack-source-id: 117553039
Test Plan: CI
Reviewed By: lw
Differential Revision: D25085458
fbshipit-source-id: b5dbef2ff8ae88fa5bc1bb85a9e0fe077dbb552c