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

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Sat Aug 27 22:18:21 CDT 2016

Le 2016-08-27 à 15:22, Jed Brown a écrit :
> Barry Smith <bsmith at mcs.anl.gov> writes:
>>     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?
> Oh, then we can have PetscVersionGet(&major,&minor,&subminor,&release).
> Or PetscVersionGetMajor(&major), ...
> Preference?
Good question!  I am not aware of other libs than MPI, and in MPI the 
returned value is a string containing eventually a lot a things... So 
the user can deeply check what is "included" or not into the lib...


OpenMPI code:

Mpich code:

Maybe it is too much, maybe not... depends of the needs of the user...

For me now, what you proposed is enough... but if the most interesting 
would be to have a function with an API that will not change too much in 
the future, maybe a string is a better choice. If changing the function 
API is not an argument, then I prefer a single call than n calls to 
retreive the complete version.



More information about the petsc-dev mailing list