issue with large environments

Belmont Cheung bcheung at cray.com
Tue May 17 20:01:42 EDT 2005


Hi,

I think I found an issue with mpiexec and large environments.  It seems 
that the environment variable pointers are not updated when the 
environment buffer is expanded.  The issue is with 0.77 but I believe it 
still exists in 0.79.  Here's the diff I used for start_tasks.c,  Hope 
it is correct.

@@ -102,12 +102,22 @@

      if (value)
         len += strlen(value);
+
      while (envbuf_pos + len >= envbuf_len) {
+       int i = 0;
+       int diff = 0;
         char *x = envbuf;
         int oldlen = envbuf_len;
         envbuf_len += envbuf_inc;
         envbuf = (char *) Malloc(envbuf_len * sizeof(char));
         memcpy(envbuf, x, oldlen);
+
+       /* adjust envp pointers */
+       diff = envbuf - x;
+       for (i=0; i<envp_pos; i++) {
+           envp[i] += diff;
+       }
+
         free(x);
      }
      ensure_envp();

thanks,

Belmont Cheung



More information about the mpiexec mailing list