LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Davide Cesari (dcesari_at_[hidden])
Date: 2002-09-18 01:31:39


On Tue, 17 Sep 2002 dburbano_at_[hidden] wrote:

> I want to send an string and put it in a vector, with the function
> MPI_Allgather. How can I do?
>
> The strings are of diferent size.
>
> char ** ArrayString;
> size p = 10;
> ArrayString = (char **) malloc (p * sizeof (char *));
>
>
> Or I do my array by this way, but I can :(:
>
> char * ArrayString [10];
> char *strings;
> int longString;
>
> ArrayString[0]= "house";
> ArrayString[1]= "dealer";
> ...
>
> I use the function:
>
> MPI_Allgather(strings,longString,MPI_CHAR,ArrayString,100,MPI_CHAR,MPI_COMM_WORLD);
>
> so, I need to put together the strings of each process in a vector, in my
> case ArrayString, Can some body help me?
>

Daniel,
        If I well understand your problem, you should use MPI_Allgatherv,
which allows different array size for each process, rather than
MPI_Allgather; moreover in both cases ArrayString should not be a vector
of pointers but just a pointer to a region big enough to hold all the
processes' strings. Maybe someone can point you to an example of use of
these routines, online or within lam-mpi distribution, I haven't any ready
at the moment.
        best regards, Davide

_______________________________________________
This list is archived at http://www.lam-mpi.org/MailArchives/lam/