Gather requires that all processes contribute the same size message. Gatherv allows the root to specify a different size that will be supplied by each peer process.
Note, too, that X1(iStart:iEnd) may well invoke a copy to copy just that portion of the array; that might hurt your performance (depending on how large the range is). > On Sep 30, 2015, at 10:43 AM, Diego Avesani <diego.aves...@gmail.com> wrote: > > dear all, > I am not sure if I have understood correctly mpi_gather and mpi_gatherv. > This is my problem: > > I have a complex vector, let's say: X1, where X1 is (1:625). > > Each CPU work only with some element of X1, let say: > > CPU 0 --> X1(iEnd-iStart) 150 elements > CPU 1 --> X1(iEnd-iStart) 150 elements > CPU 2 --> X1(iEnd-iStart) 150 elements > CPU 3 --> X1(iEnd-iStart) 175 elements > > I would like to collect all the data in only one vector, let's say PP(1:625) > > is it correct to write? > CALL MPI_Gather(X1(iStart:iEnd), iEnd-iStart+1, MPI_DOUBLE_COMPLEX, > PHIH(1:625), 625, MPI_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD,MPIdata%iErr) > > In my case I get an error: > An error occurred in MPI_Gather > [diedroLap:3995] *** reported by process [140052855128065,0] > [diedroLap:3995] *** on communicator MPI_COMM_WORLD > [diedroLap:3995] *** MPI_ERR_TRUNCATE: message truncated > > Is this because each SubVector X1 has a different size? > > really really thanks > > Diego > > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2015/09/27737.php -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/