[petsc-dev] Are there both a function AND a #define to retrieve PETSc version?
Barry Smith
bsmith at mcs.anl.gov
Sat Aug 27 14:07:48 CDT 2016
> On Aug 27, 2016, at 1:59 PM, Jed Brown <jed at jedbrown.org> wrote:
>
> 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)?
Ok
>
> Note that subminor version (Eric's example) does not affect the ABI so
> it's fine to have a mismatch there
Well in Eric's case he knows he needs a bug fix in sub minor 3 and wants to generate an error if linked against an earlier one that does not have the bug fix. There needs to be a way for users to indicate if they need above something in the sub minor, doesn't 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
>>>
>>>
More information about the petsc-dev
mailing list