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 PAPI functionality to Dr Hook #18

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ ecbuild_add_option( FEATURE MPI
DESCRIPTION "Support for MPI distributed parallelism"
REQUIRED_PACKAGES "MPI COMPONENTS Fortran" )

ecbuild_add_option( FEATURE PAPI
DESCRIPTION "Support for HW counters in drhook via PAPI"
REQUIRED_PACKAGES OpenMP PAPI
)

ecbuild_add_option( FEATURE FCKIT
DESCRIPTION "Support for fckit"
REQUIRED_PACKAGES "fckit QUIET" )
Expand All @@ -41,6 +46,11 @@ ecbuild_add_option( FEATURE WARNINGS
DEFAULT ON
DESCRIPTION "Add warnings to compiler" )

ecbuild_add_option( FEATURE MKL
DESCRIPTION "Use MKL for BLAS and/or FFTW"
DEFAULT ON
REQUIRED_PACKAGES "MKL" )

ecbuild_find_package( NAME Realtime QUIET )

### Sources
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 ${HILTIDEPS}/lib
)

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

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PAPI DEFAULT_MSG
PAPI_LIBRARIES
PAPI_INCLUDE_DIRS
)

mark_as_advanced(
PAPI_LIBRARIES
PAPI_INCLUDE_DIRS
)
1 change: 1 addition & 0 deletions cmake/project_summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ecbuild_info( "${${lang}_flags_str} : [${flags}]" )
endforeach()
ecbuild_info( "OpenMP (following variable can be overwritten by user)" )
ecbuild_info( " OpenMP_Fortran_FLAGS : [${OpenMP_Fortran_FLAGS}]" )
ecbuild_info( " OpenMP_C_FLAGS : [${OpenMP_C_FLAGS}]" )
ecbuild_info( "MPI (export MPI_HOME to correct MPI implementation)" )
ecbuild_info( " MPI_Fortran_INCLUDE_DIRS : [${MPI_Fortran_INCLUDE_DIRS}]" )
ecbuild_info( " MPI_Fortran_LIBRARIES : [${MPI_Fortran_LIBRARIES}]" )
Expand Down
17 changes: 16 additions & 1 deletion src/fiat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,22 @@ else()
endif()

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

target_link_libraries( fiat PRIVATE OpenMP::OpenMP_Fortran )
target_link_libraries( fiat PRIVATE OpenMP::OpenMP_C )

if( ${CMAKE_C_COMPILER_ID} MATCHES Intel )
ecbuild_add_c_flags("-qopenmp" NO_FAIL)
else()
ecbuild_add_c_flags("-fopenmp" NO_FAIL)
endif()

endif()

if ( HAVE_PAPI )
target_link_libraries ( fiat PRIVATE ${PAPI_LIBRARIES} )
target_include_directories ( fiat PRIVATE ${PAPI_INCLUDE_DIRS} )
target_compile_definitions ( fiat PRIVATE HKPAPI )
endif()

fiat_target_ignore_missing_symbols( TARGET fiat SYMBOLS
Expand Down
Loading
Loading