code: def get_tuning_parallism():
      if "DEV_NUM" in os.environ:
          dev_num = int(os.environ["DEV_NUM"])
      else:
          if backend in ["c-rocm", "#rocm"]:
              devices = subprocess.getoutput(
                  "/opt/rocm/bin/rocm_agent_enumerator | grep -v gfx000"
              ).split()
              if not devices:
                  raise Exception("Not valid rocm device found.")
              dev_num = len(devices)
          elif backend in ["c-cuda", "#cuda"]:
              devices = subprocess.getoutput(
                  "ls /dev/nvidia[0-9]* 2>/dev/null"
              ).split()
              if not devices:
                  raise Exception("Not valid rocm device found.")
              dev_num = len(devices)
          else:
              raise Exception("Unrecognized backend: %s" % backend)
      print("  >> Tuning parallism = %d" % dev_num)
      return dev_num
  
imports: import numpy
  import tvm
  import logging
  import math
  import re
  import sys, time, subprocess, os, random, hashlib
  from tvm import autotvm
  import topi
  import json
  from topi.util import get_const_tuple
  import importlib
  from tvm.autotvm.task.dispatcher import ApplyConfig
  from tvm.autotvm.task import ConfigEntity
  from threading import Timer
label_desc: Use image node_id 3 for calling a global function with example usage: get_tuning_parallism() and returns: dev_num