From 38831c34e37cfaaf7b1797031d4bb885f8aab8d8 Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Thu, 15 Feb 2024 16:58:15 +0100 Subject: [PATCH 1/3] merge kp-kernels-timers (#235) * merge kp-kernels-timers * remove mpi * finishTime first * change env variable name * remove mention to KernelTimerJSON in kp_all * remove test * Fix format * fix segfault * scope of kernelList --------- Co-authored-by: Damien L-G --- build-all.sh | 1 - example/CMakeLists.txt | 1 - profiling/all/kp_all.cpp | 8 +- profiling/simple-kernel-timer/CMakeLists.txt | 4 - .../simple-kernel-timer/kp_kernel_timer.cpp | 84 +++++++- .../kp_kernel_timer_json.cpp | 191 ------------------ 6 files changed, 81 insertions(+), 208 deletions(-) delete mode 100644 profiling/simple-kernel-timer/kp_kernel_timer_json.cpp diff --git a/build-all.sh b/build-all.sh index 5833313d6..993c2b011 100644 --- a/build-all.sh +++ b/build-all.sh @@ -12,7 +12,6 @@ make -f $ROOT_DIR/profiling/memory-usage/Makefile make -f $ROOT_DIR/profiling/nvtx-connector/Makefile make -f $ROOT_DIR/profiling/nvtx-focused-connector/Makefile make -f $ROOT_DIR/profiling/papi-connector/Makefile -make -f $ROOT_DIR/profiling/simple-kernel-timer-json/Makefile make -f $ROOT_DIR/profiling/simple-kernel-timer/Makefile make -f $ROOT_DIR/profiling/space-time-stack/Makefile make -f $ROOT_DIR/profiling/systemtap-connector/Makefile diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 88b3b5ac4..41980d163 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -21,7 +21,6 @@ endmacro() # and exported output in expected format, fail the test otherwise. if(NOT WIN32) add_kp_test(kernel_timer "kernel-timer") - add_kp_test(kernel_timer_json "kernel-timer-json") add_kp_test(memory_events "memory-events") add_kp_test(memory_usage "memory-usage") add_kp_test(chrome_tracing "chrome-tracing") diff --git a/profiling/all/kp_all.cpp b/profiling/all/kp_all.cpp index 1c8691274..52bc9bad9 100644 --- a/profiling/all/kp_all.cpp +++ b/profiling/all/kp_all.cpp @@ -30,7 +30,6 @@ #ifndef WIN32 KOKKOSTOOLS_EXTERN_EVENT_SET(KernelTimer) -KOKKOSTOOLS_EXTERN_EVENT_SET(KernelTimerJSON) KOKKOSTOOLS_EXTERN_EVENT_SET(MemoryEvents) KOKKOSTOOLS_EXTERN_EVENT_SET(MemoryUsage) KOKKOSTOOLS_EXTERN_EVENT_SET(HighwaterMark) @@ -69,10 +68,9 @@ namespace KokkosTools { EventSet get_event_set(const char* profiler, const char* config_str) { std::map handlers; #ifndef WIN32 - handlers["kernel-timer"] = KernelTimer::get_event_set(); - handlers["kernel-timer-json"] = KernelTimerJSON::get_event_set(); - handlers["memory-events"] = MemoryEvents::get_event_set(); - handlers["memory-usage"] = MemoryUsage::get_event_set(); + handlers["kernel-timer"] = KernelTimer::get_event_set(); + handlers["memory-events"] = MemoryEvents::get_event_set(); + handlers["memory-usage"] = MemoryUsage::get_event_set(); #if USE_MPI handlers["highwater-mark-mpi"] = HighwaterMarkMPI::get_event_set(); #endif diff --git a/profiling/simple-kernel-timer/CMakeLists.txt b/profiling/simple-kernel-timer/CMakeLists.txt index e512a1d67..ebd05a6a8 100644 --- a/profiling/simple-kernel-timer/CMakeLists.txt +++ b/profiling/simple-kernel-timer/CMakeLists.txt @@ -7,10 +7,6 @@ if(NOT MSVC) set_property(TARGET kp_kernel_shared PROPERTY POSITION_INDEPENDENT_CODE ON) endif() -# Add JSON kernel-timer -kp_add_library(kp_kernel_timer_json kp_kernel_timer_json.cpp) -target_link_libraries(kp_kernel_timer_json PRIVATE kp_kernel_shared) - # Add binary kernel-timer kp_add_library(kp_kernel_timer kp_kernel_timer.cpp) target_link_libraries(kp_kernel_timer PRIVATE kp_kernel_shared) diff --git a/profiling/simple-kernel-timer/kp_kernel_timer.cpp b/profiling/simple-kernel-timer/kp_kernel_timer.cpp index 33187c9c4..a015f5589 100644 --- a/profiling/simple-kernel-timer/kp_kernel_timer.cpp +++ b/profiling/simple-kernel-timer/kp_kernel_timer.cpp @@ -15,6 +15,7 @@ //@HEADER #include +#include #include #include #include @@ -25,6 +26,10 @@ namespace KokkosTools { namespace KernelTimer { +bool is_region(KernelPerformanceInfo const& kp) { + return kp.getKernelType() == REGION; +} + void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, const uint32_t /*devInfoCount*/, Kokkos_Profiling_KokkosPDeviceInfo* /*deviceInfo*/) { @@ -52,23 +57,90 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, void kokkosp_finalize_library() { double finishTime = seconds(); + const char* kokkos_tools_timer_json_raw = getenv("KOKKOS_TOOLS_TIMER_JSON"); + const bool kokkos_tools_timer_json = + kokkos_tools_timer_json_raw == NULL + ? false + : strcmp(kokkos_tools_timer_json_raw, "1") == 0 || + strcmp(kokkos_tools_timer_json_raw, "true") == 0 || + strcmp(kokkos_tools_timer_json_raw, "True") == 0; + + double kernelTimes = 0; + char* hostname = (char*)malloc(sizeof(char) * 256); gethostname(hostname, 256); char* fileOutput = (char*)malloc(sizeof(char) * 256); - snprintf(fileOutput, 256, "%s-%d.dat", hostname, (int)getpid()); + snprintf(fileOutput, 256, "%s-%d.%s", hostname, (int)getpid(), + kokkos_tools_timer_json ? "json" : "dat"); free(hostname); FILE* output_data = fopen(fileOutput, "wb"); const double totalExecuteTime = (finishTime - initTime); - fwrite(&totalExecuteTime, sizeof(totalExecuteTime), 1, output_data); + if (!kokkos_tools_timer_json) { + fwrite(&totalExecuteTime, sizeof(totalExecuteTime), 1, output_data); - std::vector kernelList; + for (auto kernel_itr = count_map.begin(); kernel_itr != count_map.end(); + kernel_itr++) { + kernel_itr->second->writeToBinaryFile(output_data); + } + } else { + std::vector kernelList; + + for (auto kernel_itr = count_map.begin(); kernel_itr != count_map.end(); + kernel_itr++) { + kernelList.push_back(kernel_itr->second); + kernelTimes += kernel_itr->second->getTime(); + } + + std::sort(kernelList.begin(), kernelList.end(), + compareKernelPerformanceInfo); + + fprintf(output_data, "{\n\"kokkos-kernel-data\" : {\n"); + fprintf(output_data, " \"total-app-time\" : %10.3f,\n", + totalExecuteTime); + fprintf(output_data, " \"total-kernel-times\" : %10.3f,\n", + kernelTimes); + fprintf(output_data, " \"total-non-kernel-times\" : %10.3f,\n", + (totalExecuteTime - kernelTimes)); + + const double percentKokkos = (kernelTimes / totalExecuteTime) * 100.0; + fprintf(output_data, " \"percent-in-kernels\" : %6.2f,\n", + percentKokkos); + fprintf(output_data, " \"unique-kernel-calls\" : %22llu,\n", + (unsigned long long)count_map.size()); + fprintf(output_data, "\n"); + + fprintf(output_data, " \"region-perf-info\" : [\n"); + +#define KERNEL_INFO_INDENT " " + + bool print_comma = false; + for (auto const& kernel : count_map) { + if (!is_region(*std::get<1>(kernel))) continue; + if (print_comma) fprintf(output_data, ",\n"); + kernel.second->writeToJSONFile(output_data, KERNEL_INFO_INDENT); + print_comma = true; + } + + fprintf(output_data, "\n"); + fprintf(output_data, " ],\n"); + + fprintf(output_data, " \"kernel-perf-info\" : [\n"); + + print_comma = false; + for (auto const& kernel : count_map) { + if (is_region(*std::get<1>(kernel))) continue; + if (print_comma) fprintf(output_data, ",\n"); + kernel.second->writeToJSONFile(output_data, KERNEL_INFO_INDENT); + print_comma = true; + } + + fprintf(output_data, "\n"); + fprintf(output_data, " ]\n"); - for (auto kernel_itr = count_map.begin(); kernel_itr != count_map.end(); - kernel_itr++) { - kernel_itr->second->writeToBinaryFile(output_data); + fprintf(output_data, "}\n}"); } fclose(output_data); diff --git a/profiling/simple-kernel-timer/kp_kernel_timer_json.cpp b/profiling/simple-kernel-timer/kp_kernel_timer_json.cpp deleted file mode 100644 index 859fa3d7b..000000000 --- a/profiling/simple-kernel-timer/kp_kernel_timer_json.cpp +++ /dev/null @@ -1,191 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#include -#include -#include -#include - -#include "kp_core.hpp" -#include "kp_shared.h" - -using namespace KokkosTools::KernelTimer; - -namespace KokkosTools { -namespace KernelTimerJSON { - -void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, - const uint32_t /*devInfoCount*/, - Kokkos_Profiling_KokkosPDeviceInfo* /*deviceInfo*/) { - const char* output_delim_env = getenv("KOKKOSP_OUTPUT_DELIM"); - if (NULL == output_delim_env) { - outputDelimiter = (char*)malloc(sizeof(char) * 2); - snprintf(outputDelimiter, 2, "%c", ' '); - } else { - outputDelimiter = - (char*)malloc(sizeof(char) * (strlen(output_delim_env) + 1)); - strcpy(outputDelimiter, output_delim_env); - } - - printf( - "KokkosP: LDMS JSON Connector Initialized (sequence is %d, version: " - "%llu)\n", - loadSeq, (long long unsigned int)interfaceVer); - - initTime = seconds(); -} - -void kokkosp_finalize_library() { - double finishTime = seconds(); - double kernelTimes = 0; - - char* mpi_rank = getenv("OMPI_COMM_WORLD_RANK"); - - char* hostname = (char*)malloc(sizeof(char) * 256); - gethostname(hostname, 256); - - char* fileOutput = (char*)malloc(sizeof(char) * 256); - snprintf(fileOutput, 256, "%s-%d-%s.json", hostname, (int)getpid(), - (NULL == mpi_rank) ? "0" : mpi_rank); - - free(hostname); - FILE* output_data = fopen(fileOutput, "w"); - - const double totalExecuteTime = (finishTime - initTime); - std::vector kernelList; - - for (auto kernel_itr = count_map.begin(); kernel_itr != count_map.end(); - kernel_itr++) { - kernelList.push_back(kernel_itr->second); - kernelTimes += kernel_itr->second->getTime(); - } - - std::sort(kernelList.begin(), kernelList.end(), compareKernelPerformanceInfo); - - fprintf(output_data, "{\n\"kokkos-kernel-data\" : {\n"); - fprintf(output_data, " \"mpi-rank\" : %s,\n", - (NULL == mpi_rank) ? "0" : mpi_rank); - fprintf(output_data, " \"total-app-time\" : %10.3f,\n", - totalExecuteTime); - fprintf(output_data, " \"total-kernel-times\" : %10.3f,\n", - kernelTimes); - fprintf(output_data, " \"total-non-kernel-times\" : %10.3f,\n", - (totalExecuteTime - kernelTimes)); - - const double percentKokkos = (kernelTimes / totalExecuteTime) * 100.0; - fprintf(output_data, " \"percent-in-kernels\" : %6.2f,\n", - percentKokkos); - fprintf(output_data, " \"unique-kernel-calls\" : %22llu,\n", - (unsigned long long)count_map.size()); - fprintf(output_data, "\n"); - - fprintf(output_data, " \"kernel-perf-info\" : [\n"); - -#define KERNEL_INFO_INDENT " " - - bool print_comma = false; - for (auto const& kernel : count_map) { - if (print_comma) fprintf(output_data, ",\n"); - kernel.second->writeToJSONFile(output_data, KERNEL_INFO_INDENT); - print_comma = true; - } - - fprintf(output_data, "\n"); - fprintf(output_data, " ]\n"); - fprintf(output_data, "}\n}"); - fclose(output_data); -} - -void kokkosp_begin_parallel_for(const char* name, const uint32_t /*devID*/, - uint64_t* kID) { - *kID = uniqID++; - - if ((NULL == name) || (strcmp("", name) == 0)) { - fprintf(stderr, "Error: kernel is empty\n"); - exit(-1); - } - - increment_counter(name, PARALLEL_FOR); -} - -void kokkosp_end_parallel_for(const uint64_t /*kID*/) { - currentEntry->addFromTimer(); -} - -void kokkosp_begin_parallel_scan(const char* name, const uint32_t /*devID*/, - uint64_t* kID) { - *kID = uniqID++; - - if ((NULL == name) || (strcmp("", name) == 0)) { - fprintf(stderr, "Error: kernel is empty\n"); - exit(-1); - } - - increment_counter(name, PARALLEL_SCAN); -} - -void kokkosp_end_parallel_scan(const uint64_t /*kID*/) { - currentEntry->addFromTimer(); -} - -void kokkosp_begin_parallel_reduce(const char* name, const uint32_t /*devID*/, - uint64_t* kID) { - *kID = uniqID++; - - if ((NULL == name) || (strcmp("", name) == 0)) { - fprintf(stderr, "Error: kernel is empty\n"); - exit(-1); - } - - increment_counter(name, PARALLEL_REDUCE); -} - -void kokkosp_end_parallel_reduce(const uint64_t /*kID*/) { - currentEntry->addFromTimer(); -} - -Kokkos::Tools::Experimental::EventSet get_event_set() { - Kokkos::Tools::Experimental::EventSet my_event_set; - memset(&my_event_set, 0, - sizeof(my_event_set)); // zero any pointers not set here - my_event_set.init = kokkosp_init_library; - my_event_set.finalize = kokkosp_finalize_library; - my_event_set.begin_parallel_for = kokkosp_begin_parallel_for; - my_event_set.begin_parallel_reduce = kokkosp_begin_parallel_reduce; - my_event_set.begin_parallel_scan = kokkosp_begin_parallel_scan; - my_event_set.end_parallel_for = kokkosp_end_parallel_for; - my_event_set.end_parallel_reduce = kokkosp_end_parallel_reduce; - my_event_set.end_parallel_scan = kokkosp_end_parallel_scan; - return my_event_set; -} - -} // namespace KernelTimerJSON -} // namespace KokkosTools - -extern "C" { - -namespace impl = KokkosTools::KernelTimerJSON; - -EXPOSE_INIT(impl::kokkosp_init_library) -EXPOSE_FINALIZE(impl::kokkosp_finalize_library) -EXPOSE_BEGIN_PARALLEL_FOR(impl::kokkosp_begin_parallel_for) -EXPOSE_END_PARALLEL_FOR(impl::kokkosp_end_parallel_for) -EXPOSE_BEGIN_PARALLEL_SCAN(impl::kokkosp_begin_parallel_scan) -EXPOSE_END_PARALLEL_SCAN(impl::kokkosp_end_parallel_scan) -EXPOSE_BEGIN_PARALLEL_REDUCE(impl::kokkosp_begin_parallel_reduce) -EXPOSE_END_PARALLEL_REDUCE(impl::kokkosp_end_parallel_reduce) - -} // extern "C" From fe2c93a186e074c74d598cf9334339b22623f774 Mon Sep 17 00:00:00 2001 From: "romin.tomasetti" Date: Tue, 6 Feb 2024 15:12:44 +0000 Subject: [PATCH 2/3] tests: add Google Test --- .github/workflows/build-with-kokkos.yml | 3 +- CMakeLists.txt | 1 + cmake/BuildGTest.cmake | 35 +++++++++++++ tests/CMakeLists.txt | 60 ++++++++++++++++++++++ tests/UnitTestMain.cpp | 12 +++++ tests/space-time-stack/CMakeLists.txt | 21 ++------ tests/space-time-stack/test_demangling.cpp | 20 ++++---- 7 files changed, 124 insertions(+), 28 deletions(-) create mode 100644 cmake/BuildGTest.cmake create mode 100644 tests/UnitTestMain.cpp diff --git a/.github/workflows/build-with-kokkos.yml b/.github/workflows/build-with-kokkos.yml index 7da5530a6..ad56034b1 100644 --- a/.github/workflows/build-with-kokkos.yml +++ b/.github/workflows/build-with-kokkos.yml @@ -71,9 +71,10 @@ jobs: exit -1 esac - - name: Install CMake, OpenMPI, PAPI and dtrace + - name: Install git, CMake, OpenMPI, PAPI and dtrace run: | apt --yes --no-install-recommends install \ + git ca-certificates \ cmake make \ libopenmpi-dev \ systemtap-sdt-dev \ diff --git a/CMakeLists.txt b/CMakeLists.txt index f2e1ba77f..45299188b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,6 +272,7 @@ endif() # Tests if(KokkosTools_ENABLE_TESTS) enable_testing() + include(cmake/BuildGTest.cmake) add_subdirectory(tests) endif() diff --git a/cmake/BuildGTest.cmake b/cmake/BuildGTest.cmake new file mode 100644 index 000000000..0d16ff721 --- /dev/null +++ b/cmake/BuildGTest.cmake @@ -0,0 +1,35 @@ +# Look for Google Test and enable it as a target. +# +# The main targets that will be available are: +# * GTest::gtest +# * GTest::gmock +# +# References: +# * https://github.com/google/googletest +# * https://matgomes.com/integrate-google-test-into-cmake/ +# * https://google.github.io/googletest/quickstart-cmake.html +# * https://jeremimucha.com/2021/04/cmake-fetchcontent/ + +include(FetchContent) + +# Declare the Google Test dependency +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 +) + +# If not yet populated, add Google Test to the build with the following options: +# * disable installation of Google Test +# * enable GMock +# Note that we could have used FetchContent_MakeAvailable instead, but it would then +# use the default configuration that would install Google Test. +FetchContent_GetProperties(googletest) +if (NOT googletest_POPULATED) + FetchContent_Populate(googletest) + + set(BUILD_GMOCK ON) + set(INSTALL_GTEST OFF) + + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) +endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a5fa435c6..65ec02fe0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1 +1,61 @@ +# Add an executable and its related test. +# +# The executable is always linked to 'kokkostools' and 'test_common'. +# +# Arguments: +# TARGET_NAME : name of the test (required) +# SOURCE_FILE : source file, defaults to .cpp (optional) +# KOKKOS_TOOLS_LIBS : the test environment will received the variable 'KOKKOS_TOOLS_LIBS' that is set as the path +# to the target file of this argument (optional) +function(kp_add_executable_and_test) + + cmake_parse_arguments(kaeat_args "" "TARGET_NAME;SOURCE_FILE;KOKKOS_TOOLS_LIBS" "" ${ARGN}) + + if(NOT DEFINED kaeat_args_TARGET_NAME) + message(FATAL_ERROR "'TARGET_NAME' is a required argument.") + endif() + + if(NOT DEFINED kaeat_args_SOURCE_FILE) + set(kaeat_args_SOURCE_FILE "${kaeat_args_TARGET_NAME}.cpp") + endif() + + add_executable(${kaeat_args_TARGET_NAME}) + + target_sources( + ${kaeat_args_TARGET_NAME} + PRIVATE + ${kaeat_args_SOURCE_FILE} + ) + target_link_libraries( + ${kaeat_args_TARGET_NAME} + PRIVATE + kokkostools test_common + ) + + add_test( + NAME ${kaeat_args_TARGET_NAME} + COMMAND $ + ) + + if(DEFINED kaeat_args_KOKKOS_TOOLS_LIBS) + set_property( + TEST ${kaeat_args_TARGET_NAME} + APPEND + PROPERTY + ENVIRONMENT "KOKKOS_TOOLS_LIBS=$" + ) + endif() + +endfunction(kp_add_executable_and_test) + +# Create a test library that contains the required Kokkos and Google Test +# initialization sequence. +add_library(test_common OBJECT) +target_sources( + test_common + PRIVATE + UnitTestMain.cpp +) +target_link_libraries(test_common PUBLIC GTest::gtest GTest::gmock Kokkos::kokkos) + add_subdirectory(space-time-stack) diff --git a/tests/UnitTestMain.cpp b/tests/UnitTestMain.cpp new file mode 100644 index 000000000..066d22adc --- /dev/null +++ b/tests/UnitTestMain.cpp @@ -0,0 +1,12 @@ +#include "gtest/gtest.h" + +#include "Kokkos_Core.hpp" + +//! Main entry point for tests. +int main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + + auto success = RUN_ALL_TESTS(); + + return success; +} diff --git a/tests/space-time-stack/CMakeLists.txt b/tests/space-time-stack/CMakeLists.txt index de68a5015..e16b0448c 100644 --- a/tests/space-time-stack/CMakeLists.txt +++ b/tests/space-time-stack/CMakeLists.txt @@ -1,18 +1,5 @@ -# A function to add such "simple" tests in 'tests/CMakeLists.txt' might be a good option. -add_executable(test_space_time_stack_demangling) -target_sources( - test_space_time_stack_demangling - PRIVATE - test_demangling.cpp -) -target_link_libraries( - test_space_time_stack_demangling - PRIVATE - Kokkos::kokkos kokkostools -) -add_test( - NAME test_space_time_stack_demangling - COMMAND $ - --kokkos-tools-libs=$ - --kokkos-tools-args=1e-9 +kp_add_executable_and_test( + TARGET_NAME test_space_time_stack_demangling + SOURCE_FILE test_demangling.cpp + KOKKOS_TOOLS_LIBS kp_space_time_stack ) diff --git a/tests/space-time-stack/test_demangling.cpp b/tests/space-time-stack/test_demangling.cpp index 8ed021da8..27ca95dd7 100644 --- a/tests/space-time-stack/test_demangling.cpp +++ b/tests/space-time-stack/test_demangling.cpp @@ -1,10 +1,10 @@ #include -#include #include -#include "Kokkos_Core.hpp" +#include "gmock/gmock.h" +#include "gtest/gtest.h" -#include "utils/demangle.hpp" +#include "Kokkos_Core.hpp" struct Tester { struct TagNamed {}; @@ -49,9 +49,13 @@ static const std::vector matchers{ "[0-9.e]+ sec [0-9.]+% 100.0% 0.0% ------ 1 Tester/Tester::TagUnnamed " "\\[for\\]"}; -int main(int argc, char* argv[]) { +/** + * @test This test checks that the tool effectively uses + * the demangling helpers. + */ +TEST(SpaceTimeStackTest, demangling) { //! Initialize @c Kokkos. - Kokkos::initialize(argc, argv); + Kokkos::initialize(); //! Redirect output for later analysis. std::cout.flush(); @@ -71,10 +75,6 @@ int main(int argc, char* argv[]) { //! Analyze test output. for (const auto& matcher : matchers) { - if (!std::regex_search(output.str(), std::regex(matcher))) - throw std::runtime_error("Couln't find " + matcher + " in output\n" + - output.str()); + EXPECT_THAT(output.str(), ::testing::ContainsRegex(matcher)); } - - return EXIT_SUCCESS; } From bdafe27fb5fe2191183543fc56ffd6cc01d487b9 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 22 Feb 2024 09:55:45 -0500 Subject: [PATCH 3/3] Fix Makefile for simple-kernel-timer and space-time-stack --- profiling/simple-kernel-timer/Makefile | 4 ++-- profiling/space-time-stack/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/profiling/simple-kernel-timer/Makefile b/profiling/simple-kernel-timer/Makefile index 7c8bebd7d..14f4bcea0 100644 --- a/profiling/simple-kernel-timer/Makefile +++ b/profiling/simple-kernel-timer/Makefile @@ -1,12 +1,12 @@ CXX=g++ -CXXFLAGS=-O3 -std=c++11 -g +CXXFLAGS=-O3 -std=c++17 -g SHARED_CXXFLAGS=-shared -fPIC all: kp_kernel_timer.so kp_reader kp_json_writer MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) -CXXFLAGS+=-I${MAKEFILE_PATH} -I${MAKEFILE_PATH}/../../common/makefile-only -I${MAKEFILE_PATH}../all +CXXFLAGS+=-I${MAKEFILE_PATH} -I${MAKEFILE_PATH}/../../common/makefile-only -I${MAKEFILE_PATH}../all -I${MAKEFILE_PATH}../../common kp_reader: ${MAKEFILE_PATH}kp_reader.cpp kp_kernel_timer.so $(CXX) $(CXXFLAGS) -o kp_reader ${MAKEFILE_PATH}kp_reader.cpp ${MAKEFILE_PATH}kp_shared.cpp diff --git a/profiling/space-time-stack/Makefile b/profiling/space-time-stack/Makefile index 6ed5971ea..0a71839f2 100644 --- a/profiling/space-time-stack/Makefile +++ b/profiling/space-time-stack/Makefile @@ -1,12 +1,12 @@ CXX=mpicxx -CXXFLAGS=-shared -O3 -g -fPIC -std=c++11 -Wall -Wextra +CXXFLAGS=-shared -O3 -g -fPIC -std=c++17 -Wall -Wextra #Turn MPI support off: #CXXFLAGS += -DUSE_MPI=0 MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) -CXXFLAGS+=-I${MAKEFILE_PATH} -I${MAKEFILE_PATH}/../../common/makefile-only -I${MAKEFILE_PATH}../all +CXXFLAGS+=-I${MAKEFILE_PATH} -I${MAKEFILE_PATH}/../../common/makefile-only -I${MAKEFILE_PATH}../all -I${MAKEFILE_PATH}../../common kp_space_time_stack.so: ${MAKEFILE_PATH}kp_space_time_stack.cpp $(CXX) $(CXXFLAGS) -o $@ $<