Adding list-metrics (#585)
* Adding list-metrics * cmake formatting (cmake-format) (#587) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * source formatting (clang-format v11) (#586) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * Fixing issues with validation tests * python formatting (black) (#588) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * source formatting (clang-format v11) (#589) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * cmake formatting (cmake-format) (#590) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * Update conftest.py * Update validate.py * python formatting (black) (#591) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * python formatting (black) (#592) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * Checking if agent-id in validate.py * Fixing list metrics execute test * cmake formatting (cmake-format) (#593) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * Fixing CI failure * cmake formatting (cmake-format) (#594) Co-authored-by: SrirakshaNag <104580803+SrirakshaNag@users.noreply.github.com> * Review Comments * Update source/bin/rocprofv3 Support -L shorthand for --list-metrics --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b0a88d9124
Коммит
c7407d0a9f
@@ -5,3 +5,4 @@ endforeach()
|
||||
|
||||
add_subdirectory(input1)
|
||||
add_subdirectory(input2)
|
||||
add_subdirectory(list_metrics)
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# rocprofv3 tool test
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
|
||||
|
||||
project(
|
||||
rocprofiler-tests-counter-collection
|
||||
LANGUAGES CXX
|
||||
VERSION 0.0.0)
|
||||
|
||||
find_package(rocprofiler-sdk REQUIRED)
|
||||
|
||||
foreach(FILENAME validate.py conftest.py)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${FILENAME} COPYONLY)
|
||||
endforeach()
|
||||
|
||||
# basic-metrics
|
||||
add_test(NAME rocprofv3-test-list-metrics-execute
|
||||
COMMAND $<TARGET_FILE:rocprofiler-sdk::rocprofv3> -d
|
||||
${CMAKE_CURRENT_BINARY_DIR}/out_cc_2 -o metrics --list-metrics)
|
||||
|
||||
# list-metrics-stdout
|
||||
add_test(NAME rocprofv3-test-list-metrics-std-out-execute
|
||||
COMMAND $<TARGET_FILE:rocprofiler-sdk::rocprofv3> --list-metrics)
|
||||
|
||||
string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV
|
||||
"${ROCPROFILER_MEMCHECK_PRELOAD_ENV}")
|
||||
|
||||
if(ROCPROFILER_MEMCHECK STREQUAL "LeakSanitizer")
|
||||
set(LOG_LEVEL "warning") # info produces memory leak
|
||||
else()
|
||||
set(LOG_LEVEL "info")
|
||||
endif()
|
||||
|
||||
set(cc-env-list-metrics
|
||||
"${PRELOAD_ENV}" "ROCPROF_LOG_LEVEL=${LOG_LEVEL}"
|
||||
"ROCPROFILER_LOG_LEVEL=${LOG_LEVEL}"
|
||||
"HSA_TOOLS_LIB=$<TARGET_FILE:rocprofiler::rocprofiler-shared-library>")
|
||||
|
||||
set_tests_properties(
|
||||
rocprofv3-test-list-metrics-execute
|
||||
PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-list-metrics}"
|
||||
FAIL_REGULAR_EXPRESSION "threw an exception")
|
||||
|
||||
set_tests_properties(
|
||||
rocprofv3-test-list-metrics-std-out-execute
|
||||
PROPERTIES
|
||||
TIMEOUT
|
||||
45
|
||||
LABELS
|
||||
"integration-tests"
|
||||
ENVIRONMENT
|
||||
"${cc-env-list-metrics}"
|
||||
PASS_REGULAR_EXPRESSION
|
||||
"gpu-agent[0-9]*:[a-zA-Z_]*\\n;Description:(.*)\\n*;Expression:(.)*\\n*;Block:[a-zA-Z]*\\n*;Dimensions:([A-Z_]*\\[[0-9]*:[0-9]*\\])*\\n*;"
|
||||
)
|
||||
set(VALIDATION_FILES ${CMAKE_CURRENT_BINARY_DIR}/out_cc_2/metrics_basic_metrics.csv
|
||||
${CMAKE_CURRENT_BINARY_DIR}/out_cc_2/metrics_derived_metrics.csv)
|
||||
|
||||
add_test(
|
||||
NAME rocprofv3-test-list-metrics-validate
|
||||
COMMAND
|
||||
${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py
|
||||
--derived-metrics-input
|
||||
${CMAKE_CURRENT_BINARY_DIR}/out_cc_2/metrics_derived_metrics.csv
|
||||
--basic-metrics-input
|
||||
${CMAKE_CURRENT_BINARY_DIR}/out_cc_2/metrics_basic_metrics.csv)
|
||||
|
||||
set_tests_properties(
|
||||
rocprofv3-test-list-metrics-validate
|
||||
PROPERTIES TIMEOUT
|
||||
45
|
||||
LABELS
|
||||
"integration-tests"
|
||||
DEPENDS
|
||||
rocprofv3-test-list-metrics-execute
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
"threw an exception"
|
||||
ATTACHED_FILES_ON_FAIL
|
||||
"${VALIDATION_FILES}")
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import csv
|
||||
import pytest
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--basic-metrics-input", action="store", help="Path to csv file.")
|
||||
parser.addoption("--derived-metrics-input", action="store", help="Path to csv file.")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def derived_metrics_input_data(request):
|
||||
filename = request.config.getoption("--derived-metrics-input")
|
||||
data = []
|
||||
if filename:
|
||||
with open(filename, "r") as inp:
|
||||
reader = csv.DictReader(inp)
|
||||
for row in reader:
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def basic_metrics_input_data(request):
|
||||
filename = request.config.getoption("--basic-metrics-input")
|
||||
data = []
|
||||
if filename:
|
||||
with open(filename, "r") as inp:
|
||||
reader = csv.DictReader(inp)
|
||||
for row in reader:
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
@@ -0,0 +1,34 @@
|
||||
import pandas as pd
|
||||
import sys
|
||||
import pytest
|
||||
|
||||
|
||||
def test_validate_list_basic_metrics(basic_metrics_input_data):
|
||||
for row in basic_metrics_input_data:
|
||||
assert row["Agent-id"].isdigit() == True
|
||||
assert row["Name"] != ""
|
||||
assert row["Description"] != ""
|
||||
assert row["Block"] != ""
|
||||
assert row["Dimensions"] != ""
|
||||
if row["Name"] == "SQ_WAVES":
|
||||
row[
|
||||
"Description"
|
||||
] == "Count number of waves sent to SQs. (per-simd, emulated, global)"
|
||||
row["Block"] == "SQ"
|
||||
|
||||
|
||||
def test_validate_list_derived_metrics(derived_metrics_input_data):
|
||||
for row in derived_metrics_input_data:
|
||||
assert row["Agent-id"].isdigit() == True
|
||||
assert row["Name"] != ""
|
||||
assert row["Description"] != ""
|
||||
assert row["Expression"] != ""
|
||||
assert row["Dimensions"] != ""
|
||||
if row["Name"] == "TA_BUSY_min":
|
||||
row["Description"] == "TA block is busy. Min over TA instances."
|
||||
row["Expression"] == "reduce(TA_TA_BUSY,min)"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit_code = pytest.main(["-x", __file__] + sys.argv[1:])
|
||||
sys.exit(exit_code)
|
||||
Ссылка в новой задаче
Block a user