Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_BLAS_wrappers.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_BLAS_WRAPPERS_H
45 #define EPETRA_BLAS_WRAPPERS_H
46 
47 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_ConfigDefs.h"
56 /* #include <stdio.h> */
57 /* #include <string.h> */
58 
59 
60 /* Define fcd (Fortran Epetra_fcd descriptor) for non-standard situations */
61 
62 #if defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL)
63 
64 
65 #if defined(CRAY_T3X)
66 
67 #include <fortran.h>
68 #define PREFIX
69 #define Epetra_fcd fcd
70 
71 #define DASUM_F77 SASUM
72 #define DAXPY_F77 SAXPY
73 #define DCOPY_F77 SCOPY
74 #define DDOT_F77 SDOT
75 #define DNRM2_F77 SNRM2
76 #define DSCAL_F77 SSCAL
77 #define IDAMAX_F77 ISAMAX
78 #define DGEMV_F77 SGEMV
79 #define DGER_F77 SGER
80 #define DTRMV_F77 STRMV
81 #define DGEMM_F77 SGEMM
82 #define DSYMM_F77 SSYMM
83 #define DTRMM_F77 STRMM
84 #define DTRSM_F77 STRSM
85 #define DSYRK_F77 SSYRK
86 #define EPETRA_DCRSMV_F77 EPETRA_DCRSMV
87 #define EPETRA_DCRSMM_F77 EPETRA_DCRSMM
88 #define EPETRA_DCRSSV_F77 EPETRA_DCRSSV
89 #define EPETRA_DCRSSM_F77 EPETRA_DCRSSM
90 
91 #elif defined(INTEL_CXML)
92 
93 #define PREFIX __stdcall
94 #define Epetra_fcd const char *, const unsigned int
95 
96 #elif defined(INTEL_MKL)
97 
98 #define PREFIX
99 #define Epetra_fcd const char *
100 
101 #endif
102 
103 /* All three of these machines use a simple uppercase mangling of Fortran names */
104 
105 /* if F77_BLAS_MANGLE is defined undefine it because we want to redefine */
106 
107 #ifdef F77_BLAS_MANGLE
108 #undef F77_BLAS_MANGLE
109 #endif
110 
111 #ifdef F77_FUNC
112 #undef F77_FUNC
113 #endif
114 
115 #ifdef F77_FUNC_
116 #undef F77_FUNC_
117 #endif
118 
119 #define F77_BLAS_MANGLE(lcase,UCASE) UCASE
120 #define F77_FUNC(lcase,UCASE) UCASE
121 #define F77_FUNC_(lcase,UCASE) UCASE
122 
123 #else /* Define Epetra_fcd for all other machines */
124 
125 #define PREFIX
126 #define Epetra_fcd const char *
127 
128 /* Use autoconf's definition of F77_BLAS_MANGLE
129  unless using old make system */
130 
131 #ifdef TRILINOS_NO_CONFIG_H
132 
133 #ifdef F77_BLAS_MANGLE
134 #undef F77_BLAS_MANGLE
135 #endif
136 #ifdef F77_FUNC
137 #undef F77_FUNC
138 #endif
139 #ifdef F77_FUNC_
140 #undef F77_FUNC_
141 #endif
142 
143 #ifdef TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE
144 #define F77_BLAS_MANGLE(lcase,UCASE) lcase
145 #define F77_FUNC(lcase,UCASE) lcase
146 #define F77_FUNC_(lcase,UCASE) lcase
147 #else /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE not defined*/
148 #define F77_BLAS_MANGLE(lcase,UCASE) lcase ## _
149 #define F77_FUNC(lcase,UCASE) lcase ## _
150 #define F77_FUNC_(lcase,UCASE) lcase ## __
151 #endif /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE */
152 
153 #endif /* TRILINOS_NO_CONFIG_H */
154 
155 #endif /* defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL) */
156 
157 #ifndef CRAY_T3X /* Double declarations already done for the Cray */
158 
159 #define DASUM_F77 F77_BLAS_MANGLE(dasum,DASUM)
160 #define DAXPY_F77 F77_BLAS_MANGLE(daxpy,DAXPY)
161 #define DCOPY_F77 F77_BLAS_MANGLE(dcopy,DCOPY)
162 #define DDOT_F77 F77_BLAS_MANGLE(ddot,DDOT)
163 #define DNRM2_F77 F77_BLAS_MANGLE(dnrm2,DNRM2)
164 #define DSCAL_F77 F77_BLAS_MANGLE(dscal,DSCAL)
165 #define IDAMAX_F77 F77_BLAS_MANGLE(idamax,IDAMAX)
166 #define DGEMV_F77 F77_BLAS_MANGLE(dgemv,DGEMV)
167 #define DGER_F77 F77_BLAS_MANGLE(dger,DGER)
168 #define DTRMV_F77 F77_BLAS_MANGLE(dtrmv,DTRMV)
169 #define DGEMM_F77 F77_BLAS_MANGLE(dgemm,DGEMM)
170 #define DSYMM_F77 F77_BLAS_MANGLE(dsymm,DSYMM)
171 #define DTRMM_F77 F77_BLAS_MANGLE(dtrmm,DTRMM)
172 #define DTRSM_F77 F77_BLAS_MANGLE(dtrsm,DTRSM)
173 #define DSYRK_F77 F77_BLAS_MANGLE(dsyrk,DSYRK)
174 
175 #ifndef FORTRAN_DISABLED
176 
177 #if ( defined(__GNUC__) || defined(_WIN32) ) && ! defined(FORTRAN_NO_UNDERSCORE)
178 /* standard Epetra implementation */
179 
180 #define EPETRA_DCRSMV_F77 F77_FUNC_(epetra_dcrsmv,EPETRA_DCRSMV)
181 #define EPETRA_DCRSMM_F77 F77_FUNC_(epetra_dcrsmm,EPETRA_DCRSMM)
182 #define EPETRA_DCRSSV_F77 F77_FUNC_(epetra_dcrssv,EPETRA_DCRSSV)
183 #define EPETRA_DCRSSM_F77 F77_FUNC_(epetra_dcrssm,EPETRA_DCRSSM)
184 
185 #else /* MSE: 3/17/05 - patch for Solaris/OSF/IRIX */
186 
187 #define EPETRA_DCRSMV_F77 F77_FUNC(epetra_dcrsmv,EPETRA_DCRSMV)
188 #define EPETRA_DCRSMM_F77 F77_FUNC(epetra_dcrsmm,EPETRA_DCRSMM)
189 #define EPETRA_DCRSSV_F77 F77_FUNC(epetra_dcrssv,EPETRA_DCRSSV)
190 #define EPETRA_DCRSSM_F77 F77_FUNC(epetra_dcrssm,EPETRA_DCRSSM)
191 #endif /* __GNUC__ */
192 
193 #endif /* FORTRAN_DISABLED */
194 
195 /* End of defines for double precision when not on a T3X */
196 
197 #endif
198 
199 /* The following defines are good for all platforms */
200 
201 
202 #define SSCAL_F77 F77_BLAS_MANGLE(sscal,SSCAL)
203 #define SCOPY_F77 F77_BLAS_MANGLE(scopy,SCOPY)
204 #define SAXPY_F77 F77_BLAS_MANGLE(saxpy,SAXPY)
205 #define SDOT_F77 F77_BLAS_MANGLE(sdot,SDOT)
206 #define SNRM2_F77 F77_BLAS_MANGLE(snrm2,SNRM2)
207 #define SASUM_F77 F77_BLAS_MANGLE(sasum,SASUM)
208 #define ISAMAX_F77 F77_BLAS_MANGLE(isamax,ISAMAX)
209 
210 #define SGEMV_F77 F77_BLAS_MANGLE(sgemv,SGEMV)
211 #define SGER_F77 F77_BLAS_MANGLE(sger,SGER)
212 #define STRMV_F77 F77_BLAS_MANGLE(strmv,STRMV)
213 #define SGEMM_F77 F77_BLAS_MANGLE(sgemm,SGEMM)
214 #define SSYMM_F77 F77_BLAS_MANGLE(ssymm,SSYMM)
215 #define STRMM_F77 F77_BLAS_MANGLE(strmm,STRMM)
216 #define STRSM_F77 F77_BLAS_MANGLE(strsm,STRSM)
217 #define SSYRK_F77 F77_BLAS_MANGLE(ssyrk,SSYRK)
218 
219 /* Explicitly define each F77 name for all BLAS kernels */
220 
221 #ifdef __cplusplus
222 extern "C" {
223 #endif
224 
225 /* Double precision BLAS 1 */
226 double PREFIX DASUM_F77(const int* n, const double x[], const int* incx);
227 void PREFIX DAXPY_F77(const int* n, const double* alpha, const double x[], const int* incx, double y[], const int* incy);
228 void PREFIX DCOPY_F77(const int* n, const double *x, const int* incx, double *y, const int* incy);
229 double PREFIX DDOT_F77(const int* n, const double x[], const int* incx, const double y[], const int* incy);
230 double PREFIX DNRM2_F77(const int* n, const double x[], const int* incx);
231 void PREFIX DSCAL_F77(const int* n, const double* alpha, double *x, const int* incx);
232 int PREFIX IDAMAX_F77(const int* n, const double *x, const int* incx);
233 
234 /* Single precision BLAS 1 */
235 float PREFIX SASUM_F77(const int* n, const float x[], const int* incx);
236 void PREFIX SAXPY_F77(const int* n, const float* alpha, const float x[], const int* incx, float y[], const int* incy);
237 void PREFIX SCOPY_F77(const int* n, const float *x, const int* incx, float *y, const int* incy);
238 float PREFIX SDOT_F77(const int* n, const float x[], const int* incx, const float y[], const int* incy);
239 float PREFIX SNRM2_F77(const int* n, const float x[], const int* incx);
240 void PREFIX SSCAL_F77(const int* n, const float* alpha, float *x, const int* incx);
241 int PREFIX ISAMAX_F77(const int* n, const float *x, const int* incx);
242 
243 /* Double precision BLAS 2 */
244 void PREFIX DGEMV_F77(Epetra_fcd, const int* m, const int* n, const double* alpha, const double A[], const int* lda,
245  const double x[], const int* incx, const double* beta, double y[], const int* incy);
246 void PREFIX DTRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n,
247  const double *a, const int *lda, double *x, const int *incx);
248 void PREFIX DGER_F77(const int *m, const int *n, const double *alpha, const double *x, const int *incx, const double *y,
249  const int *incy, double *a, const int *lda);
250 
251 
252 /* Single precision BLAS 2 */
253 void PREFIX SGEMV_F77(Epetra_fcd, const int* m, const int* n, const float* alpha, const float A[], const int* lda,
254  const float x[], const int* incx, const float* beta, float y[], const int* incy);
255 void PREFIX STRMV_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int *n,
256  const float *a, const int *lda, float *x, const int *incx);
257 void PREFIX SGER_F77(const int *m, const int *n, const float *alpha, const float *x, const int *incx, const float *y,
258  const int *incy, float *a, const int *lda);
259 
260 /* Double precision BLAS 3 */
261 void PREFIX DGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
262  n, const int *k, const double *alpha, const double *a, const int *lda,
263  const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
264 void PREFIX DSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
265  const double *alpha, const double *a, const int *lda,
266  const double *b, const int *ldb, const double *beta, double *c, const int *ldc);
268  const int *m, const int *n, const double *alpha, const double *a, const int * lda, double *b, const int *ldb);
270  const int *m, const int *n, const double *alpha, const double *a, const int *
271  lda, double *b, const int *ldb);
272 void PREFIX EPETRA_DCRSMV_F77(const int *, const int *, const int *, const double *, const int *,
273  const int *, double *, double *);
274 void PREFIX EPETRA_DCRSMM_F77(const int *, const int *, const int *, const double *, const int *,
275  const int *, double *, int *, double *, int *, int *);
276 void PREFIX EPETRA_DCRSSV_F77(const int *, const int *, const int *, const int *, const int *,
277  const int *, const double *, const int *, const int *, double *,
278  double *, const int *);
279 void PREFIX EPETRA_DCRSSM_F77(const int *, const int *, const int *, const int *, const int *,
280  const int *, const double *, const int *, const int *, double *,
281  const int *, double *, const int *, const int *, const int *);
282 void PREFIX DSYRK_F77(Epetra_fcd uplo, Epetra_fcd trans, const int *n, const int *k,
283  const double *alpha, const double *a, const int *lda, const double *beta,
284  double *c, const int *ldc);
285 
286 /* Single precision BLAS 3 */
287 void PREFIX SGEMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int *
288  n, const int *k, const float *alpha, const float *a, const int *lda,
289  const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
290 void PREFIX SSYMM_F77(Epetra_fcd, Epetra_fcd, const int *m, const int * n,
291  const float *alpha, const float *a, const int *lda,
292  const float *b, const int *ldb, const float *beta, float *c, const int *ldc);
294  const int *m, const int *n, const float *alpha, const float *a, const int * lda, float *b, const int *ldb);
296  const int *m, const int *n, const float *alpha, const float *a, const int *
297  lda, float *b, const int *ldb);
298 
299 void PREFIX XERBLA_F77(Epetra_fcd, int *info);
300 
301 void PREFIX SSYRK_F77(Epetra_fcd uplo, Epetra_fcd trans, const int *n, const int *k,
302  const float *alpha, const float *a, const int *lda, const float *beta,
303  float *c, const int *ldc);
304 
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif /* EPETRA_BLAS_WRAPPERS_H */
#define SGEMM_F77
#define DCOPY_F77
#define PREFIX
#define SSYRK_F77
#define ISAMAX_F77
#define STRSM_F77
#define STRMM_F77
#define DAXPY_F77
#define SSYMM_F77
#define DDOT_F77
#define SCOPY_F77
#define DTRMV_F77
#define DTRMM_F77
void PREFIX EPETRA_DCRSSM_F77(const int *, const int *, const int *, const int *, const int *, const int *, const double *, const int *, const int *, double *, const int *, double *, const int *, const int *, const int *)
#define DASUM_F77
#define DNRM2_F77
#define SSCAL_F77
#define SDOT_F77
void PREFIX EPETRA_DCRSSV_F77(const int *, const int *, const int *, const int *, const int *, const int *, const double *, const int *, const int *, double *, double *, const int *)
#define DGEMV_F77
#define DSCAL_F77
#define DGEMM_F77
#define Epetra_fcd
void PREFIX EPETRA_DCRSMM_F77(const int *, const int *, const int *, const double *, const int *, const int *, double *, int *, double *, int *, int *)
#define STRMV_F77
#define DTRSM_F77
#define SGER_F77
#define DGER_F77
#define IDAMAX_F77
#define SGEMV_F77
void PREFIX EPETRA_DCRSMV_F77(const int *, const int *, const int *, const double *, const int *, const int *, double *, double *)
#define SASUM_F77
int n
#define SNRM2_F77
#define DSYRK_F77
#define DSYMM_F77
void PREFIX XERBLA_F77(Epetra_fcd, int *info)
#define SAXPY_F77