Skip to content

Commit

Permalink
Miscellaneous Testing Fixes + CMake find_package include guard (#1106)
Browse files Browse the repository at this point in the history
* Improve ROCPROFILER_DEFAULT_FAIL_REGEX

* Support find_package called twice

* Skip iteration of ROCPROFILER_AGENT_TYPE_CPU

* Relax tests/rocprofv3/summary

* Tweak to rocprofiler-sdk-tool/tool.cpp

* Move rocprofv3-trigger-list-metrics to libexec

* Remove PC_SAMPLING_TESTS_REGEX from CI workflow

* Update packaging

- core component depends on roctx component

* Increase verbosity for failing tests

* Fix RPATH of rocprofv3-trigger-list-metrics

---------

Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
  • Loading branch information
jrmadsen and bgopesh authored Oct 22, 2024
1 parent bfe80a4 commit a92fa8f
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 55 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ env:
ROCM_PATH: "/opt/rocm"
GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1101 gfx1102"
PATH: "/usr/bin:$PATH"
PC_SAMPLING_TESTS_REGEX: ".*pc-sampling.*"

jobs:
core-deb:
Expand Down Expand Up @@ -67,12 +66,6 @@ jobs:
cat /opt/rocm/.info/version
ls -la
- name: Exclude PC Sampling Tests
if: ${{ !contains(matrix.runner, 'mi200') && !contains(matrix.runner, 'mi300') }}
shell: bash
run: |
echo 'EXCLUDED_TESTS=${{ env.PC_SAMPLING_TESTS_REGEX }}' >> $GITHUB_ENV
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') }}
shell: bash
Expand Down Expand Up @@ -195,12 +188,6 @@ jobs:
cat /opt/rocm/.info/version
ls -la
- name: Exclude PC Sampling Tests
if: ${{ !contains(matrix.runner, 'mi200') && !contains(matrix.runner, 'mi300') }}
shell: bash
run: |
echo 'EXCLUDED_TESTS=${{ env.PC_SAMPLING_TESTS_REGEX }}' >> $GITHUB_ENV
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') }}
shell: bash
Expand Down Expand Up @@ -564,12 +551,6 @@ jobs:
cat /opt/rocm/.info/version
ls -la
- name: Exclude PC Sampling Tests
if: ${{ !contains(matrix.runner, 'mi200') && !contains(matrix.runner, 'mi300') }}
shell: bash
run: |
echo 'EXCLUDED_TESTS=${{ env.PC_SAMPLING_TESTS_REGEX }}' >> $GITHUB_ENV
- name: Enable PC Sampling
if: ${{ contains(matrix.runner, 'mi200') }}
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions cmake/Templates/rocprofiler-sdk-roctx/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# @PACKAGE_NAME@::@PACKAGE_NAME@
#

# prevent "target already exists" error
include_guard(DIRECTORY)

# compute paths
get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

Expand Down
3 changes: 3 additions & 0 deletions cmake/Templates/rocprofiler-sdk/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# @PACKAGE_NAME@::@PACKAGE_NAME@
#

# prevent "target already exists" error
include_guard(DIRECTORY)

# compute paths
get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

Expand Down
1 change: 1 addition & 0 deletions cmake/rocprofiler_config_packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ endforeach()

set(CPACK_DEBIAN_PACKAGE_EPOCH 0)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS
ON
CACHE BOOL "") # auto-generate deps based on shared libs
Expand Down
4 changes: 2 additions & 2 deletions cmake/rocprofiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ include(rocprofiler_memcheck)

# default FAIL_REGULAR_EXPRESSION for tests
set(ROCPROFILER_DEFAULT_FAIL_REGEX
"threw an exception|Permission denied|Could not create logging file"
CACHE STRING "Default FAIL_REGULAR_EXPRESSION for tests")
"threw an exception|Permission denied|Could not create logging file|failed with error code"
CACHE INTERNAL "Default FAIL_REGULAR_EXPRESSION for tests" FORCE)
1 change: 1 addition & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ endif()

add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(libexec)
add_subdirectory(bin)
add_subdirectory(docs)
2 changes: 1 addition & 1 deletion source/bin/rocprofv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ def log_config(_env):
sys.stderr.flush()

if args.list_metrics:
app_args = [f"{ROCM_DIR}/lib/rocprofiler-sdk/rocprofv3-trigger-list-metrics"]
app_args = [f"{ROCM_DIR}/libexec/rocprofv3-trigger-list-metrics"]

elif not app_args:
log_config(app_env)
Expand Down
17 changes: 0 additions & 17 deletions source/lib/rocprofiler-sdk-tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,4 @@ install(
COMPONENT tools
EXPORT rocprofiler-sdk-tool-targets)

add_executable(rocprofv3-trigger-list-metrics)
target_sources(rocprofv3-trigger-list-metrics PRIVATE rocprofv3_trigger_list_metrics.cpp)
target_link_libraries(rocprofv3-trigger-list-metrics
PRIVATE rocprofiler-sdk::rocprofiler-hsa-runtime)
set_target_properties(
rocprofv3-trigger-list-metrics
PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk
BUILD_RPATH "\$ORIGIN:\$ORIGIN/.."
INSTALL_RPATH "\$ORIGIN:\$ORIGIN/..")

install(
TARGETS rocprofv3-trigger-list-metrics
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk
COMPONENT tools
EXPORT rocprofiler-sdk-tool-targets)

add_subdirectory(kokkosp)
11 changes: 3 additions & 8 deletions source/lib/rocprofiler-sdk-tool/helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,9 @@
{ \
std::string status_msg = \
rocprofiler_get_status_string(ROCPROFILER_VARIABLE(CHECKSTATUS, __LINE__)); \
std::cerr << "[" #result "][" << __FILE__ << ":" << __LINE__ << "] " << msg \
<< " failed with error code " << ROCPROFILER_VARIABLE(CHECKSTATUS, __LINE__) \
<< ": " << status_msg << "\n" \
<< std::flush; \
std::stringstream errmsg{}; \
errmsg << "[" #result "][" << __FILE__ << ":" << __LINE__ << "] " << msg " failure (" \
<< status_msg << ")"; \
throw std::runtime_error(errmsg.str()); \
ROCP_FATAL << " :: [" << __FILE__ << ":" << __LINE__ << "]\n\t" << #result << "\n\n" \
<< msg << " failed with error code " \
<< ROCPROFILER_VARIABLE(CHECKSTATUS, __LINE__) << ": " << status_msg; \
} \
}

Expand Down
7 changes: 3 additions & 4 deletions source/lib/rocprofiler-sdk-tool/tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,10 +1181,9 @@ list_metrics_iterate_agents(rocprofiler_agent_version_t,
return ROCPROFILER_STATUS_SUCCESS;
},
reinterpret_cast<void*>(&node_id));
if(status != ROCPROFILER_STATUS_SUCCESS)
{
ROCP_ERROR << "Failed to iterate counters for agent " << node_id;
}

ROCP_ERROR_IF(status != ROCPROFILER_STATUS_SUCCESS)
<< "Failed to iterate counters for agent " << node_id << " (" << agent->name << ")";
}
return ROCPROFILER_STATUS_SUCCESS;
}
Expand Down
5 changes: 5 additions & 0 deletions source/libexec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
#
#

add_subdirectory(rocprofv3-trigger-list-metrics)
21 changes: 21 additions & 0 deletions source/libexec/rocprofv3-trigger-list-metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
#
#

set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tools")

add_executable(rocprofv3-trigger-list-metrics)
target_sources(rocprofv3-trigger-list-metrics PRIVATE rocprofv3_trigger_list_metrics.cpp)
target_link_libraries(rocprofv3-trigger-list-metrics
PRIVATE rocprofiler-sdk::rocprofiler-hsa-runtime)
set_target_properties(
rocprofv3-trigger-list-metrics
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")

install(
TARGETS rocprofv3-trigger-list-metrics
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
COMPONENT tools
EXPORT rocprofiler-sdk-tool-targets)
7 changes: 4 additions & 3 deletions tests/rocprofv3/summary/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def pytest_addoption(parser):
action="store",
help="Path to summary markdown file.",
)
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)

pd.set_option("display.width", 2000)
pd.set_option("display.max_colwidth", None)
# increase debug display of pandas dataframes
for itr in ["rows", "columns", "colwidth"]:
pd.set_option(f"display.max_{itr}", None)


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/rocprofv3/summary/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_summary_data(json_data):
)
assert oitr.value.count == 2
elif itr.domain == "HIP_API":
assert itr.stats.count >= 2130 and itr.stats.count <= 2140
assert itr.stats.count >= 2130 and itr.stats.count <= 2150
elif itr.domain == "MEMORY_COPY":
assert itr.stats.count == 12
elif itr.domain == "MARKER_API":
Expand Down

0 comments on commit a92fa8f

Please sign in to comment.