code: def allreduce_cost(
      num_bytes: float, mesh: DeviceMesh, mesh_dim: int
  ) -> float:
      num_devices_on_mesh_dim = mesh.size(mesh_dim)
      bandwidth_factor = get_bandwidth_factor(mesh)[mesh_dim]
      # allreduce have 2x comm bytes compare to allgather/reduce_scatter
      return (
          1
          + 2
          * bandwidth_factor
          * num_bytes
          * (num_devices_on_mesh_dim - 1)
          / num_devices_on_mesh_dim
      )
  
file_path: pytorch/torch/distributed/_tensor/_collective_utils.py
imports: import logging
  import math
  from typing import List, Optional
  import torch
  import torch.distributed._tensor.placement_types
  from torch.distributed.device_mesh import _mesh_resources, DeviceMesh
  from torch.distributed.distributed_c10d import all_to_all, broadcast, get_global_rank, get_rank, get_world_size, GroupMember, ProcessGroup, scatter, Work
label_desc: Use image node_id 7 for calling a global function with example usage: allreduce_cost(num_bytes, mesh, mesh_dim) and returns: unknown