Move functional collectives implementation to python. (#98315)
This simplifies a lot the work we need to add new ops.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98315
Approved by: https://github.com/albanD, https://github.com/wconstab, https://github.com/Neilblaze