Epetra Package Browser (Single Doxygen Collection) Development
Epetra_BLAS_wrappers.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 //
00005 //               Epetra: Linear Algebra Services Package
00006 //                 Copyright 2011 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00039 //
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRA_BLAS_WRAPPERS_H
00045 #define EPETRA_BLAS_WRAPPERS_H
00046 
00047 #include "Epetra_ConfigDefs.h"
00048 /* #include <stdio.h> */
00049 /* #include <string.h> */
00050 
00051 
00052 /* Define fcd (Fortran Epetra_fcd descriptor) for non-standard situations */
00053 
00054 #if defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL)
00055 
00056 
00057 #if defined(CRAY_T3X)
00058 
00059 #include <fortran.h>
00060 #define PREFIX
00061 #define Epetra_fcd fcd
00062 
00063 #define DASUM_F77   SASUM
00064 #define DAXPY_F77   SAXPY
00065 #define DCOPY_F77   SCOPY
00066 #define DDOT_F77    SDOT
00067 #define DNRM2_F77   SNRM2
00068 #define DSCAL_F77   SSCAL
00069 #define IDAMAX_F77  ISAMAX
00070 #define DGEMV_F77   SGEMV
00071 #define DGER_F77    SGER
00072 #define DTRMV_F77   STRMV
00073 #define DGEMM_F77   SGEMM
00074 #define DSYMM_F77   SSYMM
00075 #define DTRMM_F77   STRMM
00076 #define DTRSM_F77   STRSM
00077 #define DSYRK_F77   SSYRK
00078 #define EPETRA_DCRSMV_F77   EPETRA_DCRSMV
00079 #define EPETRA_DCRSMM_F77   EPETRA_DCRSMM
00080 #define EPETRA_DCRSSV_F77   EPETRA_DCRSSV
00081 #define EPETRA_DCRSSM_F77   EPETRA_DCRSSM
00082 
00083 #elif defined(INTEL_CXML)
00084 
00085 #define PREFIX __stdcall
00086 #define Epetra_fcd const char *, const unsigned int
00087 
00088 #elif defined(INTEL_MKL)
00089 
00090 #define PREFIX
00091 #define Epetra_fcd const char *
00092 
00093 #endif
00094 
00095 /* All three of these machines use a simple uppercase mangling of Fortran names */
00096 
00097 /* if F77_BLAS_MANGLE is defined undefine it because we want to redefine */
00098 
00099 #ifdef F77_BLAS_MANGLE
00100 #undef F77_BLAS_MANGLE
00101 #endif
00102 
00103 #ifdef F77_FUNC
00104 #undef F77_FUNC
00105 #endif
00106 
00107 #ifdef F77_FUNC_
00108 #undef F77_FUNC_
00109 #endif
00110 
00111 #define F77_BLAS_MANGLE(lcase,UCASE) UCASE
00112 #define F77_FUNC(lcase,UCASE) UCASE
00113 #define F77_FUNC_(lcase,UCASE) UCASE
00114 
00115 #else /* Define Epetra_fcd for all other machines */
00116 
00117 #define PREFIX
00118 #define Epetra_fcd const char *
00119 
00120 /* Use autoconf's definition of F77_BLAS_MANGLE
00121    unless using old make system */
00122 
00123 #ifdef TRILINOS_NO_CONFIG_H
00124 
00125 #ifdef F77_BLAS_MANGLE
00126 #undef F77_BLAS_MANGLE
00127 #endif
00128 #ifdef F77_FUNC
00129 #undef F77_FUNC
00130 #endif
00131 #ifdef F77_FUNC_
00132 #undef F77_FUNC_
00133 #endif
00134 
00135 #ifdef TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE
00136 #define F77_BLAS_MANGLE(lcase,UCASE) lcase
00137 #define F77_FUNC(lcase,UCASE) lcase
00138 #define F77_FUNC_(lcase,UCASE) lcase
00139 #else /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE not defined*/
00140 #define F77_BLAS_MANGLE(lcase,UCASE) lcase ## _
00141 #define F77_FUNC(lcase,UCASE) lcase ## _
00142 #define F77_FUNC_(lcase,UCASE) lcase ## __
00143 #endif /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE */
00144 
00145 #endif /* TRILINOS_NO_CONFIG_H */
00146 
00147 #endif /* defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL) */
00148 
00149 #ifndef CRAY_T3X /* Double declarations already done for the Cray */
00150 
00151 #define DASUM_F77   F77_BLAS_MANGLE(dasum,DASUM)
00152 #define DAXPY_F77   F77_BLAS_MANGLE(daxpy,DAXPY)
00153 #define DCOPY_F77   F77_BLAS_MANGLE(dcopy,DCOPY)
00154 #define DDOT_F77    F77_BLAS_MANGLE(ddot,DDOT)
00155 #define DNRM2_F77   F77_BLAS_MANGLE(dnrm2,DNRM2)
00156 #define DSCAL_F77   F77_BLAS_MANGLE(dscal,DSCAL)
00157 #define IDAMAX_F77  F77_BLAS_MANGLE(idamax,IDAMAX)
00158 #define DGEMV_F77   F77_BLAS_MANGLE(dgemv,DGEMV)
00159 #define DGER_F77    F77_BLAS_MANGLE(dger,DGER)
00160 #define DTRMV_F77   F77_BLAS_MANGLE(dtrmv,DTRMV)
00161 #define DGEMM_F77   F77_BLAS_MANGLE(dgemm,DGEMM)
00162 #define DSYMM_F77   F77_BLAS_MANGLE(dsymm,DSYMM)
00163 #define DTRMM_F77   F77_BLAS_MANGLE(dtrmm,DTRMM)
00164 #define DTRSM_F77   F77_BLAS_MANGLE(dtrsm,DTRSM)
00165 #define DSYRK_F77   F77_BLAS_MANGLE(dsyrk,DSYRK)
00166 
00167 #ifndef FORTRAN_DISABLED
00168 
00169 #if defined(__GNUC__) || defined(_WIN32) /* standard Epetra implementation */
00170 
00171 #define EPETRA_DCRSMV_F77   F77_FUNC_(epetra_dcrsmv,EPETRA_DCRSMV)
00172 #define EPETRA_DCRSMM_F77   F77_FUNC_(epetra_dcrsmm,EPETRA_DCRSMM)
00173 #define EPETRA_DCRSSV_F77   F77_FUNC_(epetra_dcrssv,EPETRA_DCRSSV)
00174 #define EPETRA_DCRSSM_F77   F77_FUNC_(epetra_dcrssm,EPETRA_DCRSSM)
00175 
00176 #else /* MSE: 3/17/05 - patch for Solaris/OSF/IRIX */
00177 
00178 #define EPETRA_DCRSMV_F77   F77_FUNC(epetra_dcrsmv,EPETRA_DCRSMV)
00179 #define EPETRA_DCRSMM_F77   F77_FUNC(epetra_dcrsmm,EPETRA_DCRSMM)
00180 #define EPETRA_DCRSSV_F77   F77_FUNC(epetra_dcrssv,EPETRA_DCRSSV)
00181 #define EPETRA_DCRSSM_F77   F77_FUNC(epetra_dcrssm,EPETRA_DCRSSM)
00182 #endif /* __GNUC__ */
00183 
00184 #endif /* FORTRAN_DISABLED */
00185 
00186 /* End of defines for double precision when not on a T3X */
00187 
00188 #endif
00189 
00190 /* The following defines are good for all platforms */
00191 
00192 
00193 #define SSCAL_F77   F77_BLAS_MANGLE(sscal,SSCAL)
00194 #define SCOPY_F77   F77_BLAS_MANGLE(scopy,SCOPY)
00195 #define SAXPY_F77   F77_BLAS_MANGLE(saxpy,SAXPY)
00196 #define SDOT_F77    F77_BLAS_MANGLE(sdot,SDOT)
00197 #define SNRM2_F77   F77_BLAS_MANGLE(snrm2,SNRM2)
00198 #define SASUM_F77   F77_BLAS_MANGLE(sasum,SASUM)
00199 #define ISAMAX_F77  F77_BLAS_MANGLE(isamax,ISAMAX)
00200 
00201 #define SGEMV_F77   F77_BLAS_MANGLE(sgemv,SGEMV)
00202 #define SGER_F77    F77_BLAS_MANGLE(sger,SGER)
00203 #define STRMV_F77   F77_BLAS_MANGLE(strmv,STRMV)
00204 #define SGEMM_F77   F77_BLAS_MANGLE(sgemm,SGEMM)
00205 #define SSYMM_F77   F77_BLAS_MANGLE(ssymm,SSYMM)
00206 #define STRMM_F77   F77_BLAS_MANGLE(strmm,STRMM)
00207 #define STRSM_F77   F77_BLAS_MANGLE(strsm,STRSM)
00208 #define SSYRK_F77   F77_BLAS_MANGLE(ssyrk,SSYRK)
00209 
00210 /* Explicitly define each F77 name for all BLAS kernels */
00211 
00212 #ifdef __cplusplus
00213 extern "C" {
00214 #endif
00215 
00216 /* Double precision BLAS 1 */
00217 double PREFIX DASUM_F77(const int* n, const double x[], const int* incx);
00218 void PREFIX DAXPY_F77(const int* n, const double* alpha, const double x[], const int* incx, double y[], const int* incy);
00219 void PREFIX DCOPY_F77(const int* n, const double *x, const int* incx, double *y, const int* incy);
00220 double PREFIX DDOT_F77(const int* n, const double x[], const int* incx, const double y[], const int* incy);
00221 double PREFIX DNRM2_F77(const int* n, const double x[], const int* incx);
00222 void PREFIX DSCAL_F77(const int* n, const double* alpha, double *x, const int* incx);
00223 int PREFIX IDAMAX_F77(const int* n, const double *x, const int* incx);
00224 
00225 /* Single precision BLAS 1 */
00226 float PREFIX SASUM_F77(const int* n, const float x[], const int* incx);
00227 void PREFIX SAXPY_F77(const int* n, const float* alpha, const float x[], const int* incx, float y[], const int* incy);
00228 void PREFIX SCOPY_F77(const int* n, const float *x, const int* incx, float *y, const int* incy);
00229 float PREFIX SDOT_F77(const int* n, const float x[], const int* incx, const float y[], const int* incy);
00230 float PREFIX SNRM2_F77(const int* n, const float x[], const int* incx);
00231 void PREFIX SSCAL_F77(const int* n, const float* alpha, float *x, const int* incx);
00232 int PREFIX ISAMAX_F77(const int* n, const float *x, const int* incx);
00233 
00234 /* Double precision BLAS 2 */
00235 void PREFIX DGEMV_F77(Epetra_fcd, const int* m, const int* n, const double* alpha, const double A[], const int* lda,
00236            const double x[], const int* incx, const double* beta, double y[], const int* incy);
00237 void PREFIX DTRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n,
00238           const double *a, const int *lda, double *x, const int *incx);
00239 void PREFIX DGER_F77(const int *m, const int *n, const double *alpha, const double *x, const int *incx, const double *y,
00240          const int *incy, double *a, const int *lda);
00241 
00242 
00243 /* Single precision BLAS 2 */
00244 void PREFIX SGEMV_F77(Epetra_fcd, const int* m, const int* n, const float* alpha, const float A[], const int* lda,
00245            const float x[], const int* incx, const float* beta, float y[], const int* incy);
00246 void PREFIX STRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n,
00247           const float *a, const int *lda, float *x, const int *incx);
00248 void PREFIX SGER_F77(const int *m, const int *n, const float *alpha, const float *x, const int *incx, const float *y,
00249          const int *incy, float *a, const int *lda);
00250 
00251 /* Double precision BLAS 3 */
00252 void PREFIX DGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
00253           n, const int *k, const double *alpha, const double *a, const int *lda,
00254           const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
00255 void PREFIX DSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
00256           const double *alpha, const double *a, const int *lda,
00257           const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
00258 void PREFIX DTRMM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd,
00259           const int *m, const int *n, const double *alpha, const double *a, const int * lda, double *b, const int *ldb);
00260 void PREFIX DTRSM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd,
00261           const int *m, const int *n, const double *alpha, const double *a, const int *
00262           lda, double *b, const int *ldb);
00263 void PREFIX EPETRA_DCRSMV_F77(const int *, const int *, const int *, const double *, const int *,
00264             const int *, double *, double *);
00265 void PREFIX EPETRA_DCRSMM_F77(const int *, const int *, const int *, const double *, const int *,
00266             const int *, double *, int *, double *, int *, int *);
00267 void PREFIX EPETRA_DCRSSV_F77(const int *, const int *, const int *, const int *, const int *,
00268             const int *, const double *, const int *, const int *, double *,
00269             double *, const int *);
00270 void PREFIX EPETRA_DCRSSM_F77(const int *, const int *, const int *, const int *, const int *,
00271             const int *, const double *, const int *, const int *, double *,
00272             const int *, double *, const int *, const int *, const int *);
00273 void PREFIX DSYRK_F77(Epetra_fcd uplo, Epetra_fcd trans, const int *n, const int *k,
00274                   const double *alpha, const double *a, const int *lda, const double *beta,
00275                   double *c, const int *ldc);
00276 
00277 /* Single precision BLAS 3 */
00278 void PREFIX SGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
00279           n, const int *k, const float *alpha, const float *a, const int *lda,
00280           const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
00281 void PREFIX SSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
00282           const float *alpha, const float *a, const int *lda,
00283           const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
00284 void PREFIX STRMM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd,
00285           const int *m, const int *n, const float *alpha, const float *a, const int * lda, float *b, const int *ldb);
00286 void PREFIX STRSM_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, Epetra_fcd,
00287           const int *m, const int *n, const float *alpha, const float *a, const int *
00288           lda, float *b, const int *ldb);
00289 
00290 void PREFIX XERBLA_F77(Epetra_fcd, int *info);
00291 
00292 void PREFIX SSYRK_F77(Epetra_fcd uplo, Epetra_fcd trans, const int *n, const int *k,
00293                       const float *alpha, const float *a, const int *lda, const float *beta,
00294                       float *c, const int *ldc);
00295 
00296 #ifdef __cplusplus
00297 }
00298 #endif
00299 
00300 #endif /* EPETRA_BLAS_WRAPPERS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines