code: def get_cpu_gpu_average_load():
      # Get average cpu gpu load, as
      # load = [rank, cpu_load, nvidia_device_id, gpu_load]
      # result_arr: [load, load, ...]
  
      g_load = []
      if gpu_load_backend_ok:
          global gpu_a_load
          global gpu_m_count
  
          load_info = {**gpu_a_load}
          gpu_a_load = {}
          gpu_m_count = 0
  
          # adjust data type then transfer them to numpy ndarray
          g_load = [
              [float(a), float(load_info[a]["load"])]
              for a in load_info.keys()
          ]
          g_load = g_load[:1] if len(g_load) else []
  
      if cpu_load_backend_ok:
          global p_handler_avg
          c_load = p_handler_avg.cpu_percent()
          return collect_and_shape_result(c_load, g_load)
  
imports: import os
  import re
  import timeit
  from contextlib import contextmanager
  import nnabla
  import nnabla.utils.callback
  import numpy
  from nnabla.config import nnabla_config
  from nnabla.logger import logger
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.communicator_util import current_communicator
  from nnabla.utils.get_file_handle import get_file_handle_save, get_decorated_file_loader, load_files
  from contextlib import contextmanager
  import nnabla.logger
  from nnabla.lms import SwapInOutScheduler
label_desc: Use image node_id 7 for calling a global function with example usage: get_cpu_gpu_average_load() and returns: collect_and_shape_result