mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-06-28 09:36:01 -04:00
Fix python shadowing builtins
This commit is contained in:
parent
4595e2cfb6
commit
87ae668442
4 changed files with 10 additions and 7 deletions
|
@ -14,10 +14,13 @@ select = [
|
||||||
"W", # warnings (pycodestyle)
|
"W", # warnings (pycodestyle)
|
||||||
"I", # Import related rules (isort)
|
"I", # Import related rules (isort)
|
||||||
"UP", # Upgraded version available in newer Python
|
"UP", # Upgraded version available in newer Python
|
||||||
|
"B", # bugbear rules
|
||||||
|
"A", # shadow builtins
|
||||||
"EXE", # Executable file shebangs
|
"EXE", # Executable file shebangs
|
||||||
"Q003", # Avoidable escaped quotes
|
"Q003", # Avoidable escaped quotes
|
||||||
"Q004", # Unnecessary esacpe character
|
"Q004", # Unnecessary esacpe character
|
||||||
"RUF", # Ruff specific rules
|
"RUF", # Ruff specific rules
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
ignore = [
|
ignore = [
|
||||||
|
@ -27,5 +30,6 @@ ignore = [
|
||||||
"E741", # ambiguous variable name
|
"E741", # ambiguous variable name
|
||||||
"W291", # trailing whitespace
|
"W291", # trailing whitespace
|
||||||
"W293", # blank line contains whitespace
|
"W293", # blank line contains whitespace
|
||||||
|
"B007", # loop control variable not used
|
||||||
"RUF005", # iterable unpacking in list
|
"RUF005", # iterable unpacking in list
|
||||||
]
|
]
|
||||||
|
|
|
@ -48,7 +48,6 @@ arch_list = [
|
||||||
"rv64gc",
|
"rv64gc",
|
||||||
"rv64gc_zba_zbb_zbs"
|
"rv64gc_zba_zbb_zbs"
|
||||||
]
|
]
|
||||||
str="32"
|
|
||||||
|
|
||||||
# Define regular expressions to match the desired fields
|
# Define regular expressions to match the desired fields
|
||||||
mt_regex = r"Elapsed MTIME: (\d+).*?Elapsed MINSTRET: (\d+).*?COREMARK/MHz Score: [\d,]+ / [\d,]+ = (\d+\.\d+).*?CPI: \d+ / \d+ = (\d+\.\d+).*?Load Stalls (\d+).*?Store Stalls (\d+).*?D-Cache Accesses (\d+).*?D-Cache Misses (\d+).*?I-Cache Accesses (\d+).*?I-Cache Misses (\d+).*?Branches (\d+).*?Branches Miss Predictions (\d+).*?BTB Misses (\d+).*?Jump and JR (\d+).*?RAS Wrong (\d+).*?Returns (\d+).*?BP Class Wrong (\d+)"
|
mt_regex = r"Elapsed MTIME: (\d+).*?Elapsed MINSTRET: (\d+).*?COREMARK/MHz Score: [\d,]+ / [\d,]+ = (\d+\.\d+).*?CPI: \d+ / \d+ = (\d+\.\d+).*?Load Stalls (\d+).*?Store Stalls (\d+).*?D-Cache Accesses (\d+).*?D-Cache Misses (\d+).*?I-Cache Accesses (\d+).*?I-Cache Misses (\d+).*?Branches (\d+).*?Branches Miss Predictions (\d+).*?BTB Misses (\d+).*?Jump and JR (\d+).*?RAS Wrong (\d+).*?Returns (\d+).*?BP Class Wrong (\d+)"
|
||||||
|
@ -66,7 +65,7 @@ with open(resultfile, mode='w', newline='') as csvfile:
|
||||||
|
|
||||||
# Loop through each architecture and run the make commands
|
# Loop through each architecture and run the make commands
|
||||||
for arch in arch_list:
|
for arch in arch_list:
|
||||||
xlen_value = "32" if str in arch else "64"
|
xlen_value = "32" if "32" in arch else "64"
|
||||||
os.system("make clean")
|
os.system("make clean")
|
||||||
make_all = f"make all XLEN={xlen_value} ARCH={arch}"
|
make_all = f"make all XLEN={xlen_value} ARCH={arch}"
|
||||||
os.system(make_all)
|
os.system(make_all)
|
||||||
|
|
|
@ -64,9 +64,9 @@ def run_arch_sweep():
|
||||||
current_date = datetime.now()
|
current_date = datetime.now()
|
||||||
# Format date as a string in the format YYYYMMDD
|
# Format date as a string in the format YYYYMMDD
|
||||||
date_string = current_date.strftime('%Y%m%d_%H%M%S')
|
date_string = current_date.strftime('%Y%m%d_%H%M%S')
|
||||||
dir = "run_"+date_string
|
target_dir = "run_"+date_string
|
||||||
# Create a directory with the date string as its name
|
# Create a directory with the date string as its name
|
||||||
os.mkdir(dir)
|
os.mkdir(target_dir)
|
||||||
|
|
||||||
# make a directory with the current date as its name
|
# make a directory with the current date as its name
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ def run_arch_sweep():
|
||||||
os.system("make clean")
|
os.system("make clean")
|
||||||
os.system("make run ARCH="+arch)
|
os.system("make run ARCH="+arch)
|
||||||
for res in ["SizeOpt_size", "SizeOpt_speed", "SpeedOpt_size", "SpeedOpt_speed"]:
|
for res in ["SizeOpt_size", "SizeOpt_speed", "SpeedOpt_size", "SpeedOpt_speed"]:
|
||||||
os.system("mv -f wally"+res+".json "+dir+"/wally"+res+"_"+arch+".json")
|
os.system("mv -f wally"+res+".json "+target_dir+"/wally"+res+"_"+arch+".json")
|
||||||
return dir
|
return target_dir
|
||||||
|
|
||||||
directory = run_arch_sweep()
|
directory = run_arch_sweep()
|
||||||
#directory = "run_20231120_072037-caches"
|
#directory = "run_20231120_072037-caches"
|
||||||
|
|
|
@ -262,7 +262,7 @@ def ReportAsText(benchmarkDict):
|
||||||
if(not args.summary):
|
if(not args.summary):
|
||||||
for benchmark in benchmarkDict:
|
for benchmark in benchmarkDict:
|
||||||
print(benchmark)
|
print(benchmark)
|
||||||
for (name, type, entries, size, val) in benchmarkDict[benchmark]:
|
for (name, prefixName, entries, size, val) in benchmarkDict[benchmark]:
|
||||||
sys.stdout.write(f'{name} {entries if not args.size else size} {val if not args.invert else 100 - val:0.2f}\n')
|
sys.stdout.write(f'{name} {entries if not args.size else size} {val if not args.invert else 100 - val:0.2f}\n')
|
||||||
|
|
||||||
def Inversion(lst):
|
def Inversion(lst):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue