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

started unifying tracing #65

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ jobs:
shell: pwsh
run: |
cd build
cmake --build . -j2
CXX_FLAGS="-v" LD_FLAGS="-v" cmake --build . -j2
- name: Copy Hwloc DLL
shell: pwsh
if: matrix.cfg.MSVC == true
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif()
endif()

set(FIRESTARTER_TRACING "None" CACHE STRING "FIRESTARTER_TRACING can be any of None, Logger, ScoreP, or VampirTrace.")
set_property(CACHE FIRESTARTER_TRACING PROPERTY STRINGS None Logger ScoreP VampirTrace)

option(FIRESTARTER_TRACING_CXX_FLAGS "FIRESTARTER_TRACING_CXX_FLAGS should add include paths for the selected tracing infrastructure." "${FIRESTARTER_TRACING_CXX_FLAGS}")
option(FIRESTARTER_TRACING_LD_FLAGS "FIRESTARTER_TRACING_LD_FLAGS should set linker flags for the selected tracing infrastructure." "${FIRESTARTER_TRACING_CXX_FLAGS}")

set(FIRESTARTER_BUILD_TYPE "FIRESTARTER" CACHE STRING "FIRESTARTER_BUILD_TYPE can be any of FIRESTARTER, FIRESTARTER_CUDA, or FIRESTARTER_ONEAPI.")
set_property(CACHE FIRESTARTER_BUILD_TYPE PROPERTY STRINGS FIRESTARTER FIRESTARTER_CUDA FIRESTARTER_ONEAPI)
if (${FIRESTARTER_BUILD_TYPE} STREQUAL "FIRESTARTER")
Expand Down
35 changes: 35 additions & 0 deletions include/firestarter/Tracing/Tracing.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020-2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: daniel.hackenberg@tu-dresden.de
*****************************************************************************/

#pragma once

namespace firestarter::tracing {

class Tracing {
public:
Tracing();
~Tracing();

inline void regionBegin(const char* const region_name);
inline void regionEnd(const char* const region_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inline void regionBegin(const char* const region_name);
inline void regionEnd(const char* const region_name);
void regionBegin(const char* const region_name);
void regionEnd(const char* const region_name);

};

} // firestarter::tracing
38 changes: 38 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
)
endif()

if("${FIRESTARTER_TRACING}" STREQUAL "None")
SET(FIRESTARTER_FILES
${FIRESTARTER_FILES}
firestarter/Tracing/NoTracing.cpp
)
elseif("${FIRESTARTER_TRACING}" STREQUAL "Logger")
SET(FIRESTARTER_FILES
${FIRESTARTER_FILES}
firestarter/Tracing/LogTracing.cpp
)
elseif("${FIRESTARTER_TRACING}" STREQUAL "ScoreP")
SET(FIRESTARTER_FILES
${FIRESTARTER_FILES}
firestarter/Tracing/ScoreP.cpp
)
#todo find folder
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSCOREP_USER_ENABLE ${FIRESTARTER_TRACING_CXXFLAGS}")
elseif("${FIRESTARTER_TRACING}" STREQUAL "VampirTrace")
SET(FIRESTARTER_FILES
${FIRESTARTER_FILES}
firestarter/Tracing/VampirTrace.cpp
)
#todo find folder
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVTRACE ${FIRESTARTER_TRACING_CXXFLAGS}")
endif()


SET(FIRESTARTER_LINK_LIBRARIES
)

Expand Down Expand Up @@ -183,3 +210,14 @@ elseif(${FIRESTARTER_BUILD_TYPE} STREQUAL "FIRESTARTER")
nlohmann_json::nlohmann_json
)
endif()
if("${FIRESTARTER_TRACING}" STREQUAL "ScoreP")
#todo link scorep
target_link_libraries("${FIRESTARTER_BUILD_TYPE}"
"${FIRESTARTER_TRACING_LDFLAGS}"
)
elseif("${FIRESTARTER_TRACING}" STREQUAL "VampirTrace")
#todo link vt user
target_link_libraries("${FIRESTARTER_BUILD_TYPE}"
"${FIRESTARTER_TRACING_LDFLAGS}"
)
endif()
27 changes: 6 additions & 21 deletions src/firestarter/LoadWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <firestarter/ErrorDetectionStruct.hpp>
#include <firestarter/Firestarter.hpp>
#include <firestarter/Logging/Log.hpp>
#include <firestarter/Tracing/Tracing.hpp>

#if defined(linux) || defined(__linux__)
extern "C" {
Expand Down Expand Up @@ -267,6 +268,7 @@ void Firestarter::printPerformanceReport() {

void Firestarter::loadThreadWorker(std::shared_ptr<LoadWorkerData> td) {

firestarter::tracing::Tracing tracing;
int old = THREAD_WAIT;

#if defined(linux) || defined(__linux__)
Expand Down Expand Up @@ -350,32 +352,15 @@ void Firestarter::loadThreadWorker(std::shared_ptr<LoadWorkerData> td) {
// will be terminated by watchdog
for (;;) {
// call high load function
#ifdef ENABLE_VTRACING
VT_USER_START("HIGH_LOAD_FUNC");
#endif
#ifdef ENABLE_SCOREP
SCOREP_USER_REGION_BY_NAME_BEGIN("HIGH",
SCOREP_USER_REGION_TYPE_COMMON);
#endif
tracing.regionBegin("High");
td->iterations = td->config().payload().highLoadFunction(
td->addrMem, td->addrHigh, td->iterations);

// call low load function
#ifdef ENABLE_VTRACING
VT_USER_END("HIGH_LOAD_FUNC");
VT_USER_START("LOW_LOAD_FUNC");
#endif
#ifdef ENABLE_SCOREP
SCOREP_USER_REGION_BY_NAME_END("HIGH");
SCOREP_USER_REGION_BY_NAME_BEGIN("LOW", SCOREP_USER_REGION_TYPE_COMMON);
#endif
tracing.regionEnd("High");
tracing.regionBegin("Low");
td->config().payload().lowLoadFunction(td->addrHigh, td->period);
#ifdef ENABLE_VTRACING
VT_USER_END("LOW_LOAD_FUNC");
#endif
#ifdef ENABLE_SCOREP
SCOREP_USER_REGION_BY_NAME_END("LOW");
#endif
tracing.regionEnd("Low");

// terminate if master signals end of run and record stop timestamp
if (*td->addrHigh == LOAD_STOP) {
Expand Down
39 changes: 39 additions & 0 deletions src/firestarter/Tracing/Caliper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020-2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: daniel.hackenberg@tu-dresden.de
*****************************************************************************/

#include <firestarter/Tracing/Tracing.hpp>

#include <adiak.hpp>
#include <caliper/cali.h>

using namespace firestarter::tracing;

Tracing::Tracing(){}
Tracing::~Tracing(){}

inline void Tracing::regionBegin(const char* const region_name) {
CALI_MARK_BEGIN(region_name);
}

inline void Tracing::regionEnd(const char* const region_name) {
CALI_MARK_END(region_name);
}

37 changes: 37 additions & 0 deletions src/firestarter/Tracing/LogTracing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020-2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: daniel.hackenberg@tu-dresden.de
*****************************************************************************/


#include <firestarter/Logging/Log.hpp>
#include <firestarter/Tracing/Tracing.hpp>

using namespace firestarter::tracing;

Tracing::Tracing(){}
Tracing::~Tracing(){}

inline void Tracing::regionBegin(const char* const region_name) {
firestarter::log::trace() << "Start " << region_name;
}

inline void Tracing::regionEnd(const char* const region_name) {
firestarter::log::trace() << "End " << region_name;
}
36 changes: 36 additions & 0 deletions src/firestarter/Tracing/NoTracing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020-2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: daniel.hackenberg@tu-dresden.de
*****************************************************************************/

#include <firestarter/Tracing/Tracing.hpp>

using namespace firestarter::tracing;

Tracing::Tracing(){}
Tracing::~Tracing(){}

inline void Tracing::regionBegin(const char* const region_name) {
// Do nothing
}

inline void Tracing::regionEnd(const char* const region_name) {
// Do nothing
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inline void Tracing::regionBegin(const char* const region_name) {
// Do nothing
}
inline void Tracing::regionEnd(const char* const region_name) {
// Do nothing
}
inline void Tracing::regionBegin(const char* const) {
// Do nothing
}
inline void Tracing::regionEnd(const char* const) {
// Do nothing
}

fix warnings


38 changes: 38 additions & 0 deletions src/firestarter/Tracing/ScoreP.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020-2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: daniel.hackenberg@tu-dresden.de
*****************************************************************************/

#include <scorep/SCOREP_User.h>

#include <firestarter/Tracing/Tracing.hpp>

using namespace firestarter::tracing;

Tracing::Tracing(){}
Tracing::~Tracing(){}

inline void Tracing::regionBegin(const char* const region_name) {
SCOREP_USER_REGION_BY_NAME_BEGIN(region_name,
SCOREP_USER_REGION_TYPE_COMMON);
}

inline void Tracing::regionEnd(const char* const region_name) {
SCOREP_USER_REGION_BY_NAME_END(region_name);
}
36 changes: 36 additions & 0 deletions src/firestarter/Tracing/VampirTrace.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020-2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: daniel.hackenberg@tu-dresden.de
*****************************************************************************/

#include <vt_user.h>
#include <firestarter/Tracing/Tracing.hpp>

using namespace firestarter::tracing;

Tracing::Tracing(){}
Tracing::~Tracing(){}

inline void Tracing::regionBegin(const char* const region_name) {
VT_USER_START(region_name);
}

inline void Tracing::regionEnd(const char* const region_name) {
VT_USER_END(region_name);
}
Loading