Am 11.08.2021 um 04:08 schrieb Allin Cottrell:
On Tue, 10 Aug 2021, Sven Schreiber wrote:
> OK, my example was stupid in that respect. (Although interesting that
> "funcerr" still worked.
In the example you posted funcerr didn't "work", it was never actually
invoked (blocked by a false conditional).
Ah, of course.
> But in fact, my original problem _did_ occur within a function.
Only the
> nesting order was reversed: The MPI block itself was inside the
> function. Like this:
OK, that's tricky. So far as gretlmpi (a separate program) is
concerned, we're not inside a function at the point where errorif() is
called.
Yeah, that's what I had guessed.
Maybe the "only inside a function" requirement could be
waived within
an mpi block. Or maybe the whole program could be rewritten as
something to be run by gretlmpi from the start?
No, because we're talking about a function package, so everything is a
function.
There are two problems here in the broad context: First, the workings of
funcerr and errorif inside MPI. Secondly, how to get printout to appear
from MPI whenever there's an error. This latter issue is probably only
relevant on Windows. (AFAIK on Linux the printed output is captured OK.
On Windows, in my experience what helps is something like mpibarrier()
followed by flush, but this of course can only be done if the error can
be anticipated - during debugging, for example.)
Since MPI is an advanced thing and it's a separate program, maybe a new
thing like mpierror() could be warranted. (Plus documenting that funcerr
and errorif shouldn't be used there.) OTOH, if in the end it does the
same thing as errorif, then maybe you're right and it simply should be
allowed.
thanks
sven