Skip to content

Commit 331a6e9

Browse files
committed
Fix: expose gpu error names with static function
1 parent 7b5264a commit 331a6e9

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

GPU/GPUTracking/Global/GPUErrors.cxx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "GPUErrors.h"
1616
#include "GPUDataTypes.h"
1717
#include "GPUCommonMath.h"
18-
#include "GPUDefMacros.h"
1918
#include "GPULogging.h"
2019

2120
using namespace o2::gpu;
@@ -36,6 +35,7 @@ GPUd() void GPUErrors::raiseError(uint32_t code, uint32_t param1, uint32_t param
3635
#ifndef GPUCA_GPUCODE
3736

3837
#include <cstring>
38+
#include <unordered_map>
3939

4040
uint32_t GPUErrors::getMaxErrors()
4141
{
@@ -47,6 +47,17 @@ void GPUErrors::clear()
4747
memset(mErrors, 0, GPUCA_MAX_ERRORS * sizeof(*mErrors));
4848
}
4949

50+
static std::unordered_map<uint32_t, const char*> errorNames = {
51+
#define GPUCA_ERROR_CODE(num, name, ...) {num, GPUCA_M_STR(name)},
52+
#include "GPUErrorCodes.h"
53+
#undef GPUCA_ERROR_CODE
54+
};
55+
56+
const std::unordered_map<uint32_t, const char*>& GPUErrors::getErrorNames()
57+
{
58+
return errorNames;
59+
}
60+
5061
bool GPUErrors::printErrors(bool silent, uint64_t mask)
5162
{
5263
bool retVal = 0;

GPU/GPUTracking/Global/GPUErrors.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222
namespace o2::gpu
2323
{
2424

25-
static std::unordered_map<uint32_t, const char*> errorNames = {
26-
#define GPUCA_ERROR_CODE(num, name, ...) {num, GPUCA_M_STR(name)},
27-
#include "GPUErrorCodes.h"
28-
#undef GPUCA_ERROR_CODE
29-
};
30-
3125
class GPUErrors
3226
{
3327
public:
@@ -42,6 +36,7 @@ class GPUErrors
4236
void setMemory(GPUglobalref() uint32_t* m) { mErrors = m; }
4337
void clear();
4438
bool printErrors(bool silent = false, uint64_t mask = 0);
39+
static const std::unordered_map<uint32_t, const char*>& getErrorNames();
4540
uint32_t getNErrors() const;
4641
const uint32_t* getErrorPtr() const;
4742
static uint32_t getMaxErrors();

0 commit comments

Comments
 (0)