Cleanup converse examples and tests 84/4284/7
authorNitin Bhat <nbhat4@illinois.edu>
Wed, 20 Jun 2018 14:10:55 +0000 (09:10 -0500)
committerNitin Bhat <nbhat4@illinois.edu>
Tue, 3 Jul 2018 14:04:29 +0000 (09:04 -0500)
Fix indentation and clear out whitespaces and tabs

Change-Id: I1078cc07608b225f60004cd5a82018b3a7e30832

36 files changed:
examples/converse/ccstest/Makefile
examples/converse/ccstest/README
examples/converse/ccstest/client.C
examples/converse/ccstest/server.C
examples/converse/pingpong/pingpong.C
examples/converse/pingpong/pingpong_multipairs.C
tests/converse/commbench/broadcast.c
tests/converse/commbench/commbench.c
tests/converse/commbench/ctxt.c
tests/converse/commbench/flood.c
tests/converse/commbench/memoryAccess.c
tests/converse/commbench/overhead.c
tests/converse/commbench/pingpong-cachemiss.c
tests/converse/commbench/pingpong.c
tests/converse/commbench/proc.c
tests/converse/commbench/reduction.c
tests/converse/commbench/smputil.c
tests/converse/commbench/timer.c
tests/converse/cthtest/pgm.C
tests/converse/machinetest/multiping.C
tests/converse/machinetest/pingall.C
tests/converse/megacon/Makefile
tests/converse/megacon/bigmsg.c
tests/converse/megacon/broadc.c
tests/converse/megacon/deadlock.c
tests/converse/megacon/fibobj.c
tests/converse/megacon/megacon.c
tests/converse/megacon/multicast.c
tests/converse/megacon/multisend.c
tests/converse/megacon/nodenum.c
tests/converse/megacon/posixth.c
tests/converse/megacon/reduction.c
tests/converse/megacon/ringsimple.c
tests/converse/megacon/specmsg.c
tests/converse/megacon/vars.c
tests/converse/megacon/vecsend.c

index 6cde0adc79a5ab56581713e88a1e9700bb259a11..7936de80204423f6d06a6e07cdce0c9526a88fdf 100644 (file)
@@ -4,7 +4,7 @@ CHARMC=$(CHARMDIR)/bin/charmc $(OPTS)
 all: server client
 
 server: server.o
-       $(CHARMC) -o $@ server.o -language converse++ 
+       $(CHARMC) -o $@ server.o -language converse++
 
 client: client.o
        g++ -o $@ client.o -I$(CHARMDIR)/include -L$(CHARMDIR)/lib -lccs-client
index 3b88f6ab5a8b7ee6b4d9b49c8dc0691c82f2b0f8..62f65d7285b67605d5b961a3483e1621ed071fb3 100644 (file)
@@ -8,7 +8,7 @@ CCS Handlers registered.  Waiting for net requests...
 
 or just
 
-./charmrun +p2 ./server ++server 
+./charmrun +p2 ./server ++server
 ccs: 2
 ccs: Server IP = 128.174.241.108, Server port = 1912 $
 CCS Handlers registered.  Waiting for net requests...
@@ -17,4 +17,4 @@ CCS Handlers registered.  Waiting for net requests...
 in which case a random port is bound to and printed out.
 
 To run the client
-./client <myserverhost> <myserverport>
\ No newline at end of file
+./client <myserverhost> <myserverport>
index fe778eacf136707190ab774884083e7b34656adc..b90a5806da72401510051b54ff21beccce510bac 100644 (file)
@@ -1,5 +1,4 @@
 #include "ccs-client.h"
-//#include "ccs-client.c"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -15,14 +14,14 @@ int main(int argc, char **argv)
   CcsServer svr;
   CcsSec_secretKey *key=NULL,keySto;
   int i;
-  char *sendWhat="milind";
+  const char *sendWhat = "milind";
   char reply[1024];
   if(argc < 3) {
     usage();
   }
   if(argc>3 && CCS_AUTH_makeSecretKey(argv[3],&keySto))
-          key=&keySto;
-  
+    key=&keySto;
+
   CcsConnect(&svr, argv[1], atoi(argv[2]), key);
   for(i=0;i<CcsNumPes(&svr);i++) {
     CcsSendRequest(&svr, "ping", i, strlen(sendWhat)+1, sendWhat);
index 89472dcf97b19e6ffae308402e4dec22e3b2ea71..cc592d5b5f222d1b68729d0182b61ca43c11967d 100644 (file)
@@ -17,11 +17,10 @@ void handler(char *msg)
 
 void user_main(int argc, char **argv)
 {
-int i;
+  int i;
   CcsRegisterHandler("ping2", (CmiHandler)handler);
   CcsRegisterHandler("ping", (CmiHandler)handler);
   CmiPrintf("CCS Handlers registered.  Waiting for net requests...\n");
-  
 }
 
 int main(int argc, char **argv)
index 0e089419bee8c8be411e0d89e960713b3e86f062..fa6e63e44006da974bb6c87798dc0cd7e817aa0e 100644 (file)
@@ -4,7 +4,7 @@
   Modified from Milind's ping-pong
 
   Sameer Kumar 02/07/05
-****************************************************************/
+ ****************************************************************/
 
 #include <stdlib.h>
 #include <converse.h>
index 8d13ac6360f0e9e691aad4f8822ac28b1b932bdf..73f29a60c244ccfff4fae42dc46836ec60e3d218 100644 (file)
@@ -1,10 +1,10 @@
 
 /**********************************************************
-      Converse Ping-pong to test the message latency and bandwidth
-      Modified from Milind's ping-pong
-      
-      Sameer Kumar 02/07/05
-***************************************************/
+  Converse Ping-pong to test the message latency and bandwidth
+  Modified from Milind's ping-pong
+
+  Sameer Kumar 02/07/05
+ ***************************************************/
 
 #include <stdlib.h>
 #include <converse.h>
@@ -40,8 +40,8 @@ void startRing(char* msg_2)
 
   CmiFree(msg_2);
   //Increase message in powers of 4. Also add a converse header to that
-  CpvAccess(msgSize) = (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)*2 + 
-      CmiMsgHeaderSizeBytes;
+  CpvAccess(msgSize) = (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)*2 +
+    CmiMsgHeaderSizeBytes;
 
   char *msg = (char *)CmiAlloc(CpvAccess(msgSize));
   *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
@@ -51,33 +51,33 @@ void startRing(char* msg_2)
 
 void reduceHandlerFunc(char *msg)
 {
-   CpvAccess(recvNum) += 1;
-   CpvAccess(sumTime) += *((double*)(msg+(CmiMsgHeaderSizeBytes)));
-   if(CpvAccess(recvNum) == HALF)
-   {
-       double us_time = (CpvAccess(sumTime))/(2.*(nCycles-skip)*HALF)*1e6;
-       CmiPrintf("%d\t\t  %.2lf   %.2f\n",
-           CpvAccess(msgSize)-CmiMsgHeaderSizeBytes,
-           us_time, (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)/us_time);
-       CpvAccess(recvNum) = 0;
-   
-       if (CpvAccess(msgSize) < maxMsgSize)
-       {
-           for(int i=0; i<HALF; i++)
-           {
-               void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-               CmiSetHandler(sendmsg,CpvAccess(startRingHandler));
-               CmiSyncSendAndFree(i, CmiMsgHeaderSizeBytes, sendmsg);
-           }
-       }
-       else {
-           //exit
-           void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-           CmiSetHandler(sendmsg,CpvAccess(exitHandler));
-           CmiSyncBroadcastAllAndFree(CmiMsgHeaderSizeBytes,sendmsg);
-       }
-   }
-   CmiFree(msg);
+  CpvAccess(recvNum) += 1;
+  CpvAccess(sumTime) += *((double*)(msg+(CmiMsgHeaderSizeBytes)));
+  if(CpvAccess(recvNum) == HALF)
+  {
+    double us_time = (CpvAccess(sumTime))/(2.*(nCycles-skip)*HALF)*1e6;
+    CmiPrintf("%d\t\t  %.2lf   %.2f\n",
+        CpvAccess(msgSize)-CmiMsgHeaderSizeBytes,
+        us_time, (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)/us_time);
+    CpvAccess(recvNum) = 0;
+
+    if (CpvAccess(msgSize) < maxMsgSize)
+    {
+      for(int i=0; i<HALF; i++)
+      {
+        void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+        CmiSetHandler(sendmsg,CpvAccess(startRingHandler));
+        CmiSyncSendAndFree(i, CmiMsgHeaderSizeBytes, sendmsg);
+      }
+    }
+    else {
+      //exit
+      void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+      CmiSetHandler(sendmsg,CpvAccess(exitHandler));
+      CmiSyncBroadcastAllAndFree(CmiMsgHeaderSizeBytes,sendmsg);
+    }
+  }
+  CmiFree(msg);
 }
 //the pingpong has finished, record message time
 void ringFinished(char *msg)
@@ -85,10 +85,13 @@ void ringFinished(char *msg)
   CmiFree(msg);
 
   double elaps_time = CpvAccess(endTime)-CpvAccess(startTime);
-  //Print the time for that message size
-  //CmiPrintf("\t\t  %.2lf\n", 
-            //(1e6*(CpvAccess(endTime)-CpvAccess(startTime)))/(2.*nCycles));
+
+#if 0
+  // Print the time for that message size
+  CmiPrintf("\t\t  %.2lf\n",
+    (1e6*(CpvAccess(endTime)-CpvAccess(startTime)))/(2.*nCycles));
   //Have we finished all message sizes?
+#endif
   int mysize = CmiMsgHeaderSizeBytes+sizeof(double);
   void *sendmsg = CmiAlloc(mysize);
   *((double*)((char*)sendmsg+CmiMsgHeaderSizeBytes)) = elaps_time;
@@ -99,125 +102,125 @@ void ringFinished(char *msg)
 //We finished for all message sizes. Exit now
 CmiHandler exitHandlerFunc(char *msg)
 {
-    CmiFree(msg);
-    CsdExitScheduler();
-    return 0;
+  CmiFree(msg);
+  CsdExitScheduler();
+  return 0;
 }
 
 
 //Handler on Node 0
 CmiHandler node0HandlerFunc(char *msg)
 {
-    CpvAccess(cycleNum)++;
-    if(CpvAccess(cycleNum)== skip)
-        CpvAccess(startTime) = CmiWallTimer();
+  CpvAccess(cycleNum)++;
+  if(CpvAccess(cycleNum)== skip)
+    CpvAccess(startTime) = CmiWallTimer();
+
+  if (CpvAccess(cycleNum) == nCycles) {
+    CpvAccess(endTime) = CmiWallTimer();
+    ringFinished(msg);
+  }
+  else {
+    CmiSetHandler(msg,CpvAccess(node1Handler));
+    *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
 
-    if (CpvAccess(cycleNum) == nCycles) {
-        CpvAccess(endTime) = CmiWallTimer();
-        ringFinished(msg);
-    }
-    else {
-        CmiSetHandler(msg,CpvAccess(node1Handler));
-        *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
-        
 #if USE_PERSISTENT
-        CmiUsePersistentHandle(&h, 1);
+    CmiUsePersistentHandle(&h, 1);
 #endif
-        CmiSyncSendAndFree(CmiMyPe()+HALF,CpvAccess(msgSize),msg);
+    CmiSyncSendAndFree(CmiMyPe()+HALF,CpvAccess(msgSize),msg);
 #if USE_PERSISTENT
-        CmiUsePersistentHandle(NULL, 0);
+    CmiUsePersistentHandle(NULL, 0);
 #endif
-    }
-    return 0;
+  }
+  return 0;
 }
 
 CmiHandler node1HandlerFunc(char *msg)
 {
-    CpvAccess(msgSize) = *((int *)(msg+CmiMsgHeaderSizeBytes));
-    CmiSetHandler(msg,CpvAccess(node0Handler));
-    
+  CpvAccess(msgSize) = *((int *)(msg+CmiMsgHeaderSizeBytes));
+  CmiSetHandler(msg,CpvAccess(node0Handler));
+
 #if USE_PERSISTENT
-    CmiUsePersistentHandle(&h, 1);
+  CmiUsePersistentHandle(&h, 1);
 #endif
-    CmiSyncSendAndFree(CmiMyPe()-HALF,CpvAccess(msgSize),msg);
+  CmiSyncSendAndFree(CmiMyPe()-HALF,CpvAccess(msgSize),msg);
 #if USE_PERSISTENT
-    CmiUsePersistentHandle(NULL, 0);
+  CmiUsePersistentHandle(NULL, 0);
 #endif
-    return 0;
+  return 0;
 }
 
 // Converse handler for beginning operation
 CmiHandler startOperationHandlerFunc(char *msg)
 {
 #if USE_PERSISTENT
-    h = CmiCreatePersistent(otherPe, maxMsgSize+1024);
+  h = CmiCreatePersistent(otherPe, maxMsgSize+1024);
 #endif
-    if(CmiMyPe() == 0)
-    {
-        CmiPrintf("Multiple pair send/recv\n bytes \t\t latency(us)\t bandwidth(MBytes/sec)\n");
-    }
-    if (CmiMyPe() <CmiNumPes()/2)
-    {
-        void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-        CmiSetHandler(sendmsg,CpvAccess(startRingHandler));
-        CmiSyncSendAndFree(CmiMyPe(), CmiMsgHeaderSizeBytes, sendmsg);
-    }
-    return 0;
+  if(CmiMyPe() == 0)
+  {
+    CmiPrintf("Multiple pair send/recv\n bytes \t\t latency(us)\t bandwidth(MBytes/sec)\n");
+  }
+  if (CmiMyPe() <CmiNumPes()/2)
+  {
+    void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler(sendmsg,CpvAccess(startRingHandler));
+    CmiSyncSendAndFree(CmiMyPe(), CmiMsgHeaderSizeBytes, sendmsg);
+  }
+  return 0;
 }
 
 //Converse main. Initialize variables and register handlers
 CmiStartFn mymain(int argc, char *argv[])
 {
-    CpvInitialize(int,msgSize);
-    CpvInitialize(int,recvNum);
-    CpvInitialize(double,sumTime);
-    CpvInitialize(int,cycleNum);
-    CpvAccess(recvNum) = 0; 
-    CpvAccess(sumTime) = 0; 
-    CpvAccess(msgSize)= 4 + CmiMsgHeaderSizeBytes;
-    
-    CpvInitialize(int,reduceHandler);
-    CpvAccess(reduceHandler) = CmiRegisterHandler((CmiHandler) reduceHandlerFunc);
-    CpvInitialize(int,exitHandler);
-    CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
-    CpvInitialize(int,startRingHandler);
-    CpvAccess(startRingHandler) = CmiRegisterHandler((CmiHandler) startRing);
-    CpvInitialize(int,node0Handler);
-    CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
-    CpvInitialize(int,node1Handler);
-    CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
-    CpvInitialize(int,startOperationHandler);
-    CpvAccess(startOperationHandler) = CmiRegisterHandler((CmiHandler) startOperationHandlerFunc);
-    
-    CpvInitialize(double,startTime);
-    CpvInitialize(double,endTime);
-    
-    int otherPe = CmiMyPe() ^ 1;
-
-    // Set runtime cpuaffinity
-    CmiInitCPUAffinity(argv);
-
-    // Initialize CPU topology
-    CmiInitCPUTopology(argv);
-
-    // Wait for all PEs of the node to complete topology init
-    CmiNodeAllBarrier();
-
-    // Node 0 waits till all processors finish their topology processing
-    if(CmiMyPe() == 0) {
-        // Signal all PEs to begin computing
-        char *startOperationMsg = (char *)CmiAlloc(CmiMsgHeaderSizeBytes);
-        CmiSetHandler((char *)startOperationMsg, CpvAccess(startOperationHandler));
-        CmiSyncBroadcastAndFree(CmiMsgHeaderSizeBytes, startOperationMsg);
-
-        // start operation locally on PE 0
-        startOperationHandlerFunc(NULL);
-    }
-    return 0;
+  CpvInitialize(int,msgSize);
+  CpvInitialize(int,recvNum);
+  CpvInitialize(double,sumTime);
+  CpvInitialize(int,cycleNum);
+  CpvAccess(recvNum) = 0;
+  CpvAccess(sumTime) = 0;
+  CpvAccess(msgSize)= 4 + CmiMsgHeaderSizeBytes;
+
+  CpvInitialize(int,reduceHandler);
+  CpvAccess(reduceHandler) = CmiRegisterHandler((CmiHandler) reduceHandlerFunc);
+  CpvInitialize(int,exitHandler);
+  CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
+  CpvInitialize(int,startRingHandler);
+  CpvAccess(startRingHandler) = CmiRegisterHandler((CmiHandler) startRing);
+  CpvInitialize(int,node0Handler);
+  CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
+  CpvInitialize(int,node1Handler);
+  CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
+  CpvInitialize(int,startOperationHandler);
+  CpvAccess(startOperationHandler) = CmiRegisterHandler((CmiHandler) startOperationHandlerFunc);
+
+  CpvInitialize(double,startTime);
+  CpvInitialize(double,endTime);
+
+  int otherPe = CmiMyPe() ^ 1;
+
+  // Set runtime cpuaffinity
+  CmiInitCPUAffinity(argv);
+
+  // Initialize CPU topology
+  CmiInitCPUTopology(argv);
+
+  // Wait for all PEs of the node to complete topology init
+  CmiNodeAllBarrier();
+
+  // Node 0 waits till all processors finish their topology processing
+  if(CmiMyPe() == 0) {
+    // Signal all PEs to begin computing
+    char *startOperationMsg = (char *)CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler((char *)startOperationMsg, CpvAccess(startOperationHandler));
+    CmiSyncBroadcastAndFree(CmiMsgHeaderSizeBytes, startOperationMsg);
+
+    // start operation locally on PE 0
+    startOperationHandlerFunc(NULL);
+  }
+  return 0;
 }
 
 int main(int argc,char *argv[])
 {
-    ConverseInit(argc,argv,(CmiStartFn)mymain,0,0);
-    return 0;
+  ConverseInit(argc,argv,(CmiStartFn)mymain,0,0);
+  return 0;
 }
index 1d2a00035169d86580f04cb2a01a507cbe1c7876..45842eba38a459fbda4e3b25f12ee37b96f3b8be 100644 (file)
@@ -38,17 +38,17 @@ static struct testdata {
   int numiter;
   double time;
 } sizes[] = {
-    {4, MAXITER, 0.0},
-    {16, MAXITER, 0.0},
-    {64, MAXITER, 0.0},
-    {256, MAXITER, 0.0},
-    {1024, MAXITER, 0.0},
-    {4096, MAXITER, 0.0},
-    {16384, MAXITER, 0.0},
-    {65536, MAXITER, 0.0},
-    {262144, MAXITER / 2, 0.0},
-    {1048576, MAXITER / 4, 0.0},
-    {-1, -1, 0.0},
+  {4, MAXITER, 0.0},
+  {16, MAXITER, 0.0},
+  {64, MAXITER, 0.0},
+  {256, MAXITER, 0.0},
+  {1024, MAXITER, 0.0},
+  {4096, MAXITER, 0.0},
+  {16384, MAXITER, 0.0},
+  {65536, MAXITER, 0.0},
+  {262144, MAXITER / 2, 0.0},
+  {1048576, MAXITER / 4, 0.0},
+  {-1, -1, 0.0},
 };
 
 typedef struct _timemsg {
@@ -73,7 +73,7 @@ static void print_results(const char* func) {
 
   while (sizes[i].size != (-1)) {
     CmiPrintf(sync_outstr, func, sizes[i].time / sizes[i].numiter,
-              sizes[i].size);
+        sizes[i].size);
     i++;
   }
 }
@@ -177,11 +177,11 @@ static void bcast_central(void* msg) {
   CmiAssert(CmiMyPe() == 0);
   if (CpvAccess(currentPe) == 0) {
     CpvAccess(lasttime) =
-        tmsg->time - CpvAccess(starttime) + CpvAccess(timediff)[tmsg->srcpe];
+      tmsg->time - CpvAccess(starttime) + CpvAccess(timediff)[tmsg->srcpe];
   } else if ((tmsg->time - CpvAccess(starttime) +
-              CpvAccess(timediff)[tmsg->srcpe]) > CpvAccess(lasttime)) {
+        CpvAccess(timediff)[tmsg->srcpe]) > CpvAccess(lasttime)) {
     CpvAccess(lasttime) =
-        tmsg->time - CpvAccess(starttime) + CpvAccess(timediff)[tmsg->srcpe];
+      tmsg->time - CpvAccess(starttime) + CpvAccess(timediff)[tmsg->srcpe];
   }
   CmiFree(msg);
   CpvAccess(currentPe)++;
@@ -245,7 +245,7 @@ void broadcast_moduleinit(void) {
   CpvAccess(bcast_reply) = CmiRegisterHandler((CmiHandler)bcast_reply);
   CpvAccess(bcast_central) = CmiRegisterHandler((CmiHandler)bcast_central);
   CpvAccess(reduction_handler) =
-      CmiRegisterHandler((CmiHandler)reduction_handler);
+    CmiRegisterHandler((CmiHandler)reduction_handler);
   CpvAccess(sync_starter) = CmiRegisterHandler((CmiHandler)sync_starter);
   CpvAccess(sync_reply) = CmiRegisterHandler((CmiHandler)sync_reply);
 }
index 72346233bfa608aef0247e518961accda23bd8e9..01b1ce92db0d5f3deb44503ae7f357cb7a611767 100644 (file)
@@ -1,14 +1,14 @@
 /**************************************************************************
-* DESCRIPTION:
-*
-* To add a test to commbench, you have to:
-*
-*   1. write a testname_moduleinit function that initializes the module.
-*   2. write a testname_init function that starts the test.
-*   3. declare the testname_init function inside this module.
-*   4. extend the tests[] table in this module to include the new test.
-*
-**************************************************************************/
+ * DESCRIPTION:
+ *
+ * To add a test to commbench, you have to:
+ *
+ *   1. write a testname_moduleinit function that initializes the module.
+ *   2. write a testname_init function that starts the test.
+ *   3. declare the testname_init function inside this module.
+ *   4. extend the tests[] table in this module to include the new test.
+ *
+ **************************************************************************/
 
 #include <stdio.h>
 #include <converse.h>
@@ -49,18 +49,18 @@ struct testinfo {
   void (*initiator)(void);
   void (*initializer)(void);
 } tests[] = {
-    {"memoryAccess", memoryAccess_init, memoryAccess_moduleinit},
-    {"overhead", overhead_init, overhead_moduleinit},
-    {"timer", timer_init, timer_moduleinit},
-    {"proc", proc_init, proc_moduleinit},
-    {"smputil", smputil_init, smputil_moduleinit},
-    {"pingpong", pingpong_init, pingpong_moduleinit},
-    {"pingpong-cachemiss", pingpong_cachemiss_init, pingpong_cachemiss_moduleinit},
-    {"flood", flood_init, flood_moduleinit},
-    {"broadcast", broadcast_init, broadcast_moduleinit},
-    {"reduction", reduction_init, reduction_moduleinit},
-    {"ctxt", ctxt_init, ctxt_moduleinit},
-    {0, 0, 0},
+  {"memoryAccess", memoryAccess_init, memoryAccess_moduleinit},
+  {"overhead", overhead_init, overhead_moduleinit},
+  {"timer", timer_init, timer_moduleinit},
+  {"proc", proc_init, proc_moduleinit},
+  {"smputil", smputil_init, smputil_moduleinit},
+  {"pingpong", pingpong_init, pingpong_moduleinit},
+  {"pingpong-cachemiss", pingpong_cachemiss_init, pingpong_cachemiss_moduleinit},
+  {"flood", flood_init, flood_moduleinit},
+  {"broadcast", broadcast_init, broadcast_moduleinit},
+  {"reduction", reduction_init, reduction_moduleinit},
+  {"ctxt", ctxt_init, ctxt_moduleinit},
+  {0, 0, 0},
 };
 
 /******************************************************************************
@@ -131,7 +131,7 @@ void commbench_init(int argc, char** argv) {
   CpvInitialize(int, shutdown_handler);
   CpvInitialize(int, ack_handler);
   CpvAccess(shutdown_handler) =
-      CmiRegisterHandler((CmiHandler)commbench_shutdown);
+    CmiRegisterHandler((CmiHandler)commbench_shutdown);
   CpvAccess(ack_handler) = CmiRegisterHandler((CmiHandler)commbench_ack);
   for (i = 0; (tests[i].initializer); i++) (tests[i].initializer)();
   CpvInitialize(int, test_bank_size);
index 99365383a310cc61397f3ab45e28b2fded1d75df..3727a2a0a23aaef26d789ec4dd95aa125e7bbb17 100644 (file)
@@ -12,7 +12,7 @@ void ctxt_init(void) {
   for (i = 0; i < NITER; i++) CthYield();
   endtime = CmiWallTimer();
   CmiPrintf("[ctxt] Thread Context Switching Overhead = %le seconds\n",
-            (endtime - starttime) / NITER);
+      (endtime - starttime) / NITER);
   CmiSetHandler(&msg, CpvAccess(ack_handler));
   CmiSyncSend(0, sizeof(EmptyMsg), &msg);
 }
index ad76c6da6854808b7fcbfb71f0b5e2fca64e3782..bda7744b09826b2e8d712b28db0e7d366e379fe1 100644 (file)
@@ -12,16 +12,16 @@ static struct testdata {
   int size;
   int numiter;
 } sizes[] = {
-    {16, 400},
-    {64, 400},
-    {256, 100},
-    {1024, 100},
-    {4096, 100},
-    {16384, 100},
-    {65536, 40},
-    {524288, 10},
-    {1048576, 4},
-    {-1, -1},
+  {16, 400},
+  {64, 400},
+  {256, 100},
+  {1024, 100},
+  {4096, 100},
+  {16384, 100},
+  {65536, 40},
+  {524288, 10},
+  {1048576, 4},
+  {-1, -1},
 };
 
 typedef struct message_ {
@@ -39,7 +39,7 @@ static void fillMessage(Message* msg) {
   for (i = 0; i < items; i++) msg->data[i] = i + 0x1234;
 }
 
-/*
+#if 0
 static void checkMessage(Message *msg)
 {
   int i, size, items;
@@ -49,7 +49,8 @@ static void checkMessage(Message *msg)
     if(msg->data[i] != (i+0x1234))
       CmiAbort("[flood] Data corrupted. Run megacon !!\n");
   }
-}*/
+}
+#endif
 
 typedef struct Time_ {
   char core[CmiMsgHeaderSizeBytes];
@@ -113,16 +114,19 @@ static void recvTime(TimeMessage* msg) {
     CmiPrintf("[flood] CmiSyncSend %d \n", MSGNUMS);
     for (j = 0; j < pva(numSizes); j++) {
       CmiPrintf("flood %d       \t%.4f GBytes/sec\n", sizes[j].size,
-                sizes[j].size * MSGNUMS / pva(gavg)[j] / 1e9);
-      /*    CmiPrintf("[flood] size=%d\taverageTime=%le seconds\n",
-                                  sizes[j].size, pva(gavg)[j]);
-            CmiPrintf("[flood] size=%d\tmaxTime=%le seconds\t[%d->%d]\n",
-                        sizes[j].size,
-         pva(gmax)[j],pva(gmaxSrc)[j],pva(gmaxDest)[j]);
-            CmiPrintf("[flood] size=%d\tminTime=%le seconds\t[%d->%d]\n",
-                        sizes[j].size,
-         pva(gmin)[j],pva(gminSrc)[j],pva(gminDest)[j]);
-      */
+          sizes[j].size * MSGNUMS / pva(gavg)[j] / 1e9);
+
+#if 0
+      CmiPrintf("[flood] size=%d\taverageTime=%le seconds\n",
+          sizes[j].size, pva(gavg)[j]);
+      CmiPrintf("[flood] size=%d\tmaxTime=%le seconds\t[%d->%d]\n",
+          sizes[j].size,
+          pva(gmax)[j],pva(gmaxSrc)[j],pva(gmaxDest)[j]);
+      CmiPrintf("[flood] size=%d\tminTime=%le seconds\t[%d->%d]\n",
+          sizes[j].size,
+          pva(gmin)[j],pva(gminSrc)[j],pva(gminDest)[j]);
+#endif
+
     }
     CmiSetHandler(&m, pva(ack_handler));
     CmiSyncSend(0, sizeof(EmptyMsg), &m);
@@ -159,7 +163,7 @@ static void startNextNbr(EmptyMsg* msg) {
     tm = (TimeMessage*)CmiAlloc(size);
     for (i = 0; i < CmiNumPes(); i++)
       memcpy(tm->data + i * pva(numSizes), pva(times)[i],
-             sizeof(double) * pva(numSizes));
+          sizeof(double) * pva(numSizes));
     tm->srcNode = CmiMyPe();
     CmiSetHandler(tm, pva(timeHandler));
     CmiSyncSendAndFree(0, size, tm);
@@ -205,8 +209,8 @@ static void startNextIter(Message* msg) {
       pva(endtime) = CmiWallTimer();
       /* checkMessage(msg); */
       pva(times)[pva(nextNbr)][pva(nextSize)] =
-          (pva(endtime) - pva(starttime)) /
-          (2.0 * sizes[pva(nextSize)].numiter);
+        (pva(endtime) - pva(starttime)) /
+        (2.0 * sizes[pva(nextSize)].numiter);
       pva(nextIter) = -1;
       CmiSetHandler(&m, pva(sizeHandler));
       CmiSyncSend(CmiMyPe(), sizeof(EmptyMsg), &m);
@@ -216,7 +220,7 @@ static void startNextIter(Message* msg) {
   } else {
     CmiSetHandler(msg, pva(bounceHandler));
     CmiSyncSendAndFree(pva(nextNbr), sizeof(Message) + sizes[msg->idx].size,
-                       msg);
+        msg);
   }
 }
 
index 5d3e0b100e1878b66cf6bf274020111b45257117..6e0f6a7925e8074854f9a77e4d74fdf313309d01 100644 (file)
@@ -95,7 +95,7 @@ void memoryTest() {
     size = 1;
     for (i = 0; i < POWER; i++, size *= 2) {
       CmiPrintf("%d\t%d\t%E\t%E\t%E\t%E\n", size, CLUBMALLOC, times[i][0],
-                times[i][1], times[i][2], times[i][3]);
+          times[i][1], times[i][2], times[i][3]);
     }
   }
 
index 6b4f6e2b43f93359dc798d14bd03d93afbad6214..5b9c348a98ed4ab1a632b92e9931bfa603aed741 100644 (file)
@@ -13,13 +13,13 @@ static struct testdata {
   int numiter;
   double time;
 } sizes[] = {
-    {0, 1024, 0.0},
-    {16, 1024, 0.0},
-    {256, 1024, 0.0},
-    {4096, 1024, 0.0},
-    {65536, 1024, 0.0},
-    {1048576, 1024, 0.0},
-    {-1, -1, 0.0},
+  {0, 1024, 0.0},
+  {16, 1024, 0.0},
+  {256, 1024, 0.0},
+  {4096, 1024, 0.0},
+  {65536, 1024, 0.0},
+  {1048576, 1024, 0.0},
+  {-1, -1, 0.0},
 };
 
 static const char sync_outstr[] = "[overhead] (%s) %le seconds per %d bytes\n";
@@ -29,7 +29,7 @@ static void print_results(const char* func) {
 
   while (sizes[i].size != (-1)) {
     CmiPrintf(sync_outstr, func, sizes[i].time / sizes[i].numiter,
-              sizes[i].size);
+        sizes[i].size);
     i++;
   }
 }
@@ -118,7 +118,7 @@ static void free_handler(void* msg) {
       CmiSetHandler(msg, CpvAccess(free_handler));
       CpvAccess(starttime) = CmiWallTimer();
       CmiSyncSendAndFree(CmiMyPe(), CmiMsgHeaderSizeBytes + sizes[idx].size,
-                         msg);
+          msg);
     }
   }
 }
index 3fcb59d5ec74ddaad014147c502a0d486e0b28c0..8946b99aa41d88513481e5569da57ee195fdce6a 100644 (file)
@@ -10,16 +10,16 @@ static struct testdata {
   int size;
   int numiter;
 } sizes[] = {
-    {16, 4000},
-    {128, 4000},
-    {512, 1000},
-    {2048, 1000},
-    {8192, 1000},
-    {32768, 100},
-    {131072, 100},
-    {1048576, 40},
-    {4194304, 10},
-    {-1, -1},
+  {16, 4000},
+  {128, 4000},
+  {512, 1000},
+  {2048, 1000},
+  {8192, 1000},
+  {32768, 100},
+  {131072, 100},
+  {1048576, 40},
+  {4194304, 10},
+  {-1, -1},
 };
 
 typedef struct message_ {
@@ -31,7 +31,7 @@ typedef struct message_ {
 } Message;
 
 
-/*
+#if 0
 static void fillMessage(Message* msg) {
   int i, size, items;
   size = sizes[msg->idx].size + sizeof(double);
@@ -48,7 +48,7 @@ static void checkMessage(Message* msg) {
       CmiAbort("[pingpong] Data corrupted. Run megacon !!\n");
   }
 }
-*/
+#endif
 
 typedef struct Time_ {
   char core[CmiMsgHeaderSizeBytes];
@@ -114,13 +114,16 @@ static void recvTime(TimeMessage* msg) {
       pva(gavg)[j] /= (CmiNumNodes() * (CmiNumNodes() - 1));
     for (j = 0; j < pva(numSizes); j++) {
       CmiPrintf("%d\t\t%le\n", sizes[j].size, pva(gavg)[j]);
-   /* CmiPrintf("[pingpong] size=%d\tmaxTime=%le seconds\t[%d->%d]\n",
-                sizes[j].size,
-                pva(gmax)[j],pva(gmaxSrc)[j],pva(gmaxDest)[j]);
+
+#if 0
+      CmiPrintf("[pingpong] size=%d\tmaxTime=%le seconds\t[%d->%d]\n",
+          sizes[j].size,
+          pva(gmax)[j],pva(gmaxSrc)[j],pva(gmaxDest)[j]);
       CmiPrintf("[pingpong] size=%d\tminTime=%le seconds\t[%d->%d]\n",
-                sizes[j].size,
-                pva(gmin)[j],pva(gminSrc)[j],pva(gminDest)[j]);
-      */
+          sizes[j].size,
+          pva(gmin)[j],pva(gminSrc)[j],pva(gminDest)[j]);
+#endif
+
     }
     CmiSetHandler(&m, pva(ack_handler));
     CmiSyncSend(0, sizeof(EmptyMsg), &m);
@@ -159,7 +162,7 @@ static void startNextNbr(EmptyMsg* msg) {
     tm = (TimeMessage*)CmiAlloc(size);
     for (i = 0; i < CmiNumNodes(); i++)
       memcpy(tm->data + i * pva(numSizes), pva(times)[i],
-             sizeof(double) * pva(numSizes));
+          sizeof(double) * pva(numSizes));
     tm->srcNode = CmiMyNode();
     CmiSetHandler(tm, pva(timeHandler));
     CmiSyncSendAndFree(0, size, tm);
@@ -185,7 +188,7 @@ static void startNextSize(EmptyMsg* msg) {
     int size = sizeof(Message) + sizes[pva(nextSize)].size;
 
     pva(buffer_msgs) =
-        (char*)malloc((sizes[pva(nextSize)].numiter) * sizeof(Message*));
+      (char*)malloc((sizes[pva(nextSize)].numiter) * sizeof(Message*));
     for (i = 0; i < sizes[pva(nextSize)].numiter; i++) {
       mm = (Message *)CmiAlloc(size);
       mm->srcpe = CmiMyPe();
@@ -221,7 +224,7 @@ static void startNextIter(Message* msg) {
     pva(buffer_msgs) = 0;
 
     pva(times)[pva(nextNbr)][pva(nextSize)] =
-        (pva(endtime) - pva(starttime)) / (2.0 * sizes[pva(nextSize)].numiter);
+      (pva(endtime) - pva(starttime)) / (2.0 * sizes[pva(nextSize)].numiter);
     pva(nextIter) = -1;
     CmiSetHandler(&m, pva(sizeHandler));
     CmiSyncSend(CmiMyPe(), sizeof(EmptyMsg), &m);
@@ -271,14 +274,14 @@ static void setupMessage(Message* msg) {
 }
 static void startMessage(Message* msg) {
 #if 0
-    EmptyMsg m;
-   
-    CmiFree(msg);
+  EmptyMsg m;
 
-    CmiSetHandler(&m, pva(iterHandler));
-    /* fillMessage(mm); */
-    pva(starttime) = CmiWallTimer();
-    CmiSyncSend(CmiMyPe(), sizeof(EmptyMsg), &m);
+  CmiFree(msg);
+
+  CmiSetHandler(&m, pva(iterHandler));
+  /* fillMessage(mm); */
+  pva(starttime) = CmiWallTimer();
+  CmiSyncSend(CmiMyPe(), sizeof(EmptyMsg), &m);
 #else
   Message* mm;
   int size;
index 48b9d30de78245814c12f713b5b42df7f04afe8a..8d1f9799cb2fbc91cc3d584898fa33cbd5ec23cf 100644 (file)
@@ -10,16 +10,16 @@ static struct testdata {
   int size;
   int numiter;
 } sizes[] = {
-    {16, 1},
-    {128, 400},
-    {512, 100},
-    {2048, 100},
-    {8192, 100},
-    {32768, 100},
-    {131072, 20},
-    {1048576, 10},
-    {8388608, 4},
-    {-1, -1},
+  {16, 1},
+  {128, 400},
+  {512, 100},
+  {2048, 100},
+  {8192, 100},
+  {32768, 100},
+  {131072, 20},
+  {1048576, 10},
+  {8388608, 4},
+  {-1, -1},
 };
 
 typedef struct message_ {
@@ -107,11 +107,11 @@ static void recvTime(TimeMessage* msg) {
     CmiPrintf("[pingpong] CmiSyncSend\n");
     for (j = 0; j < pva(numSizes); j++) {
       CmiPrintf("[pingpong] size=%d\taverageTime=%le seconds\n", sizes[j].size,
-                pva(gavg)[j]);
+          pva(gavg)[j]);
       CmiPrintf("[pingpong] size=%d\tmaxTime=%le seconds\t[%d->%d]\n",
-                sizes[j].size, pva(gmax)[j], pva(gmaxSrc)[j], pva(gmaxDest)[j]);
+          sizes[j].size, pva(gmax)[j], pva(gmaxSrc)[j], pva(gmaxDest)[j]);
       CmiPrintf("[pingpong] size=%d\tminTime=%le seconds\t[%d->%d]\n",
-                sizes[j].size, pva(gmin)[j], pva(gminSrc)[j], pva(gminDest)[j]);
+          sizes[j].size, pva(gmin)[j], pva(gminSrc)[j], pva(gminDest)[j]);
     }
     CmiSetHandler(&m, pva(ack_handler));
     CmiSyncSend(0, sizeof(EmptyMsg), &m);
@@ -148,7 +148,7 @@ static void startNextNbr(EmptyMsg* msg) {
     tm = (TimeMessage*)CmiAlloc(size);
     for (i = 0; i < CmiNumPes(); i++)
       memcpy(tm->data + i * pva(numSizes), pva(times)[i],
-             sizeof(double) * pva(numSizes));
+          sizeof(double) * pva(numSizes));
     tm->srcNode = CmiMyPe();
     CmiSetHandler(tm, pva(timeHandler));
     CmiSyncSendAndFree(0, size, tm);
@@ -188,7 +188,7 @@ static void startNextIter(Message* msg) {
     pva(endtime) = CmiWallTimer();
     checkMessage(msg);
     pva(times)[pva(nextNbr)][pva(nextSize)] =
-        (pva(endtime) - pva(starttime)) / (2.0 * sizes[pva(nextSize)].numiter);
+      (pva(endtime) - pva(starttime)) / (2.0 * sizes[pva(nextSize)].numiter);
     pva(nextIter) = -1;
     CmiSetHandler(&m, pva(sizeHandler));
     CmiSyncSend(CmiMyPe(), sizeof(EmptyMsg), &m);
@@ -196,7 +196,7 @@ static void startNextIter(Message* msg) {
   } else {
     CmiSetHandler(msg, pva(bounceHandler));
     CmiSyncSendAndFree(pva(nextNbr), sizeof(Message) + sizes[msg->idx].size,
-                       msg);
+        msg);
   }
 }
 
index 577ea882c6f738152806665042c94f2626ac45c4..c95eaf40e0caffe4642365ae058d575b3763beba 100644 (file)
@@ -63,7 +63,7 @@ static void collectNumbers(ProcMsg* msg) {
       CpvAccess(parPI) = 4.0 * CpvAccess(success) / NTRIALS;
       npes = iround(CpvAccess(Time1) / CpvAccess(TimeN));
       CmiPrintf("[proc] Tseq = %le seconds, Tpar = %le seconds\n",
-                CpvAccess(Time1), CpvAccess(TimeN));
+          CpvAccess(Time1), CpvAccess(TimeN));
       CmiPrintf("[proc] CmiNumPes() reported %d processors\n", CmiNumPes());
       CmiPrintf("[proc] But actual number of processors is %d\n", npes);
       CmiPrintf("[proc] FYI, appox PI (seq) = %lf\n", CpvAccess(seqPI));
index 47b56d0b37aa76c5a5b1bb1eda305c3c3cb4313d..de488ff33e3f7c1ab6395a7ff8441c4081cb4ec0 100644 (file)
@@ -40,17 +40,17 @@ static struct testdata {
   int numiter;
   double time;
 } sizes[] = {
-    {4, MAXITER, 0.0},
-    {16, MAXITER, 0.0},
-    {64, MAXITER, 0.0},
-    {256, MAXITER, 0.0},
-    {1024, MAXITER, 0.0},
-    {4096, MAXITER, 0.0},
-    {16384, MAXITER, 0.0},
-    {65536, MAXITER, 0.0},
-    {262144, MAXITER, 0.0},
-    {1048576, MAXITER, 0.0},
-    {-1, -1, 0.0},
+  {4, MAXITER, 0.0},
+  {16, MAXITER, 0.0},
+  {64, MAXITER, 0.0},
+  {256, MAXITER, 0.0},
+  {1024, MAXITER, 0.0},
+  {4096, MAXITER, 0.0},
+  {16384, MAXITER, 0.0},
+  {65536, MAXITER, 0.0},
+  {262144, MAXITER, 0.0},
+  {1048576, MAXITER, 0.0},
+  {-1, -1, 0.0},
 };
 
 typedef struct _varmsg {
@@ -80,7 +80,7 @@ static void print_results(const char* func) {
 
   while (sizes[i].size != (-1)) {
     CmiPrintf(sync_outstr, func, sizes[i].time / sizes[i].numiter,
-              sizes[i].size);
+        sizes[i].size);
     i++;
   }
 }
@@ -130,11 +130,11 @@ static void reduction_central(void* msg) {
   ptimemsg tmsg = (ptimemsg)msg;
   if (CpvAccess(currentPe) == 0) {
     CpvAccess(lasttime) =
-        CpvAccess(endtime) - tmsg->time - CpvAccess(timediff)[tmsg->srcpe];
+      CpvAccess(endtime) - tmsg->time - CpvAccess(timediff)[tmsg->srcpe];
   } else if ((CpvAccess(endtime) - tmsg->time -
-              CpvAccess(timediff)[tmsg->srcpe]) > CpvAccess(lasttime)) {
+        CpvAccess(timediff)[tmsg->srcpe]) > CpvAccess(lasttime)) {
     CpvAccess(lasttime) =
-        CpvAccess(endtime) - tmsg->time - CpvAccess(timediff)[tmsg->srcpe];
+      CpvAccess(endtime) - tmsg->time - CpvAccess(timediff)[tmsg->srcpe];
   }
   CmiFree(msg);
   CpvAccess(currentPe)++;
@@ -219,11 +219,11 @@ void reduction_moduleinit(void) {
   CpvAccess(flip) = 0;
   CpvAccess(timediff) = (pdouble)malloc(CmiNumPes() * sizeof(double));
   CpvAccess(reduction_starter) =
-      CmiRegisterHandler((CmiHandler)reduction_starter);
+    CmiRegisterHandler((CmiHandler)reduction_starter);
   CpvAccess(reduction_handler) =
-      CmiRegisterHandler((CmiHandler)reduction_handler);
+    CmiRegisterHandler((CmiHandler)reduction_handler);
   CpvAccess(reduction_central) =
-      CmiRegisterHandler((CmiHandler)reduction_central);
+    CmiRegisterHandler((CmiHandler)reduction_central);
   CpvAccess(sync_starter) = CmiRegisterHandler((CmiHandler)sync_starter);
   CpvAccess(sync_reply) = CmiRegisterHandler((CmiHandler)sync_reply);
 }
index e6650aa87fac6556f558fed4840042ef035fc1d4..ff2633e09bfc8be7c0541b866f726f7da75ac9c3 100644 (file)
@@ -28,7 +28,7 @@ static void barrierHandler(EmptyMsg* msg) {
     endtime = CmiWallTimer();
     if (CmiMyPe() == 0) {
       CmiPrintf("[smputil] Barrier Overhead: %le seconds\n",
-                (endtime - starttime - loopOverhead) / NBARRITER);
+          (endtime - starttime - loopOverhead) / NBARRITER);
       CmiSetHandler(msg, CpvAccess(ack_handler));
       CmiSyncSend(0, sizeof(EmptyMsg), msg);
     }
@@ -94,17 +94,17 @@ void smputil_init(void) {
   for (i = 0; i < NVARITER; i++) stackVar += 1.0;
   endtime = CmiWallTimer();
   CmiPrintf("[smputil] StackVar Access Overhead: %le seconds\n",
-            (endtime - starttime - loopOverhead) / NVARITER);
+      (endtime - starttime - loopOverhead) / NVARITER);
   starttime = CmiWallTimer();
   for (i = 0; i < NVARITER; i++) CpvAccess(privateVar) += 1.0;
   endtime = CmiWallTimer();
   CmiPrintf("[smputil] ProcPrivateVar Access Overhead: %le seconds\n",
-            (endtime - starttime - loopOverhead) / NVARITER);
+      (endtime - starttime - loopOverhead) / NVARITER);
   starttime = CmiWallTimer();
   for (i = 0; i < NVARITER; i++) CsvAccess(sharedVar) += 1.0;
   endtime = CmiWallTimer();
   CmiPrintf("[smputil] SharedVar Access Overhead: %le seconds\n",
-            (endtime - starttime - loopOverhead) / NVARITER);
+      (endtime - starttime - loopOverhead) / NVARITER);
   starttime = CmiWallTimer();
   for (i = 0; i < NBARRITER; i++)
     ;
@@ -117,7 +117,7 @@ void smputil_init(void) {
   }
   endtime = CmiWallTimer();
   CmiPrintf("[smputil] LockUnlock Overhead: %le seconds\n",
-            (endtime - starttime - loopOverhead) / NLOCKITER);
+      (endtime - starttime - loopOverhead) / NLOCKITER);
 
   endtime = memoryAllocTest();
   CmiPrintf(
index 444ff38f38efbd18f99d23a6b4aeac9f4ce368aa..a14a4cf7dbe3904ee5308f1c65c54b345357763f 100644 (file)
@@ -12,22 +12,22 @@ void timer_init(void) {
   for (i = 0; i < NITER; i++) CmiCpuTimer();
   endtime = CmiWallTimer();
   CmiPrintf("[timer] (CmiCpuTimer) %le seconds per call\n",
-            (endtime - starttime) / NITER);
+      (endtime - starttime) / NITER);
   starttime = CmiWallTimer();
   for (i = 0; i < NITER; i++) CmiWallTimer();
   endtime = CmiWallTimer();
   CmiPrintf("[timer] (CmiWallTimer) %le seconds per call\n",
-            (endtime - starttime) / NITER);
+      (endtime - starttime) / NITER);
   starttime = CmiCpuTimer();
   while ((endtime = CmiCpuTimer()) == starttime)
     ;
   CmiPrintf("[timer] (CmiCpuTimer) %le seconds resolution\n",
-            endtime - starttime);
+      endtime - starttime);
   starttime = CmiWallTimer();
   while ((endtime = CmiWallTimer()) == starttime)
     ;
   CmiPrintf("[timer] (CmiWallTimer) %le seconds resolution\n",
-            endtime - starttime);
+      endtime - starttime);
   CmiSetHandler(&msg, CpvAccess(ack_handler));
   CmiSyncSend(0, sizeof(EmptyMsg), &msg);
 }
index d6a57f872fac7124a0c2fc30ae40dedc3d0005dd..f90b4ffa795b54ff9feb841ccddfa1fa241f2543 100644 (file)
@@ -1,10 +1,10 @@
 /**
-Tests out Cth routines, by running a set of threads
-that create new threads.  The pattern of creations
-and yeilds is deterministic but complicated.
+  Tests out Cth routines, by running a set of threads
+  that create new threads.  The pattern of creations
+  and yeilds is deterministic but complicated.
 
-Orion Lawlor, olawlor@acm.org, 2004/2/20
-*/
+  Orion Lawlor, olawlor@acm.org, 2004/2/20
+  */
 #include <stdio.h>
 #include "converse.h"
 #include <stdlib.h>
@@ -43,9 +43,9 @@ void runThread(void* msg) {
 
   for (int iter = 0; iter < NITER; iter++) {
     VERBOSE(char buf[NITER + 2];
-            for (int i = 0; i < NITER + 1; i++) buf[i] = ' '; buf[0] = myId;
-            buf[1 + iter] = '0' + (iter % 10); buf[NITER + 1] = 0;
-            printf("%s\n", buf);)
+        for (int i = 0; i < NITER + 1; i++) buf[i] = ' '; buf[0] = myId;
+        buf[1 + iter] = '0' + (iter % 10); buf[NITER + 1] = 0;
+        printf("%s\n", buf);)
     if ((iter % 2) == 0) {  // (rand()%NITER)<5) {
       CthYield();
     }
@@ -61,7 +61,7 @@ void runThread(void* msg) {
   if (nThreadFinish == NSPAWN) {  // We're the last thread: leave
     double timeElapsed = CmiWallTimer() - timeStart;
     printf(" %d threads ran successfully (%.3f us per context switch)\n",
-           nThreadFinish, 1.0e6 * timeElapsed / (NITER * NSPAWN));
+          nThreadFinish, 1.0e6 * timeElapsed / (NITER * NSPAWN));
     CsdExitScheduler();
   }
 }
index 1b47f9123f2886cc82aad1fbb3309196aa7f556a..c620a1c90ae0388e004d40762e621e66e58af059 100644 (file)
@@ -1,15 +1,15 @@
 
 /****************************************************
-             Measures the degree of pipeling in the network interface.
-             Each processor sends K messages and the destination
-             responds with 1 message. Depending on the message size
-             different bottlenecks in the pipeline will affect the
-             rate of message passing. For short message it could be
-             NIC processing and for large messages it will be network
-             bandwidth.
+  Measures the degree of pipeling in the network interface.
+  Each processor sends K messages and the destination
+  responds with 1 message. Depending on the message size
+  different bottlenecks in the pipeline will affect the
+  rate of message passing. For short message it could be
+  NIC processing and for large messages it will be network
+  bandwidth.
 
-   - Sameer Kumar 03/08/05
-**********************************************************/
+  - Sameer Kumar 03/08/05
+ **********************************************************/
 
 
 #include <stdlib.h>
@@ -38,9 +38,11 @@ CpvStaticDeclare(double,endTime);
 CpvStaticDeclare(int, kFactor);
 CpvStaticDeclare(int, nRecvd);
 
-#define K_FACTOR 16   //Node 0 sends K_FACTOR messages to Node 1 
-                       //and gets an ack for them. The benchmark 
-                       //measures bandwidth for this burst of K_FACTOR messages
+#define K_FACTOR 16
+/* Node 0 sends K_FACTOR messages to Node 1
+ * and gets an ack for them. The benchmark
+ * measures bandwidth for this burst of K_FACTOR messages
+ */
 
 //Compute idle time too. Accuracy of idle time depends on the machine layer
 CpvDeclare(double, IdleStartTime);
@@ -49,15 +51,15 @@ CpvDeclare(double, IdleTime);
 //Register Idle time handlers
 void ApplIdleStart(void *, double start)
 {
-    CpvAccess(IdleStartTime)= start; //CmiWallTimer();
-    return;
+  CpvAccess(IdleStartTime)= start; //CmiWallTimer();
+  return;
 }
 
 void ApplIdleEnd(void *, double cur)
 {
   if(CpvAccess(IdleStartTime) < 0)
-      return;
-  
+    return;
+
   CpvAccess(IdleTime) += cur /*CmiWallTimer()*/-CpvAccess(IdleStartTime);
   CpvAccess(IdleStartTime)=-1;
   return;
@@ -65,201 +67,200 @@ void ApplIdleEnd(void *, double cur)
 
 void startOperation()
 {
-    CpvAccess(cycleNum) = 0;
-    CpvAccess(msgSize) = (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)*2 + 
-        CmiMsgHeaderSizeBytes;
+  CpvAccess(cycleNum) = 0;
+  CpvAccess(msgSize) = (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)*2 +
+    CmiMsgHeaderSizeBytes;
 
-    char *msg = (char *)CmiAlloc(CpvAccess(msgSize));
-    *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
-    
-    CmiSetHandler(msg,CpvAccess(node0Handler));
-    CmiSyncSendAndFree(CmiMyPe(), CpvAccess(msgSize), msg);
-    
-    CpvAccess(startTime) = CmiWallTimer();
-    CpvAccess(IdleTime) = 0.0;
+  char *msg = (char *)CmiAlloc(CpvAccess(msgSize));
+  *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
+
+  CmiSetHandler(msg,CpvAccess(node0Handler));
+  CmiSyncSendAndFree(CmiMyPe(), CpvAccess(msgSize), msg);
+
+  CpvAccess(startTime) = CmiWallTimer();
+  CpvAccess(IdleTime) = 0.0;
 }
 
 //Finished operation, so time it
 void operationFinished(char *msg)
 {
-    CmiFree(msg);
-    double cycle_time = 
-        (1e6*(CpvAccess(endTime)-CpvAccess(startTime)))/
-        (1.0*nCycles*(CpvAccess(kFactor)+1));
+  CmiFree(msg);
+  double cycle_time =
+    (1e6*(CpvAccess(endTime)-CpvAccess(startTime)))/
+    (1.0*nCycles*(CpvAccess(kFactor)+1));
 
-    double compute_time = cycle_time - 
-        (1e6*(CpvAccess(IdleTime)))/(1.0*nCycles*(CpvAccess(kFactor)+1));
+  double compute_time = cycle_time -
+    (1e6*(CpvAccess(IdleTime)))/(1.0*nCycles*(CpvAccess(kFactor)+1));
 
 #if ENABLE_TIMER
-    CmiPrintf("[%d] %d \t %5.3lfus \t %5.3lfus\n", CmiMyPe(),
-              CpvAccess(msgSize) - CmiMsgHeaderSizeBytes, 
-              cycle_time, compute_time);
+  CmiPrintf("[%d] %d \t %5.3lfus \t %5.3lfus\n", CmiMyPe(),
+      CpvAccess(msgSize) - CmiMsgHeaderSizeBytes,
+      cycle_time, compute_time);
 #endif
-    
-    if (CpvAccess(msgSize) < maxMsgSize)
-        startOperation();
-    else {
-      void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-      CmiSetHandler(sendmsg,CpvAccess(ackHandler));
-      CmiSyncSendAndFree(0, CmiMsgHeaderSizeBytes, sendmsg);
-    }
+
+  if (CpvAccess(msgSize) < maxMsgSize)
+    startOperation();
+  else {
+    void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler(sendmsg,CpvAccess(ackHandler));
+    CmiSyncSendAndFree(0, CmiMsgHeaderSizeBytes, sendmsg);
+  }
 }
 
 CmiHandler ackHandlerFunc(char *msg)
 {
-    CmiFree(msg);
-    CpvAccess(ackCount)++;
-    int max = CpvAccess(twoway) ? CmiNumPes() : CmiNumPes()/2;
-    if(CpvAccess(ackCount) == max) {
-      void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-      CmiSetHandler(sendmsg,CpvAccess(exitHandler));
-      CmiSyncBroadcastAllAndFree(CmiMsgHeaderSizeBytes,sendmsg);
-    }
-    return 0;
+  CmiFree(msg);
+  CpvAccess(ackCount)++;
+  int max = CpvAccess(twoway) ? CmiNumPes() : CmiNumPes()/2;
+  if(CpvAccess(ackCount) == max) {
+    void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler(sendmsg,CpvAccess(exitHandler));
+    CmiSyncBroadcastAllAndFree(CmiMsgHeaderSizeBytes,sendmsg);
+  }
+  return 0;
 }
 
 CmiHandler exitHandlerFunc(char *msg)
 {
-    CmiFree(msg);
-    CsdExitScheduler();
-    return 0;
+  CmiFree(msg);
+  CsdExitScheduler();
+  return 0;
 }
 
 // Converse handler for beginning operation
 CmiHandler startOperationHandlerFunc(char *msg)
 {
-    CcdCallOnConditionKeep(CcdPROCESSOR_BEGIN_IDLE, ApplIdleStart, NULL);
-    CcdCallOnConditionKeep(CcdPROCESSOR_END_IDLE, ApplIdleEnd, NULL);
+  CcdCallOnConditionKeep(CcdPROCESSOR_BEGIN_IDLE, ApplIdleStart, NULL);
+  CcdCallOnConditionKeep(CcdPROCESSOR_END_IDLE, ApplIdleEnd, NULL);
 
-    if ((CmiMyPe() < CmiNumPes()/2) || CpvAccess(twoway))
-        startOperation();
-    return 0;
+  if ((CmiMyPe() < CmiNumPes()/2) || CpvAccess(twoway))
+    startOperation();
+  return 0;
 }
 
 //The handler that sends out K_FACTOR messages
 CmiHandler node0HandlerFunc(char *msg)
 {
-    CpvAccess(cycleNum) ++;
-    
-    if (CpvAccess(cycleNum) == nCycles) {
-        CpvAccess(endTime) = CmiWallTimer();
-        operationFinished(msg);
-    }
-    else {
-        CmiSetHandler(msg,CpvAccess(node1Handler));
-        *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
-        int dest = CmiNumPes() - CmiMyPe() - 1;
-        
-        for(int count = 0; count < CpvAccess(kFactor); count++) {
-            CmiSyncSend(dest,CpvAccess(msgSize),msg);
-        }
-        CmiFree(msg);
+  CpvAccess(cycleNum) ++;
+
+  if (CpvAccess(cycleNum) == nCycles) {
+    CpvAccess(endTime) = CmiWallTimer();
+    operationFinished(msg);
+  }
+  else {
+    CmiSetHandler(msg,CpvAccess(node1Handler));
+    *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
+    int dest = CmiNumPes() - CmiMyPe() - 1;
+
+    for(int count = 0; count < CpvAccess(kFactor); count++) {
+      CmiSyncSend(dest,CpvAccess(msgSize),msg);
     }
-    
-    return 0;
+    CmiFree(msg);
+  }
+
+  return 0;
 }
 
 //Receive K_FACTOR messages and send an ack back
 CmiHandler node1HandlerFunc(char *msg)
 {
-    CpvAccess(nRecvd) ++;
-    if(CpvAccess(nRecvd) != CpvAccess(kFactor)) {
-        CmiFree(msg);    
-        return 0;
-    }
-    
-    CpvAccess(nRecvd) = 0;
-    
-    int size = *((int *)(msg+CmiMsgHeaderSizeBytes));
-    CmiSetHandler(msg,CpvAccess(node0Handler));
-    
-    int dest = CmiNumPes() - CmiMyPe() - 1;
-    CmiSyncSendAndFree(dest,size,msg);
+  CpvAccess(nRecvd) ++;
+  if(CpvAccess(nRecvd) != CpvAccess(kFactor)) {
+    CmiFree(msg);
     return 0;
+  }
+
+  CpvAccess(nRecvd) = 0;
+
+  int size = *((int *)(msg+CmiMsgHeaderSizeBytes));
+  CmiSetHandler(msg,CpvAccess(node0Handler));
+
+  int dest = CmiNumPes() - CmiMyPe() - 1;
+  CmiSyncSendAndFree(dest,size,msg);
+  return 0;
 }
 
 CmiStartFn mymain(int argc, char **argv)
 {
-    CpvInitialize(int,msgSize);
-    CpvInitialize(int,cycleNum);
-    
-    CpvInitialize(int, kFactor);
-    CpvInitialize(int, nRecvd);
-    
-    CpvAccess(msgSize)= CmiMsgHeaderSizeBytes + 8;    
-    CpvAccess(kFactor) = K_FACTOR;
-    CpvAccess(nRecvd) = 0;
-
-    CpvInitialize(int,exitHandler);
-    CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
-    CpvInitialize(int,node0Handler);
-    CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
-    CpvInitialize(int,node1Handler);
-    CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
-    CpvInitialize(int,ackHandler);
-    CpvAccess(ackHandler) = CmiRegisterHandler((CmiHandler) ackHandlerFunc);
-    CpvInitialize(int,startOperationHandler);
-    CpvAccess(startOperationHandler) = CmiRegisterHandler((CmiHandler) startOperationHandlerFunc);
-    
-    CpvInitialize(double,startTime);
-    CpvInitialize(double,endTime);
-    
-    CpvInitialize(double, IdleStartTime);
-    CpvInitialize(double, IdleTime);
-
-    CpvInitialize(int,ackCount);
-    CpvAccess(ackCount) = 0;
-
-    CpvInitialize(int,twoway);
-    CpvAccess(twoway) = 0;
-
-    // Set runtime cpuaffinity
-    CmiInitCPUAffinity(argv);
-
-    // Initialize CPU topology
-    CmiInitCPUTopology(argv);
-
-    // Wait for all PEs of the node to complete topology init
-    CmiNodeAllBarrier();
-
-    // Update the argc after runtime parameters are extracted out
-    argc = CmiGetArgc(argv);
-
-    if(argc > 1)
-        CpvAccess(twoway) = atoi(argv[1]);
-    
-    if(argc > 2)
-        CpvAccess(kFactor) = atoi(argv[2]);
-
-    int otherPe = CmiMyPe() ^ 1;
-    
-    if(CmiMyRank() == CmiMyNodeSize()) return 0;
-
-    if(CmiMyPe() == 0) {
-        if(!CpvAccess(twoway))
-            CmiPrintf("Starting Multiping with oneway traffic, kFactor = %d\n", 
-                      CpvAccess(kFactor));
-        else
-            CmiPrintf("Starting Multiping with twoway traffic, kFactor = %d\n", 
-                      CpvAccess(kFactor));
-    }
+  CpvInitialize(int,msgSize);
+  CpvInitialize(int,cycleNum);
 
+  CpvInitialize(int, kFactor);
+  CpvInitialize(int, nRecvd);
 
-    // Node 0 waits till all processors finish their topology processing
-    if(CmiMyPe() == 0) {
-        // Signal all PEs to begin computing
-        char *startOperationMsg = (char *)CmiAlloc(CmiMsgHeaderSizeBytes);
-        CmiSetHandler((char *)startOperationMsg, CpvAccess(startOperationHandler));
-        CmiSyncBroadcastAndFree(CmiMsgHeaderSizeBytes, startOperationMsg);
+  CpvAccess(msgSize)= CmiMsgHeaderSizeBytes + 8;
+  CpvAccess(kFactor) = K_FACTOR;
+  CpvAccess(nRecvd) = 0;
 
-        // start operation locally on PE 0
-        startOperationHandlerFunc(NULL);
-    }
-    return 0;
+  CpvInitialize(int,exitHandler);
+  CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
+  CpvInitialize(int,node0Handler);
+  CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
+  CpvInitialize(int,node1Handler);
+  CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
+  CpvInitialize(int,ackHandler);
+  CpvAccess(ackHandler) = CmiRegisterHandler((CmiHandler) ackHandlerFunc);
+  CpvInitialize(int,startOperationHandler);
+  CpvAccess(startOperationHandler) = CmiRegisterHandler((CmiHandler) startOperationHandlerFunc);
+
+  CpvInitialize(double,startTime);
+  CpvInitialize(double,endTime);
+
+  CpvInitialize(double, IdleStartTime);
+  CpvInitialize(double, IdleTime);
+
+  CpvInitialize(int,ackCount);
+  CpvAccess(ackCount) = 0;
+
+  CpvInitialize(int,twoway);
+  CpvAccess(twoway) = 0;
+
+  // Set runtime cpuaffinity
+  CmiInitCPUAffinity(argv);
+
+  // Initialize CPU topology
+  CmiInitCPUTopology(argv);
+
+  // Wait for all PEs of the node to complete topology init
+  CmiNodeAllBarrier();
+
+  // Update the argc after runtime parameters are extracted out
+  argc = CmiGetArgc(argv);
+
+  if(argc > 1)
+    CpvAccess(twoway) = atoi(argv[1]);
+
+  if(argc > 2)
+    CpvAccess(kFactor) = atoi(argv[2]);
+
+  int otherPe = CmiMyPe() ^ 1;
+
+  if(CmiMyRank() == CmiMyNodeSize()) return 0;
+
+  if(CmiMyPe() == 0) {
+    if(!CpvAccess(twoway))
+      CmiPrintf("Starting Multiping with oneway traffic, kFactor = %d\n",
+          CpvAccess(kFactor));
+    else
+      CmiPrintf("Starting Multiping with twoway traffic, kFactor = %d\n",
+          CpvAccess(kFactor));
+  }
+
+  // Node 0 waits till all processors finish their topology processing
+  if(CmiMyPe() == 0) {
+    // Signal all PEs to begin computing
+    char *startOperationMsg = (char *)CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler((char *)startOperationMsg, CpvAccess(startOperationHandler));
+    CmiSyncBroadcastAndFree(CmiMsgHeaderSizeBytes, startOperationMsg);
+
+    // start operation locally on PE 0
+    startOperationHandlerFunc(NULL);
+  }
+  return 0;
 }
 
 int main(int argc,char *argv[])
 {
-    ConverseInit(argc,argv,(CmiStartFn)mymain,0,0);
-    return 0;
+  ConverseInit(argc,argv,(CmiStartFn)mymain,0,0);
+  return 0;
 }
index 9df83080b5e302f2870f912c49f86b8ec03101da..22a9253949be4b5e2471b261d1402bdeccc86a5c 100644 (file)
@@ -1,11 +1,11 @@
 /****************************************************************
-           Benchmark tests the performance of PINGPONG with 
-           oneway and two way traffic. It reports both completion 
-           time and COU overhead. The CPU overhead is computed from 
-           the idle time, and hence can be inaccurate on some machine layers.
+  Benchmark tests the performance of PINGPONG with
+  oneway and two way traffic. It reports both completion
+  time and COU overhead. The CPU overhead is computed from
+  the idle time, and hence can be inaccurate on some machine layers.
 
-   - Sameer Kumar (03/08/05)
-*******************************************************************/
+  - Sameer Kumar (03/08/05)
+ *******************************************************************/
 
 
 #include <stdlib.h>
@@ -37,15 +37,15 @@ CpvDeclare(double, IdleTime);
 //Registering idle handlers
 void ApplIdleStart(void *, double start)
 {
-    CpvAccess(IdleStartTime)= start; //CmiWallTimer();
-    return;
+  CpvAccess(IdleStartTime)= start; //CmiWallTimer();
+  return;
 }
 
 void ApplIdleEnd(void *, double cur)
 {
   if(CpvAccess(IdleStartTime) < 0)
-      return;
-  
+    return;
+
   CpvAccess(IdleTime) += cur /*CmiWallTimer()*/-CpvAccess(IdleStartTime);
   CpvAccess(IdleStartTime)=-1;
   return;
@@ -55,176 +55,176 @@ void ApplIdleEnd(void *, double cur)
 
 void startPingpong()
 {
-    CpvAccess(cycleNum) = 0;
-    CpvAccess(msgSize) = (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)*2 + 
-        CmiMsgHeaderSizeBytes;
+  CpvAccess(cycleNum) = 0;
+  CpvAccess(msgSize) = (CpvAccess(msgSize)-CmiMsgHeaderSizeBytes)*2 +
+    CmiMsgHeaderSizeBytes;
 
-    char *msg = (char *)CmiAlloc(CpvAccess(msgSize));
-    *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
-  
-    CmiSetHandler(msg,CpvAccess(node0Handler));
-    CmiSyncSendAndFree(CmiMyPe(), CpvAccess(msgSize), msg);
-    
-    CpvAccess(startTime) = CmiWallTimer();
-    CpvAccess(IdleTime) = 0.0;
+  char *msg = (char *)CmiAlloc(CpvAccess(msgSize));
+  *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
+
+  CmiSetHandler(msg,CpvAccess(node0Handler));
+  CmiSyncSendAndFree(CmiMyPe(), CpvAccess(msgSize), msg);
+
+  CpvAccess(startTime) = CmiWallTimer();
+  CpvAccess(IdleTime) = 0.0;
 }
 
 void pingpongFinished(char *msg)
 {
-    CmiFree(msg);
-    double cycle_time = 
-        (1e6*(CpvAccess(endTime)-CpvAccess(startTime)))/(2.*nCycles);
-    double compute_time = cycle_time - 
-        (1e6*(CpvAccess(IdleTime)))/(2.*nCycles);
+  CmiFree(msg);
+  double cycle_time =
+    (1e6*(CpvAccess(endTime)-CpvAccess(startTime)))/(2.*nCycles);
+  double compute_time = cycle_time -
+    (1e6*(CpvAccess(IdleTime)))/(2.*nCycles);
 
 #if ENABLE_TIMER
-    CmiPrintf("[%d] %d \t %5.3lfus \t %5.3lfus\n", CmiMyPe(),
-              CpvAccess(msgSize) - CmiMsgHeaderSizeBytes, 
-              cycle_time, compute_time);
+  CmiPrintf("[%d] %d \t %5.3lfus \t %5.3lfus\n", CmiMyPe(),
+      CpvAccess(msgSize) - CmiMsgHeaderSizeBytes,
+      cycle_time, compute_time);
 #endif
-    
-    CpvAccess(sizeNum)++;
-    
-    if (CpvAccess(msgSize) < maxMsgSize)
-        startPingpong();
-    else {
-      void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-      CmiSetHandler(sendmsg,CpvAccess(ackHandler));
-      CmiSyncSendAndFree(0, CmiMsgHeaderSizeBytes, sendmsg);
-    }
+
+  CpvAccess(sizeNum)++;
+
+  if (CpvAccess(msgSize) < maxMsgSize)
+    startPingpong();
+  else {
+    void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler(sendmsg,CpvAccess(ackHandler));
+    CmiSyncSendAndFree(0, CmiMsgHeaderSizeBytes, sendmsg);
+  }
 }
 
 CmiHandler ackHandlerFunc(char *msg)
 {
-    CmiFree(msg);
-    CpvAccess(ackCount)++;
-    int max = CpvAccess(twoway) ? CmiNumPes() : CmiNumPes()/2;
-    if(CpvAccess(ackCount) == max) {
-      void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
-      CmiSetHandler(sendmsg,CpvAccess(exitHandler));
-      CmiSyncBroadcastAllAndFree(CmiMsgHeaderSizeBytes,sendmsg);
-    }
-    return 0;
+  CmiFree(msg);
+  CpvAccess(ackCount)++;
+  int max = CpvAccess(twoway) ? CmiNumPes() : CmiNumPes()/2;
+  if(CpvAccess(ackCount) == max) {
+    void *sendmsg = CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler(sendmsg,CpvAccess(exitHandler));
+    CmiSyncBroadcastAllAndFree(CmiMsgHeaderSizeBytes,sendmsg);
+  }
+  return 0;
 }
 
 CmiHandler exitHandlerFunc(char *msg)
 {
-    CmiFree(msg);
-    CsdExitScheduler();
-    return 0;
+  CmiFree(msg);
+  CsdExitScheduler();
+  return 0;
 }
 
 // Converse handler for beginning operation
 CmiHandler startOperationHandlerFunc(char *msg)
 {
-    CcdCallOnConditionKeep(CcdPROCESSOR_BEGIN_IDLE, ApplIdleStart, NULL);
-    CcdCallOnConditionKeep(CcdPROCESSOR_END_IDLE, ApplIdleEnd, NULL);
+  CcdCallOnConditionKeep(CcdPROCESSOR_BEGIN_IDLE, ApplIdleStart, NULL);
+  CcdCallOnConditionKeep(CcdPROCESSOR_END_IDLE, ApplIdleEnd, NULL);
 
-    if ((CmiMyPe() < CmiNumPes()/2) || CpvAccess(twoway))
-      startPingpong();
+  if ((CmiMyPe() < CmiNumPes()/2) || CpvAccess(twoway))
+    startPingpong();
 
-    return 0;
+  return 0;
 }
 
 CmiHandler node0HandlerFunc(char *msg)
 {
-    CpvAccess(cycleNum)++;
-    
-    if (CpvAccess(cycleNum) == nCycles) {
-        CpvAccess(endTime) = CmiWallTimer();
-        pingpongFinished(msg);
-    }
-    else {
-        CmiSetHandler(msg,CpvAccess(node1Handler));
-        *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
-        
-        int dest = CmiNumPes() - CmiMyPe() - 1;
-        CmiSyncSendAndFree(dest,CpvAccess(msgSize),msg);
-    }
-    
-    return 0;
+  CpvAccess(cycleNum)++;
+
+  if (CpvAccess(cycleNum) == nCycles) {
+    CpvAccess(endTime) = CmiWallTimer();
+    pingpongFinished(msg);
+  }
+  else {
+    CmiSetHandler(msg,CpvAccess(node1Handler));
+    *((int *)(msg+CmiMsgHeaderSizeBytes)) = CpvAccess(msgSize);
+
+    int dest = CmiNumPes() - CmiMyPe() - 1;
+    CmiSyncSendAndFree(dest,CpvAccess(msgSize),msg);
+  }
+
+  return 0;
 }
 
 CmiHandler node1HandlerFunc(char *msg)
 {
-    int msgSize = *((int *)(msg+CmiMsgHeaderSizeBytes));
-    CmiSetHandler(msg,CpvAccess(node0Handler));
-    
-    int dest = CmiNumPes() - CmiMyPe() - 1;
-    CmiSyncSendAndFree(dest,msgSize,msg);
-    return 0;
+  int msgSize = *((int *)(msg+CmiMsgHeaderSizeBytes));
+  CmiSetHandler(msg,CpvAccess(node0Handler));
+
+  int dest = CmiNumPes() - CmiMyPe() - 1;
+  CmiSyncSendAndFree(dest,msgSize,msg);
+  return 0;
 }
 
 CmiStartFn mymain(int argc, char** argv)
 {
-    CpvInitialize(int,msgSize);
-    CpvInitialize(int,cycleNum);
-    CpvInitialize(int,sizeNum);
-    CpvAccess(sizeNum) = 1;
-    CpvAccess(msgSize)= CmiMsgHeaderSizeBytes + 8;
-    
-    CpvInitialize(int,exitHandler);
-    CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
-    CpvInitialize(int,node0Handler);
-    CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
-    CpvInitialize(int,node1Handler);
-    CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
-    CpvInitialize(int,ackHandler);
-    CpvAccess(ackHandler) = CmiRegisterHandler((CmiHandler) ackHandlerFunc);
-    CpvInitialize(int,startOperationHandler);
-    CpvAccess(startOperationHandler) = CmiRegisterHandler((CmiHandler) startOperationHandlerFunc);
-    
-    CpvInitialize(double,startTime);
-    CpvInitialize(double,endTime);
-    
-    CpvInitialize(double, IdleStartTime);
-    CpvInitialize(double, IdleTime);
-
-    CpvInitialize(int,ackCount);
-    CpvAccess(ackCount) = 0;
-
-    CpvInitialize(int,twoway);
-    CpvAccess(twoway) = 0;
-
-    // Set runtime cpuaffinity
-    CmiInitCPUAffinity(argv);
-
-    // Initialize CPU topology
-    CmiInitCPUTopology(argv);
-
-    // Wait for all PEs of the node to complete topology init
-    CmiNodeAllBarrier();
-
-    // Update the argc after runtime parameters are extracted out
-    argc = CmiGetArgc(argv);
-
-    if(CmiMyRank() == CmiMyNodeSize()) return 0;
-    
-    if(argc > 1)
-        CpvAccess(twoway) = atoi(argv[1]);
-
-    if(CmiMyPe() == 0) {
-      if(!CpvAccess(twoway))
-        CmiPrintf("Starting Pingpong with oneway traffic \n");
-      else
-        CmiPrintf("Starting Pingpong with twoway traffic\n");
-    }
-
-    // Node 0 waits till all processors finish their topology processing
-    if(CmiMyPe() == 0) {
-        // Signal all PEs to begin computing
-        char *startOperationMsg = (char *)CmiAlloc(CmiMsgHeaderSizeBytes);
-        CmiSetHandler((char *)startOperationMsg, CpvAccess(startOperationHandler));
-        CmiSyncBroadcastAndFree(CmiMsgHeaderSizeBytes, startOperationMsg);
-
-        // start operation locally on PE 0
-        startOperationHandlerFunc(NULL);
-    }
-    return 0;
+  CpvInitialize(int,msgSize);
+  CpvInitialize(int,cycleNum);
+  CpvInitialize(int,sizeNum);
+  CpvAccess(sizeNum) = 1;
+  CpvAccess(msgSize)= CmiMsgHeaderSizeBytes + 8;
+
+  CpvInitialize(int,exitHandler);
+  CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
+  CpvInitialize(int,node0Handler);
+  CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
+  CpvInitialize(int,node1Handler);
+  CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
+  CpvInitialize(int,ackHandler);
+  CpvAccess(ackHandler) = CmiRegisterHandler((CmiHandler) ackHandlerFunc);
+  CpvInitialize(int,startOperationHandler);
+  CpvAccess(startOperationHandler) = CmiRegisterHandler((CmiHandler) startOperationHandlerFunc);
+
+  CpvInitialize(double,startTime);
+  CpvInitialize(double,endTime);
+
+  CpvInitialize(double, IdleStartTime);
+  CpvInitialize(double, IdleTime);
+
+  CpvInitialize(int,ackCount);
+  CpvAccess(ackCount) = 0;
+
+  CpvInitialize(int,twoway);
+  CpvAccess(twoway) = 0;
+
+  // Set runtime cpuaffinity
+  CmiInitCPUAffinity(argv);
+
+  // Initialize CPU topology
+  CmiInitCPUTopology(argv);
+
+  // Wait for all PEs of the node to complete topology init
+  CmiNodeAllBarrier();
+
+  // Update the argc after runtime parameters are extracted out
+  argc = CmiGetArgc(argv);
+
+  if(CmiMyRank() == CmiMyNodeSize()) return 0;
+
+  if(argc > 1)
+    CpvAccess(twoway) = atoi(argv[1]);
+
+  if(CmiMyPe() == 0) {
+    if(!CpvAccess(twoway))
+      CmiPrintf("Starting Pingpong with oneway traffic \n");
+    else
+      CmiPrintf("Starting Pingpong with twoway traffic\n");
+  }
+
+  // Node 0 waits till all processors finish their topology processing
+  if(CmiMyPe() == 0) {
+    // Signal all PEs to begin computing
+    char *startOperationMsg = (char *)CmiAlloc(CmiMsgHeaderSizeBytes);
+    CmiSetHandler((char *)startOperationMsg, CpvAccess(startOperationHandler));
+    CmiSyncBroadcastAndFree(CmiMsgHeaderSizeBytes, startOperationMsg);
+
+    // start operation locally on PE 0
+    startOperationHandlerFunc(NULL);
+  }
+  return 0;
 }
 
 int main(int argc,char *argv[])
 {
-    ConverseInit(argc,argv,(CmiStartFn)mymain,0,0);
-    return 0;
+  ConverseInit(argc,argv,(CmiStartFn)mymain,0,0);
+  return 0;
 }
index 3633ab853b76ed8ad12c0826e3ced3b5bd58c616..c5f32db36883831b8d5b03282cd70f47d4ce08a1 100644 (file)
@@ -5,7 +5,7 @@ OBJS=blkinhand.o megacon.o ringsimple.o ring.o fibobj.o fibthr.o broadc.o priote
 
 all: pgm
 
-pgm: $(OBJS) 
+pgm: $(OBJS)
        $(CHARMC) -o pgm $(OBJS) -language converse++
 
 megacon.o: megacon.c
index 2d1d20a4113f7842f1e25e9326af8e81b2f736e2..9f68e6ef6da7f604a62cf23fb401a7bd54faa99b 100644 (file)
@@ -5,7 +5,7 @@
 CpvDeclare(int, bigmsg_index);
 
 #define CmiMsgHeaderSizeInts \
-    ((CmiMsgHeaderSizeBytes+sizeof(int)-1)/sizeof(int))
+  ((CmiMsgHeaderSizeBytes+sizeof(int)-1)/sizeof(int))
 
 void Cpm_megacon_ack(CpmDestination);
 
@@ -16,8 +16,8 @@ void bigmsg_handler(void *vmsg)
   if (CmiMyPe()==0) {
     for (i=CmiMsgHeaderSizeInts; i<250000; i++) {
       if (msg[i] != i) {
-       CmiPrintf("Failure in bigmsg test, data corrupted.\n");
-       exit(1);
+        CmiPrintf("Failure in bigmsg test, data corrupted.\n");
+        exit(1);
       }
     }
     CmiFree(msg);
index 0fa60494ff286aeb7bdbe74dc886e6a074b6f124..a5966fe647f2c3efec516374d2c0ca272bf1b14d 100644 (file)
@@ -36,22 +36,22 @@ void broadc_start_cycle(bchare c)
 {
   struct mesg_s m={{0},CmiMyPe(),c,0x12345678}; struct mesg_s *mp; CmiCommHandle h;
   switch (c->totalsent) {
-  case 0:
-    CmiSetHandler(&m, CpvAccess(broadc_recv_idx));
-    CmiSyncBroadcastAll(sizeof(struct mesg_s),&m);
-    c->totalsent++;
-    break;
-  case 1:
-  case 2:
-    mp = (mesg)CmiAlloc(sizeof(struct mesg_s));
-    CmiSetHandler(mp, CpvAccess(broadc_recv_idx));
-    mp->reply_ptr = c; mp->reply_pe = CmiMyPe(); mp->magic = 0x12345678;
-    CmiSyncBroadcastAllAndFree(sizeof(struct mesg_s),mp);
-    c->totalsent++;
-    break;
-  case 3:
-    free(c);
-    Cpm_megacon_ack(CpmSend(0));
+    case 0:
+      CmiSetHandler(&m, CpvAccess(broadc_recv_idx));
+      CmiSyncBroadcastAll(sizeof(struct mesg_s),&m);
+      c->totalsent++;
+      break;
+    case 1:
+    case 2:
+      mp = (mesg)CmiAlloc(sizeof(struct mesg_s));
+      CmiSetHandler(mp, CpvAccess(broadc_recv_idx));
+      mp->reply_ptr = c; mp->reply_pe = CmiMyPe(); mp->magic = 0x12345678;
+      CmiSyncBroadcastAllAndFree(sizeof(struct mesg_s),mp);
+      c->totalsent++;
+      break;
+    case 3:
+      free(c);
+      Cpm_megacon_ack(CpmSend(0));
   }
 }
 
index b427001d16af71cd94f34ea7182790c6d4a62e46..c5c611cfe1df93e18fdddf426829dcb785bc4655 100644 (file)
@@ -31,7 +31,7 @@ void deadlock_cram(char *msg)
   while (count<5000) {
     CmiSyncSend(1-CmiMyPe(), sizeof(m), &m);
     count++;
-  } 
+  }
   m.n = -count;
   CmiSyncSend(1-CmiMyPe(), sizeof(m), &m);
   CmiFree(msg);
@@ -68,7 +68,7 @@ static char* fCramHeader(char *msg){
 
 static char* fCramContent(char *msg){
   char *temp;
-  
+
   temp = (char *)malloc(strlen(_fCramContentStr) + 1);
   strcpy(temp, _fCramContentStr);
   return(temp);
@@ -84,7 +84,7 @@ static char* fIncHeader(char *msg){
 
 static char* fIncContent(char *msg){
   char *temp;
-  
+
   temp = (char *)malloc(strlen(_fIncContentStr) + 1 + 5);
   sprintf(temp, "%s:%d", _fIncContentStr, ((incmsg)msg)->n);
   return(temp);
@@ -96,13 +96,13 @@ char* makeIncSymbolTableInfo()
   int size;
   char *returnInfo;
   char temp[10];
-  
+
   size = 200;
   returnInfo = (char *)malloc(size * sizeof(char));
   strcpy(returnInfo, "");
   strcat(returnInfo, "Converse Handler : deadlock_inc");
   strcat(returnInfo, "#");
-  
+
   return(returnInfo);
 }
 
@@ -117,13 +117,13 @@ char* makeCramSymbolTableInfo()
   int size;
   char *returnInfo;
   char temp[10];
-  
+
   size = 200;
   returnInfo = (char *)malloc(size * sizeof(char));
   strcpy(returnInfo, "");
   strcat(returnInfo, "Converse Handler : deadlock_cram");
   strcat(returnInfo, "#");
-  
+
   return(returnInfo);
 }
 
@@ -139,14 +139,14 @@ void deadlock_moduleinit()
 #if CMK_DEBUG_MODE
   handlerArrayRegister(CpvAccess(deadlock_inc_idx), fIncHeader, fIncContent);
   handlerArrayRegister(CpvAccess(deadlock_cram_idx),fCramHeader, fCramContent);
-  
+
   symbolTableFnArrayRegister(CpvAccess(deadlock_inc_idx), 1,
-                            makeIncSymbolTableInfo,
-                            getInd);
+      makeIncSymbolTableInfo,
+      getInd);
   symbolTableFnArrayRegister(CpvAccess(deadlock_cram_idx), 1,
-                            makeCramSymbolTableInfo,
-                            getInd);
-  
+      makeCramSymbolTableInfo,
+      getInd);
+
 #endif
   CpvAccess(deadlock_count) = 0;
 }
index 06f32064c8bd255933c2e42471183220ae5c2ce5..86d615dc161794691f5752e8148c0aa18cef80ff 100644 (file)
@@ -51,8 +51,8 @@ CpmInvokable fibobj_result(int n, fibobj_chare cpos)
       Cpm_fibobj_result(CpmSend(c->ppe), c->total, c->ppos);
     else {
       if (c->total != FIB_OUTPUT) {
-       CmiPrintf("Fib: results incorrect.\n");
-       exit(1);
+        CmiPrintf("Fib: results incorrect.\n");
+        exit(1);
       }
       Cpm_megacon_ack(CpmSend(0));
     }
@@ -82,6 +82,3 @@ void fibobj_moduleinit()
 {
   CpmInitializeThisModule();
 }
-
-
-
index ea93797d5b66f28f88eea893fd2a19740f1943f8..fef2f814c2655e0152713fc9169961e52c6041ff 100644 (file)
@@ -1,4 +1,4 @@
- /**************************************************************************
+/**************************************************************************
  * DESCRIPTION:
  *
  * To add a test to megacon, you have to:
@@ -135,10 +135,10 @@ int megacon_skip(const char *test)
   skip = CpvAccess(tests_to_skip);
   for (i=0; i<num_skip; i++) {
     if ((skip[i][0]=='-')&&(strcmp(skip[i]+1, test)==0))
-      {
-       /*      CmiPrintf("skipping test %s\n",skip[i]);*/
-       return 1 - CpvAccess(test_negate_skip);
-      }
+    {
+      // CmiPrintf("skipping test %s\n",skip[i]);
+      return 1 - CpvAccess(test_negate_skip);
+    }
   }
   return CpvAccess(test_negate_skip);
 }
@@ -154,7 +154,7 @@ nextidx:
   if (idx < bank) {
     numacks = tests[idx].numacks;
     if (megacon_skip(tests[idx].name)) {
-      /*      CmiPrintf("skipping test %s\n",tests[idx].name);*/
+      // CmiPrintf("skipping test %s\n",tests[idx].name);
       CpvAccess(next_test_index)++;
       goto nextidx;
     }
@@ -163,13 +163,13 @@ nextidx:
     CpvAccess(test_start_time) = CmiWallTimer();
     CmiPrintf("test %d: initiated [%s]\n", num, tests[idx].name);
     (tests[idx].initiator)();
-    return; 
+    return;
   }
   if (idx < (2*bank)) {
     pos = idx - bank;
     numacks = tests[pos].numacks;
     if ((tests[pos].reentrant == 0)||(megacon_skip(tests[pos].name))||
-       CpvAccess(test_negate_skip)) {
+        CpvAccess(test_negate_skip)) {
       CpvAccess(next_test_index)++;
       goto nextidx;
     }
@@ -188,8 +188,8 @@ nextidx:
     for (i=0; i<bank; i++) {
       numacks = tests[i].numacks;
       if (!megacon_skip(tests[i].name)) {
-       CpvAccess(acks_expected) += (numacks ? numacks : CmiNumPes());
-       (tests[i].initiator)();
+        CpvAccess(acks_expected) += (numacks ? numacks : CmiNumPes());
+        (tests[i].initiator)();
       }
     }
     return;
@@ -208,8 +208,8 @@ CpmInvokable megacon_ack()
   CpvAccess(acks_received)++;
   if (CpvAccess(acks_received) == CpvAccess(acks_expected)) {
     CmiPrintf("test %d: completed (%1.2f sec)\n",
-             CpvAccess(next_test_number),
-             CmiWallTimer() - CpvAccess(test_start_time));
+        CpvAccess(next_test_number),
+        CmiWallTimer() - CpvAccess(test_start_time));
     CpvAccess(next_test_number)++;
     CpvAccess(next_test_index)++;
     megacon_next();
@@ -260,10 +260,13 @@ void megacon_init(int argc, char **argv)
     if (strcmp(argv[i],"-only")==0)
       CpvAccess(test_negate_skip)=1;
   CpvAccess(num_tests_to_skip) = argc;
-  /*    if(CpvAccess(test_negate_skip)) {
+
+#if 0
+  if(CpvAccess(test_negate_skip)) {
     CpvAccess(num_tests_to_skip)--;
   }
-  */
+#endif
+
   CpvAccess(tests_to_skip) = argv;
   if (CmiMyPe()==0)
     megacon_next();
index 980192f639788f93b348c13d14cf01f6ca5c960d..b905c278f0bd2dcc8c97475268f028c5cddbe41d 100644 (file)
@@ -37,23 +37,23 @@ void multicast_start_cycle(bchare c)
 {
   struct mesg_s m={{0},CmiMyPe(),c,0x12345678}; struct mesg_s *mp;
   switch (c->totalsent) {
-  case 0:
-    CmiSetHandler(&m, CpvAccess(multicast_recv_idx));
-    m.reply_ptr = c; m.reply_pe = CmiMyPe(); m.magic = 0x12345678;
-    CmiSyncMulticast(c->grp, sizeof(struct mesg_s),&m);
-    c->totalsent++;
-    break;
-  case 1:
-  case 2:
-    mp = (mesg)CmiAlloc(sizeof(struct mesg_s));
-    CmiSetHandler(mp, CpvAccess(multicast_recv_idx));
-    mp->reply_ptr = c; mp->reply_pe = CmiMyPe();mp->magic = 0x12345678;
-    CmiSyncMulticastAndFree(c->grp, sizeof(struct mesg_s), mp);
-    c->totalsent++;
-    break;
-  case 3:
-    free(c);
-    Cpm_megacon_ack(CpmSend(0));
+    case 0:
+      CmiSetHandler(&m, CpvAccess(multicast_recv_idx));
+      m.reply_ptr = c; m.reply_pe = CmiMyPe(); m.magic = 0x12345678;
+      CmiSyncMulticast(c->grp, sizeof(struct mesg_s),&m);
+      c->totalsent++;
+      break;
+    case 1:
+    case 2:
+      mp = (mesg)CmiAlloc(sizeof(struct mesg_s));
+      CmiSetHandler(mp, CpvAccess(multicast_recv_idx));
+      mp->reply_ptr = c; mp->reply_pe = CmiMyPe();mp->magic = 0x12345678;
+      CmiSyncMulticastAndFree(c->grp, sizeof(struct mesg_s), mp);
+      c->totalsent++;
+      break;
+    case 3:
+      free(c);
+      Cpm_megacon_ack(CpmSend(0));
   }
 }
 
@@ -98,9 +98,3 @@ void multicast_moduleinit()
   CpvAccess(multicast_recv_idx) = CmiRegisterHandler((CmiHandler)multicast_recv);
   CpvAccess(multicast_reply_idx) = CmiRegisterHandler((CmiHandler)multicast_reply);
 }
-
-
-
-
-
-
index be3e44bc7a7cd9358b3506eedbd195ec005fa420..940cf4134e18eaec2e74470ca5d828c9a9e8f2b9 100644 (file)
@@ -9,7 +9,7 @@ typedef struct {
 
 typedef struct
 {
-  char core[CmiMsgHeaderSizeBytes]; 
+  char core[CmiMsgHeaderSizeBytes];
   int me;
   double data[10];
 } multisendmsg;
@@ -55,12 +55,13 @@ void multisend_done_handler(multisendmsg *msg)
 
 void multisend_init(void)
 {
-/*
+
+#if 0
   if(CmiNumPes() < 2) {
     CmiPrintf("Multisend requires at least 2 processors. skipping...\n");
     Cpm_megacon_ack(CpmSend(0));
-  } else 
-*/
+  } else
+#endif
   {
     int m,i;
     int sizes[nMulti];
@@ -76,8 +77,8 @@ void multisend_init(void)
       sizes[m]=sizeof(multisendmsg)-sizeof(double)*m;
       msgs[m]=(char *)msg;
     }
-    CmiMultipleSend(1%CmiNumPes(), nMulti, sizes, msgs);  
-    for (m=0;m<nMulti;m++) 
+    CmiMultipleSend(1%CmiNumPes(), nMulti, sizes, msgs);
+    for (m=0;m<nMulti;m++)
       if (m!=0)
         CmiFree(msgs[m]);
   }
@@ -90,16 +91,16 @@ void multisend_moduleinit()
   CpvInitialize(int*, multisend_index);
   CpvInitialize(int, multisend_done_index);
   CpvInitialize(int, multisend_replies);
-  
+
   CpvAccess(multisend_index)=(int *)CmiAlloc(nMulti*sizeof(int));
   for (m=0;m<nMulti;m++) {
     multisend_info *i=(multisend_info *)CmiAlloc(sizeof(multisend_info));
     i->me=m;
     CpvAccess(multisend_index)[m]=CmiRegisterHandlerEx(
-       (CmiHandlerEx)multisend_handler,i);
+        (CmiHandlerEx)multisend_handler,i);
   }
 
-  CpvAccess(multisend_done_index) = 
+  CpvAccess(multisend_done_index) =
     CmiRegisterHandler((CmiHandler)multisend_done_handler);
 }
 
index 83814c9288f1ef099bf84fcfc21cf730d54d2442..372fb948534d0b16bad2b6d848c9bdf70b7518d6 100644 (file)
@@ -34,7 +34,7 @@ CpmInvokable nodenum_ack(nodenum_chare c)
 
 CpmInvokable nodenum_reply(nodenum_chare c, int pe, int rank, int host)
 {
-  c->info[pe].pe   = pe; 
+  c->info[pe].pe   = pe;
   c->info[pe].rank = rank;
   c->info[pe].host = host;
   nodenum_ack(c);
@@ -66,7 +66,7 @@ CpmInvokable nodenum_control()
   c.countdown = CmiNumPes(); c.pending = CthSelf(); CthSuspend();
   Cpm_nodenum_collect_info(CpmSend(CpmALL), &c);
   c.countdown = CmiNumPes(); c.pending = CthSelf(); CthSuspend();
-  
+
   /* check that the processor/host/rank table contains reasonable values */
   if ((c.info[0].host != 0)||(c.info[0].rank != 0)||(c.info[0].pe != 0))
     goto badnum;
@@ -80,7 +80,7 @@ CpmInvokable nodenum_control()
       if (curr->rank != 0) goto badnum;
     }
   }
-  
+
   Cpm_megacon_ack(CpmSend(0));
   return;
 badnum:
index 23b3bd729044a1aacf558ebdf06c259551932728..72284c5b51a424326506be3a7055e058ca54a156 100644 (file)
@@ -129,10 +129,10 @@ void posixth_main(int argc, char **argv)
   if (CrnRand()&1) CthYield();
   errck(Cpthread_mutex_destroy(&dummymutex));
   if (CrnRand()&1) CthYield();
-  
+
   if (CpvAccess(total)!=160) posixth_fail();
   if (CpvAccess(leaves)!=260) posixth_fail();
-  
+
   if (CrnRand()&1) CthYield();
   errck(Cpthread_mutex_destroy(&CpvAccess(total_mutex)));
   if (CrnRand()&1) CthYield();
@@ -142,7 +142,7 @@ void posixth_main(int argc, char **argv)
   if (CrnRand()&1) CthYield();
   errck(Cpthread_cond_destroy(&CpvAccess(donecond)));
   if (CrnRand()&1) CthYield();
-  
+
   Cpm_megacon_ack(CpmSend(0));
 }
 
@@ -166,5 +166,4 @@ void posixth_moduleinit()
   CpvInitialize(Cpthread_mutex_t, fibs_mutex);
   CpvInitialize(int,              fibs);
   CpvInitialize(Cpthread_cond_t,  donecond);
-  
 }
index 4f0598a2631a71e7a91837fae89255d7203bf65b..e90127ba1cecff5fde23fb3b1c4d90561384fcca 100644 (file)
@@ -81,7 +81,7 @@ void broadcast_msg(mesg m) {
 
 void reduction_struct(void *data) {
   int i, sum=0;
-  struct twoInts *two = (struct twoInts *)data; 
+  struct twoInts *two = (struct twoInts *)data;
   CmiAssert(CmiMyPe() == 0);
   for (i=0; i<CmiNumPes(); ++i) sum += i+1;
   if (two->positive != sum || two->negative != -2*sum) {
index e44a6af07737562bf7302fd73eb4afff37808ba5..cd9d9cfef4de75666dc3b8900c612ca6ce020233 100644 (file)
@@ -5,7 +5,7 @@ void Cpm_megacon_ack(CpmDestination);
 
 typedef struct
 {
-  char core[CmiMsgHeaderSizeBytes]; 
+  char core[CmiMsgHeaderSizeBytes];
   int hops, ringno;
   int data[10];
 } ringmsg;
@@ -51,6 +51,3 @@ void ringsimple_moduleinit()
   CpvInitialize(int, ringsimple_hop_index);
   CpvAccess(ringsimple_hop_index) = CmiRegisterHandler((CmiHandler)ringsimple_hop);
 }
-
-
-
index 2a7d09865c0a7b86a2facf03f12cf60c2ed901ee..a72f514288df0e267ca86cfec8975c7813f61c99 100644 (file)
@@ -64,7 +64,7 @@ CpmInvokable specmsg_begin()
 CpmInvokable specmsg_request(int pe, specmsg_chare c)
 {
   Cpm_specmsg_step3(CpmSend(pe), c);
-  Cpm_specmsg_step2(CpmSend(pe), c); 
+  Cpm_specmsg_step2(CpmSend(pe), c);
   Cpm_specmsg_step4(CpmSend(pe), c);
   Cpm_specmsg_step1(CpmSend(pe), c);
 }
index 331323ce564a25a8aec1a05e55b0b008b70a5941..80e43c2e84b599d47db9456809d3282a107d38a5 100644 (file)
@@ -76,16 +76,16 @@ CpmInvokable vars_control()
 
   CthAwaken(t1); CthAwaken(t2);
   c.countdown = 2; c.pending = CthSelf(); CthSuspend();
-  
+
   CthAwaken(t1); CthAwaken(t2);
   c.countdown = 2; c.pending = CthSelf(); CthSuspend();
-  
+
   Cpm_vars_set_cpv_and_csv(CpmSend(CpmALL), &c);
   c.countdown = CmiNumPes(); c.pending = CthSelf(); CthSuspend();
-  
+
   Cpm_vars_check_cpv_and_csv(CpmSend(CpmALL), &c);
   c.countdown = CmiNumPes(); c.pending = CthSelf(); CthSuspend();
-  
+
   Cpm_megacon_ack(CpmSend(0));
 }
 
@@ -99,18 +99,18 @@ void vars_moduleinit()
   CpmInitializeThisModule();
   CtvInitialize(int, ctv1);
   if (!CtvInitialized(ctv1)) {
-      CmiPrintf("ctv initialization test failed.\n");
-      exit(1);
+    CmiPrintf("ctv initialization test failed.\n");
+    exit(1);
   }
   CpvInitialize(int, cpv1);
   if (!CpvInitialized(cpv1)) {
-      CmiPrintf("cpv initialization test failed.\n");
-      exit(1);
+    CmiPrintf("cpv initialization test failed.\n");
+    exit(1);
   }
   CsvInitialize(int, csv1);
   if (!CsvInitialized(csv1)) {
-      CmiPrintf("csv initialization test failed.\n");
-      exit(1);
+    CmiPrintf("csv initialization test failed.\n");
+    exit(1);
   }
 }
 
index 0edc311075869373d9fac2bd72bdf687f4fecc62..95040d99957a31ec25436cf296a73c2db2f0fcc8 100644 (file)
@@ -5,7 +5,7 @@
 CpvDeclare(int, vecsend_index);
 
 #define CmiMsgHeaderSizeInts \
-    ((CmiMsgHeaderSizeBytes+sizeof(int)-1)/sizeof(int))
+  ((CmiMsgHeaderSizeBytes+sizeof(int)-1)/sizeof(int))
 
 void Cpm_megacon_ack(CpmDestination);
 
@@ -18,8 +18,8 @@ void vecsend_handler(int *msg)
   if (CmiMyPe()==0) {
     for (i=CmiMsgHeaderSizeInts; i<3600; i++) {
       if (msg[i] != i) {
-       CmiPrintf("Failure in vecsend test, data corrupted.\n");
-       exit(1);
+        CmiPrintf("Failure in vecsend test, data corrupted.\n");
+        exit(1);
       }
     }
     Cpm_megacon_ack(CpmSend(0));
@@ -41,7 +41,7 @@ void vecsend_init()
     CmiPrintf("note: vecsend requires at least 2 processors, skipping test.\n");
     Cpm_megacon_ack(CpmSend(0));
   } else {
-       sizes = (int *) CmiAlloc(4*sizeof(int));
+    sizes = (int *) CmiAlloc(4*sizeof(int));
     msgs = (int **) CmiAlloc(4*sizeof(int *));
     sizes[0] = 1000; sizes[1] = 500; sizes[2] = 2000; sizes[3] = 100;
     for(i=0;i<4;i++) msgs[i] = (int *)CmiAlloc(sizes[i]*sizeof(int));