[petsc-dev] Are there both a function AND a #define to retrieve PETSc version?

Barry Smith bsmith at mcs.anl.gov
Sat Aug 27 12:04:20 CDT 2016


  Eric,

   We don't have this but I guess we could add some support.

   Do you need the actual versions or would a single check be all you need such as

   PetscLibrarySubminorVersonMatchsIncludeSubminorVersion() and PetscLibraryMinorVersonMatchsIncludeMinorVersion() ?

   If we were willing to make PetscInitialize() a macro we could even do

#define PetscInitialize(a,b,c,d)  (PetscLibraryMinorVersonMatchsIncludeMinorVersion() || PetscInitialize_Private(a,b,c,d))  

:-(


   Barry

BTW: it looks like PETSC_VERSION_PATCH is not used anymore and it has been replaced with PETSC_VERSION_SUBMINOR



> On Aug 26, 2016, at 1:53 PM, Eric Chamberland <Eric.Chamberland at giref.ulaval.ca> wrote:
> 
> Hi,
> 
> wanting to prevent a possible error: I compile and link (dynamically) my code with petsc-3.7.2 BUT I may change my LD_LIBRARY_PATH to point to 3.7.0...
> 
> I would the like my code to stop and tell me I am using the wrong libs...
> 
> I could add something like:
> 
> if (PETSC_VERSION_MAJOR != PetscInfoVersionMajor() ||
>    PETSC_VERSION_MINOR != PetscInfoVersionMinor() ||
>    PETSC_VERSION_PATCH != PetscInfoVersionPatch()) {
> 
>  printf("You are using a different version of PETSc than the one you linked with...");
>  exit(1);
> }
> 
> But I then need non-inlined functions PetscInfoVersion* to have this to work...
> 
> Does this exists?
> 
> I think It could even be into Petsc itself...
> 
> Thanks,
> 
> Eric
> 
> 




More information about the petsc-dev mailing list