<div class="gmail_quote">On Mon, Sep 17, 2012 at 8:20 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":2u4">If a caller does not want to abort if PetscInit fails, alright.<div><br></div><div>However, we can still return a special error code that never goes into the</div><div>infrastructure.</div></div></blockquote>
</div><br><div>Hmm, the first couple lines of PetscInitialize has</div><div><br></div><div><div> PetscFunctionBegin;</div><div> if (PetscInitializeCalled) PetscFunctionReturn(0);</div><div><br></div><div> /* these must be initialized in a routine, not as a constant declaration*/</div>
<div> PETSC_STDOUT = stdout;</div><div> PETSC_STDERR = stderr;</div></div><div><br></div><div>This could fail if</div><div><br></div><div>1. PetscInitialize did not match __FUNCT__ (checking would use PETSC_STDERR before it was initialized)</div>
<div><br></div><div>2. PetscThreadLocalGetValue(petscstack, PetscStack*) fails. Actually, I would expect this to fail any time thread local variables are not supported:</div><div><br></div><div>#define PetscThreadLocalGetValue(name,type) ( (type)pthread_getspecific(name##_key))</div>
<div><br></div><div><br></div><div>In any case, maybe we can say that it is safe to CHKERRQ after PetscInitialize because there is no code path by which it could fail? PetscInitialize itself starts calling CHKERRQ for everything after this part.</div>