Gather receives messages of _one_ length. Hence all arrays has to be of same length (not exactly see below). Hence 625 should be 175. See the example on the documentation site: https://www.open-mpi.org/doc/v1.8/man3/MPI_Gather.3.php
You should use gatherv for varying length of messages, or use gather with the largest receive size and take into account the empty padding in the receive buffer. 2015-09-30 14:43 GMT+00:00 Diego Avesani <diego.aves...@gmail.com>: > 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 > -- Kind regards Nick