code: def measure_cpu_gpu_instant_load():
      # Get current cpu gpu load, as
      # load = [rank, cpu_load, nvidia_device_id, gpu_load]
      # result_arr: [load, load, ...]
  
      gpu_load = []
      if gpu_load_backend_ok:
          global gpu_a_load
          global gpu_m_count
  
          gpu_m_count += 1
          try:
              comm = current_communicator()
              if comm:
                  index = comm.local_rank
              elif "cuda" in str(nn.get_current_context().backend):
                  index = 0
              else:
                  raise Exception
              handler = nvml.nvmlDeviceGetHandleByIndex(index)
              gpu_load = [
                  [
                      index,
                      nvml.nvmlDeviceGetUtilizationRates(handler).gpu,
                  ]
              ]
  
              if index in gpu_a_load.keys():
                  gpu_a_load[index]["name"] = nvml.nvmlDeviceGetName(
                      handler
                  ).decode("utf-8")
                  o_load = gpu_a_load[index]["load"]
                  n_load = gpu_load[0][1]
                  gpu_a_load[index]["load"] = (
                      (gpu_m_count - 1) * o_load + n_load
                  ) / gpu_m_count
              else:
                  gpu_a_load[index] = {
                      "name": nvml.nvmlDeviceGetName(handler).decode(
                          "utf-8"
                      ),
                      "load": gpu_load[0][1],
                  }
  
          except Exception:
              gpu_load = []
  
      if cpu_load_backend_ok:
          global p_handler
          cpu_load = p_handler.cpu_percent()
          callback.update_status(
              (
                  "cpu_gpu_load",
                  collect_and_shape_result(cpu_load, gpu_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 6 for calling a global function with example usage: measure_cpu_gpu_instant_load() without return types