From 30b918910614b9d682486abd6cc16f74c7dc2ea7 Mon Sep 17 00:00:00 2001 From: Nitin Bhat Date: Fri, 8 Feb 2019 13:48:05 -0600 Subject: [PATCH] Initialize zcMsgType for all message allocations zcMsgType is a converse header field used for identifying zero copy messages (P2P_SEND, BCAST_SEND etc) from regular charm messages (NO_ZC). For that reason, it is required to initialize all allocated messages to NO_ZC to ensure that they are not treated like zero copy messages. Change-Id: I110769b2185c650c14c53a456bd4b687d4787783 --- src/conv-core/convcore.C | 6 ++++++ src/conv-core/cputopology.C | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/conv-core/convcore.C b/src/conv-core/convcore.C index b5bc8ecfd8..3189b49522 100644 --- a/src/conv-core/convcore.C +++ b/src/conv-core/convcore.C @@ -2507,6 +2507,9 @@ void CmiReductionHandleDynamicRequest(char *msg) { void CmiGetDynamicReductionRemote(int handlerIdx, int pe, int dataSize, void *data) { int size = CmiMsgHeaderSizeBytes+2*sizeof(int)+dataSize; char *msg = (char*)CmiAlloc(size); +#if CMK_ONESIDED_IMPL + CMI_ZC_MSGTYPE(msg) = CMK_REG_NO_ZC_MSG; +#endif int *values = (int*)(msg+CmiMsgHeaderSizeBytes); values[0] = pe; values[1] = dataSize; @@ -2546,6 +2549,9 @@ void CmiSendReduce(CmiReduction *red) { msg_size = pup_size(p) + CmiReservedHeaderSize; pup_destroy(p); msg = CmiAlloc(msg_size); +#if CMK_ONESIDED_IMPL + CMI_ZC_MSGTYPE(msg) = CMK_REG_NO_ZC_MSG; +#endif p = pup_new_toMem((void*)(((char*)msg)+CmiReservedHeaderSize)); (red->ops.pupFn)(p, mergedData); pup_destroy(p); diff --git a/src/conv-core/cputopology.C b/src/conv-core/cputopology.C index e4a82607ff..29b25dd435 100644 --- a/src/conv-core/cputopology.C +++ b/src/conv-core/cputopology.C @@ -266,6 +266,7 @@ static void cpuTopoHandler(void *m) int i; hostTable = CmmNew(); topomsg = (nodeTopoMsg *)CmiAlloc(sizeof(nodeTopoMsg)+CmiNumPes()*sizeof(int)); + CMI_ZC_MSGTYPE(topomsg) = CMK_REG_NO_ZC_MSG; CmiSetHandler((char *)topomsg, CpvAccess(cpuTopoRecvHandlerIdx)); topomsg->nodes = (int *)((char*)topomsg + sizeof(nodeTopoMsg)); for (i=0; inodes[i] = -1; @@ -342,6 +343,7 @@ static void * combineMessage(int *size, void *data, void **remote, int count) for (i=0; in; *size = sizeof(hostnameMsg)+sizeof(_procInfo)*nprocs; hostnameMsg *msg = (hostnameMsg *)CmiAlloc(*size); + CMI_ZC_MSGTYPE(msg) = CMK_REG_NO_ZC_MSG; msg->procs = (_procInfo*)((char*)msg + sizeof(hostnameMsg)); msg->n = nprocs; CmiSetHandler((char *)msg, CpvAccess(cpuTopoHandlerIdx)); @@ -370,6 +372,7 @@ static void *emptyReduction(int *size, void *data, void **remote, int count) } *size = sizeof(topoDoneMsg); topoDoneMsg *msg = (topoDoneMsg *)CmiAlloc(sizeof(topoDoneMsg)); + CMI_ZC_MSGTYPE(msg) = CMK_REG_NO_ZC_MSG; CmiSetHandler((char *)msg, CpvAccess(topoDoneHandlerIdx)); return msg; } @@ -601,6 +604,7 @@ extern "C" void LrtsInitCpuTopo(char **argv) /* prepare a msg to send */ msg = (hostnameMsg *)CmiAlloc(sizeof(hostnameMsg)+sizeof(_procInfo)); + CMI_ZC_MSGTYPE(msg) = CMK_REG_NO_ZC_MSG; msg->n = 1; msg->procs = (_procInfo*)((char*)msg + sizeof(hostnameMsg)); CmiSetHandler((char *)msg, CpvAccess(cpuTopoHandlerIdx)); @@ -621,6 +625,7 @@ extern "C" void LrtsInitCpuTopo(char **argv) if (CmiNumNodes() > 1) { topoDoneMsg *msg2 = (topoDoneMsg *)CmiAlloc(sizeof(topoDoneMsg)); + CMI_ZC_MSGTYPE(msg2) = CMK_REG_NO_ZC_MSG; CmiSetHandler((char *)msg2, CpvAccess(topoDoneHandlerIdx)); CmiReduce(msg2, sizeof(topoDoneMsg), emptyReduction); if ((CmiMyPe() == 0) || (CmiNumSpanTreeChildren(CmiMyPe()) > 0)) { -- 2.11.4.GIT