Re: combine SPAWN and SPAWN_MULTIPLE

Gary Oberbrunner (garyo@avs.com)
Tue, 30 Apr 1996 13:39:03 -0400

> Date: Tue, 30 Apr 1996 09:51:55 -0700
> From: "William C. Saphir" <wcs@nas.nasa.gov>
>
> > Are there reasons from the C viewpoint to leave MPI_SPAWN in the
> > standard?
>
> Yes. If you delete MPI_Spawn(), then the following code:
>
> int errcodes[5];
> MPI_Comm universe;
> MPI_Spawn("ocean", 5, 7, NULL, 0, MPI_COMM_WORLD, &universe, errcodes);
>
> becomes:
>
> int errcodes[5];
> MPI_Comm universe;
> char command[] = "ocean";
> int mincount = 5;
> int maxcount = 7;
> char infos[] = NULL;
>
> MPI_Spawn(1, command, &mincount, &maxcount, infos, 0,
> MPI_COMM_WORLD, &universe, &errcodes)
>
> I agree there is no loss in functionality. However, MPI is always
> seen as excessively complicated, and I think it would be a mistake
> to make this simple situation more difficult than it has to be.
> I expect it to be rare that applications need to use
> the MULTIPLE versions.

I agree. In fact it's worse than Bill makes out. In the general (but
common) case errcodes[] needs to be malloced, because its size is
variable, depending on the # of nodes. errcodes[5] is wrong anyway,
should be 7. Also Bill left out a couple of *s and {}s above (left as
an exercise for the reader), which just goes to show that it's too
complex for frequent use.

I suspect it's actually easier to rewrite Spawn as Spawn_Independent()
followed by accept & connect. (1/2 :-))

(PS: anyone want to write the "cmd-line quote" function that we will
all need to %ify the spaces in our spawn command lines? If it's not
in the standard, at least someone should post a version to this list
:-)

-- 
Gary Oberbrunner			garyo@avs.com
Advanced Visual Systems, Inc.		http://www.avs.com/~garyo
300 Fifth Avenue			(617)890-8192 x2133  TEL
Waltham, MA 02154			(617)890-8287	     FAX