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

Barry Smith bsmith at mcs.anl.gov
Sun Aug 28 18:16:15 CDT 2016


   We could also provide a 

   PetscVersionRequired(major_a,minor_a,subminor_a,major_b,minor_b,subminor_b)  which does both a compile and runtime check
that     version_a <= version < version_b. For example

    PetscVersionRequired(3,7,3,3,8,0) says it supports 3.7.3 and all patches in 3.7.* after it.

Barry

> On Aug 28, 2016, at 5:24 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> Eric Chamberland <Eric.Chamberland at giref.ulaval.ca> writes:
> 
>> 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... 
> 
> There is both MPI_Get_version(int *version, int *subversion) and
> MPI_Get_library_version(char *version, int *resultlen).
> 
> Meanwhile, there is already PetscGetVersion(char *version, size_t len).
> If you like parsing strings, it seems like that would serve you purpose.
> But if you want to handle it programmatically without needing to parse a
> string, then perhaps we should add a PetscGetVersionNumber (more
> consistent name than my first suggestion).  What is your peference?
> 
>> 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.
> 
> The problem with a string is that the format of the string can be
> changed without changing the API, thus breaking existing code in a
> possibly subtly way at run time.  Note that the MPI standard does not
> specify the format of MPI_Get_library_version.




More information about the petsc-dev mailing list