Skip to content

Commit

Permalink
Fix python shadowing builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
jordancarlin committed Feb 16, 2025
1 parent 4595e2c commit 87ae668
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ select = [
"W", # warnings (pycodestyle)
"I", # Import related rules (isort)
"UP", # Upgraded version available in newer Python
"B", # bugbear rules
"A", # shadow builtins
"EXE", # Executable file shebangs
"Q003", # Avoidable escaped quotes
"Q004", # Unnecessary esacpe character
"RUF", # Ruff specific rules

]

ignore = [
Expand All @@ -27,5 +30,6 @@ ignore = [
"E741", # ambiguous variable name
"W291", # trailing whitespace
"W293", # blank line contains whitespace
"B007", # loop control variable not used
"RUF005", # iterable unpacking in list
]
3 changes: 1 addition & 2 deletions benchmarks/coremark/coremark_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"rv64gc",
"rv64gc_zba_zbb_zbs"
]
str="32"

# 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+)"
Expand All @@ -66,7 +65,7 @@

# Loop through each architecture and run the make commands
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")
make_all = f"make all XLEN={xlen_value} ARCH={arch}"
os.system(make_all)
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/embench/embench_arch_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def run_arch_sweep():
current_date = datetime.now()
# Format date as a string in the format YYYYMMDD
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
os.mkdir(dir)
os.mkdir(target_dir)

# make a directory with the current date as its name

Expand All @@ -75,8 +75,8 @@ def run_arch_sweep():
os.system("make clean")
os.system("make run ARCH="+arch)
for res in ["SizeOpt_size", "SizeOpt_speed", "SpeedOpt_size", "SpeedOpt_speed"]:
os.system("mv -f wally"+res+".json "+dir+"/wally"+res+"_"+arch+".json")
return dir
os.system("mv -f wally"+res+".json "+target_dir+"/wally"+res+"_"+arch+".json")
return target_dir

directory = run_arch_sweep()
#directory = "run_20231120_072037-caches"
Expand Down
2 changes: 1 addition & 1 deletion bin/parseHPMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def ReportAsText(benchmarkDict):
if(not args.summary):
for benchmark in benchmarkDict:
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')

def Inversion(lst):
Expand Down

0 comments on commit 87ae668

Please sign in to comment.