Skip to content

Commit 9d04d1d

Browse files
committed
GPU Config: Clean up header guards
1 parent b42533c commit 9d04d1d

8 files changed

Lines changed: 109 additions & 85 deletions

File tree

‎GPU/GPUTracking/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ set(SRCS_DATATYPES DataTypes/GPUDataTypesConfig.cxx DataTypes/GPUConfigDump.cxx
6969

7070
set(HDRS_CINT_O2 Merger/GPUTPCGMTrackParam.h Merger/GPUTPCGMMergedTrack.h Merger/GPUTPCGMSectorTrack.h Merger/GPUTPCGMBorderTrack.h TRDTracking/GPUTRDInterfaces.h)
7171
set(HDRS_CINT_DATATYPES DataTypes/GPUTPCGMMergedTrackHit.h)
72-
set(HDRS_CINT_O2_ADDITIONAL DataTypes/GPUSettings.h Definitions/GPUSettingsList.h DataTypes/GPUDataTypesIO.h DataTypes/GPUDataTypesConfig.h DataTypes/GPUDataTypesQA.h DataTypes/GPUTRDTrack.h DataTypes/GPUTRDRecoParam.h DataTypes/CalibdEdxTrackTopologyPol.h DataTypes/CalibdEdxTrackTopologySpline.h) # Manual dependencies for ROOT dictionary generation
72+
set(HDRS_CINT_O2_ADDITIONAL DataTypes/GPUSettings.h DataTypes/GPUSettingsTypes.h Definitions/GPUSettingsList.h DataTypes/GPUDataTypesIO.h DataTypes/GPUDataTypesConfig.h DataTypes/GPUDataTypesQA.h DataTypes/GPUTRDTrack.h DataTypes/GPUTRDRecoParam.h DataTypes/CalibdEdxTrackTopologyPol.h DataTypes/CalibdEdxTrackTopologySpline.h) # Manual dependencies for ROOT dictionary generation
7373

7474
set(SRCS_NO_CINT
7575
DataTypes/GPUMemorySizeScalers.cxx

‎GPU/GPUTracking/DataTypes/GPUSettings.h‎

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,7 @@
1616
#define GPUSETTINGS_H
1717

1818
#include "GPUCommonDef.h"
19-
#include "GPUDataTypesConfig.h"
20-
#include "GPUTPCGMMergedTrackHit.h"
21-
#ifndef GPUCA_GPUCODE_DEVICE
22-
#include <vector>
23-
#include <string>
24-
#endif
25-
26-
namespace o2::gpu
27-
{
28-
class GPUDisplayFrontendInterface;
29-
class GPUReconstruction;
30-
31-
class GPUSettings
32-
{
33-
public:
34-
enum CompressionModes { CompressionTruncate = 1,
35-
CompressionDifferences = 2,
36-
CompressionTrackModel = 4,
37-
CompressionFull = 7 };
38-
enum CompressionSort { SortTime = 0,
39-
SortPad = 1,
40-
SortZTimePad = 2,
41-
SortZPadTime = 3,
42-
SortNoSort = 4 };
43-
enum CompressionRejection { RejectionNone = 0,
44-
RejectionStrategyA = 1,
45-
RejectionStrategyB = 2 };
46-
47-
static GPUglobalconstexpr() const uint32_t TPC_MAX_TF_TIME_BIN = ((256 * 3564 + 2 * 8 - 2) / 8);
48-
};
49-
50-
// Settings describing the global run parameters
51-
struct GPUSettingsGRP {
52-
// All new members must be sizeof(int32_t) resp. sizeof(float) for alignment reasons!, default value for newly added members for old data will be 0.
53-
float solenoidBzNominalGPU = -5.00668f; // solenoid field strength
54-
int32_t constBz = 0; // for test-MC events with constant Bz
55-
int32_t removed0 = 0; // Obsolete parameter, dummy value needed to support reading old dumps
56-
int32_t grpContinuousMaxTimeBin = -2; // 0 for triggered events, -1 for automatic setting, -2 invalid default
57-
int32_t needsClusterer = 0; // Set to true if the data requires the clusterizer
58-
int32_t doCompClusterDecode = 0; // Set to true if the data contains compressed TPC clusters
59-
int32_t tpcCutTimeBin = 0; // Cut TPC clusters and digits >= this cut
60-
};
61-
62-
// Parameters of the current time frame
63-
struct GPUSettingsTF {
64-
int32_t hasTfStartOrbit = 0;
65-
int32_t tfStartOrbit = 0;
66-
int32_t hasRunStartOrbit = 0;
67-
int32_t runStartOrbit = 0;
68-
int32_t hasSimStartOrbit = 0;
69-
int32_t simStartOrbit = 0;
70-
int32_t hasNHBFPerTF = 0;
71-
int32_t nHBFPerTF = 0;
72-
};
73-
74-
// Settings defining the setup of the GPUReconstruction processing (basically selecting the device / class instance)
75-
struct GPUSettingsDeviceBackend {
76-
uint32_t deviceType = gpudatatypes::DeviceType::CPU; // Device type, shall use gpudatatypes::DEVICE_TYPE constants, e.g. CPU / CUDA
77-
uint8_t forceDeviceType = 1; // Fail if device initialization fails, otherwise falls back to CPU
78-
GPUReconstruction* master = nullptr; // GPUReconstruction master object
79-
};
80-
81-
} // namespace o2::gpu
19+
#include "GPUSettingsTypes.h"
8220

8321
#ifdef GPUCA_GPUCODE_DEVICE
8422
#define QCONFIG_GPU
@@ -88,4 +26,4 @@ struct GPUSettingsDeviceBackend {
8826
#include "utils/qconfig.h"
8927
#endif
9028

91-
#endif
29+
#endif // GPUSETTINGS_H
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file GPUSettingsTypes.h
13+
/// \author David Rohr
14+
15+
#ifndef GPUSETTINGSTYPES_H
16+
#define GPUSETTINGSTYPES_H
17+
18+
#include "GPUCommonDef.h"
19+
#include "GPUDataTypesConfig.h"
20+
#include "GPUTPCGMMergedTrackHit.h"
21+
#ifndef GPUCA_GPUCODE_DEVICE
22+
#include <vector>
23+
#include <string>
24+
#endif
25+
26+
namespace o2::gpu
27+
{
28+
class GPUDisplayFrontendInterface;
29+
class GPUReconstruction;
30+
31+
class GPUSettings
32+
{
33+
public:
34+
enum CompressionModes { CompressionTruncate = 1,
35+
CompressionDifferences = 2,
36+
CompressionTrackModel = 4,
37+
CompressionFull = 7 };
38+
enum CompressionSort { SortTime = 0,
39+
SortPad = 1,
40+
SortZTimePad = 2,
41+
SortZPadTime = 3,
42+
SortNoSort = 4 };
43+
enum CompressionRejection { RejectionNone = 0,
44+
RejectionStrategyA = 1,
45+
RejectionStrategyB = 2 };
46+
47+
static GPUglobalconstexpr() const uint32_t TPC_MAX_TF_TIME_BIN = ((256 * 3564 + 2 * 8 - 2) / 8);
48+
};
49+
50+
// Settings describing the global run parameters
51+
struct GPUSettingsGRP {
52+
// All new members must be sizeof(int32_t) resp. sizeof(float) for alignment reasons!, default value for newly added members for old data will be 0.
53+
float solenoidBzNominalGPU = -5.00668f; // solenoid field strength
54+
int32_t constBz = 0; // for test-MC events with constant Bz
55+
int32_t removed0 = 0; // Obsolete parameter, dummy value needed to support reading old dumps
56+
int32_t grpContinuousMaxTimeBin = -2; // 0 for triggered events, -1 for automatic setting, -2 invalid default
57+
int32_t needsClusterer = 0; // Set to true if the data requires the clusterizer
58+
int32_t doCompClusterDecode = 0; // Set to true if the data contains compressed TPC clusters
59+
int32_t tpcCutTimeBin = 0; // Cut TPC clusters and digits >= this cut
60+
};
61+
62+
// Parameters of the current time frame
63+
struct GPUSettingsTF {
64+
int32_t hasTfStartOrbit = 0;
65+
int32_t tfStartOrbit = 0;
66+
int32_t hasRunStartOrbit = 0;
67+
int32_t runStartOrbit = 0;
68+
int32_t hasSimStartOrbit = 0;
69+
int32_t simStartOrbit = 0;
70+
int32_t hasNHBFPerTF = 0;
71+
int32_t nHBFPerTF = 0;
72+
};
73+
74+
// Settings defining the setup of the GPUReconstruction processing (basically selecting the device / class instance)
75+
struct GPUSettingsDeviceBackend {
76+
uint32_t deviceType = gpudatatypes::DeviceType::CPU; // Device type, shall use gpudatatypes::DEVICE_TYPE constants, e.g. CPU / CUDA
77+
uint8_t forceDeviceType = 1; // Fail if device initialization fails, otherwise falls back to CPU
78+
GPUReconstruction* master = nullptr; // GPUReconstruction master object
79+
};
80+
81+
} // namespace o2::gpu
82+
83+
#endif // GPUSETTINGSTYPES_H

‎GPU/GPUTracking/Definitions/GPUSettingsList.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
// Create static constexpr with default values for GPU run time compilation
2121

2222
#ifdef BeginConfig // File should not be included without defining the macros, but rootcling will do for dictionary generation
23-
#ifndef GPUSETTINGS_H
24-
#error Please include GPUSettings.h!
25-
#endif
2623

2724
// clang-format off
2825

‎GPU/GPUTracking/qconfigoptions.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@
1212
/// \file qconfigoptions.h
1313
/// \author David Rohr
1414

15-
#include "GPUSettings.h" // Usually we are included from GPUSettings.h, so this doesn't do anything.
16-
// But ROOT or qconfig.cpp will include us directly, so load the settings first.
15+
#ifndef QCONFIG_INTERNAL
16+
#include "GPUSettingsTypes.h"
17+
#endif
1718

1819
// clang-format off
1920
BeginNamespace(o2::gpu)
21+
#if !defined(QCONFIGOPTIONS_H_LIST) || defined(QCONFIG_INTERNAL)
22+
#define QCONFIGOPTIONS_H_LIST
2023
#include "GPUSettingsList.h"
24+
#endif
25+
26+
#if !defined(QCONFIGOPTIONS_H_PARAM) || defined(QCONFIG_INTERNAL)
27+
#define QCONFIGOPTIONS_H_PARAM
2128
#include "GPUSettingsParam.h"
29+
#endif
2230
EndNamespace() // o2::gpu

‎GPU/GPUTracking/utils/qconfig.h‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@
1313
/// \author David Rohr
1414

1515
#include "qconfig_general.h"
16-
17-
#if !defined(QCONFIG_HEADER_GUARD_NO_INCLUDE) || defined(QCONFIG_GENRTC)
18-
19-
#if defined(QCONFIG_HEADER_GUARD) && !defined(QCONFIG_GENRTC)
20-
#define QCONFIG_HEADER_GUARD_NO_INCLUDE
21-
#else
22-
#define QCONFIG_HEADER_GUARD
16+
#define QCONFIG_H
2317

2418
#ifndef BeginNamespace
2519
#define BeginNamespace(name) \
@@ -66,8 +60,4 @@
6660
};
6761
// clang-format on
6862

69-
#endif
70-
7163
#include "qconfig_wrapinclude.h"
72-
73-
#endif // QCONFIG_HEADER_GUARD_NO_INCLUDE

‎GPU/GPUTracking/utils/qconfig_internal.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,6 @@ void qConfigPrint(const T& qconfig_tmp_object, const std::string& blockName); //
292292

293293
#endif
294294

295+
#define QCONFIG_INTERNAL
295296
#include "qconfig_wrapinclude.h"
297+
#undef QCONFIG_INTERNAL

‎GPU/GPUTracking/utils/qconfig_wrapinclude.h‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
/// \file qconfig_wrapinclude.h
1313
/// \author David Rohr
1414

15-
#ifndef QCONFIG_HEADER_GUARD_NO_INCLUDE
15+
#ifndef QCONFIG_H
16+
#error Must include qconfig.h before using qconfig_internal.h, etc...
17+
#endif
18+
1619
#ifndef AddHelp
1720
#define AddHelp(cmd, cmdshort)
1821
#endif
@@ -53,6 +56,10 @@
5356
#define BeginHiddenConfig(name, instance) BeginSubConfig(name, instance, , , , )
5457
#endif
5558

59+
#ifdef QCONFIG_GENRTC
60+
#define QCONFIG_INTERNAL
61+
#endif
62+
5663
#include "qconfigoptions.h"
5764

5865
#undef AddOption
@@ -79,7 +86,6 @@
7986
#ifdef QCONFIG_COMPARE
8087
#undef QCONFIG_COMPARE
8188
#endif
82-
83-
#else
84-
#undef QCONFIG_HEADER_GUARD_NO_INCLUDE
89+
#ifdef QCONFIG_INTERNAL
90+
#undef QCONFIG_INTERNAL
8591
#endif

0 commit comments

Comments
 (0)