Project
Loading...
Searching...
No Matches
GPUChainTrackingDebug.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 GPUCHAINTRACKINGDEBUG_H
16#define GPUCHAINTRACKINGDEBUG_H
17
18#include <cstdint>
19#include <functional>
20#include <fstream>
21
22namespace o2::gpu
23{
24// NOTE: Values below 262144 are activated by default with --debug 6 in GPUSettingsList.h::debugMask
51
52template <class T, class S, typename... Args>
53inline bool GPUChain::DoDebugAndDump(GPUChain::RecoStep step, uint32_t mask, bool transfer, T& processor, S T::*func, Args&&... args)
54{
55 if (GetProcessingSettings().keepAllMemory) {
56 if (transfer) {
57 TransferMemoryResourcesToHost(step, &processor, -1, true);
58 }
59 std::function<void(Args && ...)> lambda = [&processor, &func](Args&... args_tmp) {
60 if (func) {
61 (processor.*func)(args_tmp...);
62 }
63 };
64 return DoDebugDump(mask, lambda, args...);
65 }
66 return false;
67}
68
69template <typename... Args>
70inline bool GPUChain::DoDebugDump(uint32_t mask, std::function<void(Args&...)> func, Args&... args)
71{
72 if (GetProcessingSettings().debugLevel >= 6 && (mask == 0 || (GetProcessingSettings().debugMask & mask))) {
73 func(args...);
74 return true;
75 }
76 return false;
77}
78
79} // namespace o2::gpu
80
81#endif
bool DoDebugAndDump(RecoStep step, uint32_t mask, T &processor, S T::*func, Args &&... args)
Definition GPUChain.h:239
bool DoDebugDump(uint32_t mask, std::function< void(Args &...)> func, Args &... args)
const GPUSettingsProcessing & GetProcessingSettings() const
Definition GPUChain.h:76
void TransferMemoryResourcesToHost(RecoStep step, GPUProcessor *proc, int32_t stream=-1, bool all=false)
Definition GPUChain.h:123
GLenum func
Definition glcorearb.h:778
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLint GLuint mask
Definition glcorearb.h:291