Files
rocm-systems/tests/test_profile_general.py
T

2751 wiersze
75 KiB
Python
Czysty Zwykły widok Historia

2023-09-19 16:00:29 -05:00
import os.path
from pathlib import Path
from unittest.mock import patch
import pytest
from importlib.machinery import SourceFileLoader
2023-09-25 13:50:03 -05:00
import pandas as pd
import subprocess
import re
2023-10-04 11:04:40 -05:00
import shutil
2023-10-25 14:09:59 -05:00
import inspect
2023-12-13 14:50:22 -06:00
import sys
2023-09-19 16:00:29 -05:00
2023-10-25 14:09:59 -05:00
omniperf = SourceFileLoader("omniperf", "src/omniperf").load_module()
2023-09-19 16:00:29 -05:00
workload_1 = os.path.realpath("workload")
kernel_name_1 = "vecCopy(double*, double*, double*, int, int) [clone .kd]"
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
app_1 = ["./sample/vcopy", "-n", "1048576", "-b", "256", "-i", "3"]
num_kernels = 3
dispatch_id = 0
2023-10-25 14:09:59 -05:00
2023-09-25 13:50:03 -05:00
ALL_CSVS = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_13.csv",
"pmc_perf_14.csv",
"pmc_perf_15.csv",
"pmc_perf_16.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
2023-09-25 13:50:03 -05:00
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
ALL_CSVS_MI200 = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_13.csv",
"pmc_perf_14.csv",
"pmc_perf_15.csv",
"pmc_perf_16.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-25 14:09:59 -05:00
ROOF_ONLY_FILES = [
"empirRoof_gpu-ALL_fp32.pdf",
"empirRoof_gpu-ALL_int8_fp16.pdf",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
# logging function for threshold outliers set to false
2023-12-13 14:50:22 -06:00
COUNTER_LOGGING = False
METRIC_LOGGING = True
2023-10-25 14:09:59 -05:00
def metric_compare(test_name, errors_pd, baseline_df, run_df, threshold=5):
# iterate data one row at a time
for idx_1 in run_df.index:
run_row = run_df.iloc[idx_1]
baseline_row = baseline_df.iloc[idx_1]
if not run_row["KernelName"] == baseline_row["KernelName"]:
print("Kernel/dispatch mismatch")
assert 0
kernel_name = run_row["KernelName"]
gpu_id = run_row["gpu-id"]
differences = {}
for pmc_counter in run_row.index:
if "Ns" in pmc_counter or "id" in pmc_counter or "[" in pmc_counter:
# print("skipping "+pmc_counter)
continue
# assert 0
2023-10-25 14:09:59 -05:00
if not pmc_counter in list(baseline_df.columns):
2023-10-25 14:09:59 -05:00
print("error: pmc mismatch! " + pmc_counter + " is not in baseline_df")
continue
2023-10-25 14:09:59 -05:00
run_data = run_row[pmc_counter]
baseline_data = baseline_row[pmc_counter]
if isinstance(run_data, str) and isinstance(baseline_data, str):
if run_data not in baseline_data:
print(baseline_data)
else:
# relative difference
2023-10-25 14:09:59 -05:00
if not run_data == 0:
diff = round(100 * abs(baseline_data - run_data) / run_data, 2)
if diff > threshold:
2023-10-25 14:09:59 -05:00
print("[" + pmc_counter + "] diff is :" + str(diff) + "%")
if pmc_counter not in differences.keys():
2023-10-25 14:09:59 -05:00
print(
"[" + pmc_counter + "] not found in ",
list(differences.keys()),
)
differences[pmc_counter] = [diff]
else:
# Why are we here?
2023-10-25 14:09:59 -05:00
print(
"Why did we get here?!?!? errors_pd[idx_1]:",
list(differences.keys()),
)
differences[pmc_counter].append(diff)
else:
# if 0 show absolute difference
2023-10-25 14:09:59 -05:00
diff = round(baseline_data - run_data, 2)
if diff > threshold:
2023-10-25 14:09:59 -05:00
print(str(idx_1) + "[" + pmc_counter + "] diff is :" + str(diff))
differences["kernel_name"] = [kernel_name]
differences["test_name"] = [test_name]
differences["gpu-id"] = [gpu_id]
errors_pd = pd.concat([errors_pd, pd.DataFrame.from_dict(differences)])
return errors_pd
2023-10-25 14:09:59 -05:00
2023-09-19 16:00:29 -05:00
def run(cmd):
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if cmd[0] == "rocm-smi" and p.returncode == 8:
print("ERROR: No GPU detected. Unable to load rocm-smi")
assert 0
return p.stdout.decode("ascii")
2023-09-25 13:50:03 -05:00
def gpu_soc():
rocminfo = str(
subprocess.run(
["rocminfo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
).stdout.decode("ascii")
)
rocminfo = rocminfo.split("\n")
soc_regex = re.compile(r"^\s*Name\s*:\s+ ([a-zA-Z0-9]+)\s*$", re.MULTILINE)
gpu_id = list(filter(soc_regex.match, rocminfo))[0].split()[1]
2023-09-25 13:50:03 -05:00
print("gpu_id", gpu_id)
if gpu_id == "gfx906":
return "mi50"
elif gpu_id == "gfx908":
return "mi100"
elif gpu_id == "gfx90a":
return "mi200"
elif gpu_id == "gfx900":
return "vega10"
else:
print("Invalid SoC")
assert 0
2023-09-19 16:00:29 -05:00
soc = gpu_soc()
2023-12-13 14:50:22 -06:00
# change to directory where baseline is at
Baseline_dir = os.path.realpath("Baseline_vcopy_" + soc)
if os.path.exists(Baseline_dir):
shutil.rmtree(Baseline_dir)
subprocess.run(
["hipcc", "sample/vcopy.cpp", "-o", "sample/vcopy"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
"-VVV",
"--path",
Baseline_dir,
"--",
]
+ app_1,
):
omniperf.main()
2023-10-25 14:09:59 -05:00
def logger(file_dict, test_name):
for file in file_dict.keys():
if file == "pmc_perf.csv" or "SQ" in file:
print(file)
# read file in Baseline
df_1 = pd.read_csv(Baseline_dir + "/" + file, index_col=0)
# get corresponding file from current test run
df_2 = file_dict[file]
errors = metric_compare(test_name, pd.DataFrame(), df_1, df_2, 5)
if not errors.empty:
if os.path.exists(
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv"
):
error_log = pd.read_csv(
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv",
index_col=0,
)
new_error_log = pd.concat([error_log, errors])
new_error_log = new_error_log.reindex(
sorted(new_error_log.columns), axis=1
)
new_error_log = new_error_log.sort_values(
by=["test_name", "kernel_name", "gpu-id"]
)
new_error_log.to_csv(
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv"
)
else:
errors.to_csv(
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv"
)
2023-12-13 14:50:22 -06:00
def log_metric(test_name, thresholds, args=[]):
t = subprocess.Popen(
[
sys.executable,
"src/omniperf",
"analyze",
"--path",
Baseline_dir,
]
+ args
+ ["--path", workload_1, "--report-diff", "5"],
stdout=subprocess.PIPE,
)
captured_output = t.communicate(timeout=1300)[0].decode("utf-8")
print("captured_output", captured_output)
if "DEBUG ERROR" in captured_output:
error_df = pd.DataFrame()
output_metric_errors = re.findall(r"(\')([0-9.]*)(\')", captured_output)
naughty_metrics = [x[1] for x in output_metric_errors]
print("naughty metrics:", naughty_metrics)
for metric in naughty_metrics:
metric_info = re.findall(
r"(^"
+ metric
+ r" *)([()0-9A-Za-z-]+ ?)*(?: *)([0-9.-]*)(?: *)([0-9.-]*)(?: *)\(([-0-9.]*)%\)(?: *)([-0-9.e]*)",
captured_output,
flags=re.MULTILINE,
)
if len(metric_info):
metric_info = metric_info[0]
if metric_info[-4] != "-100.0":
print("metric info:", metric_info)
print(
re.findall(
r"^" + metric + r".*", captured_output, flags=re.MULTILINE
)
)
table_idx = metric_info[1].split(".")[0]
relative_diff = float(metric_info[-2])
absolute_diff = float(metric_info[-1])
relative_threshold = thresholds["default"]["relative"]
absolute_threshold = thresholds["default"]["absolute"]
if table_idx in thresholds:
relative_threshold = thresholds[table_idx]["relative"]
absolute_threshold = thresholds[table_idx]["absolute"]
if (
relative_diff > relative_threshold
or absolute_diff > absolute_threshold
):
new_error = pd.DataFrame.from_dict(
{
"index": [metric_info[0].split()[0]],
"metric": [table_idx],
"Percent Difference": [relative_diff],
"Absolute Difference": [absolute_diff],
"Baseline": [metric_info[-2]],
"Current": [metric_info[-1]],
}
)
error_df = pd.concat([error_df, new_error])
error_df["test_name"] = test_name
if os.path.exists(Baseline_dir + "/metric_error_log.csv"):
error_log = pd.read_csv(
Baseline_dir + "/metric_error_log.csv",
index_col=0,
)
new_error_log = pd.concat([error_log, error_df])
new_error_log = new_error_log.reindex(sorted(new_error_log.columns), axis=1)
new_error_log = new_error_log.sort_values(by=["metric", "test_name"])
new_error_log.to_csv(Baseline_dir + "/metric_error_log.csv")
else:
error_df.to_csv(Baseline_dir + "/metric_error_log.csv")
2023-10-25 14:09:59 -05:00
def test_path():
2023-10-25 14:09:59 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
"-VVV",
"--path",
workload_1,
"--",
]
+ app_1,
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-25 14:09:59 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file, index_col=0)
print("length is: ", len(file_dict[file].index))
print(file_dict[file])
# TODO: verify contents: we know function evaluated
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
print(sorted(list(file_dict.keys())))
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-10-25 14:09:59 -05:00
2023-09-25 13:50:03 -05:00
def test_kernel():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel",
kernel_name_1,
2023-09-19 16:00:29 -05:00
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-19 16:00:29 -05:00
):
omniperf.main()
2023-09-25 13:50:03 -05:00
# assert successful run
2023-09-19 16:00:29 -05:00
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-09-25 13:50:03 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-10-25 14:09:59 -05:00
2023-09-25 13:50:03 -05:00
2023-09-19 16:00:29 -05:00
def test_kernel_summaries():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-19 16:00:29 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
2023-09-19 16:00:29 -05:00
"--path",
workload_1,
"--kernel-summaries",
"vcopy",
2023-09-19 16:00:29 -05:00
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-09-25 13:50:03 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQ():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQ",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQC():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQC",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(5, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_TA():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"TA",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(9, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_TD():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"TD",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_TCP():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"TCP",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(11, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_TCC():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"TCC",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(12, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SPI():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SPI",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(10, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_CPC():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"CPC",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(7, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_CPF():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"CPF",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs.insert(5, "roofline.csv")
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQ_CPC():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQ",
"CPC",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQ_TA():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQ",
"TA",
"--",
]
+ app_1,
2023-09-19 16:00:29 -05:00
):
omniperf.main()
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQ_SPI():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQ",
"SPI",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQ_SQC_TCP_CPC():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQ",
"SQC",
"TCP",
"CPC",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_ipblocks_SQ_SPI_TA_TCC_CPF():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--ipblocks",
"SQ",
"SPI",
"TA",
"TCC",
"CPF",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-09-25 13:50:03 -05:00
print(sorted(list(file_dict.keys())))
2023-10-04 11:04:40 -05:00
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
if soc == "mi200":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == expected_csvs
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_dispatch_0():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--dispatch",
"0",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 15:26:22 -05:00
if not "sysinfo" in file and not "roofline" in file:
assert len(file_dict[file].index) == 1
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_dispatch_0_1():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--dispatch",
2023-10-25 15:26:22 -05:00
"0:2",
2023-09-25 13:50:03 -05:00
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 15:26:22 -05:00
if not "sysinfo" in file and not "roofline" in file:
2023-12-13 14:50:22 -06:00
assert len(file_dict[file].index) == 2
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_dispatch_2():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--dispatch",
dispatch_id,
2023-09-25 13:50:03 -05:00
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 15:26:22 -05:00
if not "sysinfo" in file and not "roofline" in file:
assert len(file_dict[file].index) == 1
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_kernel_verbose_0():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel-verbose",
2023-09-25 13:50:03 -05:00
"0",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_kernel_verbose_1():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel-verbose",
2023-09-25 13:50:03 -05:00
"1",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_kernel_verbose_2():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel-verbose",
2023-09-25 13:50:03 -05:00
"2",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_kernel_verbose_3():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel-verbose",
2023-09-25 13:50:03 -05:00
"3",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_kernel_verbose_4():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel-verbose",
2023-09-25 13:50:03 -05:00
"4",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_kernel_verbose_5():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--kernel-verbose",
2023-09-25 13:50:03 -05:00
"5",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_join_type_grid():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--join-type",
"grid",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_join_type_kernel():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--join-type",
"kernel",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_device_0():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--device",
"0",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
2023-10-25 15:26:22 -05:00
if "roofline" in file:
assert len(file_dict[file].index)
else:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_no_roof():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--no-roof",
"--",
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"pmc_perf_12.csv",
"pmc_perf_13.csv",
"pmc_perf_14.csv",
"pmc_perf_15.csv",
"pmc_perf_16.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_sort_dispatches():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
2023-09-25 13:50:03 -05:00
"--sort",
"dispatches",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_sort_kernels():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
2023-09-25 13:50:03 -05:00
"--sort",
"kernels",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
file_dict = {}
2023-10-25 14:09:59 -05:00
# Check if csvs have data
2023-09-25 13:50:03 -05:00
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_HBM():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
"HBM",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_L2():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
"L2",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_vL1D():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
"vL1D",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_LDS():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
"LDS",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_HBM_LDS():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
2023-09-25 13:50:03 -05:00
"HBM",
"LDS",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_vL1D_LDS():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
2023-09-25 13:50:03 -05:00
"vL1D",
"LDS",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
2023-09-25 13:50:03 -05:00
def test_mem_levels_L2_vL1D_LDS():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
2023-09-25 13:50:03 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
2023-09-25 13:50:03 -05:00
"-VVV",
"--path",
workload_1,
"--roof-only",
"--mem-level",
2023-09-25 13:50:03 -05:00
"L2",
"vL1D",
"LDS",
"--",
2023-09-25 13:50:03 -05:00
]
+ app_1,
2023-09-25 13:50:03 -05:00
):
omniperf.main()
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
2023-09-25 13:50:03 -05:00
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
2023-09-25 13:50:03 -05:00
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
def test_kernel_names():
2023-10-04 11:04:40 -05:00
if os.path.exists(workload_1):
shutil.rmtree(workload_1)
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"profile",
"-n",
"app_1",
"-VVV",
"--path",
workload_1,
"--roof-only",
"--kernel-names",
"--",
]
+ app_1,
):
omniperf.main()
2023-09-25 13:50:03 -05:00
if soc == "mi100":
# assert that it did not run
assert e.value.code >= 1
# Do not continue testing
return
# assert successful run
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
2023-10-04 11:04:40 -05:00
files_in_workload = os.listdir(workload_1)
# Check if csvs have data
file_dict = {}
for file in files_in_workload:
if file.endswith(".csv"):
2023-10-04 11:04:40 -05:00
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
2023-10-25 14:09:59 -05:00
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
2023-10-25 14:09:59 -05:00
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
2023-10-04 11:04:40 -05:00
if soc == "mi200":
print(sorted(list(file_dict.keys())))
2023-10-25 14:09:59 -05:00
assert sorted(list(file_dict.keys())) == [
"empirRoof_gpu-ALL_fp32.pdf",
"empirRoof_gpu-ALL_int8_fp16.pdf",
"kernelName_legend.pdf",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"roofline.csv",
"sysinfo.csv",
"timestamps.csv",
]
2023-10-04 11:04:40 -05:00
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
2023-10-25 14:09:59 -05:00
2023-12-13 14:50:22 -06:00
if COUNTER_LOGGING:
2023-10-25 14:09:59 -05:00
logger(file_dict, inspect.stack()[0][3])
2023-12-13 14:50:22 -06:00
if METRIC_LOGGING:
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1, "relative": 5}})