[petsc-dev] ugliness due to missing lapack routines

Jed Brown jedbrown at mcs.anl.gov
Thu Feb 7 11:36:56 CST 2013


On Thu, Feb 7, 2013 at 11:31 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>  I disagree (there will be NO mention of PETSC_MISSING_LAPACK_FOO anywhere
> in PETSc source code) In this case we "fixing" broken LAPACK packages. We
> should not dirty the PETSc source tree AT all because of broken LAPACK. The
> PETSc source tree should be clean because it assumes a complete lapack.
>
>   Jed writes
> >  petscblaslapack.h needs to know not to redefine those function names.
> I'd much rather have
>
>    this is wrong. petscblaslapack.h WILL NOT CHANGE at all. Matt will
> generate exactly the missing lapack routines with their appropriate names.
> So for a double precision build with _ on BLAS/LAPACK routines Matt will
> generate
>
>     void dgeev_(whatever the args are)
>          set info to appropriate error code.
>

Okay, this is a *.c file, so different from the current system. Will this
file be put in $PETSC_ARCH/ or in the normal source tree?


>   (Note that BuildSystem already knows all about the mangling so
> generating this with and without underscore, CAPS etc is easy) Matt will
> NOT generate LAPACKgeev() or something like that.
>
>   In fact Matt can also generate the appropriate zdot_() when needed so
> ugly crap like
> /* handle complex dot() with special code */
>

How are you going to avoid a namespace collision here? The problem isn't
that the function doesn't exist, it's that we can't determine its binary
interface.


> #if defined(PETSC_USE_COMPLEX)
> PETSC_STATIC_INLINE PetscScalar BLASdot_(const PetscBLASInt *n,const
> PetscScalar *x,const PetscBLASInt *sx,const PetscScalar *y,const
> PetscBLASInt *sy)
> {
>   PetscScalar sum=0.0;
>   PetscInt    i,j,k;
>   if (*sx==1 && *sy==1) {
>     for (i=0; i < *n; i++) sum += PetscConj(x[i])*y[i];
>   } else {
>     for (i=0,j=0,k=0; i < *n; i++,j+=*sx,k+=*sy) sum +=
> PetscConj(x[j])*y[k];
>   }
>   return sum;
> }
> PETSC_STATIC_INLINE PetscScalar BLASdotu_(const PetscBLASInt *n,const
> PetscScalar *x,const PetscBLASInt *sx,const PetscScalar *y,const
> PetscBLASInt *sy)
> {
>   PetscScalar sum=0.0;
>   PetscInt    i,j,k;
>   if (*sx==1 && *sy==1) {
>     for (i=0; i < *n; i++) sum += x[i]*y[i];
>   } else {
>     for (i=0,j=0,k=0; i < *n; i++,j+=*sx,k+=*sy) sum += x[j]*y[k];
>   }
>   return sum;
> }
> #else
> PETSC_EXTERN_C PetscScalar BLASdot_(const PetscBLASInt*,const
> PetscScalar*,const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*);
> PETSC_EXTERN_C PetscScalar BLASdotu_(const PetscBLASInt*,const
> PetscScalar*,const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*);
> #endif
>
> can be removed from the petscblaslapack.h
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130207/78632a5a/attachment.html>


More information about the petsc-dev mailing list