mpich patch for shmem with > 1 myrinet board.

Douglas Johnson <[email protected]>
Newsgroups gmane.network.myrinet.general
Message-ID <[email protected]>
Hi,
	If you have 2 or more myrinet boards in an smp system and want to
use shared memory for local mpi communication, you will need the following
patch for mpich-1.2..3. 



diff -u ../clean/mpich-1.2..3/mpid/ch_gm/gm_smp.c mpid/ch_gm/gm_smp.c
--- ../clean/mpich-1.2..3/mpid/ch_gm/gm_smp.c	Thu Jun 29 13:20:42 2000
+++ mpid/ch_gm/gm_smp.c	Thu Aug 17 14:52:45 2000
@@ -8,6 +8,7 @@
 {
   MPID_Config * new_config = NULL;
   MPID_Config * return_config;
+  char *cp, *cq;
   int i, j;
 
   /* already configured ? */
@@ -19,8 +20,15 @@
 
   /* search the number of local processes */
   smpi.num_local_nodes = 0;
+  /* rip off :board specifier when doing comparisons to figure out smp-ness
+   * --pw
+   */
+  if ((cp = strrchr(gmpi.node_names[MPID_MyWorldRank], ':')))
+    *cp = 0;
   for (i=0; i < MPID_MyWorldSize; i++) {
     smpi.local_nodes[i] = -1;
+    if ((cq = strrchr(gmpi.node_names[i], ':')))
+      *cq = 0;
     if (strcmp(gmpi.node_names[i], gmpi.node_names[MPID_MyWorldRank]) == 0) {
       /* Same node name, me or another process ? */
       if (i == MPID_MyWorldRank)
@@ -28,7 +36,11 @@
       smpi.local_nodes[i] = smpi.num_local_nodes;
       smpi.num_local_nodes++;
     }
+    if (cq)
+      *cq = ':';
   }
+  if (cp)
+    *cp = ':';
   /* at least one local node : myself ! */ 
   gm_assert(smpi.num_local_nodes != 0);
   
diff -u ../clean/mpich-1.2..3/mpid/ch_gm/gmconf.c mpid/ch_gm/gmconf.c
--- ../clean/mpich-1.2..3/mpid/ch_gm/gmconf.c	Wed Mar 15 18:45:06 2000
+++ mpid/ch_gm/gmconf.c	Thu Aug 17 14:42:06 2000
@@ -214,8 +214,10 @@
 #endif
 
 	count = 0;
+	bzero(gmpi.node_names, GMPI_MAX_NUMNODES * sizeof(char *));
 	while (!feof(conffile_stream)) {
-		gmpi.node_names[count] = malloc(GM_MAX_HOST_NAME_LEN + 8);
+		if (!gmpi.node_names[count])
+		    gmpi.node_names[count] = malloc(GM_MAX_HOST_NAME_LEN + 8);
 		if (!gmpi.node_names[count]) {
 			fprintf(stderr, "couldn't allocate space for gmpi.node_names[%d]\n", count);
 			exit(1);

-- 
Doug Johnson
Systems Developer/Engineer
The Ohio Supercomputer Center
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.