Correct filtering in standalone roofline

Signed-off-by: coleramos425 <colramos@amd.com>
このコミットが含まれているのは:
coleramos425
2023-02-22 14:37:20 -06:00
コミット 0705db024c
+53 -21
ファイルの表示
@@ -216,14 +216,15 @@ def mongo_import(args, profileAndImport):
################################################
# Roofline Helpers
################################################
def roof_setup(args, my_parser):
def roof_setup(args, my_parser, VER):
if args.path == os.getcwd() + "/workloads":
args.path += "/" + args.name + "/" + str(get_soc())
args.path += "/" + args.name + "/" + args.target
# We need to make a directory for a new roofline
# Do we need a new directory for roofline?
if not os.path.isdir(args.path):
os.makedirs(args.path)
# does roof data exist?
# Does roof data exist?
print("Checking for roofline.csv in ", args.path)
roof_path = args.path + "/roofline.csv"
roofline_exists = os.path.isfile(roof_path)
@@ -234,7 +235,7 @@ def roof_setup(args, my_parser):
)
mibench(args)
# does sysinfo exist?
# Does sysinfo exist?
print("Checking for sysinfo.csv in ", args.path)
sysinfo_path = args.path + "/sysinfo.csv"
sysinfo_exists = os.path.isfile(sysinfo_path)
@@ -242,7 +243,7 @@ def roof_setup(args, my_parser):
print("sysinfo not found")
gen_sysinfo(args.name, args.path, [], args.remaining, False)
# does app data exist?
# Does app data exist?
print("Checking for pmc_perf.csv in ", args.path)
app_path = args.path + "/pmc_perf.csv"
app_exists = os.path.isfile(app_path)
@@ -257,7 +258,7 @@ def roof_setup(args, my_parser):
"Cannot find existing application data.\nAttempting to generate application data from -- <app_cmd>.\n-- <app_cmd> option is required to generate application data.",
)
else:
characterize_app(args.path, args.remaining, args.verbose)
characterize_app(args, VER)
def detect_roofline():
@@ -329,21 +330,53 @@ def mibench(args):
)
def characterize_app(path, cmd, verbose):
target = get_soc()
workload_dir = path
print("workload dir is ", workload_dir)
def characterize_app(args, VER):
# Basic Info
print("\n", PROG, "ver: ", VER)
print("Path: ", args.path)
print("Target: ", args.target)
print("Command: ", args.remaining)
print("Kernel Selection: ", args.kernel)
print("Dispatch Selection: ", args.dispatch, "\n")
perfmon_dir = str(OMNIPERF_HOME) + "/perfmon_pub"
print("permon dir is ", os.path.abspath(perfmon_dir))
app_cmd = cmd
app_cmd = args.remaining
workload_dir =args.path
# Perfmon filtering
pmc_filter(workload_dir, perfmon_dir, target)
pmc_filter(workload_dir, perfmon_dir, args.target)
# Workload profiling
for fname in glob.glob(workload_dir + "/perfmon/*.txt"):
# Kernel filtering (in-place replacement)
if not args.kernel == None:
run_subprocess(
[
"sed",
"-i",
"-r",
"s%^(kernel:).*%" + "kernel: " + ",".join(args.kernel) + "%g",
fname,
]
)
# Dispatch filtering (inplace replacement)
if not args.dispatch == None:
run_subprocess(
[
"sed",
"-i",
"-r",
"s%^(range:).*%" + "range: " + " ".join(args.dispatch) + "%g",
fname,
]
)
print(fname)
run_prof(fname, workload_dir, perfmon_dir, app_cmd, target, verbose)
if args.use_rocscope == True:
run_rocscope(args, fname)
else:
run_prof(fname, workload_dir, perfmon_dir, app_cmd, args.target, args.verbose)
# run again with timestamps
run_subprocess(
[
@@ -436,11 +469,6 @@ def run_prof(fname, workload_dir, perfmon_dir, cmd, target, verbose):
def omniperf_profile(args, VER):
# Verify valid target
if args.target not in SOC_LIST:
parse.print_help(sys.stderr)
sys.exit(1)
# Verify valid name
if args.name.find(".") != -1 or args.name.find("-") != -1:
raise ValueError("'-' and '.' are not permited in workload name", args.name)
@@ -559,6 +587,7 @@ def omniperf_profile(args, VER):
fname,
]
)
print(fname)
if args.use_rocscope == True:
run_rocscope(args, fname)
else:
@@ -652,11 +681,14 @@ def main():
if args.mode == "profile":
print("Resolving rocprof")
resolve_rocprof()
# Cannot access parent directories
if ".." in str(args.path):
throw_parse_error(
my_parser, "Access denied. Cannot access parent directories in path ../"
)
args.target = get_soc() # Must have a valid soc in profile mode
# Must have a valid soc in profile mode
args.target = get_soc()
# Verify correct command formatting
args.remaining = args.remaining[1:]
@@ -681,7 +713,7 @@ def main():
elif args.roof_only:
print("\n--------\nRoofline only\n--------\n")
# Setup prerequisits for roofline
roof_setup(args, my_parser)
roof_setup(args, my_parser, VER)
# Generate roofline
roofline_only(args.path, args.device, args.sort, args.mem_level, args.verbose)