[Bug] Fixing `test_gpu_sampling_DataLoader` that fails with torch 2.7.
## Description
<!-- Brief description. Refer to the related issues if existed.
It'll be great if relevant reviewers can be assigned as well.-->
Beginning with PyTorch `2.7.0a`, the `test_gpu_sampling_DataLoader` test consistently fails, producing the following error:
```
group = group or _get_default_group()
> work = group.alltoall_base(
output, input, output_split_sizes, input_split_sizes, opts
)
E RuntimeError: No backend type associated with device type cpu
E This exception is thrown by __iter__ of MiniBatchTransformer(datapipe=Bufferer, transformer=_seeds_cooperative_exchange_1_wait_future)
/usr/local/lib/python3.12/dist-packages/torch/distributed/distributed_c10d.py:4390: RuntimeError
```
Since the `gloo` backend does not support `alltoall`:
```
group = group or _get_default_group()
> work = group.alltoall(output_tensor_list, input_tensor_list, opts)
E RuntimeError: Backend gloo does not support alltoall
E This exception is thrown by __iter__ of MiniBatchTransformer(datapipe=Bufferer, transformer=_seeds_cooperative_exchange_2)
```
and the `ucc` backend is slated for deprecation, the `mpi` backend is now the only viable option for this test.
This PR introduces backward compatibility, allowing the test to run on older and newer PyTorch versions.
## Checklist
Please feel free to remove inapplicable items for your PR.
- [x] The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
- [x] I've leverage the [tools](https://docs.google.com/document/d/1iHyj7zlmygKSk5gBPsqIqL5ASPzJSPREaNT_QdsiYA4/edit) to beautify the python and c++ code.
- [x] The PR is complete and small, read the [Google eng practice (CL equals to PR)](https://google.github.io/eng-practices/review/developer/small-cls.html) to understand more about small PR. In DGL, we consider PRs with less than 200 lines of core code change are small (example, test and documentation could be exempted).
- [x] All changes have test coverage
- [x] Code is well-documented
- [x] To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
## Changes
<!-- You could use following template
- [ ] Feature1, tests, (and when applicable, API doc)
- [ ] Feature2, tests, (and when applicable, API doc)
-->
合并状态:未合并 0 条评论