Move functional collectives implementation to python. (#98595)
This simplifies a lot the work we need to add new ops.
This relands the previous PR, not sure why it was reverted.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98595
Approved by: https://github.com/wconstab