code: def broadcast_from_master(data: Any) -> Any:
      """
      Broadcast data from master node to all other nodes. This may be required when you
      want to compute something only on master node (e.g computational-heavy metric) and
      don't want to vaste CPU of other nodes doing same work simultaneously.
  
      >>> if is_main_process():
      >>>    result = some_code_to_run(...)
      >>> else:
      >>>    result = None
      >>> # 'result' propagated to all nodes from master
      >>> result = broadcast_from_master(result)
  
      Args:
          data: Data to be broadcasted from master node (rank 0)
  
      Returns:
          Data from rank 0 node
      """
      world_size = get_world_size()
      if world_size == 1:
          return data
  
      local_rank = get_rank()
      storage: Tensor
  
      if local_rank == 0:
          buffer = pickle.dumps(data)
          storage = torch.UntypedStorage.from_buffer(
              buffer, dtype=torch.uint8
          )
          payload = torch.ByteTensor(storage).to("cuda")
          local_size = payload.numel()
      else:
          local_size = 0
  
      # Propagate target tensor size to all nodes
      local_size = max(all_gather(local_size))
      if local_rank != 0:
          payload = torch.empty(
              (local_size,), dtype=torch.uint8, device="cuda"
          )
  
      dist.broadcast(payload, 0)
      buffer = payload.cpu().numpy().tobytes()
      return pickle.loads(buffer)
  
imports: import gc
  import inspect
  import logging
  import os
  import pickle
  import typing
  import functools
  from typing import Any, Dict, List, Optional
  import numpy
  import torch
  from torch import Tensor
  import torch.distributed
  from pytorch_toolbelt.utils.bucket_assignment import naive_bucket_assignment, compute_bucket_imbalance_score, random_bucket_assignment, filler_bucket_assignment
label_desc: Use image node_id 6 for calling a global function with example usage: broadcast_from_master(data) and returns: pickle, data