code: def communicate_flags(training_allowed, no_recovery_necessary):
      """A quick and dirty communication through the comm protocol. Should not be a major burden."""
      if torch.distributed.is_initialized():
          comm_tensor_allowed = torch.as_tensor(
              [training_allowed, no_recovery_necessary]
          )
          comm_tensor_allowed = (
              comm_tensor_allowed.cuda()
              if torch.cuda.is_available()
              else comm_tensor_allowed.float()
          )
          torch.distributed.all_reduce(
              comm_tensor_allowed,
              torch.distributed.ReduceOp.MIN,
              async_op=False,
          )
          if (
              comm_tensor_allowed[0] >= 1
          ):  # training indeed allowed on all devices
              return True, comm_tensor_allowed[1] > 0
          else:
              return False, True
      else:
          return training_allowed, no_recovery_necessary
  
file_path: bert-ultrafast/training/pretrain.py
imports: import torch
  import hydra
  import os
  import time
  import datetime
  import logging
  from collections import defaultdict
  import cramming
label_desc: Use image node_id 6 for calling a global function with example usage: communicate_flags(training_allowed, no_recovery_necessary) and returns: training_allowed,  no_recovery_necessary, True,  unknown, False,  True