[Dune] DUNE_THROW behaviour in parallel

Bernd Flemisch bernd at iws.uni-stuttgart.de
Tue Nov 8 12:49:27 CET 2016


Hi,

maybe a construct like this helps?:

int exceptionThrown = 0;
try {
   // Code that might throw
}
catch ... {
   exceptionThrown = 1;
}
exceptionThrown = gridView_().comm().max(exceptionThrown);
if (exceptionThrown) {
   // do something about it
}

By this, every process gets to know if an exception has been thrown by 
at least one process. If the "// Code that might throw" contains MPI 
routines after the throws, this won't help.

Kind regards
Bernd

On 11/08/2016 11:31 AM, Steffen Müthing wrote:
> Hi Aleksejs,
>
>> Am 08.11.2016 um 10:27 schrieb Aleksejs Fomins <aleksejs.fomins at lspr.swiss>:
>>
>> Dear Dune,
>>
>> In my experience DUNE_THROW (or the way I am using it) is working imperfectly in parallel.
>>
>> It is frequent that an exception is thrown on one or two of the many processes that are running my code. However, this does not terminate the entire code, as the other processes continue running. Further, if some of the processes start MPI communication at the same time, this causes a deadlock, and the program never crashes, as the remaining processes are waiting for the processes already crashed. As a result, if I am starting a large calculation and miss one line of error text in the output, I end up waiting in vain.
>>
>> I am not an expert in MPI, so perhaps some of you could advise me:
>>
>> Is it possible to throw an exception in such a way, that all processes running the job would crash, not just one of them?
> no, that won’t work without support by some kind of runtime - in general, you don’t even know what code the remote processes
> are currently executing, so there is no way to make them throw an exception from the outside.
>
> The only thing that might be feasible would be to install an exception handler at main scope (i.e. you exit main without handling
> the exception) that sends some kind of abort message via MPI to the other processes. However, that would require the other
> processes to listen to such a request, which will only work if you dedicate a separate thread to the job (and have a truly multithreaded
> MPI implementation).
>
> So, I don’t really see a way.
>
> Steffen
>
>>
>> Best regards,
>>
>> Aleksejs
>>
>>
>>
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune


-- 
_______________________________________________________________

Bernd Flemisch                         phone: +49 711 685 69162
IWS, Universität Stuttgart             fax:   +49 711 685 60430
Pfaffenwaldring 61            email: bernd at iws.uni-stuttgart.de
D-70569 Stuttgart            url: www.hydrosys.uni-stuttgart.de
_______________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20161108/c926c02e/attachment.htm>


More information about the Dune mailing list