Project
Loading...
Searching...
No Matches
GPUKernelDebugOutput.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 O2_GPU_KERNELDEBUGOUTPUT_H
16#define O2_GPU_KERNELDEBUGOUTPUT_H
17
18#include "GPUDef.h"
19#include "GPUProcessor.h"
20#ifdef GPUCA_KERNEL_DEBUGGER_OUTPUT
21
22namespace o2::gpu
23{
24
25class GPUKernelDebugOutput : public GPUProcessor
26{
27 public:
28#ifndef GPUCA_GPUCODE
29 void InitializeProcessor();
30 void RegisterMemoryAllocation();
31 void SetMaxData(const GPUTrackingInOutPointers& io);
32
33 void* SetPointersMemory(void* mem);
34
35 void Print()
36 {
37 printf("------ Kernel Debug Output\n");
38 for (int32_t i = 0; i < 100 * 1024; i++) {
39 int32_t* pos = mDebugOutMemory + i * 1024;
40 int32_t count = *(pos++);
41 if (count) {
42 printf("Thread %d: ", i);
43 for (int32_t j = 0; j < count; j++) {
44 printf("%d, ", pos[j]);
45 }
46 printf("\n");
47 }
48 }
49 printf("------ End of Kernel Debug Output\n");
50 }
51#endif
52 GPUdi() int32_t* memory()
53 {
54 return mDebugOutMemory;
55 }
56 GPUdi() static size_t memorySize() { return 100 * 1024 * 1024; }
57
58 GPUd() void Add(uint32_t id, int32_t val) const
59 {
60 printf("Filling debug: id %d, val %d, current count %d\n", id, val, *(mDebugOutMemory + id * 1024));
61 if (id > 100 * 1024) {
62 return;
63 }
64 int32_t* pos = mDebugOutMemory + id * 1024;
65 if (*pos >= 1023) {
66 return;
67 }
68 pos += ++(*pos);
69 *pos = val;
70 }
71
72 private:
73 mutable int32_t* mDebugOutMemory;
74};
75
76} // namespace o2::gpu
77
78#endif
79#endif
int32_t i
#define GPUdi()
#define GPUd()
uint16_t pos
Definition RawData.h:3
uint32_t j
Definition RawData.h:0
GLint GLsizei count
Definition glcorearb.h:399
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint GLfloat * val
Definition glcorearb.h:1582
GLuint memory
Definition glcorearb.h:5234