From d267e98efdaf4f438f98984d5519c83f72770415 Mon Sep 17 00:00:00 2001 From: colramos425 Date: Fri, 18 Nov 2022 12:50:07 -0600 Subject: [PATCH 1/2] Check for failed subprocesses Signed-off-by: colramos425 --- src/omniperf | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/omniperf b/src/omniperf index b215981b57..a3b56e2221 100755 --- a/src/omniperf +++ b/src/omniperf @@ -51,6 +51,12 @@ from common import getVersion ################################################ # Helper Functions ################################################ +def run_subprocess(cmd): + subprocess.run( + cmd, + check=True + ) + def resolve_rocprof(): # ROCPROF INFO global rocprof_cmd @@ -253,7 +259,7 @@ def mibench(args): ) sys.exit(1) - subprocess.run( + run_subprocess( [ path_to_binary, "-o", @@ -294,7 +300,7 @@ def run_prof(fname, workload_dir, perfmon_dir, cmd, verbose): print("pmc file:", os.path.basename(fname)) # profile the app - subprocess.run( + run_subprocess( [ rocprof_cmd, "-i", @@ -339,7 +345,7 @@ def omniperf_profile(args,VER): for fname in glob.glob(workload_dir + "/perfmon/*.txt"): # Kernel filtering (in-place replacement) if not args.kernel == None: - subprocess.run( + run_subprocess( [ "sed", "-i", @@ -351,7 +357,7 @@ def omniperf_profile(args,VER): # Dispatch filtering (inplace replacement) if not args.dispatch == None: - subprocess.run( + run_subprocess( [ "sed", "-i", @@ -363,7 +369,7 @@ def omniperf_profile(args,VER): run_prof(fname, workload_dir, perfmon_dir, args.remaining, args.verbose) # run again with timestamps - subprocess.run( + run_subprocess( [ rocprof_cmd, # "-i", fname, @@ -398,7 +404,7 @@ def omniperf_profile(args,VER): ) sys.exit(1) - subprocess.run( + run_subprocess( [ path_to_binary, "-o", From efe6d9f19a7c5bc07a7731f5c604bdb4e44b362f Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Tue, 6 Dec 2022 15:24:36 -0600 Subject: [PATCH 2/2] Throw a warning if unable to update timestamps Signed-off-by: colramos-amd --- src/omniperf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/omniperf b/src/omniperf index 0b1119b822..cbff84634b 100755 --- a/src/omniperf +++ b/src/omniperf @@ -30,6 +30,7 @@ import glob import pandas as pd from datetime import datetime from pathlib import Path as path +import warnings from parser import parse from utils import specs @@ -115,11 +116,14 @@ def isWorkloadEmpty(my_parser, path): def replace_timestamps(workload_dir): df_stamps = pd.read_csv(workload_dir + "/timestamps.csv") - df_pmc_perf = pd.read_csv(workload_dir + "/pmc_perf.csv") + if "BeginNs" in df_stamps.columns and "EndNs" in df_stamps.columns: + df_pmc_perf = pd.read_csv(workload_dir + "/pmc_perf.csv") - df_pmc_perf["BeginNs"] = df_stamps["BeginNs"] - df_pmc_perf["EndNs"] = df_stamps["EndNs"] - df_pmc_perf.to_csv(workload_dir + "/pmc_perf.csv", index=False) + df_pmc_perf["BeginNs"] = df_stamps["BeginNs"] + df_pmc_perf["EndNs"] = df_stamps["EndNs"] + df_pmc_perf.to_csv(workload_dir + "/pmc_perf.csv", index=False) + else: + warnings.warn("WARNING: Incomplete profiling data detected. Unable to update timestamps.") def gen_sysinfo(workload_name, workload_dir, ip_blocks, app_cmd, skip_roof):