parameters: (sub_g: dict, rank_id)
docstring: Example subg data
      {
      "subgraph_name":"subgraph_pool5","id":"0-3","dpu_name":"","device":"","workload":100352,"op_num":1,"i_tensors_shape":[[1,7,7,2048]],"o_tensors_shape":[[1,1,1,2048]],
      "mc_code_sstr.str()":
          "a0021001ff070000ff87017f004c02
           20a0121001ff070000ff87017f0084
           ...
          }
docstring_summary: Example subg data
      {
      "subgraph_name":"subgraph_pool5","id":"0-3","dpu_name":"","device":"","workload":100352,"op_num":1,"i_tensors_shape":[[1,7,7,2048]],"o_tensors_shape":[[1,1,1,2048]],
      "mc_code_sstr.str()":
          "a0021001ff070000ff87017f004c02
           20a0121001ff070000ff87017f0084
           ...
          }
docstring_tokens: Example subg data { subgraph_name : subgraph_pool5 id : 0 - 3 dpu_name : device : workload : 100352 op_num : 1 i_tensors_shape : [[ 1 7 7 2048 ]] o_tensors_shape : [[ 1 1 1 2048 ]] mc_code_sstr . str () : a0021001ff070000ff87017f004c02 20a0121001ff070000ff87017f0084 ... }
function: def get_subg_info(sub_g: dict, rank_id):
      """ Example subg data
      {
      "subgraph_name":"subgraph_pool5","id":"0-3","dpu_name":"","device":"","workload":100352,"op_num":1,"i_tensors_shape":[[1,7,7,2048]],"o_tensors_shape":[[1,1,1,2048]],
      "mc_code_sstr.str()":
          "a0021001ff070000ff87017f004c02
           20a0121001ff070000ff87017f0084
           ...
          }
      """
      global DPU_NAME
      global SUBGRAPH_DB
  
      """Only update DPU IP name for once"""
      if (DPU_NAME == ""):
          DPU_NAME = sub_g.get("dpu_name", "")
  
      idx_w = subg_to_id(sub_g, "workload")
  
      name = sub_g.get("subgraph_name").strip()
      workload = sub_g.get("workload", 0)
      depth = sub_g.get("depth", 0)
      op_num = sub_g.get("op_num", 0)
      device = sub_g.get("device", "unknow")
  
      mc = sub_g.get("mc_code_sstr.str()", "")
      mc_size = len(mc)
  
      if (mc_size < 50_000_000):
          if (mc_size > 5_000_000):
              logging.warning(
                  "vaitrace is analyzing .xmodel, this model is large, please wait for a while ")
          mc_info = dpu_mc_parser.process_mc(DPU_NAME, mc)
      else:
          logging.error(
              "vaitrace is analyzing .xmodel, this model is too large, vaitrace can not handle it now ")
          mc_info = [0, 0, 0, 0]
  
      load_io_img_size = mc_info[0]
      load_io_para_size = mc_info[1]
      save_io_size = mc_info[2]
  
      i_tensor_shape = sub_g.get("i_tensors_shape", [])
      o_tensor_shape = sub_g.get("o_tensors_shape", [])
  
      subg_info = {idx_w:
                   {"name": name,
                       "device": device,
                       "workload": workload,
                       "op_num": op_num,
                       "load_io_img_size": load_io_img_size,
                       "load_io_para_size": load_io_para_size,
                       "save_io_size": save_io_size,
                       "i_tensor_shape": i_tensor_shape,
                       "o_tensor_shape": o_tensor_shape,
                       "rank_id": rank_id}}
  
      if idx_w not in SUBGRAPH_DB.keys():
          SUBGRAPH_DB.update(subg_info)
      else:
          logging.info("SubGraph index duplication: [%s]" % idx_w)
function_tokens: def get_subg_info ( sub_g : dict , rank_id ) : global DPU_NAME global SUBGRAPH_DB """Only update DPU IP name for once""" if ( DPU_NAME == "" ) : DPU_NAME = sub_g . get ( "dpu_name" , "" ) idx_w = subg_to_id ( sub_g , "workload" ) name = sub_g . get ( "subgraph_name" ) . strip ( ) workload = sub_g . get ( "workload" , 0 ) depth = sub_g . get ( "depth" , 0 ) op_num = sub_g . get ( "op_num" , 0 ) device = sub_g . get ( "device" , "unknow" ) mc = sub_g . get ( "mc_code_sstr.str()" , "" ) mc_size = len ( mc ) if ( mc_size < 50_000_000 ) : if ( mc_size > 5_000_000 ) : logging . warning ( "vaitrace is analyzing .xmodel, this model is large, please wait for a while " ) mc_info = dpu_mc_parser . process_mc ( DPU_NAME , mc ) else : logging . error ( "vaitrace is analyzing .xmodel, this model is too large, vaitrace can not handle it now " ) mc_info = [ 0 , 0 , 0 , 0 ] load_io_img_size = mc_info [ 0 ] load_io_para_size = mc_info [ 1 ] save_io_size = mc_info [ 2 ] i_tensor_shape = sub_g . get ( "i_tensors_shape" , [ ] ) o_tensor_shape = sub_g . get ( "o_tensors_shape" , [ ] ) subg_info = { idx_w : { "name" : name , "device" : device , "workload" : workload , "op_num" : op_num , "load_io_img_size" : load_io_img_size , "load_io_para_size" : load_io_para_size , "save_io_size" : save_io_size , "i_tensor_shape" : i_tensor_shape , "o_tensor_shape" : o_tensor_shape , "rank_id" : rank_id } } if idx_w not in SUBGRAPH_DB . keys ( ) : SUBGRAPH_DB . update ( subg_info ) else : logging . info ( "SubGraph index duplication: [%s]" % idx_w )