[petsc-dev] ugliness due to missing lapack routines

Matthew Knepley knepley at gmail.com
Wed Feb 6 22:45:28 CST 2013


On Wed, Feb 6, 2013 at 11:43 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Wed, Feb 6, 2013 at 9:43 PM, Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Wed, Feb 6, 2013 at 8:45 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>
>>>
>>>   PETSc is littered with
>>>
>>>   if (A->factortype == MAT_FACTOR_LU) {
>>> #if defined(PETSC_MISSING_LAPACK_GETRS)
>>>     SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRS - Lapack routine is
>>> unavailable.");
>>> #else
>>>
>>> PetscStackCall("LAPACKgetrs",LAPACKgetrs_("N",&m,&nrhs,mat->v,&mat->lda,mat->pivots,x,&m,&info));
>>>     if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"GETRS - Bad solve");
>>> #endif
>>>   } else if (A->factortype == MAT_FACTOR_CHOLESKY) {
>>> #if defined(PETSC_MISSING_LAPACK_POTRS)
>>>     SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"POTRS - Lapack routine is
>>> unavailable.");
>>> #else
>>>
>>> PetscStackCall("LAPACKpotrs",LAPACKpotrs_("L",&m,&nrhs,mat->v,&mat->lda,x,&m,&info));
>>>     if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"POTRS Bad solve");
>>> #endif
>>>
>>>
>>> due to missing LAPACK routines.   I propose for each missing routine we
>>> provide a dummy routine that calls SETERRQ() with the PETSC_ERR_SUP error
>>> and returns a "special" error code in the info arg. This way we can have
>>> pretty (CPPless :-) code like
>>>
>>>   if (A->factortype == MAT_FACTOR_LU) {
>>>
>>> PetscStackCall("LAPACKgetrs",LAPACKgetrs_("N",&m,&nrhs,mat->v,&mat->lda,mat->pivots,x,&m,&info));
>>>     if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"GETRS - Bad solve");
>>>   } else if (A->factortype == MAT_FACTOR_CHOLESKY) {
>>>
>>> PetscStackCall("LAPACKpotrs",LAPACKpotrs_("L",&m,&nrhs,mat->v,&mat->lda,x,&m,&info));
>>>     if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"POTRS Bad solve");
>>>   }
>>>
>>>   Does anyone see a problem with doing this?
>>
>>
>> I like that . Configure can auto-generate those in the header.
>>
>
> Wouldn't this be easier to add to petscblaslapack.h?
>
> I think that having significant code in petscconf.h is a bad thing for
> maintainability.
>

I think we have to make a distinction as to what kind of code is in there.
The proposed
stub does nothing but raise an error, just as Fortran stubs do nothing but
forward the call.
To me, this should be kept out of petscblaslapack.h.

    Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130206/f738df03/attachment.html>


More information about the petsc-dev mailing list