Dear all, I found the error. There is a Ndata2send(iCPU) instead of Ndata2recv(iCPU). In the attachment there is the correct version of the program.
Only one thing, could do you check if the use of MPI_WAITALL and MPI_BARRIER is correct? Thanks again Diego On 8 January 2015 at 18:48, Diego Avesani <diego.aves...@gmail.com> wrote: > Dear all, > thanks thank a lot, I am learning a lot. > > I have written a simple program that send vectors of integers from a CPU > to another. > > The program is written (at least for now) for 4 CPU. > > The program is quite simple: > Each CPU knows how many data has to send to the other CPUs. This info is > than send to the other CPUS. In this way each CPU knows how may data has to > receive from other CPUs. > > This part of the program works. > > The problem is in the second part. > > In the second part, each processor sends a vector of integer to the other > processor. The size is given and each CPU knows the size of the incoming > vector form the first part of the program. > > In this second part the program fails and I do not know why. > > In the attachment you can find the program. Could you please help me. > Problably I didn't understand properly the ISEND and IRECV subroutine. > > Thanks again > > > Diego > >