Validate number of GPUs in distributed_test. (#47259)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47259
As described in https://github.com/pytorch/pytorch/issues/47257, not
using enough number of GPUs would result in an error.
As a result, before we call `init_process_group` in distributed_test, we
validate we have enough GPUs.
#Closes: https://github.com/pytorch/pytorch/issues/47257
ghstack-source-id: 115790475
Test Plan: waitforbuildbot
Reviewed By: rohan-varma
Differential Revision: D24699122
fbshipit-source-id: 59c78d191881d1e063c43623dcf4d7eb75a2e94e