Project
Loading...
Searching...
No Matches
GPUO2Interface.h
Go to the documentation of this file.
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
14
15#ifndef GPUO2INTERFACE_H
16#define GPUO2INTERFACE_H
17
18#include "GPUO2ExternalUser.h"
19#include "GPUCommonDef.h"
20#include "GPUDataTypesIO.h"
21#include "GPUDataTypesConfig.h"
22
23#include <memory>
24#include <array>
25#include <vector>
26
27namespace o2::base
28{
29template <typename value_T>
30class PropagatorImpl;
31using Propagator = PropagatorImpl<float>;
32} // namespace o2::base
33namespace o2::tpc
34{
35struct ClusterNativeAccess;
36struct ClusterNative;
37} // namespace o2::tpc
38
39namespace o2::its
40{
41template <int>
42class TrackerTraits;
43template <int>
44class VertexerTraits;
45template <int>
46class TimeFrame;
47} // namespace o2::its
48
49namespace o2::gpu
50{
51class GPUReconstruction;
52class GPUChainTracking;
53class GPUChainITS;
54struct GPUO2InterfaceConfiguration;
55struct GPUInterfaceOutputs;
56struct GPUInterfaceInputUpdate;
57struct GPUTrackingOutputs;
58struct GPUConstantMem;
59struct GPUNewCalibValues;
60struct GPUSettingsProcessing;
61struct GPUSettingsRec;
62
63struct GPUO2Interface_processingContext;
64struct GPUO2Interface_Internals;
65
67{
68 public:
71
72 int32_t Initialize(const GPUO2InterfaceConfiguration& config);
73 void Deinitialize();
74
75 int32_t RunTracking(GPUTrackingInOutPointers* data, GPUInterfaceOutputs* outputs = nullptr, uint32_t iThread = 0, GPUInterfaceInputUpdate* inputUpdateCallback = nullptr);
76 void Clear(bool clearOutputs, uint32_t iThread = 0);
77 void DumpEvent(int32_t nEvent, GPUTrackingInOutPointers* data, uint32_t iThread, const char* dir = "");
78 void DumpSettings(uint32_t iThread, const char* dir = "");
79
80 void GetITSTraits(o2::its::TrackerTraits<7>*& trackerTraits, o2::its::VertexerTraits<7>*& vertexerTraits, o2::its::TimeFrame<7>*& timeFrame);
81 const o2::base::Propagator* GetDeviceO2Propagator(int32_t iThread = 0) const;
83
84 // Updates all calibration objects that are != nullptr in newCalib
85 int32_t UpdateCalibration(const GPUCalibObjectsConst& newCalib, const GPUNewCalibValues& newVals, uint32_t iThread = 0);
86 static void ApplySyncSettings(GPUSettingsProcessing& proc, GPUSettingsRec& rec, gpudatatypes::RecoStepField& steps, bool syncMode, int32_t dEdxMode = -2);
87
88 int32_t registerMemoryForGPU(const void* ptr, size_t size);
89 int32_t unregisterMemoryForGPU(const void* ptr);
90 void setErrorCodeOutput(std::vector<std::array<uint32_t, 4>>* v);
91
92 const GPUO2InterfaceConfiguration& getConfig() const { return *mConfig; }
93
94 private:
96 GPUO2Interface& operator=(const GPUO2Interface&);
97
98 bool mContinuous = false;
99
100 uint32_t mNContexts = 0;
101 std::unique_ptr<GPUO2Interface_processingContext[]> mCtx;
102
103 std::unique_ptr<GPUO2InterfaceConfiguration> mConfig;
104 GPUChainITS* mChainITS = nullptr;
105 std::unique_ptr<GPUO2Interface_Internals> mInternals;
106};
107} // namespace o2::gpu
108
109#endif
TBranch * ptr
int32_t unregisterMemoryForGPU(const void *ptr)
const o2::base::Propagator * GetDeviceO2Propagator(int32_t iThread=0) const
int32_t Initialize(const GPUO2InterfaceConfiguration &config)
void GetITSTraits(o2::its::TrackerTraits< 7 > *&trackerTraits, o2::its::VertexerTraits< 7 > *&vertexerTraits, o2::its::TimeFrame< 7 > *&timeFrame)
void DumpSettings(uint32_t iThread, const char *dir="")
void setErrorCodeOutput(std::vector< std::array< uint32_t, 4 > > *v)
void UseGPUPolynomialFieldInPropagator(o2::base::Propagator *prop) const
static void ApplySyncSettings(GPUSettingsProcessing &proc, GPUSettingsRec &rec, gpudatatypes::RecoStepField &steps, bool syncMode, int32_t dEdxMode=-2)
const GPUO2InterfaceConfiguration & getConfig() const
void DumpEvent(int32_t nEvent, GPUTrackingInOutPointers *data, uint32_t iThread, const char *dir="")
int32_t RunTracking(GPUTrackingInOutPointers *data, GPUInterfaceOutputs *outputs=nullptr, uint32_t iThread=0, GPUInterfaceInputUpdate *inputUpdateCallback=nullptr)
int32_t registerMemoryForGPU(const void *ptr, size_t size)
void Clear(bool clearOutputs, uint32_t iThread=0)
int32_t UpdateCalibration(const GPUCalibObjectsConst &newCalib, const GPUNewCalibValues &newVals, uint32_t iThread=0)
GLsizeiptr size
Definition glcorearb.h:659
const GLdouble * v
Definition glcorearb.h:832
GLboolean * data
Definition glcorearb.h:298
PropagatorF Propagator
Definition Propagator.h:223
Global TPC definitions and constants.
Definition SimTraits.h:168
GPUReconstruction * rec