mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-12-27 06:43:55 +01:00
6bb95f068d
- Added NVTX annotations to GPU kernel.
27 lines
885 B
C
27 lines
885 B
C
#pragma once
|
|
|
|
#define USE_NVTX
|
|
|
|
#ifdef USE_NVTX
|
|
#include "nvToolsExt.h"
|
|
#include "nvtxDetail/nvtxLinkOnce.h"
|
|
const uint32_t colors[] = { 0xff00ff00, 0xff0000ff, 0xffffff00, 0xffff00ff, 0xff00ffff, 0xffff0000, 0xffffffff };
|
|
const int num_colors = sizeof(colors)/sizeof(uint32_t);
|
|
#define PUSH_RANGE(name,cid) { \
|
|
int color_id = cid; \
|
|
color_id = color_id%num_colors;\
|
|
nvtxEventAttributes_t eventAttrib = {0}; \
|
|
eventAttrib.version = NVTX_VERSION; \
|
|
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \
|
|
eventAttrib.colorType = NVTX_COLOR_ARGB; \
|
|
eventAttrib.color = colors[color_id]; \
|
|
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \
|
|
eventAttrib.message.ascii = name; \
|
|
nvtxRangePushEx(&eventAttrib); \
|
|
}
|
|
#define POP_RANGE nvtxRangePop();
|
|
#else
|
|
#define PUSH_RANGE(name,cid)
|
|
#define POP_RANGE
|
|
#endif
|