About output in lammps

Dear Lammps authors

I have some problem with the following code:
MPI_Irecv(buf,maxbuf*size_one,MPI_DOUBLE,me+iproc,0,world,&request);
MPI_Send(&tmp,0,MPI_INT,me+iproc,0,world);
MPI_Wait(&request,&status);
MPI_Get_count(&status,MPI_DOUBLE,&nlines);

(in dump->write())

Why you need to send 0 int from the main processor?

Thanks very much!

Best!

Hao

Dear Lammps authors

        I have some problem with the following code:

MPI_Irecv(buf,maxbuf*size_one,MPI_DOUBLE,me+iproc,0,world,&request);
          MPI_Send(&tmp,0,MPI_INT,me+iproc,0,world);
          MPI_Wait(&request,&status);
          MPI_Get_count(&status,MPI_DOUBLE,&nlines);
(in dump->write())
Why you need to send 0 int from the main processor?

​because the remote processor is blocking on an MPI_Recv()​.

to understand you have to look at the overall code including the opposite
side. and it is probably better to understand looking at it backwards.

- all processors, that want to send data launch a blocking receive and
thus wait for the send. after receiving the send, they immediately send
their data back with a "ready-send" message.

- the processor that is does the i/o and wants to receive data is looping
over all processors, it expects data from. it then sets up a non-blocking
receive (for the "ready-send" message), and then posts the blocking send,
which will then "unblock" the blocking receive on the sender and start the
ready-send. MPI_Wait() then blocks until the receive is complete.

take a piece of paper and write down in pseudocode what happens step by
step and side by side for just two or three MPI ranks and you'll see.
it could be written simpler, but there is a good reason for doing it this
way.

axel.