{"record":{"id":"d616c8756e086909","repo":"open-mmlab/mmdetection","slug":"group-is-deprecated-currently-only-supports-nccl","errorCode":null,"errorMessage":"group` is deprecated. Currently only supports NCCL backend.","messagePattern":"group` is deprecated\\. Currently only supports NCCL backend\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/utils/dist_utils.py","lineNumber":110,"sourceCode":"    The code is modified from https://github.com/Megvii-\n    BaseDetection/YOLOX/blob/main/yolox/utils/allreduce_norm.py.\n\n    NOTE: make sure that py_dict in different ranks has the same keys and\n    the values should be in the same shape. Currently only supports\n    nccl backend.\n\n    Args:\n        py_dict (dict): Dict to be applied all reduce op.\n        op (str): Operator, could be 'sum' or 'mean'. Default: 'sum'\n        group (:obj:`torch.distributed.group`, optional): Distributed group,\n            Default: None.\n        to_float (bool): Whether to convert all values of dict to float.\n            Default: True.\n\n    Returns:\n        OrderedDict: reduced python dict object.\n    \"\"\"\n    warnings.warn(\n        'group` is deprecated. Currently only supports NCCL backend.')\n    _, world_size = get_dist_info()\n    if world_size == 1:\n        return py_dict\n\n    # all reduce logic across different devices.\n    py_key = list(py_dict.keys())\n    if not isinstance(py_dict, OrderedDict):\n        py_key_tensor = obj2tensor(py_key)\n        dist.broadcast(py_key_tensor, src=0)\n        py_key = tensor2obj(py_key_tensor)\n\n    tensor_shapes = [py_dict[k].shape for k in py_key]\n    tensor_numels = [py_dict[k].numel() for k in py_key]\n\n    if to_float:\n        warnings.warn('Note: the \"to_float\" is True, you need to '\n                      'ensure that the behavior is reasonable.')","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/utils/dist_utils.py#L92-L128","documentation":"all_reduce_dict in mmdet/utils/dist_utils.py warns that the group argument is deprecated and only the NCCL backend is supported, before performing an all-reduce of a dict of tensors across ranks (used by hooks like before_val_epoch to aggregate validation metrics). On world_size == 1 it returns immediately after the warning, so single-process runs only see noise.","triggerScenarios":"Distributed evaluation (mmdet hooks calling all_reduce_dict in before_val_epoch) or any direct call to all_reduce_dict(py_dict). Triggered regardless of backend because the warning fires unconditionally at function entry; actual reduction requires NCCL (GPU) distributed init.","commonSituations":"Multi-GPU validation with torch.distributed launched via tools/dist_train.sh; running on CPU-only distributed (Gloo) where the NCCL-only assumption breaks; single-GPU runs where the warning is pure noise since world_size==1 short-circuits.","solutions":["If on GPUs, ensure distributed is initialized with NCCL: torch.distributed.init_process_group(backend='nccl') and launch via the provided dist scripts.","If you called all_reduce_dict directly, drop the group argument and rely on the default process group.","For CPU/multi-machine non-NCCL setups, replace all_reduce_dict with your own reduce (e.g. all_gather + torch.distributed.all_reduce with Gloo) since NCCL is unsupported here.","Suppress the notice in logs when behavior is already correct: warnings.filterwarnings('ignore', message=\".*group` is deprecated.*\")."],"exampleFix":"# before\nreduced = all_reduce_dict(metrics, group=my_group)\n# after\nreduced = all_reduce_dict(metrics)  # group deprecated; NCCL default process group used","handlingStrategy":"validation","validationCode":"import torch, torch.distributed as dist\n\ndef nccl_ready() -> bool:\n    return dist.is_available() and dist.is_initialized() and dist.get_backend() == 'nccl'","typeGuard":"def safe_all_reduce_dict(py_dict):\n    import warnings\n    from mmdet.utils import all_reduce_dict, get_dist_info\n    _, world_size = get_dist_info()\n    if world_size == 1:\n        return py_dict  # skip warn + reduce on single process\n    assert dist.get_backend() == dist.Backend.NCCL, 'all_reduce_dict requires NCCL'\n    with warnings.catch_warnings():\n        warnings.simplefilter('ignore')\n        return all_reduce_dict(py_dict)","tryCatchPattern":null,"preventionTips":["Initialize distributed with backend='nccl' for GPU training/validation.","Call all_reduce_dict without the group argument.","Short-circuit on world_size==1 to avoid pointless warnings in single-GPU runs."],"tags":["mmdetection","distributed","nccl","deprecation","all-reduce"],"backgroundTag":"distributed-backend-mismatch","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}