[petsc-dev] ugliness due to missing lapack routines

Jed Brown jedbrown at mcs.anl.gov
Sat Feb 9 13:10:32 CST 2013


On Sat, Feb 9, 2013 at 11:57 AM, Karl Rupp <rupp at mcs.anl.gov> wrote:

> Fortunately, b) can be checked easily with 'style checkers', keeping the
> lifetime of such a bug below 1 day.
>

That is true, and if we did pull requests (instead of pushing directly),
the CI server would do the style checking before it reached the stable
branch.


>  To convert this to usual C semantics, we could use (yet another) macro
>> trick
>>
>
> Replacing CPP with CPP to get rid of CPP? That does not sound like a good
> approach :-D
>

It's CPP, but not conditional compilation. There's a big difference for
static code analysis. As we've discussed before, there are certain bits of
CPP that we can't remove (without huge refactoring and increased verbosity
or adding our own preprocessor, which would be gross and we'd still have to
teach the "manipulator" the semantics of that preprocessor). It is not so
hard to teach the manipulator about one "safe" macro that gets
configuration information. (It can reason about it as if the expression was
a const global variable.)



>
>
>  With this sort of thing, we could write
>>
>> if (PETSC_HAVE_(SOMETHING)) {
>>    some_func(no_headache);
>> } else { ... }
>>
>> which can be reasoned about using normal C semantics. The condition
>> evaluates at compile time so the code produced (with any optimization)
>> is identical. If different functions are called in the two cases, the
>> linker may request both of them. (This can be good or bad.)
>>
>
> Since #if defined(...) is often used to conditionally enable calls to
> external libraries, this would require us to either disallow all direct
> calls to external libraries in all of PETSc core (and use some
> sublibrary-type generic interface instead),
>

We do this now by putting that stuff in impls/external-thing/ which is
conditionally compiled using #requirespackage in the makefile. We have one
access point to that functionality: registration of the corresponding
XXCreate_YY(), which is done in XXRegisterAll(). The body of that routine
must either use conditional compilation via CPP or be generated using some
other tool. CPP is perfectly sufficient for "generating" that file.


> or to always link against all libraries. The latter is a nightmare with
> respect to support-requests to petsc-maint.
>

This is crazy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130209/506fa1a2/attachment.html>


More information about the petsc-dev mailing list