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

Jed Brown jed at jedbrown.org
Sat Aug 27 13:59:44 CDT 2016


What about

#define PetscInitialize(argc,argv,file,help) PetscInitialize_Private(argc,argv,file,help,PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR,PETSC_VERSION_SUBMINOR,PETSC_VERSION_RELEASE)

and PetscInitialize will check for ABI compatibility (error if not)?

Note that subminor version (Eric's example) does not affect the ABI so
it's fine to have a mismatch there (but I think it should be passed so
we can note it in -log_summary).  If the user has non-release headers,
we probably just allow anything -- the user is on their own.

Eric, would this serve your purposes?  I'd rather see everyone get this
check rather than just making it possible for a user to do themselves.

Barry Smith <bsmith at mcs.anl.gov> writes:

>   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
>> 
>> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160827/56cb6169/attachment.sig>


More information about the petsc-dev mailing list