Files
rocm-systems/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt
T
Jonathan R. Madsen 17cf00c51d fix omnitrace print-* with libraries (#94)
* fix omnitrace print-* with libraries

* timemory submodule update

* Update workflows to use ./bin/omnitrace instead of ./omnitrace

* cmake format

* update timemory submodule

- fix ODR violations in utility/procfs

* cmake updates

- uniform find_package for all ROCm-based libraries

* tweak transpose example

- throw exception instead of std::exit

* Inspect cmdv name before assuming not exe

- some ELF execs "think" they are libraries so only assume rewrite + simulate + all-functions if filename looks like library
- adds some test for --print-available -- <library>

* Fix _has_lib_prefix when command is < 3

* Updates and reverts to omnitrace exe

- update module_function operator< and operator==
- add function_signature operator<
- refactor module_function ctor
- revert some previous changes w.r.t. simulate and include_unninstr

* Fix source/bin/tests to use same output dir as tests

* cmake format

* Segfault mitigation + refactor + modify function iteration

- refactor module_function ctor to avoid segfaults
- string_t -> std::string
- replace std::string with std::string_view in some places
- get_name(module_t*)
- get_name(procedure_t*)
- disable using both app_modules and app_functions
- new option: --parse-all-modules to iterate over app_modules
- removed some unused code w.r.t. debug info

* Disable module_function address range for uninstrumentable functions

* Disable module_function address range for uninstrumentable functions

* Refactored getting file/line info and init/fini

- use dyninst insertInitCallback and insertFiniCallback if main not found
- fixed all issues with segmentation faults in --simulate --all-functions

* revert changes to Findrocprofiler.cmake

[ROCm/rocprofiler-systems commit: d04cbe862e]
2022-07-21 01:15:41 -05:00

70 lines
2.2 KiB
CMake

cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(omnitrace-transpose LANGUAGES CXX)
find_package(hip QUIET HINTS ${ROCmVersion_DIR} PATHS ${ROCmVersion_DIR})
find_program(
HIPCC_EXECUTABLE
NAMES hipcc
HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm NO_CACHE)
mark_as_advanced(HIPCC_EXECUTABLE)
if(NOT HIPCC_EXECUTABLE)
message(AUTHOR_WARNING "hipcc could not be found. Cannot build transpose target")
return()
endif()
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
if(CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE OR "${CMAKE_CXX_COMPILER}" MATCHES
"hipcc")
set(CMAKE_CXX_COMPILER_IS_HIPCC
1
CACHE BOOL "HIP compiler")
endif()
endif()
if((NOT CMAKE_CXX_COMPILER_IS_HIPCC OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT hip_FOUND))
AND (NOT COMMAND omnitrace_custom_compilation AND NOT HIPCC_EXECUTABLE))
message(AUTHOR_WARNING "transpose target could not be built")
return()
endif()
option(TRANSPOSE_USE_MPI "Enable MPI support in transpose exe" ${TIMEMORY_USE_MPI})
if(TRANSPOSE_USE_MPI)
find_package(MPI REQUIRED)
endif()
add_executable(transpose transpose.cpp)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_libraries(
transpose
PRIVATE
$<IF:$<TARGET_EXISTS:omnitrace::omnitrace-compile-options>,omnitrace::omnitrace-compile-options,>
$<IF:$<TARGET_EXISTS:hip::host>,hip::host,>
$<IF:$<TARGET_EXISTS:hip::device>,hip::device,>)
else()
target_compile_options(transpose PRIVATE -W -Wall)
endif()
if(TRANSPOSE_USE_MPI)
target_compile_definitions(transpose PRIVATE USE_MPI)
target_link_libraries(transpose PRIVATE MPI::MPI_C)
endif()
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
# defined in MacroUtilities.cmake
omnitrace_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose)
endif()
if(OMNITRACE_INSTALL_EXAMPLES)
install(
TARGETS transpose
DESTINATION bin
COMPONENT omnitrace-examples)
endif()