[petsc-dev] ugliness due to missing lapack routines
Matthew Knepley
knepley at gmail.com
Wed Feb 6 21:43:30 CST 2013
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.
Matt
>
> Barry
>
>
>
--
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/3a0fbb87/attachment.html>
More information about the petsc-dev
mailing list