3535import unittest
3636import subprocess
3737import os
38- import shutil
3938from .autotuner_test_utils import AutoTunerTestUtils , accepted_rc
4039
4140cur_dir = os .path .dirname (os .path .abspath (__file__ ))
4544class BaseAlgoEvalSmokeTest (unittest .TestCase ):
4645 platform = ""
4746 design = ""
47+ flow_variant = "smoke-test-algo-eval"
4848
4949 def setUp (self ):
5050 design_path = f"../../../flow/designs/{ self .platform } /{ self .design } "
51- report_path = f"../../../flow/reports/{ self .platform } /{ self .design } "
5251 self .config = os .path .join (cur_dir , f"{ design_path } /autotuner.json" )
53- self .experiment = f"smoke-test-algo-eval-{ self .platform } "
54- self .reference = os .path .join (cur_dir , f"{ design_path } /metadata-base-at.json" )
52+ self .experiment = f"{ self .flow_variant } -{ self .platform } "
53+ self .reference = os .path .join (
54+ cur_dir , f"{ design_path } /metadata-{ self .flow_variant } -at.json"
55+ )
5556 # note for ppa-improv, you need to also add in reference file (--reference)
5657 _algo = ["hyperopt" , "ax" , "optuna" , "pbt" , "random" ]
5758 _eval = ["default" , "ppa-improv" ]
@@ -68,17 +69,14 @@ def setUp(self):
6869 f" --reference { self .reference } "
6970 for a , e in self .matrix
7071 ]
71- # Make a file copy of the original metadata.json
72- self .metadata = os .path .join (cur_dir , f"{ report_path } /metadata.json" )
73- shutil .copyfile (self .metadata , self .metadata + ".orig" )
7472
7573 def make_base (self ):
76- commands = [
77- f"make -C { orfs_dir } DESIGN_CONFIG=./designs/{ self .platform } /{ self .design } /config.mk clean_all" ,
78- f"make -C { orfs_dir } DESIGN_CONFIG=./designs/{ self .platform } /{ self .design } /config.mk EQUIVALENCE_CHECK=0" ,
79- f"make -C { orfs_dir } DESIGN_CONFIG=./designs/{ self .platform } /{ self .design } /config.mk update_metadata_autotuner" ,
74+ base_commands = [
75+ f"FLOW_VARIANT= { self . flow_variant } make -C { orfs_dir } DESIGN_CONFIG=./designs/{ self .platform } /{ self .design } /config.mk clean_all" ,
76+ f"FLOW_VARIANT= { self . flow_variant } make -C { orfs_dir } DESIGN_CONFIG=./designs/{ self .platform } /{ self .design } /config.mk EQUIVALENCE_CHECK=0" ,
77+ f"FLOW_VARIANT= { self . flow_variant } make -C { orfs_dir } DESIGN_CONFIG=./designs/{ self .platform } /{ self .design } /config.mk update_metadata_autotuner" ,
8078 ]
81- for command in commands :
79+ for command in base_commands :
8280 out = subprocess .run (command , shell = True )
8381 self .assertTrue (out .returncode in accepted_rc )
8482
@@ -93,10 +91,6 @@ def test_algo_eval(self):
9391 successful = out .returncode in accepted_rc
9492 self .assertTrue (successful )
9593
96- # On successful run, restore the metadata.json file
97- shutil .copyfile (self .metadata + ".orig" , self .metadata )
98- os .remove (self .metadata + ".orig" )
99-
10094
10195class asap7AlgoEvalSmokeTest (BaseAlgoEvalSmokeTest ):
10296 platform = "asap7"
0 commit comments