code: def search(mnk_set, output_cfg_file, output_cfg_str):
      gemm_test_func = cuda_module.gemm_test
  
      all_outputs = []
      print("Start searching...")
      for m, n, k in tqdm(mnk_set):
          output = gemm_test_func(m, n, k)
          all_outputs.extend(output.strip().split("\n"))
  
      best_gemm_algos = extract(all_outputs)
      for d in best_gemm_algos:
          d_str = "{:>5d} {:>5d} {:>5d} {:>27} | {:>2d} {:>2d} {:>2d} {:>2d} {:>2d} {:>2d} {:>2d} {:>7d} | {:.4f} {:.4f} {:.2f} {:>2d}".format(
              d.shape[0],
              d.shape[1],
              d.shape[2],
              d.data_order,
              d.algo_id,
              d.tile,
              d.splitk,
              d.reduc,
              d.swizzle,
              d.custom,
              d.stages,
              d.workspace,
              d.fp16_time,
              d.int8_time,
              d.speedup,
              d.sm,
          )
          output_cfg_str.append(
              (d.shape[0], d.shape[1], d.shape[2], d.data_order, d_str)
          )
  
      def cmp(x, y):
          if x[2] != y[2]:
              return sign(x[2], y[2])
          elif x[1] != y[1]:
              return sign(x[1], y[1])
          elif x[0] != y[0]:
              return sign(x[0], y[0])
          else:
              return sign(x[3], y[3])
  
      output_cfg_str.sort(key=functools.cmp_to_key(cmp))
  
      with open(output_cfg_file, "w") as fout:
          for s in output_cfg_str:
              fout.write(s[4] + "\n")
  
file_path: lightseq/lightseq/training/ops/pytorch/gemm_test.py
imports: import os
  import functools
  from dataclasses import dataclass
  from copy import deepcopy
  from tqdm import tqdm
  from lightseq.training.ops.pytorch.builder import KernelBuilder
label_desc: Use image node_id 6 for calling a global function with example usage: search(mnk_set, output_cfg_file, output_cfg_str) and returns: sign, sign, sign, sign