update of profile tests to reorganize subset of output csv file

checking into a common utility function -> check_csv_files()

Signed-off-by: Karl W Schulz <karl.schulz@amd.com>


[ROCm/rocprofiler-compute commit: 9677666ce7]
이 커밋은 다음에 포함됨:
Karl W Schulz
2023-12-20 17:31:48 -06:00
커밋한 사람 Karl W. Schulz
부모 e0f6955737
커밋 cf0efd0f28
2개의 변경된 파일161개의 추가작업 그리고 462개의 파일을 삭제
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다. Diff 로드
+37 -1
파일 보기
@@ -23,10 +23,10 @@
##############################################################################el
# Common helper routines for testing collateral
import inspect
import os
import shutil
import pandas as pd
def check_resource_allocation():
@@ -62,3 +62,39 @@ def get_output_dir(suffix="_output", clean_existing=True):
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
return output_dir
def clean_output_dir(cleanup, output_dir):
"""Remove output directory generated from omniperf execution
Args:
cleanup (boolean): flag to enable/disable directory cleanup
output_dir (string): name of directory to remove
"""
if cleanup:
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
return
def check_csv_files(output_dir, num_kernels):
"""Check profiling output csv files for expected number of entries (based on kernel invocations)
Args:
output_dir (string): output directory containing csv files
num_kernels (int): number of kernels expected to have been profiled
Returns:
dict: dictionary housing file contents as pandas dataframe
"""
file_dict = {}
files_in_workload = os.listdir(output_dir)
for file in files_in_workload:
if file.endswith(".csv"):
file_dict[file] = pd.read_csv(output_dir + "/" + file)
if not "sysinfo" in file:
assert len(file_dict[file].index) >= num_kernels
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
return file_dict