Explicitly destory ProcessGroup in allgather_coalesced_async test (#65513)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65513
The error in #65231 means some child threads were destructed before
joined. I added some trace and prints and found that, in the failed
tests, all `assertEqual` are passed, but the `ProcessGroupGloo`
destructor wasn't called in one of the process. It could be due to
the only guarantee that Python makes is that garbage collection MAY
happen before the program exits. This commit adds an explicit
`destroy_process_group()` to alleviate the problem.
cc pietern mrshenli pritamdamania87 zhaojuanmao satgera rohan-varma gqchen aazzolini osalpekar jiayisuse SciPioneer H-Huang gcramer23
Test Plan: Imported from OSS
Reviewed By: rohan-varma
Differential Revision: D31134174
Pulled By: mrshenli
fbshipit-source-id: 2e42fe93d3f16ce34681b591afc15a6ac0b9fab6