Okay, that is a reason.
But I think that it is not necessary to generate with each "ADD"
a new handle.
Therefore I would modify the interface to
handle = MPI_STRING_NULL; /* handle of an empty string */
MPI_String_add ( &handle, string); /* handle is changed */
MPI_Spawn (... handle, ....); /* handle is used */
MPI_String_free ( handle ); /* handle is freed
(the value of the argument
remains unchanged) */
> > Simple things should be simply programmable.
>
> Somehow this seems less simple to me than
> MPI_Spawn(..., string, ...);
This interface is less simmple as it seems because the code to
program
info = "filename=<some value given by keybord>"
is
read (*,'(A)') name # reads e.g. 'my_file%1'
call percent_algorithm(name)
info = 'filename=' // name
call MPI_SPAWN(..., info, ...)
and the user written routine "percent_algorithm" is more than 2 lines!
The proposal with the handle needs less work by the user:
read (*,'(A)') name
info = 'filename=' // name
handle = MPI_STRING_NULL
call MPI_STRING_ADD ( handle, info)
call MPI_SPAWN (..., handle, ...)
call MPI_STRING_FREE (handle)
Another example is a loop to constuct an info argument with n strings.
handle = MPI_STRING_NULL
DO...
string = ....
strlen = ....
call MPI_STRING_ADD (handle,string(1:strlen))
ENDDO
call MPI_SPAWN (..., handle, ...)
call MPI_STRING_FREE (handle)
versus the same with strings:
infoend = 0
DO...
string = ....
strlen = ....
call percent_algorithm(string,strlen)
info(infoend+1:infoend+1) = ' ' # add seperator
info(infoend+2:infoend+1+strlen) = string # add string
infoend = infoend + 1 + strlen # seperator + strlen
ENDDO
infobeg = 2 # omit first separator
IF(infoend .EQ. 0) THEN
infobeg = 1
info(1:1) = ' '
infoend = 1
ENDIF
call MPI_SPAWN (..., info(infobeg:infoend), ...)
And the C-code is not really better -- or?
Rolf
Rolf Rabenseifner (Computer Center )
Rechenzentrum Universitaet Stuttgart (University of Stuttgart)
Allmandring 30 Phone: ++49 711 6855530
D-70550 Stuttgart 80 FAX: ++49 711 6787626
Germany rabenseifner@rus.uni-stuttgart.de