Ah ha! It turns out that the MPI spec specifically states that the user's code has to add a blank string at the end of the array to indicate the end. Specifically (as was just quoted to me), MPI-2.2, p310:18-25 defines:
"The argv argument argv is an array of strings containing arguments that are passed to the program. The first element of argv is the first argument passed to command, not, as is conventional in some contexts, the command itself. The argument list is terminated by NULL in C and C++ and an empty string in Fortran. In Fortran, leading and trailing spaces are always stripped, so that a string consisting of all spaces is considered an empty string. The constant MPI_ARGV_NULL may be used in C, C++ and Fortran to indicate an empty argument list. In C and C++, this constant is the same as NULL." This definition is also valid for MPI_COMM_SPAWN_MULTIPLE. OMPI does mistakenly assume that all your argv have the same number of tokens; I'll fix that. On May 25, 2010, at 11:55 AM, Jeff Squyres (jsquyres) wrote: > (somehow I apparently never sent this mail! It's been sitting in my drafts > folder for weeks. To followup what I said below: I sent a question about > this issue to the MPI-3 Fortran working group -- to see exactly what *should* > be the right thing to do: > http://lists.mpi-forum.org/mpi3-fortran/2010/05/0830.php) > > > On May 7, 2010, at 6:30 PM, Noam Bernstein wrote: > > > As with every array in Fortran, arrays of strings > > are contiguous in memory, and presumably the end of string (1,1) > > is right before the beginning of string(2,1), etc. > > Yep -- got all that -- we have some f2c string translation routines in OMPI > for just this purpose. > > But MPI_COMM_SPAWN_MULTIPLE is a little unique in that it takes a 2D array of > character strings. We know the first dimension; it has to be the same as the > "count" argument to MPI_COMM_SPAWN_MULTIPLE. And by the hidden argument, we > know the length of all of the strings. But we don't know the 2nd dimension > of the array. > > So OMPI searches for it by looking for an empty string (i.e., all spaces). > My gfortran 4.1 isn't doing that, although my ifort 11.1 and pgf90 10.0 are. > In my small example that I sent, it *is* apparently doing that for Andrew's > ifort 9.0, but it (apparently) isn't in his production tests. Sigh. > > -- > Jeff Squyres > jsquy...@cisco.com > For corporate legal information go to: > http://www.cisco.com/web/about/doing_business/legal/cri/ > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users > -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/