Files
rocm-systems/projects/rocprofiler-systems/tests/rocprof-sys-thread-limit-tests.cmake
T
Kian Cossettini 2a080641a1 [rocprofiler-systems] Consolidate CTests to tests/ folder (#1461)
* Consolidate CTests to tests/ folder

* Remove comment

* Consolidate CTests to tests/ folder

* Remove comment

* Separate source code and test code for thread-limit into appropriate folders

* Remove sleeper.cpp and instead use linux sleep cmd

* Merge python-console tests into python-tests
2025-11-03 11:03:35 -05:00

88 řádky
3.2 KiB
CMake

# MIT License
#
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# -------------------------------------------------------------------------------------- #
#
# thread-limit tests
#
# -------------------------------------------------------------------------------------- #
if(NOT TARGET thread-limit)
return()
endif()
set(_thread_limit_environment
"${_base_environment}"
"ROCPROFSYS_TRACE=ON"
"ROCPROFSYS_PROFILE=ON"
"ROCPROFSYS_COUT_OUTPUT=ON"
"ROCPROFSYS_USE_SAMPLING=ON"
"ROCPROFSYS_SAMPLING_FREQ=250"
"ROCPROFSYS_VERBOSE=2"
"ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,peak_rss,page_rss"
)
# Maximum allowed threads
set(ALLOWED_MAX_THREADS 4096)
math(EXPR THREAD_VAL_1 "${ROCPROFSYS_MAX_THREADS} + 24")
math(EXPR THREAD_VAL_2 "${ALLOWED_MAX_THREADS} + 1")
set(THREAD_VALUES ${THREAD_VAL_1} ${THREAD_VAL_2})
# Loop over thread values
foreach(THREADS IN LISTS THREAD_VALUES)
set(THREAD_PASS_VALUE ${THREADS})
math(EXPR THREAD_FAIL_VALUE "${THREADS} + 1")
if(${THREADS} GREATER_EQUAL ${ALLOWED_MAX_THREADS})
math(EXPR THREAD_PASS_VALUE "${ALLOWED_MAX_THREADS} - 1")
math(EXPR THREAD_FAIL_VALUE "${THREADS}")
endif()
set(_thread_limit_pass_regex "\\|${THREAD_PASS_VALUE}>>>")
set(_thread_limit_fail_regex "\\|${THREAD_FAIL_VALUE}>>>|ROCPROFSYS_ABORT_FAIL_REGEX")
# Unique test name
set(_test_name thread-limit-${THREADS})
# Add test
rocprofiler_systems_add_test(
SKIP_BASELINE
NAME ${_test_name}
TARGET thread-limit
LABELS "max-threads"
REWRITE_ARGS -e -v 2 -i 1024 --label return args
RUNTIME_ARGS -e -v 1 -i 1024 --label return args
RUN_ARGS 35 2 ${THREADS}
SAMPLING_TIMEOUT 180
REWRITE_TIMEOUT 180
RUNTIME_TIMEOUT 360
RUNTIME_PASS_REGEX "${_thread_limit_pass_regex}"
SAMPLING_PASS_REGEX "${_thread_limit_pass_regex}"
REWRITE_RUN_PASS_REGEX "${_thread_limit_pass_regex}"
RUNTIME_FAIL_REGEX "${_thread_limit_fail_regex}"
SAMPLING_FAIL_REGEX "${_thread_limit_fail_regex}"
REWRITE_RUN_FAIL_REGEX "${_thread_limit_fail_regex}"
ENVIRONMENT "${_thread_limit_environment}"
)
endforeach()