def get_data_parallel_group():
    """Get the data parallel group the caller rank belongs to."""
    global _USE_MEGATRON
    if _USE_MEGATRON:
        from fairseq.model_parallel.megatron import mpu

        return mpu.get_data_parallel_group()
    else:
        return get_global_group()
Get the data parallel group the caller rank belongs to.
fairseq/distributed/utils.py