code: def get_tmpdir() -> str:
      """return the same tmpdir for all processes."""
      rank, world_size = get_dist_info()
      MAX_LEN = 512
      # 32 is whitespace
      dir_tensor = torch.full((MAX_LEN,), 32, dtype=torch.uint8)
      if rank == 0:
          tmpdir = tempfile.mkdtemp()
          tmpdir = torch.tensor(
              bytearray(tmpdir.encode()), dtype=torch.uint8
          )
          dir_tensor[: len(tmpdir)] = tmpdir
      broadcast(dir_tensor, 0)
      tmpdir = dir_tensor.cpu().numpy().tobytes().decode().rstrip()
      return tmpdir
  
imports: import os
  import os.path
  import shutil
  import tempfile
  from collections import defaultdict
  from typing import List, Optional, Union
  import numpy
  import torch
  from mmengine.dist import all_gather_object, barrier, broadcast, broadcast_object_list, get_dist_info, is_main_process
  from mmengine.logging import MMLogger
  from mmdet.registry import METRICS, TASK_UTILS
  from .base_video_metric import BaseVideoMetric
label_desc: Use image node_id 1 for calling a global function with example usage: get_tmpdir() and returns: tmpdir