[petsc-dev] ugliness due to missing lapack routines
Jed Brown
jedbrown at mcs.anl.gov
Wed Feb 6 22:43:26 CST 2013
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130206/2c1e8131/attachment.html>
More information about the petsc-dev
mailing list