Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HPX-APEX cmake integration #6342

Merged
merged 4 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ jobs:
-DHPX_WITH_MALLOC=system \
-DHPX_WITH_FETCH_ASIO=Off \
-DHPX_WITH_APEX=On \
-DHPX_WITH_FETCH_APEX=ON \
-DHPX_WITH_TESTS=On \
-DHPX_WITH_EXAMPLES=On
rm -rf *
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux_release_fetchcontent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
-DHPX_WITH_MALLOC=system \
-DHPX_WITH_FETCH_ASIO=ON \
-DHPX_WITH_APEX=ON \
-DHPX_WITH_FETCH_APEX=ON \
-DHPX_WITH_EXAMPLES=ON \
-DHPX_WITH_TESTS=OFF \
-DHPX_REPOSITORY="file:////$(pwd)" \
Expand Down
1 change: 1 addition & 0 deletions .jenkins/cscs/env-clang-apex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ configure_extra_options+=" -DHPX_WITH_COMPILER_WARNINGS_AS_ERRORS=ON"
configure_extra_options+=" -DHPX_WITH_SPINLOCK_DEADLOCK_DETECTION=ON"
#configure_extra_options+=" -DHPX_WITH_LIBCDS=ON"
configure_extra_options+=" -DHPX_WITH_APEX=ON"
configure_extra_options+=" -DHPX_WITH_FETCH_APEX=ON"
configure_extra_options+=" -DHPX_WITH_PAPI=ON"
configure_extra_options+=" -DAPEX_WITH_PAPI=ON"
configure_extra_options+=" -DAPEX_WITH_OTF2=ON"
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,15 @@ hpx_option(
CATEGORY "Profiling"
)

hpx_option(
HPX_WITH_FETCH_APEX
BOOL
"Use FetchContent to fetch APEX. By default an installed APEX will be used. (default: OFF)"
OFF
CATEGORY "Build Targets"
ADVANCED
)

if(HPX_WITH_APEX)
hpx_add_config_define(HPX_HAVE_APEX) # tell HPX that we use APEX
hpx_option(
Expand Down
27 changes: 16 additions & 11 deletions cmake/HPX_SetupApex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ if(HPX_WITH_APEX AND NOT TARGET APEX::apex)
# We want to track parent dependencies
hpx_add_config_define(HPX_HAVE_THREAD_PARENT_REFERENCE)

if(Apex_ROOT)
# Use given (external) APEX
set(HPX_APEX_ROOT ${Apex_ROOT})

else()
if(HPX_WITH_FETCH_APEX)
# If Apex_ROOT not specified, local clone into hpx source dir
include(FetchContent)
fetchcontent_declare(
Expand All @@ -76,23 +72,32 @@ if(HPX_WITH_APEX AND NOT TARGET APEX::apex)
set(Apex_ROOT ${apex_SOURCE_DIR})

hpx_info("Apex_ROOT is not set. Cloning APEX into ${apex_SOURCE_DIR}.")
list(APPEND CMAKE_MODULE_PATH "${Apex_ROOT}/cmake/Modules")
add_subdirectory(${Apex_ROOT}/src/apex ${CMAKE_BINARY_DIR}/apex/src/apex)
endif()

list(APPEND CMAKE_MODULE_PATH "${Apex_ROOT}/cmake/Modules")
add_subdirectory(${Apex_ROOT}/src/apex ${CMAKE_BINARY_DIR}/apex/src/apex)
if(Amplifier_FOUND)
hpx_error("Amplifier_FOUND has been set. Please disable the use of the \
Intel Amplifier (WITH_AMPLIFIER=Off) in order to use APEX"
)
endif()
endif()

add_library(APEX::apex INTERFACE IMPORTED)
if(HPX_FIND_PACKAGE)
target_link_libraries(APEX::apex INTERFACE HPX::apex)
if(HPX_WITH_FETCH_APEX)
add_library(APEX::apex INTERFACE IMPORTED)
if(HPX_FIND_PACKAGE)
target_link_libraries(APEX::apex INTERFACE HPX::apex)
else()
target_link_libraries(APEX::apex INTERFACE apex)
endif()
else()
target_link_libraries(APEX::apex INTERFACE apex)
if(Apex_ROOT)
find_package(APEX REQUIRED PATHS ${Apex_ROOT})
else()
hpx_error("Apex_ROOT not set.")
endif()
endif()

if((UNIX AND NOT APPLE) OR MINGW)
target_link_options(APEX::apex INTERFACE "-Wl,-no-as-needed")
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/templates/HPXConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ set(APEX_WITH_ACTIVEHARMONY "@APEX_WITH_ACTIVEHARMONY@")
set(Activeharmony_ROOT "@Activeharmony_ROOT@")
set(APEX_WITH_OTF2 "@APEX_WITH_OTF2@")
set(Otf2_ROOT "@Otf2_ROOT@")
set(Apex_ROOT "@Apex_ROOT@")
include(HPX_SetupApex)
# ##############################################################################

Expand Down