genJobList.py 1.52 KB
Newer Older
1 2 3 4
import os
import shutil
import fileinput
import re
5
import time
6 7

testcases = ['ariane136', 'ariane133', 'mempool_tile', 'nvdla']
8
enablements = ['NanGate45', 'ASAP7', 'SKY130HD']
9
flows = [1, 2]
10 11
if not os.path.exists("./job"):
    os.makedirs("./job")
12
job_file = "./job/all_jobs"
13

14
fp = open(job_file, "w+")
15
run_dir_name= f"run-{time.strftime('%Y%m%d-%H%M%S')}"
16 17 18 19
for enablement in enablements:
  for testcase in testcases:
    for flow in flows:
      ## Check if the run directory exists
20 21
      run_dir = f"./{enablement}/{testcase}/{run_dir_name}"
      print(run_dir)
22 23 24 25 26
      if not os.path.exists(run_dir):
        os.makedirs(run_dir)
      
      ## Copy the scripts
      scripts_src = f"./{enablement}/{testcase}/scripts/cadence"
27
      scripts_dst = f"{run_dir}/flow{flow}"
sakundu committed
28
      
29
      if os.path.exists(scripts_dst):
sakundu committed
30 31 32
          print(f"For TestCase:{testcase} Enablement:{enablement} Flow:{flow}"
                "already exists. So not generating job for this")
      
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
      shutil.copytree(scripts_src, scripts_dst)

      ## Update the run.sh for flow
      flow_ip = 0
      if flow == 2:
        flow_ip = 1

      for line in fileinput.input(f"{scripts_dst}/run.sh", inplace=True):
        #line.replace("export PHY_SYNTH.*", f"export PHY_SYNTH={flow_ip}")
        line = re.sub(r"export\s+PHY_SYNTH\s*=.*",
                      f"export PHY_SYNTH={flow_ip}", line)
        print(line, end="")

      ## Add job to the job list
      scripts_dst_abs_path = os.path.abspath(scripts_dst)
      fp.write(f"cd {scripts_dst_abs_path}; sh run.sh;\n")