Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ add_subdirectory(Utils)

add_subdirectory(AnalysisSupport)

add_subdirectory(GUISupport)

add_subdirectory(TestWorkflows)
36 changes: 1 addition & 35 deletions Framework/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
# granted to it by virtue of its status as an Intergovernmental Organization or
# submit itself to any jurisdiction.

if (TARGET AliceO2::DebugGUI)
set(GUI_SOURCES src/FrameworkGUIDebugger.cxx src/FrameworkGUIDevicesGraph.cxx
src/FrameworkGUIDeviceInspector.cxx
src/FrameworkGUIDataRelayerUsage.cxx src/PaletteHelpers.cxx)
set(DEBUGGUI_TARGET AliceO2::DebugGUI)
else()
set(GUI_SOURCES src/FrameworkDummyDebugger.cxx)
endif()

# Given GCC 7.3 does not provide std::filesystem we use Boost instead
# Drop this once we move to GCC 8.2+
# if (NOT __APPLE__)
Expand All @@ -26,7 +17,6 @@ endif()
o2_add_library(Framework
SOURCES src/AODReaderHelpers.cxx
src/ASoA.cxx
${GUI_SOURCES}
src/AnalysisHelpers.cxx
src/AnalysisDataModelHelpers.cxx
src/BoostOptionsRetriever.cxx
Expand Down Expand Up @@ -108,8 +98,7 @@ o2_add_library(Framework
src/StepTHn.cxx
test/TestClasses.cxx
PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src
PUBLIC_LINK_LIBRARIES ${DEBUGGUI_TARGET}
AliceO2::Common
PUBLIC_LINK_LIBRARIES AliceO2::Common
AliceO2::Configuration
AliceO2::InfoLogger
AliceO2::Monitoring
Expand Down Expand Up @@ -257,16 +246,6 @@ endforeach()

# #####################################################@

if (TARGET AliceO2::DebugGUI)
if (NOT APPLE)
set (DEBUG_GUI_TESTS_WORKFLOW
CustomGUIGL
CustomGUISokol
SimpleTracksED
)
endif()
endif()

foreach(w
BoostSerializedProcessing
CallbackService
Expand All @@ -288,7 +267,6 @@ foreach(w
SingleDataSource
Task
ExternalFairMQDeviceWorkflow
${DEBUG_GUI_TESTS_WORKFLOW}
)
o2_add_test(${w} NAME test_Framework_test_${w}
SOURCES test/test_${w}.cxx
Expand All @@ -304,18 +282,6 @@ endforeach()
# part. [WARN] Incoming data is already obsolete, not relaying.
set_property(TEST test_Framework_test_DanglingInputs PROPERTY DISABLED TRUE)

if (TARGET AliceO2::DebugGUI)
# TODO: investigate the problem with the two unit tests, maybe setup of the CI
# environment assertion fired X11: The DISPLAY environment variable is missing
# glfw-3.2.1/src/window.c:579: glfwGetFramebufferSize: Assertion `window !=
# ((void *)0)' failed.
if(NOT APPLE)
set_property(TEST test_Framework_test_SimpleTracksED PROPERTY DISABLED TRUE)
set_property(TEST test_Framework_test_CustomGUIGL PROPERTY DISABLED TRUE)
set_property(TEST test_Framework_test_CustomGUISokol PROPERTY DISABLED TRUE)
endif()
endif()

# TODO: investigate the problem and re-enable
set_property(TEST test_Framework_test_BoostSerializedProcessing
PROPERTY DISABLED TRUE)
Expand Down
40 changes: 40 additions & 0 deletions Framework/Core/include/Framework/DebugGUI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef O2_FRAMEWORK_DEBUGUIINTERFACE_H_
#define O2_FRAMEWORK_DEBUGUIINTERFACE_H_

#include "Framework/DeviceInfo.h"
#include "Framework/DeviceSpec.h"
#include "Framework/DeviceControl.h"
#include "Framework/DataProcessorInfo.h"
#include "Framework/DeviceMetricsInfo.h"
#include "Framework/DriverInfo.h"
#include "Framework/DriverControl.h"

#include <functional>
#include <vector>

namespace o2::framework
{
/// Plugin interface for DPL GUIs.
struct DebugGUI {
virtual std::function<void(void)> getGUIDebugger(std::vector<o2::framework::DeviceInfo> const& infos,
std::vector<o2::framework::DeviceSpec> const& devices,
std::vector<o2::framework::DataProcessorInfo> const& metadata,
std::vector<o2::framework::DeviceMetricsInfo> const& metricsInfos,
o2::framework::DriverInfo const& driverInfo,
std::vector<o2::framework::DeviceControl>& controls,
o2::framework::DriverControl& driverControl) = 0;
virtual void* initGUI(char const* windowTitle) = 0;
virtual bool pollGUI(void* context, std::function<void(void)> guiCallback) = 0;
virtual void disposeGUI() = 0;
};
} // namespace o2::framework
#endif // O2_FRAMEWORK_DEBUGUIINTERFACE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <functional>
#include <vector>

#include "DriverInfo.h"
#include "Framework/DriverInfo.h"
#include "Framework/DataProcessorSpec.h"
#include "Framework/DeviceSpec.h"
#include "Framework/DeviceExecution.h"
Expand Down
5 changes: 4 additions & 1 deletion Framework/Core/include/Framework/Plugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ namespace o2::framework
enum struct DplPluginKind : int {
// A plugin which can customise the workflow. Needs to return
// an object of kind o2::framework::WorkflowCustomizationService
CustomAlgorithm
CustomAlgorithm,
// A plugin which implements a ImGUI GUI. Needs to return an
// object of the kind o2::framework::DebugGUIImpl
DebugGUIImpl
};

} // namespace o2::framework
Expand Down
2 changes: 1 addition & 1 deletion Framework/Core/src/DeviceSpecHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "Framework/AlgorithmSpec.h"
#include "Framework/ConfigParamSpec.h"
#include "Framework/OutputRoute.h"
#include "Framework/DataProcessorInfo.h"
#include "ResourceManager.h"
#include "DataProcessorInfo.h"
#include "WorkflowHelpers.h"
#include <boost/program_options.hpp>

Expand Down
2 changes: 1 addition & 1 deletion Framework/Core/src/DriverControl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "DriverControl.h"
#include "Framework/DriverControl.h"
2 changes: 1 addition & 1 deletion Framework/Core/src/DriverInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "DriverInfo.h"
#include "Framework/DriverInfo.h"
38 changes: 0 additions & 38 deletions Framework/Core/src/FrameworkDummyDebugger.cxx

This file was deleted.

2 changes: 1 addition & 1 deletion Framework/Core/src/WorkflowHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Framework/ForwardRoute.h"
#include "Framework/WorkflowSpec.h"
#include "Framework/DataOutputDirector.h"
#include "DataProcessorInfo.h"
#include "Framework/DataProcessorInfo.h"

#include <cstddef>
#include <vector>
Expand Down
9 changes: 3 additions & 6 deletions Framework/Core/src/WorkflowSerializationHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
#define O2_FRAMEWORK_CORE_WORKFLOWSERIALIZATIONHELPERS_H_

#include "Framework/DataProcessorSpec.h"
#include "DataProcessorInfo.h"
#include "Framework/DataProcessorInfo.h"

#include <iosfwd>
#include <vector>

namespace o2
{
namespace framework
namespace o2::framework
{

struct WorkflowSerializationHelpers {
Expand All @@ -30,7 +28,6 @@ struct WorkflowSerializationHelpers {
std::vector<DataProcessorInfo> const& metadata);
};

} // namespace framework
} // namespace o2
} // namespace o2::framework

#endif // O2_FRAMEWORK_CORE_WORKFLOWSERIALIZATIONHELPERS_H_
57 changes: 41 additions & 16 deletions Framework/Core/src/runDataProcessing.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,15 @@
#include "Framework/ConfigContext.h"
#include "Framework/DataProcessingDevice.h"
#include "Framework/DataProcessorSpec.h"
#if __has_include(<DebugGUI/DebugGUI.h>)
#include <DebugGUI/DebugGUI.h>
#else
// the DebugGUI is in a separate package and is optional for O2,
// we include a header implementing GUI interface dummy methods
#pragma message "Building DPL without Debug GUI"
#include "Framework/NoDebugGUI.h"
#endif
#include "Framework/Plugins.h"
#include "Framework/DeviceControl.h"
#include "Framework/DeviceExecution.h"
#include "Framework/DeviceInfo.h"
#include "Framework/DeviceMetricsInfo.h"
#include "Framework/DeviceConfigInfo.h"
#include "Framework/DeviceSpec.h"
#include "Framework/DeviceState.h"
#include "Framework/FrameworkGUIDebugger.h"
#include "Framework/DebugGUI.h"
#include "Framework/LocalRootFileService.h"
#include "Framework/LogParsingHelpers.h"
#include "Framework/Logger.h"
Expand All @@ -43,15 +36,15 @@
#include "Framework/CallbackService.h"
#include "Framework/WorkflowSpec.h"
#include "Framework/Monitoring.h"
#include "Framework/DataProcessorInfo.h"
#include "Framework/DriverInfo.h"
#include "Framework/DriverControl.h"

#include "ComputingResourceHelpers.h"
#include "DataProcessingStatus.h"
#include "DDSConfigHelpers.h"
#include "O2ControlHelpers.h"
#include "DeviceSpecHelpers.h"
#include "DriverControl.h"
#include "DriverInfo.h"
#include "DataProcessorInfo.h"
#include "GraphvizHelpers.h"
#include "PropertyTreeHelpers.h"
#include "SimpleResourceManager.h"
Expand Down Expand Up @@ -841,6 +834,7 @@ struct GuiCallbackContext {
uint64_t frameLast;
float* frameLatency;
float* frameCost;
DebugGUI* plugin;
void* window;
bool* guiQuitRequested;
std::function<void(void)> callback;
Expand All @@ -849,9 +843,12 @@ struct GuiCallbackContext {
void gui_callback(uv_timer_s* ctx)
{
GuiCallbackContext* gui = reinterpret_cast<GuiCallbackContext*>(ctx->data);
if (gui->plugin == nullptr) {
return;
}
uint64_t frameStart = uv_hrtime();
uint64_t frameLatency = frameStart - gui->frameLast;
*(gui->guiQuitRequested) = (pollGUI(gui->window, gui->callback) == false);
*(gui->guiQuitRequested) = (gui->plugin->pollGUI(gui->window, gui->callback) == false);
uint64_t frameEnd = uv_hrtime();
*(gui->frameCost) = (frameEnd - frameStart) / 1000000;
*(gui->frameLatency) = frameLatency / 1000000;
Expand Down Expand Up @@ -892,12 +889,39 @@ int runStateMachine(DataProcessorSpecs const& workflow,

auto resourceManager = std::make_unique<SimpleResourceManager>(resources);

DebugGUI* debugGUI = nullptr;
void* window = nullptr;
decltype(gui::getGUIDebugger(infos, deviceSpecs, dataProcessorInfos, metricsInfos, driverInfo, controls, driverControl)) debugGUICallback;
decltype(debugGUI->getGUIDebugger(infos, deviceSpecs, dataProcessorInfos, metricsInfos, driverInfo, controls, driverControl)) debugGUICallback;

// An empty frameworkId means this is the driver, so we initialise the GUI
if (driverInfo.batch == false && frameworkId.empty()) {
window = initGUI("O2 Framework debug GUI");
auto initDebugGUI = []() -> DebugGUI* {
uv_lib_t supportLib;
int result = 0;
#ifdef __APPLE__
result = uv_dlopen("libO2FrameworkGUISupport.dylib", &supportLib);
#else
result = uv_dlopen("libO2FrameworkGUISupport.so", &supportLib);
#endif
if (result == -1) {
LOG(ERROR) << uv_dlerror(&supportLib);
return nullptr;
}
void* callback = nullptr;
DPLPluginHandle* (*dpl_plugin_callback)(DPLPluginHandle*);

result = uv_dlsym(&supportLib, "dpl_plugin_callback", (void**)&dpl_plugin_callback);
if (result == -1) {
LOG(ERROR) << uv_dlerror(&supportLib);
return nullptr;
}
DPLPluginHandle* pluginInstance = dpl_plugin_callback(nullptr);
return PluginManager::getByName<DebugGUI>(pluginInstance, "ImGUIDebugGUI");
};
debugGUI = initDebugGUI();
if (debugGUI) {
window = debugGUI->initGUI("O2 Framework debug GUI");
}
}
if (driverInfo.batch == false && window == nullptr && frameworkId.empty()) {
LOG(WARN) << "Could not create GUI. Switching to batch mode. Do you have GLFW on your system?";
Expand All @@ -920,6 +944,7 @@ int runStateMachine(DataProcessorSpecs const& workflow,
}

GuiCallbackContext guiContext;
guiContext.plugin = debugGUI;
guiContext.frameLast = uv_hrtime();
guiContext.frameLatency = &driverInfo.frameLatency;
guiContext.frameCost = &driverInfo.frameCost;
Expand Down Expand Up @@ -1125,7 +1150,7 @@ int runStateMachine(DataProcessorSpecs const& workflow,
// because getGUIDebugger actually recreates the GUI state.
if (window) {
uv_timer_stop(&gui_timer);
guiContext.callback = gui::getGUIDebugger(infos, deviceSpecs, dataProcessorInfos, metricsInfos, driverInfo, controls, driverControl);
guiContext.callback = debugGUI->getGUIDebugger(infos, deviceSpecs, dataProcessorInfos, metricsInfos, driverInfo, controls, driverControl);
guiContext.window = window;
gui_timer.data = &guiContext;
uv_timer_start(&gui_timer, gui_callback, 0, 20);
Expand Down
Loading