Skip to content

Commit

Permalink
fix(tracing/nvtx): silence -Wmissing-field-initializer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-nslick committed Sep 12, 2024
1 parent 22cf81b commit fd644c1
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions include/tracing_impl/nvtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,36 @@

#if HAVE_NVTX_TRACING
#include "nvToolsExt.h"
#include <string.h>

#define NCCL_OFI_N_NVTX_DOMAIN_PER_COMM 8

static inline void nvtx_mark_domain(nvtxDomainHandle_t domain, const char* name, uint32_t color)
{
const nvtxEventAttributes_t eventAttrib = {
.version = NVTX_VERSION,
.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE,
.colorType = NVTX_COLOR_ARGB,
.color = color,
.messageType = NVTX_MESSAGE_TYPE_ASCII,
.message = { .ascii = name },
};
nvtxEventAttributes_t eventAttrib;
memset(&eventAttrib, 0, sizeof(nvtxEventAttributes_t));

eventAttrib.version = NVTX_VERSION;
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
eventAttrib.colorType = NVTX_COLOR_ARGB;
eventAttrib.color = color;
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
eventAttrib.message = { .ascii = name };

nvtxDomainMarkEx(domain, &eventAttrib);
}

static inline nvtxRangeId_t nvtx_start_domain(bool have_domain, nvtxDomainHandle_t domain, const char* name, uint32_t color) {
const nvtxEventAttributes_t eventAttrib = {
.version = NVTX_VERSION,
.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE,
.colorType = NVTX_COLOR_ARGB,
.color = color,
.messageType = NVTX_MESSAGE_TYPE_ASCII,
.message = { .ascii = name },
};
nvtxEventAttributes_t eventAttrib;
memset(&eventAttrib, 0, sizeof(nvtxEventAttributes_t));

eventAttrib.version = NVTX_VERSION;
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
eventAttrib.colorType = NVTX_COLOR_ARGB;
eventAttrib.color = color;
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
eventAttrib.message = { .ascii = name };

if (have_domain)
return nvtxDomainRangeStartEx(domain, &eventAttrib);
else
Expand Down

0 comments on commit fd644c1

Please sign in to comment.