Skip to content

Commit e096e6d

Browse files
committed
Add check to autoenable GPU Standalone QA and Event display (needs Linux, GLEW, GLFW))
1 parent 47b780b commit e096e6d

9 files changed

Lines changed: 37 additions & 43 deletions

File tree

Detectors/TPC/reconstruction/test/testTPCCATracking.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(CATracking_test1)
5353
config.configProcessing.forceDeviceType = true;
5454

5555
config.configDeviceProcessing.nThreads = 4; //4 threads if we run on the CPU, 1 = default, 0 = auto-detect
56-
config.configDeviceProcessing.runQA = true; //Run QA after tracking
56+
config.configDeviceProcessing.runQA = false; //Run QA after tracking
5757
config.configDeviceProcessing.eventDisplay = nullptr; //Ptr to event display backend, for running standalone OpenGL event display
5858
//config.configDeviceProcessing.eventDisplay = new GPUDisplayBackendGlfw;
5959

Detectors/TPC/workflow/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set(SRCS
2222
src/TrackReaderSpec.cxx
2323
)
2424

25-
if (GPUCA_EVENT_DISPLAY)
25+
if (OPENGL_FOUND AND GLFW_FOUND AND GLEW_FOUND AND OPENGL_GLU_FOUND AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2626
add_definitions(-DBUILD_EVENT_DISPLAY)
2727
endif()
2828

GPU/GPUTracking/Base/GPUReconstructionCPU.cxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#include "GPUMemoryResource.h"
3434
#include "GPUConstantMem.h"
3535

36-
#include "GPUQA.h"
37-
#include "GPUDisplay.h"
38-
3936
#define GPUCA_LOGGING_PRINTF
4037
#include "GPULogging.h"
4138

GPU/GPUTracking/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ endif()
66

77
if(ALIGPU_BUILD_TYPE STREQUAL "O2")
88
set(DEFINITIONS ${DEFINITIONS} GPUCA_O2_LIB GPUCA_TPC_GEOMETRY_O2 HAVE_O2HEADERS)
9+
if (OPENGL_FOUND AND GLFW_FOUND AND GLEW_FOUND AND OPENGL_GLU_FOUND AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
10+
set(GPUCA_EVENT_DISPLAY ON)
11+
endif()
12+
set(GPUCA_QA ON)
913
endif()
1014

1115
if(OpenMP_CXX_FOUND)
@@ -317,6 +321,6 @@ if(ALIGPU_BUILD_TYPE STREQUAL "O2")
317321
target_link_libraries(${MODULE} OpenMP::OpenMP_CXX)
318322
endif()
319323
if (GPUCA_EVENT_DISPLAY)
320-
target_link_libraries(${MODULE} -lGL -lGLU -lGLEW)
324+
target_link_libraries(${MODULE} ${GLEW_LIBRARIES} ${GLFW_LIBRARIES} OpenGL::GL OpenGL::GLU)
321325
endif()
322326
endif()

GPU/GPUTracking/Interface/GPUO2Interface.cxx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@
2424

2525
using namespace o2::gpu;
2626

27-
#ifdef BUILD_EVENT_DISPLAY
28-
#include "GPUDisplayBackendGlfw.h"
29-
#else
30-
#include "GPUDisplayBackend.h"
31-
namespace GPUCA_NAMESPACE
32-
{
33-
namespace gpu
34-
{
35-
class GPUDisplayBackendGlfw : public GPUDisplayBackend
36-
{
37-
};
38-
} // namespace gpu
39-
} // namespace GPUCA_NAMESPACE
40-
#endif
41-
4227
#include "DataFormatsTPC/ClusterNative.h"
4328
#include "ClusterNativeAccessExt.h"
4429

GPU/GPUTracking/Standalone/display/GPUDisplay.cpp

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
/// \file GPUDisplay.cpp
1212
/// \author David Rohr
1313

14-
//#ifdef GPUCA_O2_LIB
15-
//#include "../src/GL/gl3w.h"
16-
//#else
17-
#include <GL/glew.h>
18-
//#endif
19-
2014
#include "GPUDisplay.h"
2115
#include "GPUTPCDef.h"
2216

@@ -53,10 +47,6 @@
5347

5448
using namespace GPUCA_NAMESPACE::gpu;
5549

56-
#if !defined(GL_VERSION_4_5) || GL_VERSION_4_5 != 1
57-
#error Unsupported OpenGL version < 4.5
58-
#endif
59-
6050
//#define CHKERR(cmd) {cmd;}
6151
#define CHKERR(cmd) \
6252
do { \
@@ -158,17 +148,17 @@ void GPUDisplay::calcXYZ()
158148
createQuaternionFromMatrix(mQuat, mCurrentMatrix);
159149

160150
/*float mAngle[1] = -asinf(mCurrentMatrix[2]); //Calculate Y-axis angle - for rotX*rotY*rotZ
161-
float C = cosf( angle_y );
162-
if (fabsf(C) > 0.005) //Gimball lock?
163-
{
164-
mAngle[0] = atan2f(-mCurrentMatrix[6] / C, mCurrentMatrix[10] / C);
165-
mAngle[2] = atan2f(-mCurrentMatrix[1] / C, mCurrentMatrix[0] / C);
166-
}
167-
else
168-
{
169-
mAngle[0] = 0; //set x-angle
170-
mAngle[2] = atan2f(mCurrentMatrix[4], mCurrentMatrix[5]);
171-
}*/
151+
float C = cosf( angle_y );
152+
if (fabsf(C) > 0.005) //Gimball lock?
153+
{
154+
mAngle[0] = atan2f(-mCurrentMatrix[6] / C, mCurrentMatrix[10] / C);
155+
mAngle[2] = atan2f(-mCurrentMatrix[1] / C, mCurrentMatrix[0] / C);
156+
}
157+
else
158+
{
159+
mAngle[0] = 0; //set x-angle
160+
mAngle[2] = atan2f(mCurrentMatrix[4], mCurrentMatrix[5]);
161+
}*/
172162
}
173163

174164
void GPUDisplay::SetCollisionFirstCluster(unsigned int collision, int slice, int cluster)

GPU/GPUTracking/Standalone/display/GPUDisplay.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
#ifndef GPUDISPLAY_H
1515
#define GPUDISPLAY_H
1616

17+
#ifdef BUILD_EVENT_DISPLAY
18+
//#ifdef GPUCA_O2_LIB
19+
//#include "../src/GL/gl3w.h"
20+
//#else
21+
#include <GL/glew.h>
22+
//#endif
23+
24+
#if !defined(GL_VERSION_4_5) || GL_VERSION_4_5 != 1
25+
#ifdef GPUCA_STANDALONE
26+
#error Unsupported OpenGL version < 4.5
27+
#else
28+
#warning Unsupported OpenGL version < 4.5, disabling standalone event display
29+
#endif
30+
#endif
31+
#endif
32+
1733
#include "GPUDisplayConfig.h"
1834
#include "GPUDisplayBackend.h"
1935

GPU/GPUTracking/Standalone/display/GPUDisplayBackendNone.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#ifndef GPUDISPLAYBACKENDNONE_H
1515
#define GPUDISPLAYBACKENDNONE_H
1616

17-
#include "GPUDisplay.h"
17+
#include "GPUDisplayBackend.h"
1818

1919
namespace GPUCA_NAMESPACE
2020
{

cmake/O2Dependencies.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ find_package(Monitoring REQUIRED)
6565
find_package(Common REQUIRED)
6666
find_package(RapidJSON REQUIRED)
6767
find_package(GLFW)
68+
find_package(GLEW)
69+
find_package(OpenGL)
6870
find_package(benchmark QUIET)
6971
find_package(Arrow)
7072
find_package(CURL REQUIRED)

0 commit comments

Comments
 (0)