From 119bc9d8f95bd40b614da43ed8c94a0e56d01e34 Mon Sep 17 00:00:00 2001 From: cephi_sui Date: Wed, 11 Dec 2024 14:43:23 -0500 Subject: [PATCH] Some updates --- analysis/data_stat.py | 8 ++++++-- pytorch/analyze.py | 1 + .../altra_10_10_soc-sign-Slashdot090221_100000.json | 1 - pytorch/run.py | 8 +++++--- pytorch/spmv.py | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/analysis/data_stat.py b/analysis/data_stat.py index 9783392..83b5d50 100644 --- a/analysis/data_stat.py +++ b/analysis/data_stat.py @@ -3,7 +3,7 @@ import re from enum import Enum class Stat(Enum): - CPU = 'cpu' + PLATFORM = 'platform' THREADS = 'threads' ITERATIONS = 'iterations' @@ -21,9 +21,13 @@ class Stat(Enum): POWER_BEFORE = 'power before' POWER = 'power' POWER_AFTER = 'power after' + TIME_S_OVERALL = 'time (sec) overall' TIME_S = 'time (sec)' - DELTA_WATT = 'Δ watt' + JOULES_OVERALL = 'joules overall' JOULES = 'joules' + WATTS_OVERALL = 'wattage overall' + WATTS = 'wattage' + DELTA_WATT = 'Δ watt' TASK_CLK = 'task clock (msec)' PAGE_FAULTS = 'page faults' diff --git a/pytorch/analyze.py b/pytorch/analyze.py index 9ca8f48..e67764e 100755 --- a/pytorch/analyze.py +++ b/pytorch/analyze.py @@ -178,6 +178,7 @@ def main(): for filename in glob.glob(f'{args.input_dir.rstrip("/")}/*.json'): with open(filename, 'r') as file: + print(filename) data_list.append(json.load(file)) print(filename + " loaded.") diff --git a/pytorch/output_test2/altra_10_10_soc-sign-Slashdot090221_100000.json b/pytorch/output_test2/altra_10_10_soc-sign-Slashdot090221_100000.json index 7134d2c..644846e 100644 --- a/pytorch/output_test2/altra_10_10_soc-sign-Slashdot090221_100000.json +++ b/pytorch/output_test2/altra_10_10_soc-sign-Slashdot090221_100000.json @@ -1,2 +1 @@ {"CPU": "ALTRA", "ITERATIONS": 100000, "MATRIX_FILE": "soc-sign-Slashdot090221", "MATRIX_SHAPE": [82144, 82144], "MATRIX_SIZE": 6747636736, "MATRIX_NNZ": 549202, "MATRIX_DENSITY": 8.13917555860553e-05, "TIME_S": 9.906620264053345, "BASELINE_TIME_S": 10, "BASELINE_DELAY_S": 10, "POWER_BEFORE": [21.48, 21.28, 21.6, 21.6, 21.88, 21.96, 21.96, 21.84, 21.4, 21.44], "POWER": [102.12, 100.8, 88.12, 72.96, 55.76, 56.68, 60.92, 60.92, 77.88, 98.52, 109.4, 109.76, 111.0, 109.04, 106.48, 104.8, 105.32, 102.52], "JOULES": 1025.1467094707486, "POWER_AFTER": [21.88, 21.84, 21.76, 21.24, 21.36, 21.4, 21.32, 21.48, 21.6, 21.48]} -48, 21.4, 21.12, 20.92, 20.6]} diff --git a/pytorch/run.py b/pytorch/run.py index 9d2acc2..92abd81 100644 --- a/pytorch/run.py +++ b/pytorch/run.py @@ -65,6 +65,8 @@ program_result = run_program(program[args.cpu]) result |= program_result[0] print(program_result[1], file=sys.stderr) +result[Stat.TIME_S.name] = result[Stat.TIME_S_OVERALL.name] / result[Stat.ITERATIONS.name] + if args.power: result[Stat.BASELINE_TIME_S.name] = args.baseline_time_s result[Stat.BASELINE_DELAY_S.name] = args.baseline_delay_s @@ -91,15 +93,15 @@ if args.power: # Riemann Sum across the last (s) power recordings. from math import ceil result[Stat.JOULES.name] = ( - sum(result[Stat.POWER.name][-ceil(result[Stat.TIME_S.name]):-1]) - + (result[Stat.POWER.name][-1] * (result[Stat.TIME_S.name] % 1))) + sum(result[Stat.POWER.name][-ceil(result[Stat.TIME_S_OVERALL.name]):-1]) + + (result[Stat.POWER.name][-1] * (result[Stat.TIME_S_OVERALL.name] % 1))) elif args.cpu == Cpu.EPYC_7313P: power_process = subprocess.Popen( [python[args.cpu], 'power.py'] + program[args.cpu], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True) result[Stat.POWER.name] = [float(x) for x in power_process.communicate()[0].strip().split('\n')] - result[Stat.JOULES.name] = result[Stat.POWER.name][0] * result[Stat.TIME_S.name] + result[Stat.JOULES.name] = result[Stat.POWER.name][0] * result[Stat.TIME_S_OVERALL.name] if args.debug: print(result) diff --git a/pytorch/spmv.py b/pytorch/spmv.py index d063b35..3f92543 100644 --- a/pytorch/spmv.py +++ b/pytorch/spmv.py @@ -50,7 +50,7 @@ print(f"NNZ: {result[Stat.MATRIX_NNZ.name]}", file=sys.stderr) result[Stat.MATRIX_DENSITY.name] = matrix.values().shape[0] / (matrix.shape[0] * matrix.shape[1]) print(f"Density: {result[Stat.MATRIX_DENSITY.name]}", file=sys.stderr) -result[Stat.TIME_S.name] = end - start -print(f"Time: {result[Stat.TIME_S.name]} seconds", file=sys.stderr) +result[Stat.TIME_S_OVERALL.name] = end - start +print(f"Time: {result[Stat.TIME_S_OVERALL.name]} seconds", file=sys.stderr) print(json.dumps(result))