[petsc-dev] ugliness due to missing lapack routines

Barry Smith bsmith at mcs.anl.gov
Wed Feb 6 21:56:58 CST 2013


> 
>   Does anyone see a problem with doing this?
> 
> I like that . Configure can auto-generate those in the header.
> 
>    Matt

   Does this sound like someone volunteering? If you do one I can easily add the others.

  Barry


On 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.
> 
>    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




More information about the petsc-dev mailing list