On Feb 6, 2013, at 10:53 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
> On Wed, Feb 6, 2013 at 10:45 PM, Matthew Knepley <knepley at gmail.com> wrote:
> I think we have to make a distinction as to what kind of code is in there.
> The proposed
> stub does nothing but raise an error, just as Fortran stubs do nothing but
> forward the call.
> To me, this should be kept out of petscblaslapack.h.
>
> petscblaslapack.h needs to know not to redefine those function names. I'd
> much rather have
>
> #if defined(PETSC_MISSING_LAPACK_FOO)
> ... definition that raises an error
> #else
> ... normal definition
> #endif
>
> than
>
> #if !defined(PETSC_MISSING_LAPACK_FOO)
> ... normal definition
> /* missing definition is generated */
> #endif
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.
(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 */
#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
Barry
>