From 8d413afedf8013d7db128cfa51e34c2796e8dc3b Mon Sep 17 00:00:00 2001 From: kanschat Date: Wed, 28 Apr 2010 22:52:53 +0000 Subject: [PATCH] document lapack templates a bit better git-svn-id: https://svn.dealii.org/trunk@21051 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/configure.in | 9 ++++++++- deal.II/contrib/blastemplates/templates.pl | 23 +++++++++++++++++++++- deal.II/lac/include/lac/lapack_templates.h | 11 +++++------ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/deal.II/configure.in b/deal.II/configure.in index 6b4b5b2623..7a5f92335d 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -549,7 +549,9 @@ AC_SUBST(UMFPACK_LIB) AC_SUBST(UMFPACK_INCLUDE_DIR) AC_SUBST(USE_CONTRIB_UMFPACK) -dnl Check for LAPACK +dnl ------------------------------------------------------------- +dnl Check for LAPACK and the LAPACK functions being used +dnl ------------------------------------------------------------- AC_ARG_WITH(lapack, [ --with-lapack=lapacklib Use the lapack library lapacklib. Make sure the path to the libary is searched by ld, since it is @@ -565,6 +567,11 @@ if test "x$with_blas" != "x" -a "x$with_blas" != "xno" ; then AC_CHECK_FUNC(daxpy_,,[AC_MSG_ERROR([BLAS library not installed correctly($with_blas)])]) fi +dnl Since we might have an incomplete LAPACK installation, check all +dnl the functions we may want to use. If any of them is missing, +dnl deal.II will not attempt to call it and rather throw and +dnl exception. + AC_CHECK_FUNCS([daxpy_ saxpy_ dgemv_ sgemv_ dgeev_ sgeev_ dgeevx_ sgeevx_]) AC_CHECK_FUNCS([dgesvd_ sgesvd_ dgemm_ sgemm_ dgetrf_ sgetrf_ dgetri_ sgetri_]) AC_CHECK_FUNCS([dgeqrf_ sgeqrf_ dormqr_ sormqr_ dorgqr_ sorgqr_ dtrtrs_ strtrs_]) diff --git a/deal.II/contrib/blastemplates/templates.pl b/deal.II/contrib/blastemplates/templates.pl index e4d2c908f2..2fd0419614 100644 --- a/deal.II/contrib/blastemplates/templates.pl +++ b/deal.II/contrib/blastemplates/templates.pl @@ -11,6 +11,27 @@ # #--------------------------------------------------------------------------- +#--------------------------------------------------------------------------- +# This perl script translates lapack_templates.h.in to lapack_templates.h +# +# In the *.in file, every BLAS/LAPACK function which is defined for +# double precision, i.e. having a name like 'dfoo_', is expanded to +# itself plus the same function for single precision, namely +# 'sfoo_'. Additionally, a C++ function 'foo' without the prefix +# letter and the trailing underscore is generated, such that the +# fortran functions can easily be called from templates. The +# implementation of this function is modified due to the configure +# variables 'HAVE_DFOO_' and 'HAVE_DFOO_': if these are set, then the +# lapack functions 'dfoo_' and 'sfoo_' will be called, if not, an +# exception will be thrown. +# +# Therefore, in order to be able to call a LAPACK function, the +# functions have to be tested by configure. Search for the section +# "Check for LAPACK..." in deal.II/configure.in and add the functions +# 'dfoo_' and 'sfoo_' to the tests at the end of that section. +# + + my $templates; my $double; @@ -21,7 +42,7 @@ print << 'EOT' // This file was automatically generated from lapack_templates.h.in // See blastemplates in the deal.II contrib directory // -// Copyright (C) 2005, 2006, 2007, 2008, 2009 by the deal authors +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer diff --git a/deal.II/lac/include/lac/lapack_templates.h b/deal.II/lac/include/lac/lapack_templates.h index 15ed5ecc69..617e44f93e 100644 --- a/deal.II/lac/include/lac/lapack_templates.h +++ b/deal.II/lac/include/lac/lapack_templates.h @@ -1,6 +1,4 @@ //--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ // // This file was automatically generated from lapack_templates.h.in // See blastemplates in the deal.II contrib directory @@ -142,7 +140,7 @@ void dsyev_ (const char *jobz, const char *uplo, const int *n, void ssyev_ (const char *jobz, const char *uplo, const int *n, float *A, const int *lda, float *w, float *work, const int *lwork, int *info); -// General eigenvalues and eigenvectors of +// General eigenvalues and eigenvectors of // 1: A*x = lambda*B*x; 2: A*B*x = lambda*x; 3: B*A*x = lambda*x // A and B are symmetric and B is definite void dsygv_ (const int* itype, const char* jobz, const char* uplo, @@ -180,9 +178,9 @@ void sstev_ (const char* jobz, const int* n, } - DEAL_II_NAMESPACE_OPEN + #ifdef HAVE_DAXPY_ inline void axpy (const int* n, const double* alpha, const double* x, const int* incx, double* y, const int* incy) @@ -577,7 +575,7 @@ syev (const char *, const char *, const int *, float *, const int *, float *, fl inline void sygv (const int* itype, const char* jobz, const char* uplo, const int* n, double* A, const int* lda, double* B, const int* ldb, double* w, double* work, const int* lwork, int* info) { - dsygv_(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, info); + dsygv_ (itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info); } #else inline void @@ -592,7 +590,7 @@ sygv (const int*, const char*, const char*, const int*, double*, const int*, dou inline void sygv (const int* itype, const char* jobz, const char* uplo, const int* n, float* A, const int* lda, float* B, const int* ldb, float* w, float* work, const int* lwork, int* info) { - ssygv_(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, info); + ssygv_ (itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info); } #else inline void @@ -662,6 +660,7 @@ stev (const char*, const int*, float*, float*, float*, const int*, float*, int*) } #endif + DEAL_II_NAMESPACE_CLOSE #endif -- 2.39.5