Optimizations to run_prof() utility

Signed-off-by: colramos-amd <colramos@amd.com>


[ROCm/rocprofiler-compute commit: a1b5c252e2]
This commit is contained in:
colramos-amd authored and Cole Ramos committed 2024-01-24 16:30:04 -06:00
1 parent 5a1281e375
commit 3bc71d87e9
8 files changed
+90 -46

No files matched your search

+14 -34
View File
@@ -178,46 +178,26 @@ def capture_subprocess_output(subprocess_args):
return (success, output)
def run_prof(fname, workload_dir, perfmon_dir, cmd, target, verbose):
def run_prof(fname, profiler_options):
fbase = os.path.splitext(os.path.basename(fname))[0]
logging.debug("pmc file:", os.path.basename(fname))
# profile the app (run w/ custom config files for mi100)
if target == "mi100":
logging.info("RUNNING WITH CUSTOM METRICS")
success, output = capture_subprocess_output(
[
rocprof_cmd,
"-i",
fname,
"-m",
perfmon_dir + "/" + "metrics.xml",
"--timestamp",
"on",
"-o",
workload_dir + "/" + fbase + ".csv",
'"' + cmd + '"',
]
)
if not success:
error(output)
else:
success, output = capture_subprocess_output(
[
rocprof_cmd,
"-i",
fname,
"--timestamp",
"on",
"-o",
workload_dir + "/" + fbase + ".csv",
'"' + cmd + '"',
]
)
if not success:
# standard rocprof options
default_options = [
"-i", fname
]
options = default_options + profiler_options
# profile the app
success, output = capture_subprocess_output(
[ rocprof_cmd, "-i", fname ] + options
)
if not success:
error(output)
# write rocprof output to logging
logging.info(output)