Fix TestDistBackendWithSpawn.test_backend_group and test_backend_full_group (#107231)
Fixes https://github.com/pytorch/pytorch/issues/107078 and allows tests to be run with 2 GPUs only.
testing command:
`BACKEND=gloo WORLD_SIZE=2 pytest test/distributed/test_distributed_spawn.py -vs -k test_backend_group`
`BACKEND=nccl WORLD_SIZE=2 pytest test/distributed/test_distributed_spawn.py -vs -k test_backend_full_group`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/107231
Approved by: https://github.com/rohan-varma