From 4f5998397df242c57738fa7395e24d6addfa4cfc Mon Sep 17 00:00:00 2001 From: "Karl W. Schulz" Date: Wed, 23 Nov 2022 15:41:18 -0600 Subject: [PATCH] Update error message to be more accurate when roofline binary is missing (but with a supported OS and rocm version). In response to debugging #34 a second time. Signed-off-by: Karl W. Schulz --- src/omniperf | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/src/omniperf b/src/omniperf index b215981b57..31fc166ce3 100755 --- a/src/omniperf +++ b/src/omniperf @@ -71,6 +71,7 @@ def resolve_rocprof(): print("ROC Profiler: ", rocprof_path.stdout.decode("utf-8")) + def get_soc(): mspec = specs.get_machine_specs(0) @@ -177,8 +178,6 @@ def gen_sysinfo(workload_name, workload_dir, ip_blocks, app_cmd, skip_roof): if not skip_roof: blocks.append("roofline") - - # ip block info if ip_blocks == None: t = ["SQ", "LDS", "SQC", "TA", "TD", "TCP", "TCC", "SPI", "CPC", "CPF"] @@ -199,10 +198,12 @@ def mongo_import(args, profileAndImport): csv_converter.convert_folder(connectionInfo, Extractionlvl) print("-- Complete! --") + ################################################ # Roofline Helpers ################################################ + def detect_roofline(): mspec = specs.get_machine_specs(0) rocm_ver = mspec.rocmversion[:1] @@ -216,7 +217,7 @@ def detect_roofline(): rooflineBinary = os.environ["ROOFLINE_BIN"] if os.path.exists(rooflineBinary): print("Detected user-supplied binary") - return {"rocm_ver":"override", "distro":"override", "path":rooflineBinary} + return {"rocm_ver": "override", "distro": "override", "path": rooflineBinary} else: print("ROOFLINE ERROR: user-supplied path to binary not accessible") print("--> ROOFLINE_BIN = %s\n" % target_binary) @@ -234,23 +235,31 @@ def detect_roofline(): print("ROOFLINE ERROR: Cannot find a valid binary for your operating system") sys.exit(1) - target_binary = { "rocm_ver":rocm_ver, "distro":distro } + target_binary = {"rocm_ver": rocm_ver, "distro": distro} return target_binary + def mibench(args): print("No roofline data found. Generating...") - + target_binary = detect_roofline() if target_binary["rocm_ver"] == "override": path_to_binary = target_binary["path"] else: - path_to_binary = str(OMNIPERF_HOME) + "/utils/rooflines/roofline" + "-" + DISTRO_MAP[target_binary["distro"]] + "-" + args.target.lower() + "-rocm" + target_binary["rocm_ver"] + path_to_binary = ( + str(OMNIPERF_HOME) + + "/utils/rooflines/roofline" + + "-" + + DISTRO_MAP[target_binary["distro"]] + + "-" + + args.target.lower() + + "-rocm" + + target_binary["rocm_ver"] + ) # Distro is valid but cant find rocm ver if not os.path.exists(path_to_binary): - print( - "ROOFLINE ERROR: ROCm version not supported." - ) + print("ROOFLINE ERROR: Unable to locate expected binary (%s)." % path_to_binary) sys.exit(1) subprocess.run( @@ -280,6 +289,7 @@ def characterize_app(path, cmd, verbose): print(fname) run_prof(fname, workload_dir, perfmon_dir, app_cmd, verbose) + ################################################ # Profiling Helpers ################################################ @@ -310,7 +320,7 @@ def run_prof(fname, workload_dir, perfmon_dir, cmd, verbose): ) -def omniperf_profile(args,VER): +def omniperf_profile(args, VER): # Verify valid target if args.target not in SOC_LIST: parse.print_help(sys.stderr) @@ -390,11 +400,21 @@ def omniperf_profile(args,VER): if target_binary["rocm_ver"] == "override": path_to_binary = target_binary["path"] else: - path_to_binary = str(OMNIPERF_HOME) + "/utils/rooflines/roofline" + "-" + DISTRO_MAP[target_binary["distro"]] + "-" + args.target.lower() + "-rocm" + target_binary["rocm_ver"] - # Distro is valid but cant find rocm ver + path_to_binary = ( + str(OMNIPERF_HOME) + + "/utils/rooflines/roofline" + + "-" + + DISTRO_MAP[target_binary["distro"]] + + "-" + + args.target.lower() + + "-rocm" + + target_binary["rocm_ver"] + ) + # Distro is valid but cant find valid binary if not os.path.exists(path_to_binary): print( - "ROOFLINE ERROR: ROCm version not supported." + "ROOFLINE ERROR: Unable to locate expected binary (%s))." + % path_to_binary ) sys.exit(1) @@ -408,6 +428,7 @@ def omniperf_profile(args,VER): ] ) + ################################################ # MAIN ################################################ @@ -426,7 +447,7 @@ def main(): args = my_parser.parse_args() vData = getVersion() - VER = vData['version'] + VER = vData["version"] if args.mode == None: throw_parse_error( @@ -526,7 +547,7 @@ def main(): # Profile only else: print("\n-------------\nProfile only\n-------------\n") - omniperf_profile(args,VER) + omniperf_profile(args, VER) ############## # DATABASE MODE