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_FUNC is defined undefine it because we want to redefine */
00085 
00086 #ifdef F77_FUNC
00087 #undef F77_FUNC
00088 #endif
00089 
00090 #ifdef F77_FUNC_
00091 #undef F77_FUNC_
00092 #endif
00093 
00094 
00095 #define F77_FUNC(lcase,UCASE) UCASE
00096 #define F77_FUNC_(lcase,UCASE) UCASE
00097 
00098 #else /* Define Epetra_fcd for all other machines */
00099 
00100 #define PREFIX
00101 #define Epetra_fcd const char * 
00102 
00103 /* Use autoconf's definition of F77_FUNC 
00104    unless using old make system */
00105 
00106 #ifndef HAVE_CONFIG_H
00107 
00108 #ifdef F77_FUNC
00109 #undef F77_FUNC
00110 #endif
00111 #ifdef F77_FUNC_
00112 #undef F77_FUNC_
00113 #endif
00114 
00115 #ifdef TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE
00116 #define F77_FUNC(lcase,UCASE) lcase
00117 #define F77_FUNC_(lcase,UCASE) lcase
00118 #else /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE not defined*/
00119 #define F77_FUNC(lcase,UCASE) lcase ## _
00120 #define F77_FUNC_(lcase,UCASE) lcase ## __
00121 #endif /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE */
00122 
00123 #endif /* HAVE_CONFIG_H */
00124 
00125 #endif /* defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL) */
00126 
00127 #ifndef CRAY_T3X /* Double declarations already done for the Cray */
00128 
00129 #define DASUM_F77   F77_FUNC(dasum,DASUM)
00130 #define DAXPY_F77   F77_FUNC(daxpy,DAXPY)
00131 #define DCOPY_F77   F77_FUNC(dcopy,DCOPY)
00132 #define DDOT_F77    F77_FUNC(ddot,DDOT)
00133 #define DNRM2_F77   F77_FUNC(dnrm2,DNRM2)
00134 #define DSCAL_F77   F77_FUNC(dscal,DSCAL)
00135 #define IDAMAX_F77  F77_FUNC(idamax,IDAMAX)
00136 #define DGEMV_F77   F77_FUNC(dgemv,DGEMV)
00137 #define DGER_F77    F77_FUNC(dger,DGER)
00138 #define DTRMV_F77   F77_FUNC(dtrmv,DTRMV)
00139 #define DGEMM_F77   F77_FUNC(dgemm,DGEMM)
00140 #define DSYMM_F77   F77_FUNC(dsymm,DSYMM)
00141 #define DTRMM_F77   F77_FUNC(dtrmm,DTRMM)
00142 #define DTRSM_F77   F77_FUNC(dtrsm,DTRSM)
00143 
00144 #ifdef __GNUC__ /* standard Epetra implementation */ 
00145 
00146 #define EPETRA_DCRSMV_F77   F77_FUNC_(epetra_dcrsmv,EPETRA_DCRSMV)
00147 #define EPETRA_DCRSMM_F77   F77_FUNC_(epetra_dcrsmm,EPETRA_DCRSMM)
00148 #define EPETRA_DCRSSV_F77   F77_FUNC_(epetra_dcrssv,EPETRA_DCRSSV)
00149 #define EPETRA_DCRSSM_F77   F77_FUNC_(epetra_dcrssm,EPETRA_DCRSSM)
00150 
00151 #else /* MSE: 3/17/05 - patch for Solaris/OSF/IRIX */ 
00152 
00153 #define EPETRA_DCRSMV_F77   F77_FUNC(epetra_dcrsmv,EPETRA_DCRSMV) 
00154 #define EPETRA_DCRSMM_F77   F77_FUNC(epetra_dcrsmm,EPETRA_DCRSMM) 
00155 #define EPETRA_DCRSSV_F77   F77_FUNC(epetra_dcrssv,EPETRA_DCRSSV) 
00156 #define EPETRA_DCRSSM_F77   F77_FUNC(epetra_dcrssm,EPETRA_DCRSSM) 
00157 #endif /* __GNUC__ */ 
00158 
00159 
00160 /* End of defines for double precision when not on a T3X */
00161 
00162 #endif
00163 
00164 /* The following defines are good for all platforms */
00165 
00166 
00167 #define SSCAL_F77   F77_FUNC(sscal,SSCAL)
00168 #define SCOPY_F77   F77_FUNC(scopy,SCOPY)
00169 #define SAXPY_F77   F77_FUNC(saxpy,SAXPY)
00170 #define SDOT_F77    F77_FUNC(sdot,SDOT)
00171 #define SNRM2_F77   F77_FUNC(snrm2,SNRM2)
00172 #define SASUM_F77   F77_FUNC(sasum,SASUM)
00173 #define ISAMAX_F77  F77_FUNC(isamax,ISAMAX)
00174 
00175 #define SGEMV_F77   F77_FUNC(sgemv,SGEMV)
00176 #define SGER_F77    F77_FUNC(sger,SGER)
00177 #define STRMV_F77   F77_FUNC(strmv,STRMV)
00178 #define SGEMM_F77   F77_FUNC(sgemm,SGEMM)
00179 #define SSYMM_F77   F77_FUNC(ssymm,SSYMM)
00180 #define STRMM_F77   F77_FUNC(strmm,STRMM)
00181 #define STRSM_F77   F77_FUNC(strsm,STRSM)
00182     
00183 /* Explicitly define each F77 name for all BLAS kernels */
00184 
00185 #ifdef __cplusplus
00186 extern "C" {
00187 #endif
00188 
00189 /* Double precision BLAS 1 */
00190 double PREFIX DASUM_F77(const int* n, const double x[], const int* incx);
00191 void PREFIX DAXPY_F77(const int* n, const double* alpha, const double x[], const int* incx, double y[], const int* incy);
00192 void PREFIX DCOPY_F77(const int* n, const double *x, const int* incx, double *y, const int* incy);
00193 double PREFIX DDOT_F77(const int* n, const double x[], const int* incx, const double y[], const int* incy);
00194 double PREFIX DNRM2_F77(const int* n, const double x[], const int* incx);
00195 void PREFIX DSCAL_F77(const int* n, const double* alpha, double *x, const int* incx);
00196 int PREFIX IDAMAX_F77(const int* n, const double *x, const int* incx);
00197 
00198 /* Single precision BLAS 1 */
00199 float PREFIX SASUM_F77(const int* n, const float x[], const int* incx);
00200 void PREFIX SAXPY_F77(const int* n, const float* alpha, const float x[], const int* incx, float y[], const int* incy);
00201 void PREFIX SCOPY_F77(const int* n, const float *x, const int* incx, float *y, const int* incy);
00202 float PREFIX SDOT_F77(const int* n, const float x[], const int* incx, const float y[], const int* incy);
00203 float PREFIX SNRM2_F77(const int* n, const float x[], const int* incx);
00204 void PREFIX SSCAL_F77(const int* n, const float* alpha, float *x, const int* incx);
00205 int PREFIX ISAMAX_F77(const int* n, const float *x, const int* incx);
00206 
00207 /* Double precision BLAS 2 */
00208 void PREFIX DGEMV_F77(Epetra_fcd, const int* m, const int* n, const double* alpha, const double A[], const int* lda,
00209            const double x[], const int* incx, const double* beta, double y[], const int* incy);
00210 void PREFIX DTRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n, 
00211           const double *a, const int *lda, double *x, const int *incx);
00212 void PREFIX DGER_F77(const int *m, const int *n, const double *alpha, const double *x, const int *incx, const double *y, 
00213          const int *incy, double *a, const int *lda);
00214 
00215 
00216 /* Single precision BLAS 2 */
00217 void PREFIX SGEMV_F77(Epetra_fcd, const int* m, const int* n, const float* alpha, const float A[], const int* lda,
00218            const float x[], const int* incx, const float* beta, float y[], const int* incy);
00219 void PREFIX STRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n, 
00220           const float *a, const int *lda, float *x, const int *incx);
00221 void PREFIX SGER_F77(const int *m, const int *n, const float *alpha, const float *x, const int *incx, const float *y, 
00222          const int *incy, float *a, const int *lda);
00223 
00224 /* Double precision BLAS 3 */
00225 void PREFIX DGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
00226           n, const int *k, const double *alpha, const double *a, const int *lda, 
00227           const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
00228 void PREFIX DSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
00229           const double *alpha, const double *a, const int *lda, 
00230           const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
00231 void PREFIX DTRMM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00232           const int *m, const int *n, const double *alpha, const double *a, const int * lda, double *b, const int *ldb);
00233 void PREFIX DTRSM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00234           const int *m, const int *n, const double *alpha, const double *a, const int *
00235           lda, double *b, const int *ldb);
00236 void PREFIX EPETRA_DCRSMV_F77(const int *, const int *, const int *, const double *, const int *, 
00237             const int *, double *, double *);
00238 void PREFIX EPETRA_DCRSMM_F77(const int *, const int *, const int *, const double *, const int *, 
00239             const int *, double *, int *, double *, int *, int *);
00240 void PREFIX EPETRA_DCRSSV_F77(const int *, const int *, const int *, const int *, const int *, 
00241             const int *, const double *, const int *, const int *, double *, 
00242             double *, const int *);
00243 void PREFIX EPETRA_DCRSSM_F77(const int *, const int *, const int *, const int *, const int *, 
00244             const int *, const double *, const int *, const int *, double *, 
00245             const int *, double *, const int *, const int *, const int *);
00246 
00247 /* Single precision BLAS 3 */
00248 void PREFIX SGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
00249           n, const int *k, const float *alpha, const float *a, const int *lda, 
00250           const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
00251 void PREFIX SSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
00252           const float *alpha, const float *a, const int *lda, 
00253           const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
00254 void PREFIX STRMM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00255           const int *m, const int *n, const float *alpha, const float *a, const int * lda, float *b, const int *ldb);
00256 void PREFIX STRSM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd, 
00257           const int *m, const int *n, const float *alpha, const float *a, const int *
00258           lda, float *b, const int *ldb);
00259 
00260 void PREFIX XERBLA_F77(Epetra_fcd, int *info);
00261 
00262 #ifdef __cplusplus
00263 }
00264 #endif
00265 
00266 #endif /* EPETRA_BLAS_WRAPPERS_H */

Generated on Thu Sep 18 12:37:56 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1