35
35
import unittest
36
36
import subprocess
37
37
import os
38
- import shutil
39
38
from .autotuner_test_utils import AutoTunerTestUtils , accepted_rc
40
39
41
40
cur_dir = os .path .dirname (os .path .abspath (__file__ ))
45
44
class BaseAlgoEvalSmokeTest (unittest .TestCase ):
46
45
platform = ""
47
46
design = ""
47
+ flow_variant = "smoke-test-algo-eval"
48
48
49
49
def setUp (self ):
50
50
design_path = f"../../../flow/designs/{ self .platform } /{ self .design } "
51
- report_path = f"../../../flow/reports/{ self .platform } /{ self .design } "
52
51
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
+ )
55
56
# note for ppa-improv, you need to also add in reference file (--reference)
56
57
_algo = ["hyperopt" , "ax" , "optuna" , "pbt" , "random" ]
57
58
_eval = ["default" , "ppa-improv" ]
@@ -68,17 +69,14 @@ def setUp(self):
68
69
f" --reference { self .reference } "
69
70
for a , e in self .matrix
70
71
]
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" )
74
72
75
73
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" ,
80
78
]
81
- for command in commands :
79
+ for command in base_commands :
82
80
out = subprocess .run (command , shell = True )
83
81
self .assertTrue (out .returncode in accepted_rc )
84
82
@@ -93,10 +91,6 @@ def test_algo_eval(self):
93
91
successful = out .returncode in accepted_rc
94
92
self .assertTrue (successful )
95
93
96
- # On successful run, restore the metadata.json file
97
- shutil .copyfile (self .metadata + ".orig" , self .metadata )
98
- os .remove (self .metadata + ".orig" )
99
-
100
94
101
95
class asap7AlgoEvalSmokeTest (BaseAlgoEvalSmokeTest ):
102
96
platform = "asap7"
0 commit comments