PetscErrorCode  SNESCreate(MPI_Comm comm,SNES *outsnes)
{
....
  PetscCall(SNESInitializePackage());

One rank creates a SNES, another one doesn't completely different order of 
registration hence a complete mess.

With dynamic libraries 

PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsnes(void)
{
  PetscFunctionBegin;
  PetscCall(SNESInitializePackage());
  PetscFunctionReturn(0);
}

Everything gets initialized when the libraries are loaded so they can be in the 
same order.

I believe Jed found some nonstandard magic that when using shared? classic? 
libraries triggering an initialization function in C from that library that 
could solve the problem but I forgot what it was. We should start using it, 
like Jed said we should have five years ago :-).

Barry


> On Sep 17, 2022, at 7:53 AM, Matthew Knepley <[email protected]> wrote:
> 
> It has to be collective, so how could it not be called in the same order?
> 
>    Matt
> 
> On Fri, Sep 16, 2022 at 9:05 PM Barry Smith <[email protected] 
> <mailto:[email protected]>> wrote:
> PetscLogEventRegister() is problematic since it must be call in exactly the 
> same order on all ranks. So for any computing beyond the trivial we've been 
> doing for 30 years -log_view is worthless
> 
> 
> 
> 
> 
> -- 
> 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
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>

Reply via email to