Skip to content

Commit 24d3e04

Browse files
authored
DPL: move GUI to a plugin (#5099)
This moves the whole GUI implementation to an on demand plugin which will be loaded only if we are not in batch mode. This will both save memory (30MB PSS, in my tests) and speedup startup when running in batch mode.
1 parent 809fcfa commit 24d3e04

31 files changed

+235
-142
lines changed

Framework/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ add_subdirectory(Utils)
1818

1919
add_subdirectory(AnalysisSupport)
2020

21+
add_subdirectory(GUISupport)
22+
2123
add_subdirectory(TestWorkflows)

Framework/Core/CMakeLists.txt

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@
88
# granted to it by virtue of its status as an Intergovernmental Organization or
99
# submit itself to any jurisdiction.
1010

11-
if (TARGET AliceO2::DebugGUI)
12-
set(GUI_SOURCES src/FrameworkGUIDebugger.cxx src/FrameworkGUIDevicesGraph.cxx
13-
src/FrameworkGUIDeviceInspector.cxx
14-
src/FrameworkGUIDataRelayerUsage.cxx src/PaletteHelpers.cxx)
15-
set(DEBUGGUI_TARGET AliceO2::DebugGUI)
16-
else()
17-
set(GUI_SOURCES src/FrameworkDummyDebugger.cxx)
18-
endif()
19-
2011
# Given GCC 7.3 does not provide std::filesystem we use Boost instead
2112
# Drop this once we move to GCC 8.2+
2213
# if (NOT __APPLE__)
@@ -26,7 +17,6 @@ endif()
2617
o2_add_library(Framework
2718
SOURCES src/AODReaderHelpers.cxx
2819
src/ASoA.cxx
29-
${GUI_SOURCES}
3020
src/AnalysisHelpers.cxx
3121
src/AnalysisDataModelHelpers.cxx
3222
src/BoostOptionsRetriever.cxx
@@ -108,8 +98,7 @@ o2_add_library(Framework
10898
src/StepTHn.cxx
10999
test/TestClasses.cxx
110100
PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src
111-
PUBLIC_LINK_LIBRARIES ${DEBUGGUI_TARGET}
112-
AliceO2::Common
101+
PUBLIC_LINK_LIBRARIES AliceO2::Common
113102
AliceO2::Configuration
114103
AliceO2::InfoLogger
115104
AliceO2::Monitoring
@@ -257,16 +246,6 @@ endforeach()
257246

258247
# #####################################################@
259248

260-
if (TARGET AliceO2::DebugGUI)
261-
if (NOT APPLE)
262-
set (DEBUG_GUI_TESTS_WORKFLOW
263-
CustomGUIGL
264-
CustomGUISokol
265-
SimpleTracksED
266-
)
267-
endif()
268-
endif()
269-
270249
foreach(w
271250
BoostSerializedProcessing
272251
CallbackService
@@ -288,7 +267,6 @@ foreach(w
288267
SingleDataSource
289268
Task
290269
ExternalFairMQDeviceWorkflow
291-
${DEBUG_GUI_TESTS_WORKFLOW}
292270
)
293271
o2_add_test(${w} NAME test_Framework_test_${w}
294272
SOURCES test/test_${w}.cxx
@@ -304,18 +282,6 @@ endforeach()
304282
# part. [WARN] Incoming data is already obsolete, not relaying.
305283
set_property(TEST test_Framework_test_DanglingInputs PROPERTY DISABLED TRUE)
306284

307-
if (TARGET AliceO2::DebugGUI)
308-
# TODO: investigate the problem with the two unit tests, maybe setup of the CI
309-
# environment assertion fired X11: The DISPLAY environment variable is missing
310-
# glfw-3.2.1/src/window.c:579: glfwGetFramebufferSize: Assertion `window !=
311-
# ((void *)0)' failed.
312-
if(NOT APPLE)
313-
set_property(TEST test_Framework_test_SimpleTracksED PROPERTY DISABLED TRUE)
314-
set_property(TEST test_Framework_test_CustomGUIGL PROPERTY DISABLED TRUE)
315-
set_property(TEST test_Framework_test_CustomGUISokol PROPERTY DISABLED TRUE)
316-
endif()
317-
endif()
318-
319285
# TODO: investigate the problem and re-enable
320286
set_property(TEST test_Framework_test_BoostSerializedProcessing
321287
PROPERTY DISABLED TRUE)
File renamed without changes.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
#ifndef O2_FRAMEWORK_DEBUGUIINTERFACE_H_
11+
#define O2_FRAMEWORK_DEBUGUIINTERFACE_H_
12+
13+
#include "Framework/DeviceInfo.h"
14+
#include "Framework/DeviceSpec.h"
15+
#include "Framework/DeviceControl.h"
16+
#include "Framework/DataProcessorInfo.h"
17+
#include "Framework/DeviceMetricsInfo.h"
18+
#include "Framework/DriverInfo.h"
19+
#include "Framework/DriverControl.h"
20+
21+
#include <functional>
22+
#include <vector>
23+
24+
namespace o2::framework
25+
{
26+
/// Plugin interface for DPL GUIs.
27+
struct DebugGUI {
28+
virtual std::function<void(void)> getGUIDebugger(std::vector<o2::framework::DeviceInfo> const& infos,
29+
std::vector<o2::framework::DeviceSpec> const& devices,
30+
std::vector<o2::framework::DataProcessorInfo> const& metadata,
31+
std::vector<o2::framework::DeviceMetricsInfo> const& metricsInfos,
32+
o2::framework::DriverInfo const& driverInfo,
33+
std::vector<o2::framework::DeviceControl>& controls,
34+
o2::framework::DriverControl& driverControl) = 0;
35+
virtual void* initGUI(char const* windowTitle) = 0;
36+
virtual bool pollGUI(void* context, std::function<void(void)> guiCallback) = 0;
37+
virtual void disposeGUI() = 0;
38+
};
39+
} // namespace o2::framework
40+
#endif // O2_FRAMEWORK_DEBUGUIINTERFACE_H_

Framework/Core/src/DriverControl.h renamed to Framework/Core/include/Framework/DriverControl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <functional>
1414
#include <vector>
1515

16-
#include "DriverInfo.h"
16+
#include "Framework/DriverInfo.h"
1717
#include "Framework/DataProcessorSpec.h"
1818
#include "Framework/DeviceSpec.h"
1919
#include "Framework/DeviceExecution.h"
File renamed without changes.

Framework/Core/include/Framework/Plugins.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ namespace o2::framework
1919
enum struct DplPluginKind : int {
2020
// A plugin which can customise the workflow. Needs to return
2121
// an object of kind o2::framework::WorkflowCustomizationService
22-
CustomAlgorithm
22+
CustomAlgorithm,
23+
// A plugin which implements a ImGUI GUI. Needs to return an
24+
// object of the kind o2::framework::DebugGUIImpl
25+
DebugGUIImpl
2326
};
2427

2528
} // namespace o2::framework

Framework/Core/src/DeviceSpecHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include "Framework/AlgorithmSpec.h"
2323
#include "Framework/ConfigParamSpec.h"
2424
#include "Framework/OutputRoute.h"
25+
#include "Framework/DataProcessorInfo.h"
2526
#include "ResourceManager.h"
26-
#include "DataProcessorInfo.h"
2727
#include "WorkflowHelpers.h"
2828
#include <boost/program_options.hpp>
2929

Framework/Core/src/DriverControl.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
// In applying this license CERN does not waive the privileges and immunities
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
10-
#include "DriverControl.h"
10+
#include "Framework/DriverControl.h"

Framework/Core/src/DriverInfo.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
// In applying this license CERN does not waive the privileges and immunities
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
10-
#include "DriverInfo.h"
10+
#include "Framework/DriverInfo.h"

0 commit comments

Comments
 (0)