code: def get_cpu_info():
      get_physical_core = {}
      get_socket = {}
      if platform.system() == "Windows":
          get_physical_core_args = [
              "wmic",
              "CPU",
              "GET",
              "NumberOfCores",
              "/VALUE",
          ]
          physical_cores = int(
              subprocess.check_output(
                  get_physical_core_args, universal_newlines=True
              )
              .splitlines()[4]
              .split("=")[1]
          )
          get_logical_core_args = [
              "wmic",
              "CPU",
              "GET",
              "NumberOfLogicalProcessors",
              "/VALUE",
          ]
          logical_cores = int(
              subprocess.check_output(
                  get_logical_core_args, universal_newlines=True
              )
              .splitlines()[4]
              .split("=")[1]
          )
          for i in range(logical_cores):
              # We don't know how to query which cores are physical cores on Windows,
              # so we use all logical cores
              get_physical_core[i] = i
              get_socket[i] = 0
      elif platform.system() == "Darwin":
          # We cannot query which cores are physical cores on MacOS,
          # so we use all logical cores
          get_logical_core_num_args = ["sysctl", "-n", "hw.ncpu"]
          logical_core_num = int(
              subprocess.check_output(
                  get_logical_core_num_args, universal_newlines=True
              )
          )
          for i in range(logical_core_num):
              get_physical_core[i] = i
              get_socket[i] = 0
      else:
          cpuinfo = []
  
          args = ["lscpu", "--parse=CPU,Core,Socket"]
          lscpu_info = subprocess.check_output(
              args, universal_newlines=True
          ).split("\n")
  
          # Get information about  cpu, core, socket and node
          for line in lscpu_info:
              pattern = r"^([\d]+,[\d]+,[\d]+)"
              regex_out = re.search(pattern, line)
              if regex_out:
                  cpuinfo.append(regex_out.group(1).strip().split(","))
  
          for line in cpuinfo:
              int_line = [int(x) for x in line]
              l_id, p_id, s_id = int_line
              get_physical_core[l_id] = p_id
              get_socket[l_id] = s_id
  
      return get_physical_core, get_socket
  
file_path: BigDL/python/nano/src/bigdl/nano/utils/common/schedule.py
imports: import subprocess
  import re
  import os
  from typing import Optional
  import platform
  import cpuinfo
  from bigdl.nano.utils.common import invalidInputError
label_desc: Use image node_id 2 for calling a global function with example usage: get_cpu_info() and returns: get_physical_core,  get_socket