Skip to content

Commit

Permalink
Merge branch 'master' into woptim/shared-ci-2023-12-0
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienbernede committed Jan 22, 2024
2 parents 60188ed + b4553b9 commit c21e982
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 8 deletions.
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ add_caliper_option(WITH_GOTCHA "Enable GOTCHA wrapping" ${CALIPER_HAVE_LINUX}
add_caliper_option(WITH_ROCTX "Enable AMD RocTX support" FALSE)
add_caliper_option(WITH_ROCTRACER "Enable AMD RocTracer support" FALSE)
add_caliper_option(WITH_ROCM "Enable AMD RocTracer and RocTX support" FALSE)
# add_caliper_option(WITH_SOS "Enable SOSFlow data management" FALSE)
#add_caliper_option(WITH_SOS "Enable SOSFlow data management" FALSE)
add_caliper_option(WITH_TAU "Enable TAU service (TAU Performance System)" FALSE)
add_caliper_option(WITH_VTUNE "Enable Intel(R) VTune(tm) annotation bindings" FALSE)
add_caliper_option(WITH_ADIAK "Enable adiak support" FALSE)
Expand All @@ -78,6 +78,7 @@ add_caliper_option(WITH_PCP "Enable performance co-pilot support" FALSE)
add_caliper_option(WITH_VARIORUM "Enable Variorum support" FALSE)
add_caliper_option(WITH_UMPIRE "Enable Umpire statistics support" FALSE)
add_caliper_option(WITH_CRAYPAT "Enable CrayPAT region forwarding support" FALSE)
add_caliper_option(WITH_LDMS "Enable LDMS forwarder" FALSE)

add_caliper_option(USE_EXTERNAL_GOTCHA "Use pre-installed gotcha instead of building our own" FALSE)

Expand Down Expand Up @@ -461,6 +462,17 @@ if (WITH_UMPIRE)
list(APPEND CALIPER_EXTERNAL_LIBS umpire)
endif()

if (WITH_LDMS)
include(FindLDMS)
if (LDMS_FOUND)
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}")
message("Library Names: ${LDMS_LIBLDMS} ${LDMS_LIBSTREAM}")
endif()
endif()

# PGI 17.x has issues with some constexpr constructors
if(CMAKE_CXX_COMPILER_ID MATCHES PGI)
set(CALIPER_REDUCED_CONSTEXPR_USAGE TRUE)
Expand Down Expand Up @@ -583,7 +595,8 @@ set(CALIPER_MODULES
histogram
variorum
umpire
CrayPAT)
CrayPAT
LDMS)

foreach(_caliper_module ${CALIPER_MODULES})
string(LENGTH "${_caliper_module}" _strlen)
Expand Down
50 changes: 50 additions & 0 deletions cmake/FindLDMS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Try to find LDMS headers and libraries.
#
# Usage of this module as follows:
#
# find_package(LDMS)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# LDMS_PREFIX Set this variable to the root installation of
# LDMS if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# LDMS_FOUND System has LDMS libraries and headers
# LDMS_LIBRARIES The LDMS library
# LDMS_INCLUDE_DIRS The location of LDMS headers

find_library(LDMS_LIBLDMS
NAMES ldms
PATHS /usr/lib64 /usr/lib /opt/ovis/lib
)

find_library(LDMS_LIBSTREAM
NAMES ldmsd_stream
PATHS /usr/lib64 /usr/lib /opt/ovis/lib
)

find_path(LDMS_INCLUDE_DIRS
NAMES "ldms.h" "ldmsd_stream.h"
PATH_SUFFIXES "ldms"
)
message(STATUS "libldms.so => ${LDMS_LIBRARIES}")
message(STATUS "ldmsd_stream.h => ${LDMS_INCLUDE_DIRS}")
message(STATUS "ldms.h => ${LDMS_INCLUDE_DIRS}")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LDMS DEFAULT_MSG
LDMS_LIBLDMS
LDMS_LIBSTREAM
LDMS_INCLUDE_DIRS
)

mark_as_advanced(
LDMS_PREFIX_DIRS
LDMS_LIBLDMS
LDMS_LIBSTREAM
LDMS_INCLUDE_DIRS
)
14 changes: 8 additions & 6 deletions src/caliper/Caliper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ struct Caliper::ThreadData
MetadataTree tree;
::siglock lock;

SnapshotRecord snapshot;

// This thread's blackboard
Blackboard thread_blackboard;
// copy of the last process blackboard snapshot
Expand Down Expand Up @@ -902,17 +904,17 @@ Caliper::push_snapshot(Channel* channel, SnapshotView trigger_info)
std::lock_guard<::siglock>
g(sT->lock);

SnapshotRecord rec;
sT->snapshot.reset();

// copy pull_snapshot() functionality to avoid superfluous siglock update
rec.builder().append(trigger_info);
channel->mP->events.snapshot(this, channel, trigger_info, rec.builder());
sT->snapshot.builder().append(trigger_info);
channel->mP->events.snapshot(this, channel, trigger_info, sT->snapshot.builder());

sT->thread_blackboard.snapshot(rec.builder());
sT->thread_blackboard.snapshot(sT->snapshot.builder());
sT->update_process_snapshot(sG->process_blackboard);
rec.builder().append(sT->process_snapshot.view());
sT->snapshot.builder().append(sT->process_snapshot.view());

channel->mP->events.process_snapshot(this, channel, trigger_info, rec.view());
channel->mP->events.process_snapshot(this, channel, trigger_info, sT->snapshot.view());
}

void
Expand Down
11 changes: 11 additions & 0 deletions src/services/ldms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include_directories(${LDMS_INCLUDE_DIRS})

set(CALIPER_LDMS_SOURCES
LdmsForwarder.cpp)

add_library(caliper-ldms OBJECT ${CALIPER_LDMS_SOURCES})

add_service_objlib("caliper-ldms")
add_caliper_service("ldms CALIPER_HAVE_LDMS")


Loading

0 comments on commit c21e982

Please sign in to comment.