def initialize_dist(request: pytest.FixtureRequest):
    """Initialize the default PyTorch distributed process group for tests."""
    gpu = request.node.get_closest_marker('gpu')
    dist.initialize_dist(get_device('gpu' if gpu is not None else 'cpu'))
Initialize the default PyTorch distributed process group for tests.
tests/fixtures/autouse.py