Epetra_BLAS_wrappers.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_BLAS_WRAPPERS_H
00033 #define EPETRA_BLAS_WRAPPERS_H
00034 
00035 #include "Epetra_ConfigDefs.h"
00036 /* #include <stdio.h> */
00037 /* #include <string.h> */
00038 
00039 
00040 /* Define fcd (Fortran Epetra_fcd descriptor) for non-standard situations */
00041 
00042 #if defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL)
00043 
00044 
00045 #if defined(CRAY_T3X)
00046 
00047 #include <fortran.h>
00048 #define PREFIX
00049 #define Epetra_fcd fcd
00050 
00051 #define DASUM_F77   SASUM
00052 #define DAXPY_F77   SAXPY
00053 #define DCOPY_F77   SCOPY
00054 #define DDOT_F77    SDOT
00055 #define DNRM2_F77   SNRM2
00056 #define DSCAL_F77   SSCAL
00057 #define IDAMAX_F77  ISAMAX
00058 #define DGEMV_F77   SGEMV
00059 #define DGER_F77    SGER
00060 #define DTRMV_F77   STRMV
00061 #define DGEMM_F77   SGEMM
00062 #define DSYMM_F77   SSYMM
00063 #define DTRMM_F77   STRMM
00064 #define DTRSM_F77   STRSM
00065 #define EPETRA_DCRSMV_F77   EPETRA_DCRSMV
00066 #define EPETRA_DCRSMM_F77   EPETRA_DCRSMM
00067 #define EPETRA_DCRSSV_F77   EPETRA_DCRSSV
00068 #define EPETRA_DCRSSM_F77   EPETRA_DCRSSM
00069 
00070 #elif defined(INTEL_CXML)
00071 
00072 #define PREFIX __stdcall
00073 #define Epetra_fcd const char *, const unsigned int
00074 
00075 #elif defined(INTEL_MKL)
00076 
00077 #define PREFIX
00078 #define Epetra_fcd const char *
00079 
00080 #endif 
00081 
00082 /* All three of these machines use a simple uppercase mangling of Fortran names */
00083 
00084 /* if F77_BLAS_MANGLE is defined undefine it because we want to redefine */
00085 
00086 #ifdef F77_BLAS_MANGLE
00087 #undef F77_BLAS_MANGLE
00088 #endif
00089 
00090 #ifdef F77_FUNC
00091 #undef F77_FUNC
00092 #endif
00093 
00094 #ifdef F77_FUNC_
00095 #undef F77_FUNC_
00096 #endif
00097 
00098 #define F77_BLAS_MANGLE(lcase,UCASE) UCASE
00099 #define F77_FUNC(lcase,UCASE) UCASE
00100 #define F77_FUNC_(lcase,UCASE) UCASE
00101 
00102 #else /* Define Epetra_fcd for all other machines */
00103 
00104 #define PREFIX
00105 #define Epetra_fcd const char * 
00106 
00107 /* Use autoconf's definition of F77_BLAS_MANGLE 
00108    unless using old make system */
00109 
00110 #ifdef TRILINOS_NO_CONFIG_H
00111 
00112 #ifdef F77_BLAS_MANGLE
00113 #undef F77_BLAS_MANGLE
00114 #endif
00115 #ifdef F77_FUNC
00116 #undef F77_FUNC
00117 #endif
00118 #ifdef F77_FUNC_
00119 #undef F77_FUNC_
00120 #endif
00121 
00122 #ifdef TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE
00123 #define F77_BLAS_MANGLE(lcase,UCASE) lcase
00124 #define F77_FUNC(lcase,UCASE) lcase
00125 #define F77_FUNC_(lcase,UCASE) lcase
00126 #else /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE not defined*/
00127 #define F77_BLAS_MANGLE(lcase,UCASE) lcase ## _
00128 #define F77_FUNC(lcase,UCASE) lcase ## _
00129 #define F77_FUNC_(lcase,UCASE) lcase ## __
00130 #endif /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE */
00131 
00132 #endif /* TRILINOS_NO_CONFIG_H */
00133 
00134 #endif /* defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL) */
00135 
00136 #ifndef CRAY_T3X /* Double declarations already done for the Cray */
00137 
00138 #define DASUM_F77   F77_BLAS_MANGLE(dasum,DASUM)
00139 #define DAXPY_F77   F77_BLAS_MANGLE(daxpy,DAXPY)
00140 #define DCOPY_F77   F77_BLAS_MANGLE(dcopy,DCOPY)
00141 #define DDOT_F77    F77_BLAS_MANGLE(ddot,DDOT)
00142 #define DNRM2_F77   F77_BLAS_MANGLE(dnrm2,DNRM2)
00143 #define DSCAL_F77   F77_BLAS_MANGLE(dscal,DSCAL)
00144 #define IDAMAX_F77  F77_BLAS_MANGLE(idamax,IDAMAX)
00145 #define DGEMV_F77   F77_BLAS_MANGLE(dgemv,DGEMV)
00146 #define DGER_F77    F77_BLAS_MANGLE(dger,DGER)
00147 #define DTRMV_F77   F77_BLAS_MANGLE(dtrmv,DTRMV)
00148 #define DGEMM_F77   F77_BLAS_MANGLE(dgemm,DGEMM)
00149 #define DSYMM_F77   F77_BLAS_MANGLE(dsymm,DSYMM)
00150 #define DTRMM_F77   F77_BLAS_MANGLE(dtrmm,DTRMM)
00151 #define DTRSM_F77   F77_BLAS_MANGLE(dtrsm,DTRSM)
00152 
00153 #ifndef FORTRAN_DISABLED
00154 
00155 #if defined(__GNUC__) || defined(_WIN32) /* standard Epetra implementation */ 
00156 
00157 #define EPETRA_DCRSMV_F77   F77_FUNC_(epetra_dcrsmv,EPETRA_DCRSMV)
00158 #define EPETRA_DCRSMM_F77   F77_FUNC_(epetra_dcrsmm,EPETRA_DCRSMM)
00159 #define EPETRA_DCRSSV_F77   F77_FUNC_(epetra_dcrssv,EPETRA_DCRSSV)
00160 #define EPETRA_DCRSSM_F77   F77_FUNC_(epetra_dcrssm,EPETRA_DCRSSM)
00161 
00162 #else /* MSE: 3/17/05 - patch for Solaris/OSF/IRIX */ 
00163 
00164 #define EPETRA_DCRSMV_F77   F77_FUNC(epetra_dcrsmv,EPETRA_DCRSMV) 
00165 #define EPETRA_DCRSMM_F77   F77_FUNC(epetra_dcrsmm,EPETRA_DCRSMM) 
00166 #define EPETRA_DCRSSV_F77   F77_FUNC(epetra_dcrssv,EPETRA_DCRSSV) 
00167 #define EPETRA_DCRSSM_F77   F77_FUNC(epetra_dcrssm,EPETRA_DCRSSM) 
00168 #endif /* __GNUC__ */ 
00169 
00170 #endif /* FORTRAN_DISABLED */
00171 
00172 /* End of defines for double precision when not on a T3X */
00173 
00174 #endif
00175 
00176 /* The following defines are good for all platforms */
00177 
00178 
00179 #define SSCAL_F77   F77_BLAS_MANGLE(sscal,SSCAL)
00180 #define SCOPY_F77   F77_BLAS_MANGLE(scopy,SCOPY)
00181 #define SAXPY_F77   F77_BLAS_MANGLE(saxpy,SAXPY)
00182 #define SDOT_F77    F77_BLAS_MANGLE(sdot,SDOT)
00183 #define SNRM2_F77   F77_BLAS_MANGLE(snrm2,SNRM2)
00184 #define SASUM_F77   F77_BLAS_MANGLE(sasum,SASUM)
00185 #define ISAMAX_F77  F77_BLAS_MANGLE(isamax,ISAMAX)
00186 
00187 #define SGEMV_F77   F77_BLAS_MANGLE(sgemv,SGEMV)
00188 #define SGER_F77    F77_BLAS_MANGLE(sger,SGER)
00189 #define STRMV_F77   F77_BLAS_MANGLE(strmv,STRMV)
00190 #define SGEMM_F77   F77_BLAS_MANGLE(sgemm,SGEMM)
00191 #define SSYMM_F77   F77_BLAS_MANGLE(ssymm,SSYMM)
00192 #define STRMM_F77   F77_BLAS_MANGLE(strmm,STRMM)
00193 #define STRSM_F77   F77_BLAS_MANGLE(strsm,STRSM)
00194     
00195 /* Explicitly define each F77 name for all BLAS kernels */
00196 
00197 #ifdef __cplusplus
00198 extern "C" {
00199 #endif
00200 
00201 /* Double precision BLAS 1 */
00202 double PREFIX DASUM_F77(const int* n, const double x[], const int* incx);
00203 void PREFIX DAXPY_F77(const int* n, const double* alpha, const double x[], const int* incx, double y[], const int* incy);
00204 void PREFIX DCOPY_F77(const int* n, const double *x, const int* incx, double *y, const int* incy);
00205 double PREFIX DDOT_F77(const int* n, const double x[], const int* incx, const double y[], const int* incy);
00206 double PREFIX DNRM2_F77(const int* n, const double x[], const int* incx);
00207 void PREFIX DSCAL_F77(const int* n, const double* alpha, double *x, const int* incx);
00208 int PREFIX IDAMAX_F77(const int* n, const double *x, const int* incx);
00209 
00210 /* Single precision BLAS 1 */
00211 float PREFIX SASUM_F77(const int* n, const float x[], const int* incx);
00212 void PREFIX SAXPY_F77(const int* n, const float* alpha, const float x[], const int* incx, float y[], const int* incy);
00213 void PREFIX SCOPY_F77(const int* n, const float *x, const int* incx, float *y, const int* incy);
00214 float PREFIX SDOT_F77(const int* n, const float x[], const int* incx, const float y[], const int* incy);
00215 float PREFIX SNRM2_F77(const int* n, const float x[], const int* incx);
00216 void PREFIX SSCAL_F77(const int* n, const float* alpha, float *x, const int* incx);
00217 int PREFIX ISAMAX_F77(const int* n, const float *x, const int* incx);
00218 
00219 /* Double precision BLAS 2 */
00220 void PREFIX DGEMV_F77(Epetra_fcd, const int* m, const int* n, const double* alpha, const double A[], const int* lda,
00221            const double x[], const int* incx, const double* beta, double y[], const int* incy);
00222 void PREFIX DTRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n, 
00223           const double *a, const int *lda, double *x, const int *incx);
00224 void PREFIX DGER_F77(const int *m, const int *n, const double *alpha, const double *x, const int *incx, const double *y, 
00225          const int *incy, double *a, const int *lda);
00226 
00227 
00228 /* Single precision BLAS 2 */
00229 void PREFIX SGEMV_F77(Epetra_fcd, const int* m, const int* n, const float* alpha, const float A[], const int* lda,
00230            const float x[], const int* incx, const float* beta, float y[], const int* incy);
00231 void PREFIX STRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n, 
00232           const float *a, const int *lda, float *x, const int *incx);
00233 void PREFIX SGER_F77(const int *m, const int *n, const float *alpha, const float *x, const int *incx, const float *y, 
00234          const int *incy, float *a, const int *lda);
00235 
00236 /* Double precision BLAS 3 */
00237 void PREFIX DGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
00238           n, const int *k, const double *alpha, const double *a, const int *lda, 
00239           const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
00240 void PREFIX DSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
00241           const double *alpha, const double *a, const int *lda, 
00242           const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
00243 void PREFIX DTRMM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00244           const int *m, const int *n, const double *alpha, const double *a, const int * lda, double *b, const int *ldb);
00245 void PREFIX DTRSM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00246           const int *m, const int *n, const double *alpha, const double *a, const int *
00247           lda, double *b, const int *ldb);
00248 void PREFIX EPETRA_DCRSMV_F77(const int *, const int *, const int *, const double *, const int *, 
00249             const int *, double *, double *);
00250 void PREFIX EPETRA_DCRSMM_F77(const int *, const int *, const int *, const double *, const int *, 
00251             const int *, double *, int *, double *, int *, int *);
00252 void PREFIX EPETRA_DCRSSV_F77(const int *, const int *, const int *, const int *, const int *, 
00253             const int *, const double *, const int *, const int *, double *, 
00254             double *, const int *);
00255 void PREFIX EPETRA_DCRSSM_F77(const int *, const int *, const int *, const int *, const int *, 
00256             const int *, const double *, const int *, const int *, double *, 
00257             const int *, double *, const int *, const int *, const int *);
00258 
00259 /* Single precision BLAS 3 */
00260 void PREFIX SGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
00261           n, const int *k, const float *alpha, const float *a, const int *lda, 
00262           const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
00263 void PREFIX SSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
00264           const float *alpha, const float *a, const int *lda, 
00265           const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
00266 void PREFIX STRMM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00267           const int *m, const int *n, const float *alpha, const float *a, const int * lda, float *b, const int *ldb);
00268 void PREFIX STRSM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00269           const int *m, const int *n, const float *alpha, const float *a, const int *
00270           lda, float *b, const int *ldb);
00271 
00272 void PREFIX XERBLA_F77(Epetra_fcd, int *info);
00273 
00274 #ifdef __cplusplus
00275 }
00276 #endif
00277 
00278 #endif /* EPETRA_BLAS_WRAPPERS_H */

Generated on Wed May 12 21:41:04 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7