[petsc-dev] ugliness due to missing lapack routines

Barry Smith bsmith at mcs.anl.gov
Thu Feb 7 11:41:54 CST 2013


On Feb 7, 2013, at 11:36 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> 
> 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?

   Obviously in $PETSC_ARCH/  since it is arch specific and generated by BuildSystem
> 
> 
> 
>   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.

   Crap you are right. We'll need to come up with some other solution UNLESS the BLAS library version of them are in their separate .o files so we can pick up the generated one in libpetsc.a and it won't ever load the one in the blas library.

   Sometime I will send a detailed email explaining why I wish to totally eradicate CPP.

   Barry

>  
> #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
> 
> 




More information about the petsc-dev mailing list