Skip to content

Commit

Permalink
Fixing several bugs on original PR
Browse files Browse the repository at this point in the history
Signed-off-by: coleramos425 <[email protected]>
  • Loading branch information
coleramos425 committed Aug 15, 2023
1 parent 878948e commit 4aa3384
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 185 deletions.
65 changes: 11 additions & 54 deletions src/omniperf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ from common import (

from common import getVersion

cache = dict()

################################################
# Helper Functions
################################################
Expand Down Expand Up @@ -443,26 +441,12 @@ def characterize_app(args, VER):
# Update timestamps
replace_timestamps(workload_dir, log)

# Manually join each pmc_perf*.csv output
if args.use_rocscope == False:
# Manually join each pmc_perf*.csv output
join_prof(workload_dir, args.join_type, log, args.verbose)
#demangle
for filename in os.listdir(workload_dir):
try:
# fileName = file[0 : file.find(".")]
# Only shorten KernelNames if instructed to
if args.kernelVerbose < 5:
t1 = pd.read_csv(
os.path.join(workload_dir, filename),
on_bad_lines="skip",
engine="python",
)
t2 = csv_converter.kernel_name_shortener(t1, cache, level=args.kernelVerbose)
t2.to_csv(fname, index=False)
except pd.errors.EmptyDataError:
print("Skipping empty csv " + filename)

# Close log
# Demangle and overwrite original KernelNames
csv_converter.kernel_name_shortener(workload_dir, args.kernelVerbose)

log.close()


Expand Down Expand Up @@ -559,6 +543,10 @@ def omniperf_profile(args, VER):
print("IP Blocks: All")
else:
print("IP Blocks: ", args.ipblocks)
if args.kernelVerbose > 5:
print("KernelName verbose level: DISABLED")
else:
print("KernelName verbose level: ", str(args.kernelVerbose))

# Set up directories
workload_dir = args.path + "/" + args.name + "/" + args.target
Expand Down Expand Up @@ -680,25 +668,11 @@ def omniperf_profile(args, VER):
# Update timestamps
replace_timestamps(workload_dir, log)

# Manually join each pmc_perf*.csv output
if args.use_rocscope == False:
# Manually join each pmc_perf*.csv output
join_prof(workload_dir, args.join_type, log, args.verbose)
#demangle
for filename in os.listdir(workload_dir):
if filename.endswith('.csv'):
try:
# fileName = file[0 : file.find(".")]
# Only shorten KernelNames if instructed to
if args.kernelVerbose < 5:
t1 = pd.read_csv(
os.path.join(workload_dir, filename),
on_bad_lines="skip",
engine="python",
)
t2 = csv_converter.kernel_name_shortener(t1, cache, level=args.kernelVerbose)
t2.to_csv(os.path.join(workload_dir, filename), index=False)
except pd.errors.EmptyDataError:
print("Skipping empty csv " + filename)
# Demangle and overwrite original KernelNames
csv_converter.kernel_name_shortener(workload_dir, args.kernelVerbose)

# Generate sysinfo
gen_sysinfo(args.name, workload_dir, args.ipblocks, args.remaining, args.no_roof)
Expand Down Expand Up @@ -814,23 +788,6 @@ def main():
else:
print("\n-------------\nProfile only\n-------------\n")
omniperf_profile(args, VER)
workload_dir = args.path
#demangle
for filename in os.listdir(workload_dir):
if filename.endswith('.csv'):
try:
# fileName = file[0 : file.find(".")]
# Only shorten KernelNames if instructed to
if args.kernelVerbose < 5:
t1 = pd.read_csv(
os.path.join(workload_dir, filename),
on_bad_lines="skip",
engine="python",
)
t2 = csv_converter.kernel_name_shortener(t1, cache, level=args.kernelVerbose)
t2.to_csv(os.path.join(workload_dir, filename), index=False)
except pd.errors.EmptyDataError:
print("Skipping empty csv " + filename)

##############
# DATABASE MODE
Expand Down
13 changes: 2 additions & 11 deletions src/omniperf_analyze/omniperf_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@
from omniperf_analyze.utils import parser, file_io
from omniperf_analyze.utils.gui_components.roofline import get_roofline
from utils import csv_converter
import pandas as pd

archConfigs = {}


################################################
# Helper Functions
################################################
Expand Down Expand Up @@ -222,16 +220,9 @@ def run_cli(args, runs):
# If we assume the panel layout for all archs are similar, it doesn't matter
# which archConfig passed into show_all function.
# After decide to how to manage kernels display patterns, we can revisit it.
cache = dict()
for d in args.path:
# demangle
for filename in os.listdir(d[0]):
if filename.endswith(".csv"):
df = pd.read_csv(os.path.join(d[0], filename))
new_df = csv_converter.kernel_name_shortener(
df, cache, args.kernelVerbose
)
new_df.to_csv(os.path.join(d[0], filename), index=False)
# Demangle and overwrite original KernelNames
csv_converter.kernel_name_shortener(d[0], args.kernelVerbose)

file_io.create_df_kernel_top_stats(
d[0],
Expand Down
17 changes: 3 additions & 14 deletions src/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@ def parse(my_parser):
help="\t\t\tProvide command for profiling after double dash.",
)
profile_group.add_argument(
"-f",
"--kernelVerbose",
required=False,
metavar="",
help="\t\t\t\tSpecify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 2) (DISABLE: 5)",
help="\t\t\tSpecify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 2) (DISABLE: 5)",
default=2,
type=int,
)
Expand Down Expand Up @@ -351,15 +350,6 @@ def parse(my_parser):
dest="workload",
help="\t\t\t\tSpecify name of workload (to remove) or path to workload (to import)",
)
connection_group.add_argument(
"-k",
"--kernelVerbose",
required=False,
metavar="",
help="\t\t\t\tSpecify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 2) (DISABLE: 5)",
default=2,
type=int,
)

## Analyze Command Line Options
## ----------------------------
Expand Down Expand Up @@ -524,11 +514,10 @@ def parse(my_parser):
help="\t\tRandomly generate a port to launch GUI application.\n\t\tRegistered Ports range inclusive (1024-49151).",
)
analyze_group.add_argument(
"-f",
"--kernelVerbose",
required=False,
metavar="",
help="\t\t\t\tSpecify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 2) (DISABLE: 5)",
default=2,
help="\t\tSpecify Kernel Name verbose level 1-5. Lower the level, shorter the kernel name. (DEFAULT: 5) (DISABLE: 5)",
default=5,
type=int,
)
Loading

0 comments on commit 4aa3384

Please sign in to comment.