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
50
51template <class T, class S, typename... Args>
52inline bool GPUChain::DoDebugAndDump(GPUChain::RecoStep step, uint32_t mask, bool transfer, T& processor, S T::*func, Args&&... args)
53{
54 if (GetProcessingSettings().keepAllMemory) {
55 if (transfer) {
56 TransferMemoryResourcesToHost(step, &processor, -1, true);
57 }
58 std::function<void(Args && ...)> lambda = [&processor, &func](Args&... args_tmp) {
59 if (func) {
60 (processor.*func)(args_tmp...);
61 }
62 };
63 return DoDebugDump(mask, lambda, args...);
64 }
65 return false;
66}
67
68template <typename... Args>
69inline bool GPUChain::DoDebugDump(uint32_t mask, std::function<void(Args&...)> func, Args&... args)
70{
71 if (GetProcessingSettings().debugLevel >= 6 && (mask == 0 || (GetProcessingSettings().debugMask & mask))) {
72 func(args...);
73 return true;
74 }
75 return false;
76}
77
78} // namespace o2::gpu
79
80#endif
bool DoDebugAndDump(RecoStep step, uint32_t mask, T &processor, S T::*func, Args &&... args)
Definition GPUChain.h:230
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