Skip to content

Commit

Permalink
Merge branch 'master' into woptim/spack-envs
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienbernede committed Apr 12, 2024
2 parents 2a2a467 + 4e19ce9 commit cd9c0ff
Show file tree
Hide file tree
Showing 89 changed files with 356 additions and 275 deletions.
98 changes: 74 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ if (WITH_FORTRAN)
enable_language(Fortran)
set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fortran")
set(CALIPER_Fortran_CMAKE_MSG "Yes, using ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}")
set(CALIPER_HAVE_FORTRAN TRUE)
endif()

if (BUILD_TESTING)
Expand Down Expand Up @@ -306,8 +307,11 @@ if (WITH_ADIAK)
list(APPEND CALIPER_EXTERNAL_LIBS ${CMAKE_DL_LIBS})
endif()
else()
set(CALIPER_HAVE_ADIAK FALSE)
message(WARNING "Adiak support was requested but Adiak was not found")
endif()
else()
set(CALIPER_HAVE_ADIAK FALSE)
endif()

if (WITH_KOKKOS)
Expand Down Expand Up @@ -452,7 +456,7 @@ endif()
if (WITH_LDMS)
include(FindLDMS)
if (LDMS_FOUND)
set(CALIPER_HAVE_LDMS TRUE)
set(CALIPER_HAVE_LDMS TRUE)
set(CALIPER_LDMS_CMAKE_MSG "Yes, using ${LDMS_LIBLDMS} ${LDMS_LIBSTREAM}")
list(APPEND CALIPER_EXTERNAL_LIBS ${LDMS_LIBLDMS} ${LDMS_LIBSTREAM})
message("Include Directory: ${LDMS_INCLUDE_DIRS}")
Expand All @@ -473,7 +477,19 @@ configure_file(
include_directories(${PROJECT_BINARY_DIR}/include)
include_directories(include)

if(INSTALL_HEADERS)
add_subdirectory(ext)
add_subdirectory(src)

add_subdirectory(examples/apps EXCLUDE_FROM_ALL)

if (BUILD_TESTING)
add_subdirectory(test)
endif()
if (BUILD_DOCS)
add_subdirectory(doc EXCLUDE_FROM_ALL)
endif()

if (INSTALL_HEADERS)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
Expand All @@ -487,15 +503,32 @@ if(INSTALL_HEADERS)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/caliper
FILES_MATCHING PATTERN "*.h")

if (WITH_FORTRAN)
if (CALIPER_HAVE_FORTRAN)
install(
DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/caliper/fortran
FILES_MATCHING PATTERN "*.mod")
endif()

install(
DIRECTORY
"python/caliper-reader/caliperreader"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/caliper"
FILES_MATCHING
PATTERN "*.py"
)

install(
PROGRAMS
"python/cali2traceevent.py"
"python/cali2traceevent"
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
endif()

if(INSTALL_CONFIG)
if (INSTALL_CONFIG)
# Create pkg-config .pc file
set(PKG_CONFIG_INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
set(PKG_CONFIG_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
Expand All @@ -506,31 +539,48 @@ if(INSTALL_CONFIG)
${PROJECT_SOURCE_DIR}/caliper.pc.in
${PROJECT_BINARY_DIR}/caliper.pc)

# Make caliper findable for cmake
configure_file(
${PROJECT_SOURCE_DIR}/caliper-config.cmake.in
${PROJECT_BINARY_DIR}/caliper-config.cmake
@ONLY)
include(CMakePackageConfigHelpers)

install(FILES ${PROJECT_BINARY_DIR}/caliper-config.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/caliper)
install(EXPORT caliper-targets
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/caliper)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/caliper-config-version.cmake"
VERSION
${LIBTOOL_INTERFACE}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}
COMPATIBILITY
SameMajorVersion
)

install(FILES ${PROJECT_BINARY_DIR}/caliper.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
set(caliper_INSTALL_INCLUDE_DIR "include/")

add_subdirectory(ext)
add_subdirectory(src)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/caliper-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/caliper-config.cmake"
INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/cmake/caliper
PATH_VARS
caliper_INSTALL_INCLUDE_DIR
)

add_subdirectory(examples/apps EXCLUDE_FROM_ALL)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/caliper-config-version.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/caliper-config.cmake"
DESTINATION
"${CMAKE_INSTALL_DATAROOTDIR}/cmake/caliper"
)

if (BUILD_TESTING)
add_subdirectory(test)
endif()
if (BUILD_DOCS)
add_subdirectory(doc EXCLUDE_FROM_ALL)
install(
EXPORT
caliper-targets
DESTINATION
"${CMAKE_INSTALL_DATAROOTDIR}/cmake/caliper"
)

install(
FILES
${PROJECT_BINARY_DIR}/caliper.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif()

#
Expand Down
74 changes: 22 additions & 52 deletions caliper-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,58 +1,28 @@
# - caliper: Context Annotation Library
#
#=============================================================================
# Caliper is a program instrumentation and performance measurement
# framework. It provides data collection mechanisms and a source-code
# annotation API for a variety of performance engineering use cases,
# e.g., performance profiling, tracing, monitoring, and
# auto-tuning.
#
#=== Usage ===================================================================
# This file allows caliper to be automatically detected by other libraries
# using CMake. To build with caliper, you can do one of two things:
#
# 1. Set the caliper_DIR environment variable to the root of the Caliper
# installation. If you loaded caliper through a dotkit, this may already
# be set, and caliper will be autodetected by CMake.
#
# 2. Configure your project with this option:
# -Dcaliper_DIR=<caliper install prefix>/share/
#
# If you have done either of these things, then CMake should automatically find
# and include this file when you call find_package(caliper) from your
# CMakeLists.txt file.
#
#=== Components ==============================================================
# (David's TO DO)
#
# To link against these, just do, for example:
#
# find_package(caliper REQUIRED)
# add_executable(foo foo.c)
# target_link_libraries(foo caliper)
#
# That's all!
#
if (NOT caliper_CONFIG_LOADED)
set(caliper_CONFIG_LOADED TRUE)
@PACKAGE_INIT@

# Install layout
set(caliper_INSTALL_PREFIX @CMAKE_INSTALL_PREFIX@)
set(caliper_INCLUDE_DIR @CMAKE_INSTALL_FULL_INCLUDEDIR@)
set(caliper_LIB_DIR @CMAKE_INSTALL_FULL_LIBDIR@)
set(caliper_CMAKE_DIR @CMAKE_INSTALL_FULL_DATADIR@/cmake/caliper)
include(CMakeFindDependencyMacro)

# Includes needed to use caliper
set(caliper_INCLUDE_PATH ${caliper_INCLUDE_DIR})
set(caliper_LIB_PATH ${caliper_LIB_DIR})
include("${CMAKE_CURRENT_LIST_DIR}/caliper-targets.cmake")

include(CMakeFindDependencyMacro)
find_dependency(Threads)
set_and_check(caliper_INCLUDE_DIR "@PACKAGE_caliper_INSTALL_INCLUDE_DIR@")

if (@CALIPER_HAVE_ADIAK@)
find_dependency(adiak)
if (@CALIPER_HAVE_ADIAK@)
if (NOT TARGET adiak::adiak)
set(CALIPER_ADIAK_DIR @adiak_DIR@)
if (NOT adiak_DIR)
set(adiak_DIR ${CALIPER_ADIAK_DIR})
endif()
find_dependency(
adiak
CONFIG
NO_DEFAULT_PATH
PATHS
${adiak_DIR}
${adiak_DIR}/lib/cmake/adiak
${PACKAGE_PREFIX_DIR}
${PACKAGE_PREFIX_DIR}/lib/cmake/adiak
)
endif()

# Library targets imported from file
include(${caliper_CMAKE_DIR}/caliper-targets.cmake)
endif()

check_required_components(caliper)
12 changes: 11 additions & 1 deletion cmake/FindRoctracer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ find_library(ROCTRACER_LIBHSAKMT
NAMES hsakmt
HINTS ${ROCM_ROOT_DIR}/lib
)
find_library(ROCTRACER_LIBHSAKMT
NAMES hsakmt
HINTS ${ROCM_ROOT_DIR}/lib
)
find_library(ROCTRACER_AMDHIP64
NAMES amdhip64
HINTS ${ROCM_ROOT_DIR}/lib
)

find_path(ROCTRACER_INCLUDE_DIR
NAMES roctracer.h
Expand All @@ -33,7 +41,9 @@ set(ROCTRACER_INCLUDE_DIRS
set(ROCTRACER_LIBRARIES
${ROCTRACER_LIBROCTRACER}
${ROCTRACER_LIBHSARUNTIME}
${ROCTRACER_LIBHSAKMT})
${ROCTRACER_LIBHSAKMT}
${ROCTRACER_AMDHIP64}
)

include(FindPackageHandleStandardArgs)

Expand Down
13 changes: 6 additions & 7 deletions doc/sphinx/CaliperBasics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ of exclusive region times:
Caliper provides many more performance measurement configurations in addition
to `runtime-report` that make use of region annotations. For example,
`hatchet-region-profile` writes a json file with region times for processing
`hatchet-region-profile` writes a .cali file with region times for processing
with `Hatchet <https://github.com/LLNL/hatchet>`_. See
:ref:`more-on-configurations` below to learn more about different
configurations and their options.
Expand Down Expand Up @@ -327,11 +327,10 @@ maximum amount of memory that was allocated in each region:
foo 0.000778 0.000778 0.000778 8.930211 0.000016
init 0.000020 0.000020 0.000020 0.229568 0.000000
You can use the cali-query and mpi-caliquery programs to list available
configs and their parameters (note that cali-query does not list MPI-dependent
options and configs). For example, ``mpi-caliquery --help=configs`` lists all
configs and their options. You can also query parameters for a specific config,
e.g. ``mpi-caliquery --help=runtime-report``.
You can use the cali-query program to list available configs and their parameters.
For example, ``cali-query --help=configs`` lists all configs and their options.
You can also query parameters for a specific config, e.g.
``cali-query --help=runtime-report``.

Some available performance measurement configs include:

Expand Down Expand Up @@ -528,7 +527,7 @@ high-water mark:
2500 1382 2.502447 552.259448 0.000016
3750 1085 2.634396 411.859113 0.000016
See :doc:`BuiltinConfigurations` or run ``mpi-caliquery --help=loop-report``
See :doc:`BuiltinConfigurations` or run ``cali-query --help=loop-report``
to learn about all loop-report options. Loop profiling is also available
with other configs, notably the `spot` config producing output for the Spot
performance visualization web framework.
Expand Down
36 changes: 18 additions & 18 deletions doc/sphinx/calql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ profile for an application's main loop and printing results in a
table, sorted by time, is accomplished with the following statement:
::

SELECT *, count(), sum(time.duration)
SELECT *, count(), sum(time.duration.ns)
WHERE loop=mainloop
GROUP BY function
FORMAT table
ORDER BY time.duration
ORDER BY time.duration.ns

Quick reference
--------------------------------
Expand Down Expand Up @@ -92,7 +92,7 @@ For example, we can use the scale() operator to scale a value before
subsequent aggregations::

LET
sec=scale(time.duration,1e-6)
sec=scale(time.duration.ns,1e-9)
SELECT
path,sum(sec)

Expand All @@ -102,15 +102,15 @@ aggregate blocks of 10 iterations in a time-series profile::
LET
block=truncate(iteration#mainloop,10)
SELECT
block,sum(time.duration)
block,sum(time.duration.ns)
GROUP BY
block

The first() operator returns the first attribute out of a list of attribute
names found in an input record. It can also be used to rename attributes::

LET
time=first(time.duration,sum#time.duration)
time=first(time.duration.ns,sum#time.duration.ns)
SELECT
sum(time) AS Time
GROUP BY
Expand All @@ -133,11 +133,11 @@ records that contain "omp.work" regions, and then uses that to compute
efficiency from the total and "work" time:

LET
work=first(time.duration) IF omp.work
work=first(time.duration.ns) IF omp.work
SELECT
sum(time.duration) AS Total,
sum(work) AS Work,
ratio(work,time.duration) AS Efficiency
sum(time.duration.ns) AS Total,
sum(work) AS Work,
ratio(work,time.duration.ns) AS Efficiency
GROUP BY
path

Expand All @@ -163,10 +163,10 @@ aggregations (e.g., ``min(count())``) within a query are not supported.
The ``AS`` keyword assigns a user-defined name to a selected attribute
or aggregation result. Example::

SELECT sum(time.duration) AS "Time (usec)" FORMAT table
SELECT sum(time.duration.ns) AS "Time (nsec)" FORMAT table

Here, the `table` formatter uses "Time (usec)" instead of "sum#time.duration" as
column name for the ``sum(time.duration)`` column. Only some
Here, the `table` formatter uses "Time (nsec)" instead of "sum#time.duration.ns" as
column name for the ``sum(time.duration.ns)`` column. Only some
formatters (table, tree, json, and json-split) support ``AS``.

Inclusive aggregation operations (`inclusive_sum`, `inclusive_scale`, and
Expand All @@ -180,15 +180,15 @@ A more complex example::

SELECT
*,
scale(time.duration,1e-6) AS Time,
inclusive_percent_total(time.duration) AS "Time %"
scale(time.duration.ns,1e-9) AS Time,
inclusive_percent_total(time.duration.ns) AS "Time %"
GROUP BY
path
FORMAT
tree

The computes the (exclusive) sum of `time.duration` divided by 100000 and the inclusive
percent-of-total for `time.duration`. Example output::
The computes the (exclusive) sum of `time.duration.ns` divided by 100000000 and
the inclusive percent-of-total for `time.duration.ns`. Example output::

Path Time Time %
main 5 100
Expand Down Expand Up @@ -280,11 +280,11 @@ attribute name and not an alias assigned with ``AS``: ::

SELECT
*,
sum(time.inclusive.duration) AS Time
sum(time.inclusive.duration.ns) AS Time
FORMAT
table
ORDER BY
sum#time.inclusive.duration DESC,
sum#time.inclusive.duration.ns DESC,
iteration#mainloop

function loop iteration#mainloop Time
Expand Down
Loading

0 comments on commit cd9c0ff

Please sign in to comment.