From 1b0841aeca0e886d17ba89c748cb2d351788d9c9 Mon Sep 17 00:00:00 2001 From: Nitin Bhat Date: Mon, 15 Apr 2019 16:28:56 -0500 Subject: [PATCH] Tests: Add CmiInitMsgHeader calls for non-CmiAlloc message allocations Change-Id: If269b7c43738c5ff05bb26c88187f47c5f4bf9a8 --- tests/ampi/speed/hello.C | 1 + tests/converse/commbench/broadcast.c | 3 +++ tests/converse/commbench/commbench.c | 1 + tests/converse/commbench/flood.c | 7 +++++++ tests/converse/commbench/memoryAccess.c | 1 + tests/converse/commbench/overhead.c | 1 + tests/converse/commbench/pingpong-cachemiss.c | 7 +++++++ tests/converse/commbench/pingpong.c | 6 ++++++ tests/converse/commbench/proc.c | 2 ++ tests/converse/commbench/reduction.c | 6 ++++++ tests/converse/commbench/smputil.c | 1 + tests/converse/commbench/timer.c | 1 + tests/converse/megacon/broadc.c | 2 ++ tests/converse/megacon/deadlock.c | 1 + tests/converse/megacon/multicast.c | 2 ++ tests/converse/megacon/multisend.c | 1 + tests/converse/megacon/ringsimple.c | 2 ++ 17 files changed, 45 insertions(+) diff --git a/tests/ampi/speed/hello.C b/tests/ampi/speed/hello.C index 614cd203f3..f938e3c832 100644 --- a/tests/ampi/speed/hello.C +++ b/tests/ampi/speed/hello.C @@ -136,6 +136,7 @@ struct conv_start_msg { /** Called on processor 0 to initiate the test */ void convCommTest(int isLocal) { conv_start_msg m; + CmiInitMsgHeader(m.hdr, sizeof(struct conv_start_msg)); CmiSetHandler(&m,CpvAccess(conv_kicker_idx)); m.isLocal=isLocal; CmiSyncBroadcastAllFn(sizeof(m),(char *)&m); diff --git a/tests/converse/commbench/broadcast.c b/tests/converse/commbench/broadcast.c index 45842eba38..1b3ddc9a9f 100644 --- a/tests/converse/commbench/broadcast.c +++ b/tests/converse/commbench/broadcast.c @@ -105,6 +105,7 @@ static void reduction_handler(void* msg) { int i = 0; int idx = CpvAccess(nextidx); EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); sizes[idx].time = CmiWallTimer() - CpvAccess(starttime); CmiFree(msg); @@ -134,6 +135,7 @@ static void reduction_handler(void* msg) { /* on PE 0 */ static void sync_starter(void* msg) { EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); ptimemsg tmsg = (ptimemsg)msg; double midTime = (CmiWallTimer() + CpvAccess(lasttime)) / 2; @@ -173,6 +175,7 @@ static void bcast_reply(void* msg) { static void bcast_central(void* msg) { EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); ptimemsg tmsg = (ptimemsg)msg; CmiAssert(CmiMyPe() == 0); if (CpvAccess(currentPe) == 0) { diff --git a/tests/converse/commbench/commbench.c b/tests/converse/commbench/commbench.c index 01b1ce92db..88f0c0549b 100644 --- a/tests/converse/commbench/commbench.c +++ b/tests/converse/commbench/commbench.c @@ -99,6 +99,7 @@ int commbench_skip(const char* test) { void commbench_next() { int idx, bank; EmptyMsg msg; + CmiInitMsgHeader(msg.core, sizeof(EmptyMsg)); bank = CpvAccess(test_bank_size); nextidx: diff --git a/tests/converse/commbench/flood.c b/tests/converse/commbench/flood.c index bda7744b09..66403d92da 100644 --- a/tests/converse/commbench/flood.c +++ b/tests/converse/commbench/flood.c @@ -90,6 +90,7 @@ static void recvTime(TimeMessage* msg) { int i, j; double time; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(numRecv)++; for (i = 0; i < CmiNumPes(); i++) { if (i == msg->srcNode) continue; @@ -136,6 +137,7 @@ static void recvTime(TimeMessage* msg) { static void startNextNode(EmptyMsg* msg) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); CmiFree(msg); if ((CmiMyPe() + 1) != CmiNumPes()) { CmiSetHandler(&m, pva(nbrHandler)); @@ -148,6 +150,7 @@ static void startNextNbr(EmptyMsg* msg) { TimeMessage* tm; int i, size; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); CmiFree(msg); pva(nextNbr)++; if (pva(nextNbr) == CmiMyPe()) { @@ -177,6 +180,8 @@ static void startNextSize(EmptyMsg* msg) { EmptyMsg m; Message* mm; int num; + + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(nextSize)++; if (pva(nextSize) == pva(numSizes)) { pva(nextSize) = -1; @@ -200,6 +205,7 @@ static void startNextSize(EmptyMsg* msg) { static void startNextIter(Message* msg) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); msg->iter += 1; @@ -231,6 +237,7 @@ static void bounceMessage(Message* msg) { void flood_init(void) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); if (CmiNumPes() == 1) { CmiPrintf("[flood] This benchmark requires > 1 nodes.\n"); diff --git a/tests/converse/commbench/memoryAccess.c b/tests/converse/commbench/memoryAccess.c index 6e0f6a7925..a985ed7327 100644 --- a/tests/converse/commbench/memoryAccess.c +++ b/tests/converse/commbench/memoryAccess.c @@ -192,6 +192,7 @@ static void memoryHandler(EmptyMsg* msg) { void memoryAccess_init(void) { EmptyMsg msg; + CmiInitMsgHeader(msg.core, sizeof(EmptyMsg)); CmiPrintf("Single core malloc/free/traversal performance numbers\n"); memoryTest(); diff --git a/tests/converse/commbench/overhead.c b/tests/converse/commbench/overhead.c index 5b9c348a98..00b9677eb1 100644 --- a/tests/converse/commbench/overhead.c +++ b/tests/converse/commbench/overhead.c @@ -127,6 +127,7 @@ static void enqueue_handler(void* msg) { int idx = CpvAccess(nextidx); EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); CpvAccess(numiter)++; if (CpvAccess(numiter) < sizes[idx].numiter) { CsdEnqueue(msg); diff --git a/tests/converse/commbench/pingpong-cachemiss.c b/tests/converse/commbench/pingpong-cachemiss.c index 8946b99aa4..481ef6c8ed 100644 --- a/tests/converse/commbench/pingpong-cachemiss.c +++ b/tests/converse/commbench/pingpong-cachemiss.c @@ -91,6 +91,7 @@ static void recvTime(TimeMessage* msg) { int i, j; double time; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(numRecv)++; for (i = 0; i < CmiNumNodes(); i++) { if (i == msg->srcNode) continue; @@ -133,6 +134,7 @@ static void recvTime(TimeMessage* msg) { static void startNextNode(EmptyMsg* msg) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); CmiFree(msg); if ((CmiMyNode() + 1) != CmiNumNodes()) { CmiSetHandler(&m, pva(nbrHandler)); @@ -147,6 +149,7 @@ static void startNextNbr(EmptyMsg* msg) { /* CmiAssert(CmiMyPe()==0); */ + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); CmiFree(msg); pva(nextNbr)++; if (pva(nextNbr) == CmiMyNode()) { @@ -179,6 +182,7 @@ static void startNextSize(EmptyMsg* msg) { /* CmiAssert(CmiMyPe()==0); */ + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(nextSize)++; if (pva(nextSize) == pva(numSizes)) { pva(nextSize) = -1; @@ -210,6 +214,8 @@ static void startNextIter(Message* msg) { EmptyMsg m; Message* mm; pva(nextIter)++; + + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); if (pva(nextIter) >= sizes[pva(nextSize)].numiter) { pva(endtime) = CmiWallTimer(); /* checkMessage(msg); */ @@ -299,6 +305,7 @@ static void startMessage(Message* msg) { void pingpong_cachemiss_init(void) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); if (CmiNumNodes() == 1) { CmiPrintf("[pingpong] This benchmark requires > 1 nodes.\n"); diff --git a/tests/converse/commbench/pingpong.c b/tests/converse/commbench/pingpong.c index 8d1f9799cb..d59bd9b9c3 100644 --- a/tests/converse/commbench/pingpong.c +++ b/tests/converse/commbench/pingpong.c @@ -83,6 +83,7 @@ static void recvTime(TimeMessage* msg) { int i, j; double time; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(numRecv)++; for (i = 0; i < CmiNumPes(); i++) { if (i == msg->srcNode) continue; @@ -121,6 +122,7 @@ static void recvTime(TimeMessage* msg) { static void startNextNode(EmptyMsg* msg) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); CmiFree(msg); if ((CmiMyPe() + 1) != CmiNumPes()) { CmiSetHandler(&m, pva(nbrHandler)); @@ -133,6 +135,7 @@ static void startNextNbr(EmptyMsg* msg) { TimeMessage* tm; int i, size; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); CmiFree(msg); pva(nextNbr)++; if (pva(nextNbr) == CmiMyPe()) { @@ -162,6 +165,7 @@ static void startNextSize(EmptyMsg* msg) { EmptyMsg m; Message* mm; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(nextSize)++; if (pva(nextSize) == pva(numSizes)) { pva(nextSize) = -1; @@ -183,6 +187,7 @@ static void startNextSize(EmptyMsg* msg) { static void startNextIter(Message* msg) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); pva(nextIter)++; if (pva(nextIter) > sizes[pva(nextSize)].numiter) { pva(endtime) = CmiWallTimer(); @@ -208,6 +213,7 @@ static void bounceMessage(Message* msg) { void pingpong_init(void) { EmptyMsg m; + CmiInitMsgHeader(m.core, sizeof(EmptyMsg)); if (CmiNumPes() == 1) { CmiPrintf("[pingpong] This benchmark requires > 1 nodes.\n"); CmiSetHandler(&m, pva(ack_handler)); diff --git a/tests/converse/commbench/proc.c b/tests/converse/commbench/proc.c index c95eaf40e0..9c9d664ba0 100644 --- a/tests/converse/commbench/proc.c +++ b/tests/converse/commbench/proc.c @@ -42,6 +42,7 @@ static int iround(double x) { return (int)(ceil(2.0 * x) / 2.0); } static void collectNumbers(ProcMsg* msg) { int npes; EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); if (CpvAccess(isSingle)) { CpvAccess(Time1) = CmiWallTimer() - CpvAccess(Time1); @@ -77,6 +78,7 @@ static void collectNumbers(ProcMsg* msg) { void proc_init(void) { ProcMsg msg; + CmiInitMsgHeader(msg.core, sizeof(EmptyMsg)); CpvAccess(isSingle) = 1; msg.success = NTRIALS; diff --git a/tests/converse/commbench/reduction.c b/tests/converse/commbench/reduction.c index de488ff33e..ec7548eccb 100644 --- a/tests/converse/commbench/reduction.c +++ b/tests/converse/commbench/reduction.c @@ -118,6 +118,8 @@ static void reduction_starter(void* msg) { static void reduction_handler(void* msg) { EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); + CpvAccess(endtime) = CmiWallTimer(); CmiFree(msg); @@ -128,6 +130,8 @@ static void reduction_handler(void* msg) { static void reduction_central(void* msg) { EmptyMsg emsg; ptimemsg tmsg = (ptimemsg)msg; + + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); if (CpvAccess(currentPe) == 0) { CpvAccess(lasttime) = CpvAccess(endtime) - tmsg->time - CpvAccess(timediff)[tmsg->srcpe]; @@ -166,6 +170,7 @@ static void sync_starter(void* msg) { EmptyMsg emsg; ptimemsg tmsg = (ptimemsg)msg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); double midTime = (CmiWallTimer() + CpvAccess(lasttime)) / 2; CpvAccess(timediff)[CpvAccess(currentPe)] = midTime - tmsg->time; CmiFree(msg); @@ -193,6 +198,7 @@ static void sync_reply(void* msg) { void reduction_init(void) { EmptyMsg emsg; + CmiInitMsgHeader(emsg.core, sizeof(EmptyMsg)); CmiSetHandler(&emsg, CpvAccess(sync_reply)); CpvAccess(lasttime) = CmiWallTimer(); diff --git a/tests/converse/commbench/smputil.c b/tests/converse/commbench/smputil.c index ff2633e09b..a894959c13 100644 --- a/tests/converse/commbench/smputil.c +++ b/tests/converse/commbench/smputil.c @@ -86,6 +86,7 @@ void smputil_init(void) { int i; CmiNodeLock lock; + CmiInitMsgHeader(msg.core, sizeof(EmptyMsg)); starttime = CmiWallTimer(); for (i = 0; i < NVARITER; i++) ; diff --git a/tests/converse/commbench/timer.c b/tests/converse/commbench/timer.c index a14a4cf7db..2fd19706eb 100644 --- a/tests/converse/commbench/timer.c +++ b/tests/converse/commbench/timer.c @@ -7,6 +7,7 @@ void timer_init(void) { volatile double starttime, endtime; int i; EmptyMsg msg; + CmiInitMsgHeader(msg.core, sizeof(EmptyMsg)); starttime = CmiWallTimer(); for (i = 0; i < NITER; i++) CmiCpuTimer(); diff --git a/tests/converse/megacon/broadc.c b/tests/converse/megacon/broadc.c index a5966fe647..3d16eabc81 100644 --- a/tests/converse/megacon/broadc.c +++ b/tests/converse/megacon/broadc.c @@ -35,6 +35,8 @@ void broadc_recv(mesg m) void broadc_start_cycle(bchare c) { struct mesg_s m={{0},CmiMyPe(),c,0x12345678}; struct mesg_s *mp; CmiCommHandle h; + + CmiInitMsgHeader(m.head, sizeof(struct mesg_s)); switch (c->totalsent) { case 0: CmiSetHandler(&m, CpvAccess(broadc_recv_idx)); diff --git a/tests/converse/megacon/deadlock.c b/tests/converse/megacon/deadlock.c index c5c611cfe1..5a15e56215 100644 --- a/tests/converse/megacon/deadlock.c +++ b/tests/converse/megacon/deadlock.c @@ -40,6 +40,7 @@ void deadlock_cram(char *msg) void deadlock_init() { char msg[CmiMsgHeaderSizeBytes]={0}; + CmiInitMsgHeader(msg, sizeof(struct incmsg_s)); if (CmiNumPes()<2) { CmiPrintf("warning: need 2 processors for deadlock-test, skipping.\n"); Cpm_megacon_ack(CpmSend(0)); diff --git a/tests/converse/megacon/multicast.c b/tests/converse/megacon/multicast.c index b905c278f0..e09722efbf 100644 --- a/tests/converse/megacon/multicast.c +++ b/tests/converse/megacon/multicast.c @@ -36,6 +36,8 @@ void multicast_recv(mesg m) void multicast_start_cycle(bchare c) { struct mesg_s m={{0},CmiMyPe(),c,0x12345678}; struct mesg_s *mp; + + CmiInitMsgHeader(m.head, sizeof(struct mesg_s)); switch (c->totalsent) { case 0: CmiSetHandler(&m, CpvAccess(multicast_recv_idx)); diff --git a/tests/converse/megacon/multisend.c b/tests/converse/megacon/multisend.c index 940cf4134e..7aaf9216d2 100644 --- a/tests/converse/megacon/multisend.c +++ b/tests/converse/megacon/multisend.c @@ -67,6 +67,7 @@ void multisend_init(void) int sizes[nMulti]; char *msgs[nMulti]; multisendmsg first; /* Allocate one message on the stack (because you can!) */ + CmiInitMsgHeader(first.core, sizeof(multisendmsg)); for (m=0;m