>         On Aug 12, 2018, at 2:18 PM, Diego Avesani
>         <diego.aves...@gmail.com> wrote: 
>         > 
>         > For example, I have to exit to a cycle, according to a
>         check:
>         > 
>         > IF(counter.GE.npercstop*nParticles)THEN
>         >         flag2exit=1
>         >         WRITE(*,*) '-Warning PSO has been exit'
>         >         EXIT pso_cycle
>         >      ENDIF
>         > 
>         > But this is difficult to do since I have to exit only after
>         all the threats inside a set have finish their task.
>         > 
>         > Do you have some suggestions?
>         > Do you need other information?
>         
Dear Diego et al,
Assuming I understand your problem:
The way I do this is set up one process that is responsible for normal
and error exits.  It sits looking for messages from all the other ranks
that are doing work.  Certain messages are defined to indicate an error
exit with an error number or some text.  The exit process is spawned by
the master process at startup and is told how many working processes are
there.  Each process either sends an OK exit when it is done or an error
message.  The exit process counts these exit messages and when the count
equals the number of working processes, it prints any/all errors, then
sends messages back to all the working processes, which, at this time,
should be waiting for these and they can terminate with MPI_Finalize.
   Of course it is more complicated than that to handle special cases
like termination before everything has really started or when the
protocol is not followed, debug messages that do not initiate
termination, etc. but maybe this will give you an idea for one
way to deal with this issue.
George Reeke




_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to