[lammps-users] why MPI_Barrier seems does not work for iterative loop in verlet.cpp

Hi,

I'm trying to modify the iterate() in verlet.cpp and I've got several
problems. The key problem is MPI_Barrier seems does not work. I added
the following codes before modify->final_integrate();

lmp->timer->barrier_start(TIME_LOOP);
(writing statements, prints out CPU ID, loop identifier i,...etc.)
lmp->timer->barrier_stop(TIME_LOOP);

And I ran a simple MD simulation with eam potential. It is supposed to
print out the CPU ID for each loop, however, output file shows that MD
loop continues in one CPU for several steps and then switch to
another. Besides, I cannot see CPU 0 until the simulation finishes.

If I try MPI_Allreduce to sum up the number of local atoms, the print
out shows that the sum is only the number of local atoms in CPU 1(not
0, nor other CPU ID).

Besides these everything looks fine. The scale of multiple CPUs and
the results looks all right. May be I cannot consider the iterate
function as a simple parallel MD loop?

Thanks.

Best,
sapphire

Hi,

I'm trying to modify the iterate() in verlet.cpp and I've got several
problems. The key problem is MPI_Barrier seems does not work. I added
the following codes before modify->final_integrate();

lmp->timer->barrier_start(TIME_LOOP);
(writing statements, prints out CPU ID, loop identifier i,...etc.)
lmp->timer->barrier_stop(TIME_LOOP);

And I ran a simple MD simulation with eam potential. It is supposed to
print out the CPU ID for each loop, however, output file shows that MD
loop continues in one CPU for several steps and then switch to
another. Besides, I cannot see CPU 0 until the simulation finishes.

i don't think that this has to do with how MPI_Barrier works,
but rather how your MPI library handles I/O from remote nodes.
if you want to determine the order of output, you have to
first send it to the rank 0 node and then print it from there,
or see, if there is an mpirun flag, that turns off I/O buffering
for stdout. sometimes, you can get around it by printing to stderr
instead of stdout.

cheers,
   axel.