runAllBenchmarks.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import os
  2. import os.path
  3. import subprocess
  4. import colorama
  5. from colorama import init,Fore, Back, Style
  6. import argparse
  7. GROUPS = [
  8. "BasicBenchmarks",
  9. "ComplexBenchmarks",
  10. "FIR",
  11. "MISC",
  12. "DECIM",
  13. "BIQUAD",
  14. "Controller",
  15. "FastMath",
  16. "SupportBarF32",
  17. "Support",
  18. "Unary",
  19. "Binary",
  20. "Transform"
  21. ]
  22. init()
  23. def msg(t):
  24. print(Fore.CYAN + t + Style.RESET_ALL)
  25. def processTest(test):
  26. subprocess.call(["python","processTests.py","-e",test])
  27. def addToDB(cmd):
  28. for g in GROUPS:
  29. msg("Add group %s" % g)
  30. subprocess.call(["python",cmd,g])
  31. def run(build,fvp,custom=None):
  32. result = "results.txt"
  33. resultPath = os.path.join(build,result)
  34. current=os.getcwd()
  35. try:
  36. msg("Build" )
  37. os.chdir(build)
  38. subprocess.call(["make"])
  39. msg("Run")
  40. with open(result,"w") as results:
  41. if custom:
  42. subprocess.call([fvp] + custom,stdout=results)
  43. else:
  44. subprocess.call([fvp,"-a","Testing"],stdout=results)
  45. finally:
  46. os.chdir(current)
  47. msg("Parse result")
  48. subprocess.call(["python","processResult.py","-e","-r",resultPath])
  49. msg("Regression computations")
  50. subprocess.call(["python","summaryBench.py","-r",resultPath])
  51. msg("Add results to benchmark database")
  52. addToDB("addToDB.py")
  53. msg("Add results to regression database")
  54. addToDB("addToRegDB.py")
  55. def processAndRun(buildfolder,fvp,custom=None):
  56. processTest("DSPBenchmarks")
  57. run(buildfolder,fvp,custom=custom)
  58. parser = argparse.ArgumentParser(description='Parse test description')
  59. parser.add_argument('-f', nargs='?',type = str, default="build_benchmark_m7", help="Build folder")
  60. parser.add_argument('-v', nargs='?',type = str, default="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe", help="Fast Model")
  61. parser.add_argument('-c', nargs='?',type = str, help="Custom args")
  62. args = parser.parse_args()
  63. if args.f is not None:
  64. BUILDFOLDER=args.f
  65. else:
  66. BUILDFOLDER="build_benchmark_m7"
  67. if args.v is not None:
  68. FVP=args.v
  69. else:
  70. FVP="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe"
  71. if args.c:
  72. custom = args.c.split()
  73. else:
  74. custom = None
  75. print(Fore.RED + "bench.db and reg.db databases must exist before running this script" + Style.RESET_ALL)
  76. msg("Process benchmark description file")
  77. subprocess.call(["python", "preprocess.py","-f","bench.txt"])
  78. msg("Generate all missing C files")
  79. subprocess.call(["python","processTests.py", "-e"])
  80. processAndRun(BUILDFOLDER,FVP,custom=custom)