adding C test
Change-Id: I006130d6711fd8e7bb222b985e4c64a801825f41
This commit is contained in:
+7
-3
@@ -32,6 +32,10 @@ if ( NOT DEFINED TEST_DIR )
|
|||||||
include ( env )
|
include ( env )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
## C test
|
||||||
|
add_executable ( "c_test" ${TEST_DIR}/app/c_test.c )
|
||||||
|
target_include_directories ( "c_test" PRIVATE ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
||||||
|
|
||||||
## Util sources
|
## Util sources
|
||||||
file( GLOB UTIL_SRC "${TEST_DIR}/util/*.cpp" )
|
file( GLOB UTIL_SRC "${TEST_DIR}/util/*.cpp" )
|
||||||
|
|
||||||
@@ -67,17 +71,17 @@ execute_process ( COMMAND sh -xc "${TEST_DIR}/../bin/build_kernel.sh ${TEST_DIR}
|
|||||||
## Building standalone test executable
|
## Building standalone test executable
|
||||||
add_executable ( ${STEXE_NAME} ${STTST_SRC} ${UTIL_SRC} ${KERN_SRC} )
|
add_executable ( ${STEXE_NAME} ${STTST_SRC} ${UTIL_SRC} ${KERN_SRC} )
|
||||||
target_include_directories ( ${STEXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
target_include_directories ( ${STEXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
||||||
target_link_libraries( ${STEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt )
|
target_link_libraries ( ${STEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt )
|
||||||
|
|
||||||
## Building intercept test executable
|
## Building intercept test executable
|
||||||
add_library ( ${INEXE_NAME} SHARED ${INTST_SRC} ${UTIL_SRC} ${KERN_SRC} )
|
add_library ( ${INEXE_NAME} SHARED ${INTST_SRC} ${UTIL_SRC} ${KERN_SRC} )
|
||||||
target_include_directories ( ${INEXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
target_include_directories ( ${INEXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
||||||
target_link_libraries( ${INEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt )
|
target_link_libraries ( ${INEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt )
|
||||||
|
|
||||||
## Building ctrl test executable
|
## Building ctrl test executable
|
||||||
add_executable ( ${EXE_NAME} ${CTRL_SRC} ${UTIL_SRC} ${KERN_SRC} )
|
add_executable ( ${EXE_NAME} ${CTRL_SRC} ${UTIL_SRC} ${KERN_SRC} )
|
||||||
target_include_directories ( ${EXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
target_include_directories ( ${EXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} )
|
||||||
target_link_libraries( ${EXE_NAME} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt )
|
target_link_libraries ( ${EXE_NAME} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt )
|
||||||
execute_process ( COMMAND sh -xc "cp ${TEST_DIR}/run.sh ${PROJECT_BINARY_DIR}" )
|
execute_process ( COMMAND sh -xc "cp ${TEST_DIR}/run.sh ${PROJECT_BINARY_DIR}" )
|
||||||
execute_process ( COMMAND sh -xc "cp ${TEST_DIR}/tool/*.xml ${PROJECT_BINARY_DIR}" )
|
execute_process ( COMMAND sh -xc "cp ${TEST_DIR}/tool/*.xml ${PROJECT_BINARY_DIR}" )
|
||||||
execute_process ( COMMAND sh -xc "mkdir -p ${PROJECT_BINARY_DIR}/RESULTS" )
|
execute_process ( COMMAND sh -xc "mkdir -p ${PROJECT_BINARY_DIR}/RESULTS" )
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
Copyright (c) 2018 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.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "inc/rocprofiler.h"
|
||||||
|
const int ret = 0;
|
||||||
|
int main() { return ret; }
|
||||||
+10
-12
@@ -56,8 +56,6 @@ eval_test() {
|
|||||||
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
|
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
|
||||||
# paths to ROC profiler and oher libraries
|
# paths to ROC profiler and oher libraries
|
||||||
export LD_LIBRARY_PATH=$PWD
|
export LD_LIBRARY_PATH=$PWD
|
||||||
# ROC profiler library loaded by HSA runtime
|
|
||||||
export HSA_TOOLS_LIB=librocprofiler64.so
|
|
||||||
# enable error messages logging to '/tmp/rocprofiler_log.txt'
|
# enable error messages logging to '/tmp/rocprofiler_log.txt'
|
||||||
export ROCPROFILER_LOG=1
|
export ROCPROFILER_LOG=1
|
||||||
# ROC profiler metrics config file
|
# ROC profiler metrics config file
|
||||||
@@ -67,8 +65,17 @@ export ROCP_METRICS=metrics.xml
|
|||||||
# test trace
|
# test trace
|
||||||
export ROC_TEST_TRACE=1
|
export ROC_TEST_TRACE=1
|
||||||
|
|
||||||
## Intercepting usage model test
|
## C test
|
||||||
|
eval_test "C test" ./test/c_test
|
||||||
|
|
||||||
|
## Standalone sampling usage model test
|
||||||
|
unset HSA_TOOLS_LIB
|
||||||
|
unset ROCP_TOOL_LIB
|
||||||
|
eval_test "Standalone sampling usage model test" ./test/standalone_test
|
||||||
|
|
||||||
|
## Intercepting usage model test
|
||||||
|
# ROC profiler library loaded by HSA runtime
|
||||||
|
export HSA_TOOLS_LIB=librocprofiler64.so
|
||||||
# tool library loaded by ROC profiler
|
# tool library loaded by ROC profiler
|
||||||
export ROCP_TOOL_LIB=./test/libintercept_test.so
|
export ROCP_TOOL_LIB=./test/libintercept_test.so
|
||||||
export ROCP_KITER=50
|
export ROCP_KITER=50
|
||||||
@@ -77,13 +84,7 @@ export ROCP_AGENTS=1
|
|||||||
export ROCP_THRS=3
|
export ROCP_THRS=3
|
||||||
eval_test "Intercepting usage model test" "../bin/run_tool.sh ./test/ctrl"
|
eval_test "Intercepting usage model test" "../bin/run_tool.sh ./test/ctrl"
|
||||||
|
|
||||||
## Standalone sampling usage model test
|
|
||||||
|
|
||||||
unset ROCP_TOOL_LIB
|
|
||||||
eval_test "Standalone sampling usage model test" ./test/standalone_test
|
|
||||||
|
|
||||||
## Libtool test
|
## Libtool test
|
||||||
|
|
||||||
# tool library loaded by ROC profiler
|
# tool library loaded by ROC profiler
|
||||||
export ROCP_TOOL_LIB=libtool.so
|
export ROCP_TOOL_LIB=libtool.so
|
||||||
# ROC profiler kernels timing
|
# ROC profiler kernels timing
|
||||||
@@ -111,7 +112,6 @@ export ROCP_INPUT=input1.xml
|
|||||||
eval_test "'rocprof' libtool test n-threads" ./test/ctrl
|
eval_test "'rocprof' libtool test n-threads" ./test/ctrl
|
||||||
|
|
||||||
## SPM test
|
## SPM test
|
||||||
|
|
||||||
export ROCP_KITER=3
|
export ROCP_KITER=3
|
||||||
export ROCP_DITER=3
|
export ROCP_DITER=3
|
||||||
export ROCP_AGENTS=1
|
export ROCP_AGENTS=1
|
||||||
@@ -120,7 +120,6 @@ export ROCP_INPUT=spm_input.xml
|
|||||||
eval_test "libtool test, SPM trace test" ./test/ctrl
|
eval_test "libtool test, SPM trace test" ./test/ctrl
|
||||||
|
|
||||||
## Libtool test, counter sets
|
## Libtool test, counter sets
|
||||||
|
|
||||||
# Memcopies tracking
|
# Memcopies tracking
|
||||||
export ROCP_MCOPY_TRACKING=1
|
export ROCP_MCOPY_TRACKING=1
|
||||||
|
|
||||||
@@ -130,7 +129,6 @@ export ROCP_INPUT=input2.xml
|
|||||||
eval_test "libtool test, counter sets" ./test/ctrl
|
eval_test "libtool test, counter sets" ./test/ctrl
|
||||||
|
|
||||||
## OpenCL test
|
## OpenCL test
|
||||||
|
|
||||||
export ROCP_OBJ_TRACKING=1
|
export ROCP_OBJ_TRACKING=1
|
||||||
export ROCP_INPUT=input1.xml
|
export ROCP_INPUT=input1.xml
|
||||||
eval_test "libtool test, OpenCL sample" ./test/ocl/SimpleConvolution
|
eval_test "libtool test, OpenCL sample" ./test/ocl/SimpleConvolution
|
||||||
|
|||||||
Reference in New Issue
Block a user