Skip to content

Commit

Permalink
update hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
saienduri committed Oct 3, 2024
1 parent 4dc6c93 commit c48257e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
21 changes: 6 additions & 15 deletions common_tools/utils/bench_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,12 @@
import hashlib
import base64

def generate_md5_base64(file_path):
md5_hash = hashlib.md5()

with open(file_path, "rb") as file:
# Read the file in chunks to avoid using too much memory for large files
for chunk in iter(lambda: file.read(4096), b""):
md5_hash.update(chunk)

# Get the digest (raw bytes) of the MD5 hash
digest = md5_hash.digest()

# Encode the digest in Base64 and decode to string
base64_hash = base64.b64encode(digest).decode('utf-8')

return base64_hash
def generate_md5_hex(file_path):
md5 = hashlib.md5()
with open(file_path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
md5.update(chunk)
return md5.hexdigest()

BenchmarkResult = namedtuple(
"BenchmarkResult", "benchmark_name time cpu_time iterations user_counters"
Expand Down
2 changes: 1 addition & 1 deletion gemmbench/gemm_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def compile_gemm(tag, config, kernel_dir, vmfb_dir, target, extra_compiler_args,

for vmfb_filename, value in vmfb_dict.items():
tag, config = value
vmfb_hash = generate_md5_base64(vmfb_filename)
vmfb_hash = generate_md5_hex(vmfb_filename)
name = config.get_name()

inp1 = config.get_inp1()
Expand Down

0 comments on commit c48257e

Please sign in to comment.