CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How to stop program when using MPI? (https://www.cfd-online.com/Forums/main/182772-how-stop-program-when-using-mpi.html)

bhbuaa January 18, 2017 14:17

How to stop program when using MPI?
 
I am adding MPI package to my Fortran CFD code. I let #0 processor to send data to other processors to do the most of time-consume part and then receive the new data back to continue the following fluid calculations, and then all processors will repeat to call the same subroutine in a loop. The code will continue until there is an error in the #0 processor or the #0 processor finish all loops.

Since the CFD code is big, and there are tons of subroutines may call exit() function to terminate the calculation in #0 processor, it is not possible to add MPI functions in every subroutine to send information to other processors and let them terminate the program.

Hence, I would like to ask if there is any function that can detect if the calculation or job in #0 processor is terminated or finished at a certain point, and then I can just send that information to other processors to tell them continue the loops or stop??? Thank you.


All times are GMT -4. The time now is 07:33.