All logging should use call new functions
Signed-off-by: colramos-amd <colramos@amd.com>
[ROCm/rocprofiler-compute commit: 5bf38a4fed]
Bu işleme şunda yer alıyor:
işlemeyi yapan:
Karl W. Schulz
ebeveyn
cfdf288cba
işleme
a1371462ba
@@ -23,12 +23,11 @@
|
||||
##############################################################################el
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from dash import dcc
|
||||
from utils.utils import mibench, gen_sysinfo, demarcate, error
|
||||
from utils.utils import mibench, gen_sysinfo, demarcate, console_error, console_log, console_debug
|
||||
from dash import html
|
||||
import plotly.graph_objects as go
|
||||
from utils.roofline_calc import calc_ai, constuct_roof
|
||||
@@ -77,10 +76,8 @@ class Roofline:
|
||||
self.validate_parameters()
|
||||
|
||||
def validate_parameters(self):
|
||||
if self.__run_parameters["include_kernel_names"] and (
|
||||
not self.__run_parameters["is_standalone"]
|
||||
):
|
||||
error("--roof-only is required for --kernel-names")
|
||||
if self.__run_parameters['include_kernel_names'] and (not self.__run_parameters['is_standalone']):
|
||||
console_error("--roof-only is required for --kernel-names")
|
||||
|
||||
def roof_setup(self):
|
||||
# set default workload path if not specified
|
||||
@@ -103,13 +100,16 @@ class Roofline:
|
||||
):
|
||||
"""Generate a set of empirical roofline plots given a directory containing required profiling and benchmarking data"""
|
||||
# Create arithmetic intensity data that will populate the roofline model
|
||||
logging.debug("[roofline] Path: %s" % self.__run_parameters["workload_dir"])
|
||||
self.__ai_data = calc_ai(self.__run_parameters["sort_type"], ret_df)
|
||||
|
||||
logging.debug("[roofline] AI at each mem level:")
|
||||
console_debug(
|
||||
"roofline",
|
||||
"Path: %s" % self.__run_parameters['workload_dir']
|
||||
)
|
||||
self.__ai_data = calc_ai(self.__run_parameters['sort_type'], ret_df)
|
||||
|
||||
msg="AI at each mem level:"
|
||||
for i in self.__ai_data:
|
||||
logging.debug("%s -> %s" % (i, self.__ai_data[i]))
|
||||
logging.debug("\n")
|
||||
msg += ("\n\t%s -> %s" % (i, self.__ai_data[i]))
|
||||
console_debug(msg)
|
||||
|
||||
# Generate a roofline figure for each data type
|
||||
fp32_fig = self.generate_plot(dtype="FP32")
|
||||
@@ -166,11 +166,12 @@ class Roofline:
|
||||
self.__run_parameters["workload_dir"]
|
||||
+ "/empirRoof_gpu-{}_int8_fp16.pdf".format(dev_id)
|
||||
)
|
||||
if self.__run_parameters["include_kernel_names"]:
|
||||
self.__figure.write_image(
|
||||
self.__run_parameters["workload_dir"] + "/kernelName_legend.pdf"
|
||||
)
|
||||
logging.info("[roofline] Empirical Roofline PDFs saved!")
|
||||
if self.__run_parameters['include_kernel_names']:
|
||||
self.__figure.write_image(self.__run_parameters['workload_dir'] + "/kernelName_legend.pdf")
|
||||
console_log(
|
||||
"roofline",
|
||||
"Empirical Roofline PDFs saved!"
|
||||
)
|
||||
else:
|
||||
return html.Section(
|
||||
id="roofline",
|
||||
@@ -211,7 +212,10 @@ class Roofline:
|
||||
roofline_parameters=self.__run_parameters,
|
||||
dtype=dtype,
|
||||
)
|
||||
logging.debug("[roofline] Ceiling data:\n%s" % self.__ceiling_data)
|
||||
console_debug(
|
||||
"roofline",
|
||||
"Ceiling data:\n%s" % self.__ceiling_data
|
||||
)
|
||||
|
||||
#######################
|
||||
# Plot ceilings
|
||||
@@ -359,8 +363,10 @@ class Roofline:
|
||||
app_path = os.path.join(self.__run_parameters["workload_dir"], "pmc_perf.csv")
|
||||
roofline_exists = os.path.isfile(app_path)
|
||||
if not roofline_exists:
|
||||
logging.error("[roofline] Error: {} does not exist".format(app_path))
|
||||
sys.exit(1)
|
||||
console_error(
|
||||
"roofline",
|
||||
"{} does not exist".format(app_path)
|
||||
)
|
||||
t_df = OrderedDict()
|
||||
t_df["pmc_perf"] = pd.read_csv(app_path)
|
||||
self.empirical_roofline(ret_df=t_df)
|
||||
@@ -370,12 +376,12 @@ class Roofline:
|
||||
def pre_processing(self):
|
||||
if self.__args.roof_only:
|
||||
# check for sysinfo
|
||||
logging.info(
|
||||
"[roofline] Checking for sysinfo.csv in " + str(self.__args.path)
|
||||
console_log(
|
||||
"roofline", "Checking for sysinfo.csv in " + str(self.__args.path)
|
||||
)
|
||||
sysinfo_path = os.path.join(self.__args.path, "sysinfo.csv")
|
||||
if not os.path.isfile(sysinfo_path):
|
||||
logging.info("[roofline] sysinfo.csv not found. Generating...")
|
||||
console_log("roofline", "sysinfo.csv not found. Generating...")
|
||||
|
||||
class Dummy_SoC:
|
||||
roofline_obj = True
|
||||
@@ -395,28 +401,37 @@ class Roofline:
|
||||
def profile(self):
|
||||
if self.__args.roof_only:
|
||||
# check for roofline benchmark
|
||||
logging.info(
|
||||
"[roofline] Checking for roofline.csv in " + str(self.__args.path)
|
||||
console_log(
|
||||
"roofline",
|
||||
"Checking for roofline.csv in " + str(self.__args.path)
|
||||
)
|
||||
roof_path = os.path.join(self.__args.path, "roofline.csv")
|
||||
if not os.path.isfile(roof_path):
|
||||
mibench(self.__args, self.__mspec)
|
||||
|
||||
# check for profiling data
|
||||
logging.info(
|
||||
"[roofline] Checking for pmc_perf.csv in " + str(self.__args.path)
|
||||
console_log(
|
||||
"roofline",
|
||||
"Checking for pmc_perf.csv in " + str(self.__args.path)
|
||||
)
|
||||
app_path = os.path.join(self.__args.path, "pmc_perf.csv")
|
||||
if not os.path.isfile(app_path):
|
||||
logging.info("[roofline] pmc_perf.csv not found. Generating...")
|
||||
console_log(
|
||||
"roofline",
|
||||
"pmc_perf.csv not found. Generating..."
|
||||
)
|
||||
if not self.__args.remaining:
|
||||
error(
|
||||
console_error(
|
||||
"profiling"
|
||||
"An <app_cmd> is required to run.\nomniperf profile -n test -- <app_cmd>"
|
||||
)
|
||||
# TODO: Add an equivelent of characterize_app() to run profiling directly out of this module
|
||||
|
||||
#TODO: Add an equivelent of characterize_app() to run profiling directly out of this module
|
||||
|
||||
elif self.__args.no_roof:
|
||||
logging.info("[roofline] Skipping roofline.")
|
||||
console_log(
|
||||
"roofline",
|
||||
"Skipping roofline."
|
||||
)
|
||||
else:
|
||||
mibench(self.__args, self.__mspec)
|
||||
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle