CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Parallel kill from inside the code (

johndeas January 25, 2010 07:00

Parallel kill from inside the code

I got a modified version of channeloodles that contains this piece of code:


if (Pstream::master())
    if(myPipe.pull()=="noFile" && feederStop)
        Info << "!!! NO VALID INLET FOUND, ENDING RUN !!!";

The statement

myPipe.pull()=="noFile" && feederStop
is tested on the master proc only, and if it is false, the whole computation should stop immediately. This is part of a system I have written to manage DNS boundary conditions, and the "false" case corresponds to a case where no boundary conditions can be found for the current time.

MPI_BARRIER being a simple reimplementation as read in

This piece of code works in serial execution, but in parallel run, std::exit(0) is only executed in the master proc. I would like a method so that, if the master proc detects a termination condition, all run exit. It can be noted that, while the master proc is testing the termination condition, the other procs are waiting for a reduction, as defined in MPI_BARRIER in the other thread.

I would be happy even if the run could end abruptly, all processes just have to end. Can mpirun be asked to broadcast a kill signal to all the processes, for example ?

Thank you


All times are GMT -4. The time now is 09:04.