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

Add ability for users to specify PAPI events in Dr Hook #27

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
586191a
Add DR_HOOK support for HW counters with PAPI
MartynF Nov 3, 2023
e3ff319
Make fiat-drhook-sanity a unit-test, refactor CMake and other cosmetic
wdeconinck Jul 24, 2024
bcd9d78
Fix invalid arguments error to PAPI_list_events
wdeconinck Jul 24, 2024
374e33a
Fix DR_HOOK_SILENT option
wdeconinck Jul 24, 2024
61d3927
Change error messages to be more explicit
Andrew-Beggs-ECMWF Aug 19, 2024
d652f0d
Fix missing intent
Andrew-Beggs-ECMWF Aug 19, 2024
8e0a9e2
Add new debug print
Andrew-Beggs-ECMWF Aug 19, 2024
8553e73
Add functionality for user specified PAPI events
Andrew-Beggs-ECMWF Aug 21, 2024
23810e1
Fix whitespacing
Andrew-Beggs-ECMWF Aug 28, 2024
77179d9
Fix malloc -> malloc_drhook
Andrew-Beggs-ECMWF Oct 22, 2024
b19fdd2
Fix safe_thread_num -> papi_safe_thread_num
Andrew-Beggs-ECMWF Oct 22, 2024
9ca74b7
Merge branch 'develop' into papi
Andrew-Beggs-ECMWF Oct 23, 2024
8049e04
Add if (opt_papi) guards
Andrew-Beggs-ECMWF Oct 23, 2024
6bc7379
Refactor PAPI extension
Andrew-Beggs-ECMWF Oct 23, 2024
0e5fffe
Fix NPAPICNTRS -> MAXNPAPICNTRS
Andrew-Beggs-ECMWF Oct 24, 2024
b10867b
Remove static from malloc_drhook()
Andrew-Beggs-ECMWF Oct 24, 2024
9596442
Move OML_MY_THREAD() into parallel region
Andrew-Beggs-ECMWF Oct 24, 2024
4cd9b52
Add PAPI tests
Andrew-Beggs-ECMWF Oct 28, 2024
8a558aa
Fix nproc being initialised to 1
Andrew-Beggs-ECMWF Oct 28, 2024
84d0362
Rename dr_hook -> drhook
Andrew-Beggs-ECMWF Oct 28, 2024
997bc63
Add copyright headers
Andrew-Beggs-ECMWF Oct 28, 2024
e609d23
Revert "Fix nproc being initialised to 1"
Andrew-Beggs-ECMWF Oct 30, 2024
0bee022
Fix output formatting
Andrew-Beggs-ECMWF Oct 29, 2024
f87140b
Change initialising process info
Andrew-Beggs-ECMWF Oct 30, 2024
aade15c
Fix drhook_papi_max_name_len() missing from header
Andrew-Beggs-ECMWF Oct 30, 2024
b93a1f3
Add drhook_papi_user_counters_more_than_max test
Andrew-Beggs-ECMWF Oct 30, 2024
652ca48
Fix set_tests_properties() not finding MPI tests
Andrew-Beggs-ECMWF Oct 30, 2024
19522b3
Use tid argument vs drhook_oml_get_thread_num()
Andrew-Beggs-ECMWF Oct 30, 2024
ac793d2
Add guards to set_tests_properties() in tests
Andrew-Beggs-ECMWF Nov 12, 2024
82a5b50
Add C_DR_HOOK_PROCINFO()
Andrew-Beggs-ECMWF Nov 12, 2024
aaad9fe
Fix compiler warnings
Andrew-Beggs-ECMWF Nov 12, 2024
7558ac5
Fix valid_csv tests
Andrew-Beggs-ECMWF Nov 13, 2024
b207369
Remove reliance on papi.h when building without PAPI
Andrew-Beggs-ECMWF Feb 10, 2025
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
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
### Options

ecbuild_add_option( FEATURE OMP
DESCRIPTION "support for OpenMP shared memory parallelism"
DESCRIPTION "Support for OpenMP shared memory parallelism"
REQUIRED_PACKAGES "OpenMP COMPONENTS Fortran" )

ecbuild_add_option( FEATURE MPI
DESCRIPTION "Support for MPI distributed parallelism"
REQUIRED_PACKAGES "MPI COMPONENTS Fortran" )

ecbuild_add_option( FEATURE DR_HOOK_PAPI
DESCRIPTION "Support for HW counters in DR_HOOK via PAPI"
REQUIRED_PACKAGES "PAPI")

ecbuild_find_package( fckit QUIET )
ecbuild_add_option( FEATURE FCKIT
DESCRIPTION "Support for fckit"
Expand All @@ -51,7 +55,6 @@ ecbuild_add_option( FEATURE WARNINGS
DEFAULT ON
DESCRIPTION "Add warnings to compiler" )


ecbuild_add_option( FEATURE DR_HOOK_NVTX
DEFAULT ${DEFAULT_DR_HOOK_NVTX}
DESCRIPTION "Support for NVTX in DR_HOOK"
Expand Down
44 changes: 44 additions & 0 deletions cmake/FindPAPI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Try to find PAPI headers and libraries.
#
# Usage of this module as follows:
#
# find_package(PAPI)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# PAPI_ROOT Set this variable to the root installation of
# libpapi if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# PAPI_FOUND System has PAPI libraries and headers
# PAPI_LIBRARIES The PAPI library
# PAPI_INCLUDE_DIRS The location of PAPI headers

find_path(PAPI_ROOT
NAMES include/papi.h
)

find_library(PAPI_LIBRARIES
# Pick the static library first for easier run-time linking.
NAMES libpapi.so libpapi.a papi
HINTS ${PAPI_ROOT}/lib
)

find_path(PAPI_INCLUDE_DIRS
NAMES papi.h
HINTS ${PAPI_ROOT}/include
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PAPI DEFAULT_MSG
PAPI_LIBRARIES
PAPI_INCLUDE_DIRS
)

mark_as_advanced(
PAPI_LIBRARIES
PAPI_INCLUDE_DIRS
)
15 changes: 14 additions & 1 deletion src/fiat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ if (HAVE_DR_HOOK_NVTX)
endif()
endif()


if (HAVE_DR_HOOK_PAPI)
# Files from within DrHook
ecbuild_list_add_pattern( LIST fiat_papi_src GLOB *.c SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/drhook/extensions/papi)
target_sources(fiat PRIVATE ${fiat_papi_src})
target_include_directories(fiat PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/drhook/extensions/papi)

# Files defined externally
target_link_libraries ( fiat PRIVATE ${PAPI_LIBRARIES} )
target_include_directories ( fiat PRIVATE ${PAPI_INCLUDE_DIRS} )
target_compile_definitions ( fiat PRIVATE DR_HOOK_HAVE_PAPI=1 )
endif()

if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
# Following should not be necessary;
# Probably a bug in the M1 prerelease of gfortran 10.2.0.4
Expand All @@ -103,7 +116,7 @@ else()
endif()

if( HAVE_OMP )
target_link_libraries( fiat PRIVATE OpenMP::OpenMP_Fortran )
target_link_libraries( fiat PRIVATE OpenMP::OpenMP_Fortran )
endif()

fiat_target_ignore_missing_symbols( TARGET fiat SYMBOLS
Expand Down
Loading