This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is mpi SYNC ALL supposed to work?


On Jan 13 2012, Vladimír Fuka wrote:

Hello, I tried the mpi version of coarrays (library from today's trunk and gfotran from trunk from 20. December). I can not get an a simple integral with reduction at the end to work, because the SYNC ALL does not seem to work for me. I even tried this:


void
_gfortran_caf_sync_all (int *stat, char *errmsg, int errmsg_len)
{
 int ierr;
printf("sync_all");
 if (unlikely (caf_is_finalized))
   ierr = STAT_STOPPED_IMAGE;
 else
printf("mpi bariera 1 %i",MPI_COMM_WORLD);
   ierr = MPI_Barrier (MPI_COMM_WORLD);
printf("mpi bariera 2 %i",MPI_COMM_SELF);

and the print were one after another from different images, without any sign of performed barrier, ie. they were not ordered all "mpi bariera 1" first and then all "mpi bariera 2", but first 1 then 2 and so on.

I do not understand it. Regards,

I am not surprised. You will find an explanation in my MPI course: http://www-uxsup.csx.cam.ac.uk/courses/MPI/index.html There is an over-simplied one in lecture 8 (Miscellaneous Guidelines) and a fuller one in lecture 11 (Attributes and I/O). Both will tell you how to do the job properly.

Despite common belief MPI_Barrier does NOT necessarily synchronise
output, though it is the best you can do.  Well, almost.  You could
put a fflush(stdout); immediately after each printf, and that might
do the job.  Might.  It won't on all systems.

Note that exactly the same applies to Fortran SYNC ALL - see Note 9.15
in 9.5.1 of the standard.  The reasons are nasty and almost insoluble,
and you are welcome to blame me (among others) for taking that decision.


Regards, Nick Maclaren.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]