forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 3
/
GPUO2InterfaceConfiguration.h
147 lines (129 loc) · 5.56 KB
/
GPUO2InterfaceConfiguration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// 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.
/// \file GPUO2InterfaceConfiguration.h
/// \author David Rohr
#ifndef GPUO2INTERFACECONFIGURATION_H
#define GPUO2INTERFACECONFIGURATION_H
#ifndef HAVE_O2HEADERS
#define HAVE_O2HEADERS
#endif
#ifndef GPUCA_TPC_GEOMETRY_O2
#define GPUCA_TPC_GEOMETRY_O2
#endif
#ifndef GPUCA_O2_INTERFACE
#define GPUCA_O2_INTERFACE
#endif
#include <memory>
#include <array>
#include <vector>
#include <functional>
#include <gsl/gsl>
#include "GPUSettings.h"
#include "GPUDataTypes.h"
#include "GPUHostDataTypes.h"
#include "DataFormatsTPC/Constants.h"
class TH1F;
class TH1D;
class TH2F;
namespace o2
{
namespace tpc
{
class TrackTPC;
class Digit;
}
namespace gpu
{
class TPCFastTransform;
struct GPUSettingsO2;
// This defines an output region. Ptr points to a memory buffer, which should have a proper alignment.
// Since DPL does not respect the alignment of data types, we do not impose anything specic but just use a char data type, but it should be >= 64 bytes ideally.
// The size defines the maximum possible buffer size when GPUReconstruction is called, and returns the number of filled bytes when it returns.
// If ptr == nullptr, there is no region defined and GPUReconstruction will write its output to an internal buffer.
// If allocator is set, it is called as a callback to provide a ptr to the memory.
struct GPUInterfaceOutputRegion {
void* ptr = nullptr;
size_t size = 0;
std::function<void*(size_t)> allocator = nullptr;
};
struct GPUInterfaceQAOutputs {
const std::vector<TH1F>* hist1;
const std::vector<TH2F>* hist2;
const std::vector<TH1D>* hist3;
};
struct GPUInterfaceOutputs {
GPUInterfaceOutputRegion compressedClusters;
GPUInterfaceOutputRegion clustersNative;
GPUInterfaceOutputRegion tpcTracks;
GPUInterfaceOutputRegion clusterLabels;
GPUInterfaceOutputRegion sharedClusterMap;
GPUInterfaceQAOutputs qa;
};
// Full configuration structure with all available settings of GPU...
struct GPUO2InterfaceConfiguration {
GPUO2InterfaceConfiguration() = default;
~GPUO2InterfaceConfiguration() = default;
GPUO2InterfaceConfiguration(const GPUO2InterfaceConfiguration&) = default;
// Settings for the Interface class
struct GPUInterfaceSettings {
int dumpEvents = 0;
bool outputToExternalBuffers = false;
bool dropSecondaryLegs = true;
float memoryBufferScaleFactor = 1.f;
// These constants affect GPU memory allocation only and do not limit the CPU processing
unsigned long maxTPCZS = 8192ul * 1024 * 1024;
unsigned int maxTPCHits = 1024 * 1024 * 1024;
unsigned int maxTRDTracklets = 128 * 1024;
unsigned int maxITSTracks = 96 * 1024;
};
GPUSettingsDeviceBackend configDeviceBackend;
GPUSettingsProcessing configProcessing;
GPUSettingsEvent configEvent;
GPUSettingsRec configReconstruction;
GPUSettingsDisplay configDisplay;
GPUSettingsQA configQA;
GPUInterfaceSettings configInterface;
GPURecoStepConfiguration configWorkflow;
GPUCalibObjects configCalib;
GPUSettingsO2 ReadConfigurableParam();
};
// Structure with pointers to actual data for input and output
// Which ptr is used for input and which for output is defined in GPUO2InterfaceConfiguration::configWorkflow
// Inputs and outputs are mutually exclusive.
// Inputs which are nullptr are considered empty, and will not throw an error.
// Outputs, which point to std::[container] / MCTruthContainer, will be filled and no output
// is written if the ptr is a nullptr.
// Outputs, which point to other structures are set by GPUCATracking to the location of the output. The previous
// value of the pointer is overridden. GPUCATracking will try to place the output in the "void* outputBuffer"
// location if it is not a nullptr.
struct GPUO2InterfaceIOPtrs {
// Input: TPC clusters in cluster native format, or digits, or list of ZS pages - const as it can only be input
const o2::tpc::ClusterNativeAccess* clusters = nullptr;
const std::array<gsl::span<const o2::tpc::Digit>, o2::tpc::constants::MAXSECTOR>* o2Digits = nullptr;
std::array<const o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel>*, o2::tpc::constants::MAXSECTOR>* o2DigitsMC = nullptr;
const o2::gpu::GPUTrackingInOutZS* tpcZS = nullptr;
// Input / Output for Merged TPC tracks, two ptrs, for the tracks themselves, and for the MC labels.
std::vector<o2::tpc::TrackTPC>* outputTracks = nullptr;
std::vector<uint32_t>* outputClusRefs = nullptr;
std::vector<o2::MCCompLabel>* outputTracksMCTruth = nullptr;
// Output for entropy-reduced clusters of TPC compression
const o2::tpc::CompressedClustersFlat* compressedClusters = nullptr;
// Hint for GPUCATracking to place its output in this buffer if possible.
// This enables to create the output directly in a shared memory segment of the framework.
// This allows further processing with zero-copy.
// So far this is only a hint, GPUCATracking will not always follow.
// If outputBuffer = nullptr, GPUCATracking will allocate the output internally and own the memory.
// TODO: Make this mandatory if outputBuffer != nullptr, and throw an error if outputBufferSize is too small.
void* outputBuffer = nullptr;
size_t outputBufferSize = 0;
};
} // namespace gpu
} // namespace o2
#endif