Removed spantree.c from each machine directory, and provided
authorMilind Bhandarkar <milind@cs.uiuc.edu>
Mon, 28 Dec 1998 05:55:42 +0000 (05:55 +0000)
committerMilind Bhandarkar <milind@cs.uiuc.edu>
Mon, 28 Dec 1998 05:55:42 +0000 (05:55 +0000)
a common spantree.c. One can provide machine-specific implementations
using appropriate CMK_SPANTREE constant defined in conv-mach.h.
Currently, all machines use common code.

51 files changed:
src/arch/exemplar-mpi/conv-mach.h
src/arch/exemplar-mpi/spantree.c [deleted file]
src/arch/exemplar/conv-mach.h
src/arch/exemplar/spantree.c [deleted file]
src/arch/ncube2/conv-mach.h
src/arch/ncube2/spantree.c [deleted file]
src/arch/net-aix-ppc/conv-mach.h
src/arch/net-hp-acc/conv-mach.h
src/arch/net-hp-cc/conv-mach.h
src/arch/net-hp/conv-mach.h
src/arch/net-irix-64/conv-mach.h
src/arch/net-irix/conv-mach.h
src/arch/net-linux-kcc/conv-mach.h
src/arch/net-linux-smp/conv-mach.h
src/arch/net-linux/conv-mach.h
src/arch/net-sol-cc/conv-mach.h
src/arch/net-sol-smp/conv-mach.h
src/arch/net-sol/conv-mach.h
src/arch/net-sun/conv-mach.h
src/arch/net/spantree.c [deleted file]
src/arch/origin-mpi/conv-mach.h
src/arch/origin-mpi/spantree.c [deleted file]
src/arch/origin-pthreads/conv-mach.h
src/arch/origin-pthreads/spantree.c [deleted file]
src/arch/origin2000/conv-mach.h
src/arch/origin2000/spantree.c [deleted file]
src/arch/paragon-red/conv-mach.h
src/arch/paragon/spantree.c [deleted file]
src/arch/sim-hp/conv-mach.h
src/arch/sim-irix-64/conv-mach.h
src/arch/sim-irix/conv-mach.h
src/arch/sim-linux/conv-mach.h
src/arch/sim-rs6k/conv-mach.h
src/arch/sim-sol/conv-mach.h
src/arch/sim-sun/conv-mach.h
src/arch/sim/spantree.c [deleted file]
src/arch/sp3/conv-mach.h
src/arch/sp3/spantree.c [deleted file]
src/arch/t3e/conv-mach.h
src/arch/t3e/spantree.c [deleted file]
src/arch/uth-hp-cc/conv-mach.h
src/arch/uth-hp/conv-mach.h
src/arch/uth-irix-64/conv-mach.h
src/arch/uth-irix/conv-mach.h
src/arch/uth-linux/conv-mach.h
src/arch/uth-rs6k/conv-mach.h
src/arch/uth-sol-cc/conv-mach.h
src/arch/uth-sol/conv-mach.h
src/arch/uth/spantree.c [deleted file]
src/conv-core/spantree.c [new file with mode: 0644]
src/xlat-i/xi-generate.C

index a5470c76322fcc7d958a2bb732b42fb2e269c941..c6a9fd55f0b9949e58cde7494f11b0266b570f5d 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/exemplar-mpi/spantree.c b/src/arch/exemplar-mpi/spantree.c
deleted file mode 100644 (file)
index 70a345d..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-#define MAXNODES   1024
-#define MAXCUBEDIM  10         /* log_2 (MAXNODES) */
-
-
-typedef struct spantreearray {
-    int noofchildren;
-    int parent;
-    int *children;
-} SpanTreeArray;
-
-static SpanTreeArray *SpanArray;
-static int *NodeStore;   /* used to store the nodes in the spanning 
-                      tree in breadth first order */
-static int numnodes;
-
-CmiSpanTreeInit()
-{
-    int i, j;
-    int visited[MAXNODES];
-    int next, currentnode;
-    int neighbours[MAXCUBEDIM];
-    int dim;
-
-    numnodes = CmiNumPes();
-    dim      = CmiNumNeighbours(0);
-    SpanArray = (SpanTreeArray *)CmiAlloc(sizeof(SpanTreeArray) * numnodes);
-    NodeStore = (int *) CmiAlloc(sizeof(int) * numnodes);
-    visited[0] = 1;
-    NodeStore[0] = 0;  /* the root of the spanning tree */
-    SpanArray[0].parent = -1;  /* no parent */
-
-    for (i = 1; i < numnodes; i++)
-        visited[i] = 0;
-
-    for (next = 1, i = 0; i < numnodes; i++)
-    {
-       currentnode = NodeStore[i];
-       CmiGetNodeNeighbours(currentnode, neighbours);
-       SpanArray[currentnode].noofchildren = 0;
-       for (j = 0; j < dim && 
-                   SpanArray[currentnode].noofchildren < MAXSPAN; j++)
-       {
-           if (!visited[neighbours[j]])
-           {
-               NodeStore[next + SpanArray[currentnode].noofchildren] = 
-                                                               neighbours[j];
-               SpanArray[currentnode].noofchildren++;
-               SpanArray[neighbours[j]].parent = currentnode;
-               visited[neighbours[j]] = 1;
-               
-           }
-       }
-       if (SpanArray[currentnode].noofchildren != 0)
-       {
-           SpanArray[currentnode].children = &NodeStore[next];
-           next += SpanArray[currentnode].noofchildren;
-       }
-    }
-
-    for (i = 0; i < numnodes; i++)  /* check */
-       if (!visited[i])
-          CmiError("node %d not part of spanning tree: initialization error!\n",i);
-}
-
-
-int CmiSpanTreeRoot()
-{
-    return 0;  /* node 0 is always the root of the spanning tree on the 
-                 hypercubes */
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    return SpanArray[node].parent;
-}
-
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for( i = 0; i < SpanArray[node].noofchildren; i++)
-         children[i] = SpanArray[node].children[i];
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    return SpanArray[node].noofchildren;
-}
-
-
-
-
-PrintSpanTree()
-{
-    int i,j;
-
-    for (i = 0; i < numnodes; i++)
-    {
-       CmiPrintf("node: %d, parent: %d, numchildren: %d, children: ",
-                i, SpanArray[i].parent, SpanArray[i].noofchildren); 
-       for (j = 0; j < SpanArray[i].noofchildren; j++)
-            CmiPrintf("%d ",SpanArray[i].children[j]);
-       CmiPrintf("\n");
-    }
-}
-
-
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    /* node 0 cannot be a leaf of a spanning tree: it is the root */
-    for (node = 1; node < numnodes; node++)
-    if (SpanArray[node].noofchildren == 0)  /* it is a leaf */
-        CmiAsyncSendFn(node, size, msg);
-}
index 5aeab7c2d431498712f3aaf8392f833f95fa713c..2c42c7ad40604619dcfb5966c95787cfc53b014a 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             1
 #define CMK_STATIC_PROTO_WORKS                             0
 
diff --git a/src/arch/exemplar/spantree.c b/src/arch/exemplar/spantree.c
deleted file mode 100644 (file)
index 48f4505..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-
-CmiSpanTreeInit()
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < CmiNumPes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < CmiNumPes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= CmiNumPes())
-        return 0;
-    else return ((CmiNumPes() - 1) - node * MAXSPAN);
-}
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (CmiNumPes() - 2) / MAXSPAN;   /* integer division */
-        node < CmiNumPes(); node++)
-        CmiSyncSend(node, size, msg);
-}
-
index 4fe95c3e4239ebb45a4b270a4d94abd13120308a..2e479d5faed9bc648122b2271ccd51293114dec9 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/ncube2/spantree.c b/src/arch/ncube2/spantree.c
deleted file mode 100644 (file)
index f8a9f09..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-#define MAXNODES   1024
-#define MAXCUBEDIM  10         /* log_2 (MAXNODES) */
-
-
-typedef struct spantreearray {
-    int noofchildren;
-    int parent;
-    int *children;
-} SpanTreeArray;
-
-static SpanTreeArray *SpanArray;
-static int *NodeStore;   /* used to store the nodes in the spanning 
-                      tree in breadth first order */
-static int numnodes;
-
-CmiSpanTreeInit()
-{
-    int i, j;
-    int visited[MAXNODES];
-    int next, currentnode;
-    int neighbours[MAXCUBEDIM];
-    int dim;
-    
-    dim      =  CmiNumNeighbours(0);
-    numnodes = CmiNumPes();
-    SpanArray = (SpanTreeArray *)CmiAlloc(sizeof(SpanTreeArray) * numnodes);
-    NodeStore = (int *) CmiAlloc(sizeof(int) * numnodes);
-    visited[0] = 1;
-    NodeStore[0] = 0;  /* the root of the spanning tree */
-    SpanArray[0].parent = -1;  /* no parent */
-
-    for (i = 1; i < numnodes; i++)
-        visited[i] = 0;
-
-    for (next = 1, i = 0; i < numnodes; i++)
-    {
-       currentnode = NodeStore[i];
-       CmiGetNodeNeighbours(currentnode, neighbours);
-       SpanArray[currentnode].noofchildren = 0;
-       for (j = 0; j < dim && 
-                   SpanArray[currentnode].noofchildren < MAXSPAN; j++)
-       {
-           if (!visited[neighbours[j]])
-           {
-               NodeStore[next + SpanArray[currentnode].noofchildren] = 
-                                                               neighbours[j];
-               SpanArray[currentnode].noofchildren++;
-               SpanArray[neighbours[j]].parent = currentnode;
-               visited[neighbours[j]] = 1;
-               
-           }
-       }
-       if (SpanArray[currentnode].noofchildren != 0)
-       {
-           SpanArray[currentnode].children = &NodeStore[next];
-           next += SpanArray[currentnode].noofchildren;
-       }
-    }
-
-    for (i = 0; i < numnodes; i++)  /* check */
-       if (!visited[i])
-          CmiError("node %d not part of spanning tree: initialization error!\n",i);
-}
-
-
-int CmiSpanTreeRoot()
-{
-    return 0;  /* node 0 is always the root of the spanning tree on the 
-                 hypercubes */
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    return SpanArray[node].parent;
-}
-
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for( i = 0; i < SpanArray[node].noofchildren; i++)
-         children[i] = SpanArray[node].children[i];
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    return SpanArray[node].noofchildren;
-}
-
-
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    /* node 0 cannot be a leaf of a spanning tree: it is the root */
-    for (node = 1; node < numnodes; node++)
-    if (SpanArray[node].noofchildren == 0)  /* it is a leaf */
-        CmiAsyncSendFn(node, size, msg);
-}
index a8b27eb54c98b6f0f675eda50d05841d5171d4f1..2c2bae5c9e23493979222a070be40ed6e5e48bfd 100644 (file)
 
 #define CMK_SIZE_T                                         long unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 9fc03a67e740e47fbf39182c030402d3d26e64c7..e3072061c5b244af86506c07587ded8cb88ca915 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 92d326de9d558937ac6be38b7374e70e0b0d99eb..57a09529beebc48d2a99f474abb9544755fdb734 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 482ca4d4ec3a81664d4ae9a20773e640ebbe24f5..3be35d8aa9e808d828d0dff4d9bbdd6a10c9e86f 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 4ce030b90298996d09bd22cff75f67071e9371f0..12ee4b6d67b90db50539acf0a1bf15eddc30a7c5 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 380f3e0a2a6c5a09a897b26d7e80e6ea64751855..d04c67de2b9c7a27f61dfcaf356ba1bef3b8feaa 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index a0384a8b8402b7bb6385e02855af142874d71714..a3beeed96a3877e0f343f9f9e23f158fffc30850 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 90a3630ea3623df89460b61ece0f965c60af2a40..6e61824dc3dfbb632e91d454e36852057894a9f8 100644 (file)
@@ -8,7 +8,13 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1  1998-12-18 23:40:49  pramacha
+ * Revision 1.2  1998-12-28 05:56:03  milind
+ * Removed spantree.c from each machine directory, and provided
+ * a common spantree.c. One can provide machine-specific implementations
+ * using appropriate CMK_SPANTREE constant defined in conv-mach.h.
+ * Currently, all machines use common code.
+ *
+ * Revision 1.1  1998/12/18 23:40:49  pramacha
  * Integrated Debugging-Interface-related changes.
  *
  * Revision 1.8  1998/06/15 22:11:16  jyelon
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index a0384a8b8402b7bb6385e02855af142874d71714..a3beeed96a3877e0f343f9f9e23f158fffc30850 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 0f8721af4fbddde13a6c50eac728128052ad7197..48911faadffd4e5350fbb4dca9770841fe30d5c9 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 01326e6f81f14ea1187ecbc1258588b106f0e9a4..44863ce859525e6d35d62c70c42308ecb11f52e9 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 39297f3987b324a5e02919e0373c33130c01658c..fb7c78bcce92a616244d30364d3f05dd39de8481 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 6737500170a5301aa16cf0a33fdc3a9ba19fba4e..a831c8092d1f2f735d84054265a8978b62671c4f 100644 (file)
 
 #define CMK_SIZE_T                                         long unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/net/spantree.c b/src/arch/net/spantree.c
deleted file mode 100644 (file)
index 4d80f1d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <converse.h>
-
-/**************************
-**
-** Spanning Tree Functions
-**
-**************************/
-
-/*
-** These are identical to the ipsc2 spanning tree functions.
-*/
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-
-CmiSpanTreeInit() {}
-
-
-int
-CmiSpanTreeParent(node) int node; {
-    if (node == 0)
-         return -1;
-    else 
-       return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-
-int
-CmiSpanTreeRoot() { return 0; }
-
-
-void CmiSpanTreeChildren(node, children) int node, *children; {
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < CmiNumPes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int
-CmiNumSpanTreeChildren(node) int node; {
-    if ((node + 1) * MAXSPAN < CmiNumPes()) return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= CmiNumPes()) return 0;
-    else return ((CmiNumPes() - 1) - node * MAXSPAN);
-}
-
-
-CmiSendToSpanTreeLeaves(size, msg) int size; char * msg; {
-    int node;
-
-    for (node = (CmiNumPes() - 2) / MAXSPAN;   /* integer division */
-        node < CmiNumPes(); node++)
-       CmiSyncSend(node,size,msg);
-}
-
-
-
-PrintSpanTree() {
-    int i,j;
-    int children[MAXSPAN];
-    for (i = 0; i < CmiNumPes(); i++) {
-       CmiPrintf("node: %d, parent: %d, numchildren: %d, children: ",
-                i, CmiSpanTreeParent(i), CmiNumSpanTreeChildren(i));
-       CmiSpanTreeChildren(i, children);
-       for (j = 0; j < CmiNumSpanTreeChildren(i); j++)
-            CmiPrintf("%d ", children[j]);
-       CmiPrintf("\n");
-    }
-}
index c7538d3a004da873a9a36e6301b97ba9d394ae4e..c19d0faa0444be1e69a63881852b9529cd73c602 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/origin-mpi/spantree.c b/src/arch/origin-mpi/spantree.c
deleted file mode 100644 (file)
index 4c558fb..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <converse.h>
-
-#define DEGREE 4
-
-int CmiSpanTreeParent(node)
-int node;
-{
-  return((node-1)/DEGREE);
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;  /* node 0 is always the root of the spanning tree */
-}
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-  int n=Cmi_numpes-1-node*DEGREE;
-  if (n > DEGREE) {
-       return(DEGREE);
-  }
-
-  if (n<0) return(0);
-
-  return(n);
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-  CmiPrintf("NOT IMPLEMENTED\n");
-}
-
-void CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-  CmiPrintf("NOT IMPLEMENTED\n");
-}
index 6e7db46e475057776703e888295e0faf1a14bea0..961d645d7ab002d0b91bf29d00d81355eb948777 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/origin-pthreads/spantree.c b/src/arch/origin-pthreads/spantree.c
deleted file mode 100644 (file)
index fb61443..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-
-void CmiSpanTreeInit(void)
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < CmiNumPes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < CmiNumPes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= CmiNumPes())
-        return 0;
-    else return ((CmiNumPes() - 1) - node * MAXSPAN);
-}
-
-void CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (CmiNumPes() - 2) / MAXSPAN;   /* integer division */
-        node < CmiNumPes(); node++)
-        CmiSyncSend(node, size, msg);
-}
-
index 577033d98ffebb78fc933ae0289e379ea11d5e46..210a8716f3c206839733bd8ce8b4d5d81cf62f68 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/origin2000/spantree.c b/src/arch/origin2000/spantree.c
deleted file mode 100644 (file)
index fb61443..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-
-void CmiSpanTreeInit(void)
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < CmiNumPes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < CmiNumPes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= CmiNumPes())
-        return 0;
-    else return ((CmiNumPes() - 1) - node * MAXSPAN);
-}
-
-void CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (CmiNumPes() - 2) / MAXSPAN;   /* integer division */
-        node < CmiNumPes(); node++)
-        CmiSyncSend(node, size, msg);
-}
-
index 461ba87c5fe5d661e436ed1a92880d454b20204e..e1dc59dbca42a8b0a708d4a6e73e6c35bd5cedf8 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/paragon/spantree.c b/src/arch/paragon/spantree.c
deleted file mode 100644 (file)
index 8a70dde..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <converse.h>
-
-/* This file contains all the spanning tree functions */
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-#define MAXNODES   256
-#define MAXCUBEDIM 8          /* log_2 (MAXNODES) */
-
-
-CmiSpanTreeInit()
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < numnodes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < numnodes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= numnodes())
-        return 0;
-    else return ((numnodes() - 1) - node * MAXSPAN);
-}
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (numnodes() - 2) / MAXSPAN;   /* integer division */
-        node < numnodes(); node++)
-        CmiSyncSend(node, size, msg);
-}
index 2d8e4d831fdd1262740efe5f91a7d42588002bf7..48259626b5234fc07bfc8b309539d49820eaa974 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index fbd67d86aa23d4f6af39e5f7160d928adebf7f94..8dd26898ff0d4093dfb90e6e7d13728f752ef977 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index cf0299ad40614042967a3c3733d4c4f97099de1c..72b88fa9ae057f4af6a8e243e504ce2f673a18f9 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 0786ddf212417419dbc73c64776c118995b64bd9..355bfa7df5b02aeff7a6c0fe135cd3c8160d82b3 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index f2f4207cdc51a827664a572dc6dff6922a9792ba..fb24e0e25623e2aeb1b365e78ae102f17430cf97 100644 (file)
 
 #define CMK_SIZE_T                                         long unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 373f467bc1476286e20fdd6db397801bc6bd2fc2..f34eecb6833957cd9214a0da3667ce92d723de80 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 2542f4a2e5442af1138beea18409ee8c53565af0..35a50270935814f0f20648764fe21cca37365ede 100644 (file)
 
 #define CMK_SIZE_T                                         long unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/sim/spantree.c b/src/arch/sim/spantree.c
deleted file mode 100644 (file)
index 3772e12..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-
-CmiSpanTreeInit()
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChild(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < CmiNumPes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < CmiNumPes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= CmiNumPes())
-        return 0;
-    else return ((CmiNumPes() - 1) - node * MAXSPAN);
-}
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (CmiNumPes() - 2) / MAXSPAN;   /* integer division */
-        node < CmiNumPes(); node++)
-        CmiSyncSend(node, size, msg);
-}
-
index daf6d0d02c3c8baf4d09cc3e73acf7d72ffae87d..21dd3fe8fc0274d2924410e34abe2069b74bd9c8 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/sp3/spantree.c b/src/arch/sp3/spantree.c
deleted file mode 100644 (file)
index 70a345d..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-#define MAXNODES   1024
-#define MAXCUBEDIM  10         /* log_2 (MAXNODES) */
-
-
-typedef struct spantreearray {
-    int noofchildren;
-    int parent;
-    int *children;
-} SpanTreeArray;
-
-static SpanTreeArray *SpanArray;
-static int *NodeStore;   /* used to store the nodes in the spanning 
-                      tree in breadth first order */
-static int numnodes;
-
-CmiSpanTreeInit()
-{
-    int i, j;
-    int visited[MAXNODES];
-    int next, currentnode;
-    int neighbours[MAXCUBEDIM];
-    int dim;
-
-    numnodes = CmiNumPes();
-    dim      = CmiNumNeighbours(0);
-    SpanArray = (SpanTreeArray *)CmiAlloc(sizeof(SpanTreeArray) * numnodes);
-    NodeStore = (int *) CmiAlloc(sizeof(int) * numnodes);
-    visited[0] = 1;
-    NodeStore[0] = 0;  /* the root of the spanning tree */
-    SpanArray[0].parent = -1;  /* no parent */
-
-    for (i = 1; i < numnodes; i++)
-        visited[i] = 0;
-
-    for (next = 1, i = 0; i < numnodes; i++)
-    {
-       currentnode = NodeStore[i];
-       CmiGetNodeNeighbours(currentnode, neighbours);
-       SpanArray[currentnode].noofchildren = 0;
-       for (j = 0; j < dim && 
-                   SpanArray[currentnode].noofchildren < MAXSPAN; j++)
-       {
-           if (!visited[neighbours[j]])
-           {
-               NodeStore[next + SpanArray[currentnode].noofchildren] = 
-                                                               neighbours[j];
-               SpanArray[currentnode].noofchildren++;
-               SpanArray[neighbours[j]].parent = currentnode;
-               visited[neighbours[j]] = 1;
-               
-           }
-       }
-       if (SpanArray[currentnode].noofchildren != 0)
-       {
-           SpanArray[currentnode].children = &NodeStore[next];
-           next += SpanArray[currentnode].noofchildren;
-       }
-    }
-
-    for (i = 0; i < numnodes; i++)  /* check */
-       if (!visited[i])
-          CmiError("node %d not part of spanning tree: initialization error!\n",i);
-}
-
-
-int CmiSpanTreeRoot()
-{
-    return 0;  /* node 0 is always the root of the spanning tree on the 
-                 hypercubes */
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    return SpanArray[node].parent;
-}
-
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for( i = 0; i < SpanArray[node].noofchildren; i++)
-         children[i] = SpanArray[node].children[i];
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    return SpanArray[node].noofchildren;
-}
-
-
-
-
-PrintSpanTree()
-{
-    int i,j;
-
-    for (i = 0; i < numnodes; i++)
-    {
-       CmiPrintf("node: %d, parent: %d, numchildren: %d, children: ",
-                i, SpanArray[i].parent, SpanArray[i].noofchildren); 
-       for (j = 0; j < SpanArray[i].noofchildren; j++)
-            CmiPrintf("%d ",SpanArray[i].children[j]);
-       CmiPrintf("\n");
-    }
-}
-
-
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    /* node 0 cannot be a leaf of a spanning tree: it is the root */
-    for (node = 1; node < numnodes; node++)
-    if (SpanArray[node].noofchildren == 0)  /* it is a leaf */
-        CmiAsyncSendFn(node, size, msg);
-}
index 36e4fda712c06dfa8f301e446f6bb0b0b93abc1f..4f827f1fb9c8d151c2b9d7c7fd6f5629ce9313f2 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/t3e/spantree.c b/src/arch/t3e/spantree.c
deleted file mode 100644 (file)
index 34422fd..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <converse.h>
-
-/* This file contains all the spanning tree functions */
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-#define MAXNODES   256
-#define MAXCUBEDIM 8          /* log_2 (MAXNODES) */
-
-
-CmiSpanTreeInit()
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < _num_pes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < _num_pes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= _num_pes())
-        return 0;
-    else return ((_num_pes() - 1) - node * MAXSPAN);
-}
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (_num_pes() - 2) / MAXSPAN;   /* integer division */
-        node < _num_pes(); node++)
-        CmiSyncSend(node, size, msg);
-}
index 61fa99a70e4b83eb93310fd4b1d7ef4d8b27422d..72e140492f83d0be619a9ab702172e5ad8f417db 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 865f3fa419a2281ade1481091953afba19df15d4..6641694e25ed247ca54999f5dade2324ca3a2af1 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 071034386127e5c3a60f9cc608e6d3ae4a6855fd..3d5dffbbf4c1b4d929f93d0af277e068a2612506 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned long
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 07cd4c5a00fe28fac895b1653e98fff668d053ca..d36b87fc181a68ca3c08fd97897db5dcbd75c9c0 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index f7646f0b6326753a9f7835073bdbd33443c78030..0ef91c4266e7e4a4c037d4e212f132ae3a9f3646 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 2532fec2bb1ea59ca085cff508c5eea72efcf4f1..5850722e3acea37a11f261d48e4c6abe17dcdac3 100644 (file)
 
 #define CMK_SIZE_T                                         long unsigned int
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 88330eaca152675774df99ea5dcc82eeaa9ffa05..2d1eec5cfd463ae893002970953ba3a7c4e58b38 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
index 3787a16990a6192b476f7b7f1f53b8703c5c4bcc..a22c8b3492012aa2bedac7cfeb22ab10398a2c33 100644 (file)
 
 #define CMK_SIZE_T                                         unsigned
 
+#define CMK_SPANTREE_MAXSPAN                               4
+#define CMK_SPANTREE_USE_COMMON_CODE                       1
+#define CMK_SPANTREE_USE_SPECIAL_CODE                      0
+
 #define CMK_STATIC_PROTO_FAILS                             0
 #define CMK_STATIC_PROTO_WORKS                             1
 
diff --git a/src/arch/uth/spantree.c b/src/arch/uth/spantree.c
deleted file mode 100644 (file)
index 48f4505..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file contains all the spanning tree functions */
-#include <converse.h>
-
-
-#define MAXSPAN    4          /* The maximum permitted span on 
-                                each node of the spanning tree */
-
-CmiSpanTreeInit()
-{
-}
-
-
-int CmiSpanTreeParent(node)
-int node;
-{
-    if (node == 0)
-         return -1;
-    else return ((node - 1) / MAXSPAN);   /* integer division */
-}
-
-int CmiSpanTreeRoot()
-{
-    return 0;
-}
-
-void CmiSpanTreeChildren(node, children)
-int node, *children;
-{
-    int i;
-
-    for (i = 1; i <= MAXSPAN ; i++)
-       if (MAXSPAN * node + i < CmiNumPes())
-            children[i-1] = node * MAXSPAN + i;
-       else children[i-1] = -1;
-}
-
-
-int CmiNumSpanTreeChildren(node)
-int node;
-{
-    if ((node + 1) * MAXSPAN < CmiNumPes())
-         return MAXSPAN;
-    else if (node * MAXSPAN + 1 >= CmiNumPes())
-        return 0;
-    else return ((CmiNumPes() - 1) - node * MAXSPAN);
-}
-
-CmiSendToSpanTreeLeaves(size, msg)
-int size;
-char * msg;
-{
-    int node;
-
-    for (node = (CmiNumPes() - 2) / MAXSPAN;   /* integer division */
-        node < CmiNumPes(); node++)
-        CmiSyncSend(node, size, msg);
-}
-
diff --git a/src/conv-core/spantree.c b/src/conv-core/spantree.c
new file mode 100644 (file)
index 0000000..4f96be0
--- /dev/null
@@ -0,0 +1,76 @@
+#include <converse.h>
+
+#if CMK_SPANTREE_USE_COMMON_CODE
+
+void 
+CmiSpanTreeInit(void) 
+{
+  return;
+}
+
+
+int
+CmiSpanTreeParent(int node)
+{
+  return (node ? ((node-1)/CMK_SPANTREE_MAXSPAN) : (-1));
+}
+
+
+int
+CmiSpanTreeRoot(void) 
+{ 
+  return 0; 
+}
+
+
+void 
+CmiSpanTreeChildren(int node, int *children)
+{
+  int i;
+
+  for (i=1; i<=CMK_SPANTREE_MAXSPAN; i++)
+    if (CMK_SPANTREE_MAXSPAN*node+i < CmiNumPes())
+      children[i-1] = node*CMK_SPANTREE_MAXSPAN+i;
+    else 
+      children[i-1] = (-1);
+}
+
+
+int
+CmiNumSpanTreeChildren(int node)
+{
+    if ((node+1)*CMK_SPANTREE_MAXSPAN < CmiNumPes()) 
+      return CMK_SPANTREE_MAXSPAN;
+    else if (node*CMK_SPANTREE_MAXSPAN+1 >= CmiNumPes()) 
+           return 0;
+         else 
+           return ((CmiNumPes()-1)-node*CMK_SPANTREE_MAXSPAN);
+}
+
+
+void
+CmiSendToSpanTreeLeaves(int size, char *msg)
+{
+  int node;
+
+  for (node=(CmiNumPes()-2)/CMK_SPANTREE_MAXSPAN;node<CmiNumPes();node++)
+    CmiSyncSend(node,size,msg);
+}
+
+
+void
+PrintSpanTree(void)
+{
+  int i,j;
+  int children[CMK_SPANTREE_MAXSPAN];
+  for (i=0; i<CmiNumPes(); i++) {
+    CmiPrintf("node: %d, parent: %d, numchildren: %d, children: ",
+      i, CmiSpanTreeParent(i), CmiNumSpanTreeChildren(i));
+    CmiSpanTreeChildren(i, children);
+    for (j=0; j<CmiNumSpanTreeChildren(i); j++)
+      CmiPrintf("%d ", children[j]);
+    CmiPrintf("\n");
+  }
+}
+
+#endif
index 1f3c6f40459a65cbe5903f89286ce6ae0e1228dc..10dfdb65af6132958d0d4c3f7efb2a29538656ff 100644 (file)
@@ -537,21 +537,21 @@ const char *CImessage = // msgType
 ;
 
 const char *CIAsyncChareCreateProto = // charename, msgname
-"extern void CAsync_\01(\02 *m, int onPE=CK_PE_ANY);\n"
+"extern void CNew_\01(\02 *m, int onPE=CK_PE_ANY);\n"
 ;
 
 const char *CIAsyncChareCreateImpl = // charename, msgname
-"void CAsync_\01(\02 *m, int onPE) {\n"
+"void CNew_\01(\02 *m, int onPE) {\n"
 "  new_chare2(\01, \02, m, (ChareIDType *)0, onPE);\n"
 "};\n"
 ;
 
 const char *CIAsyncGroupCreateProto = // groupname, msgname
-"extern int CAsync_\01(\02 *m);\n"
+"extern int CNew_\01(\02 *m);\n"
 ;
 
 const char *CIAsyncGroupCreateImpl = // groupname, msgname
-"int CAsync_\01(\02 *m) {\n"
+"int CNew_\01(\02 *m) {\n"
 "  return new_group(\01, \02, m);\n"
 "};\n"
 ;