[petsc-dev] Increase PETSCSTACKSIZE?

Matthew Knepley knepley at gmail.com
Tue May 4 14:52:32 CDT 2010


On Tue, May 4, 2010 at 2:42 PM, Jed Brown <jed at 59a2.org> wrote:

> PetscFunctionBegin has logic to to avoid overflowing the array, but the
> stack still gets skewed because PetscFunctionReturn always pops the
> stack.  This is a problem because many simple examples already overflow
> the stack at some point, resulting in a truncated stack in the error
> messages.  This macro is currently defined at 15, with fieldsplits and
> V-cycles, it's easy to exceed 30 frames.
>
> The stack skew problem could be overcome by introducing a new local
> variable with another level of nesting, something like
>
> #define PetscFunctionBegin {  \
>    PetscTruth _petscstackpushed = petscstack->currentsize < PETSCSTACKSIZE;
> \
>    ExistingPetscFunctionBegin;
>
> #define PetscFunctionReturn(n) \
>    {if (_petscstackpushed) PetscStackPop; return (n);} \
>  }
>
> But I'm not a huge fan of doing this sort of thing with macros and it's
>

I really hate variables in macros that are necessary in other macros. It so
opaque.
I do not have a better solution.


> still easy enough to get an error from deeper than 15 frames, so I want
> to increase the PETSCSTACKSIZE regardless of whether the macro hack
> above is also done.  Is there a reason not to use a biggish number like
> 50 or more?


Yep, we should increase it to 64.

   Matt


>
> Jed

-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100504/a38ba059/attachment.html>


More information about the petsc-dev mailing list