Statistiques
| Révision :

root / include / hpl_blas.h @ 1

Historique | Voir | Annoter | Télécharger (19,47 ko)

1
/* 
2
 * -- High Performance Computing Linpack Benchmark (HPL)                
3
 *    HPL - 2.0 - September 10, 2008                          
4
 *    Antoine P. Petitet                                                
5
 *    University of Tennessee, Knoxville                                
6
 *    Innovative Computing Laboratory                                 
7
 *    (C) Copyright 2000-2008 All Rights Reserved                       
8
 *                                                                      
9
 * -- Copyright notice and Licensing terms:                             
10
 *                                                                      
11
 * Redistribution  and  use in  source and binary forms, with or without
12
 * modification, are  permitted provided  that the following  conditions
13
 * are 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. All  advertising  materials  mentioning  features  or  use of this
23
 * software must display the following acknowledgement:                 
24
 * This  product  includes  software  developed  at  the  University  of
25
 * Tennessee, Knoxville, Innovative Computing Laboratory.             
26
 *                                                                      
27
 * 4. The name of the  University,  the name of the  Laboratory,  or the
28
 * names  of  its  contributors  may  not  be used to endorse or promote
29
 * products  derived   from   this  software  without  specific  written
30
 * permission.                                                          
31
 *                                                                      
32
 * -- Disclaimer:                                                       
33
 *                                                                      
34
 * THIS  SOFTWARE  IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,  INCLUDING,  BUT NOT
36
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
38
 * OR  CONTRIBUTORS  BE  LIABLE FOR ANY  DIRECT,  INDIRECT,  INCIDENTAL,
39
 * SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT
40
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41
 * DATA OR PROFITS; OR BUSINESS INTERRUPTION)  HOWEVER CAUSED AND ON ANY
42
 * THEORY OF LIABILITY, WHETHER IN CONTRACT,  STRICT LIABILITY,  OR TORT
43
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
45
 */ 
46
#ifndef HPL_BLAS_H
47
#define HPL_BLAS_H
48
/*
49
 * ---------------------------------------------------------------------
50
 * Include files
51
 * ---------------------------------------------------------------------
52
 */
53
#include "hpl_misc.h"
54
/*
55
 * ---------------------------------------------------------------------
56
 * typedef definitions
57
 * ---------------------------------------------------------------------
58
 */
59
enum HPL_ORDER
60
{  HplRowMajor = 101,  HplColumnMajor  = 102 };
61
enum HPL_TRANS
62
{  HplNoTrans  = 111,  HplTrans        = 112,  HplConjTrans    = 113 };
63
enum HPL_UPLO
64
{  HplUpper    = 121,  HplLower        = 122 };
65
enum HPL_DIAG
66
{  HplNonUnit  = 131,  HplUnit         = 132 };
67
enum HPL_SIDE
68
{  HplLeft     = 141,  HplRight        = 142 }; 
69

    
70
#ifdef HPL_CALL_CBLAS
71
/*
72
 * ---------------------------------------------------------------------
73
 * The C interface of the BLAS is available ...
74
 * ---------------------------------------------------------------------
75
 * #define macro constants
76
 * ---------------------------------------------------------------------
77
 */
78
#define    CBLAS_INDEX         int
79
 
80
#define    CBLAS_ORDER         HPL_ORDER
81
#define    CblasRowMajor       HplRowMajor
82
#define    CblasColMajor       HplColMajor
83
 
84
#define    CBLAS_TRANSPOSE     HPL_TRANS
85
#define    CblasNoTrans        HplNoTrans
86
#define    CblasTrans          HplTrans
87
#define    CblasConjTrans      HplConjTrans
88
 
89
#define    CBLAS_UPLO          HPL_UPLO
90
#define    CblasUpper          HplUpper
91
#define    CblasLower          HplLower
92
 
93
#define    CBLAS_DIAG          HPL_DIAG
94
#define    CblasNonUnit        HplNonUnit
95
#define    CblasUnit           HplUnit
96
 
97
#define    CBLAS_SIDE          HPL_SIDE
98
#define    CblasLeft           HplLeft
99
#define    CblasRight          HplRight
100
/*
101
 * ---------------------------------------------------------------------
102
 * CBLAS Function prototypes
103
 * ---------------------------------------------------------------------
104
 */
105
CBLAS_INDEX       cblas_idamax
106
STDC_ARGS(
107
(  const int,       const double *,  const int ) );
108
void              cblas_dswap
109
STDC_ARGS(
110
(  const int,       double *,        const int,       double *,
111
   const int ) );
112
void              cblas_dcopy
113
STDC_ARGS(
114
(  const int,       const double *,  const int,       double *,
115
   const int ) );
116
void              cblas_daxpy
117
STDC_ARGS(
118
(  const int,       const double,    const double *,  const int,
119
   double *,        const int ) );
120
void              cblas_dscal
121
STDC_ARGS(
122
(  const int,       const double,    double *,        const int ) );
123

    
124
void              cblas_dgemv
125
STDC_ARGS(
126
(  const enum CBLAS_ORDER,           const enum CBLAS_TRANSPOSE,
127
   const int,       const int,       const double,    const double *,
128
   const int,       const double *,  const int,       const double,
129
   double *,        const int ) );
130

    
131
void              cblas_dger
132
STDC_ARGS(
133
(  const enum CBLAS_ORDER,           const int,       const int,
134
   const double,    const double *,  const int,       const double *,
135
   const int,       double *,        const int ) );
136
void              cblas_dtrsv
137
STDC_ARGS(
138
(  const enum CBLAS_ORDER,           const enum CBLAS_UPLO,
139
   const enum CBLAS_TRANSPOSE,       const enum CBLAS_DIAG,
140
   const int,       const double *,  const int,       double *,
141
   const int ) );
142

    
143
void              cblas_dgemm
144
STDC_ARGS(
145
(  const enum CBLAS_ORDER,           const enum CBLAS_TRANSPOSE,
146
   const enum CBLAS_TRANSPOSE,       const int,       const int,
147
   const int,       const double,    const double *,  const int,
148
   const double *,  const int,       const double,    double *,
149
   const int ) );
150
void              cblas_dtrsm
151
STDC_ARGS(
152
(  const enum CBLAS_ORDER,           const enum CBLAS_SIDE,
153
   const enum CBLAS_UPLO,            const enum CBLAS_TRANSPOSE,
154
   const enum CBLAS_DIAG,            const int,       const int,
155
   const double,    const double *,  const int,       double *,
156
   const int ) );
157
/*
158
 * ---------------------------------------------------------------------
159
 * HPL C BLAS macro definition
160
 * ---------------------------------------------------------------------
161
 */
162
#define    HPL_dswap           cblas_dswap
163
#define    HPL_dcopy           cblas_dcopy
164
#define    HPL_daxpy           cblas_daxpy
165
#define    HPL_dscal           cblas_dscal
166
#define    HPL_idamax          cblas_idamax
167

    
168
#define    HPL_dgemv           cblas_dgemv
169
#define    HPL_dtrsv           cblas_dtrsv
170
#define    HPL_dger            cblas_dger
171

    
172
#define    HPL_dgemm           cblas_dgemm
173
#define    HPL_dtrsm           cblas_dtrsm
174

    
175
#endif
176

    
177
#ifdef HPL_CALL_FBLAS
178
/*
179
 * ---------------------------------------------------------------------
180
 * Use the Fortran 77 interface of the BLAS ...
181
 * ---------------------------------------------------------------------
182
 * Defaults: Add_, F77_INTEGER=int, StringSunStyle
183
 * ---------------------------------------------------------------------
184
 */
185
#ifndef NoChange
186
#ifndef UpCase
187
#ifndef Add__
188
#ifndef Add_
189

    
190
#define Add_
191

    
192
#endif
193
#endif
194
#endif
195
#endif
196

    
197
#ifndef F77_INTEGER
198
#define    F77_INTEGER         int
199
#else
200
#define    HPL_USE_F77_INTEGER_DEF
201
#endif
202

    
203
#ifndef StringCrayStyle
204
#ifndef StringStructVal
205
#ifndef StringStructPtr
206
#ifndef StringSunStyle
207

    
208
#define StringSunStyle
209

    
210
#endif
211
#endif
212
#endif
213
#endif
214
/*
215
 * ---------------------------------------------------------------------
216
 * Fortran 77 <-> C interface
217
 * ---------------------------------------------------------------------
218
 *
219
 * These macros identifies how Fortran routines will be called.
220
 *
221
 * Add_     : the Fortran compiler expects the name of C functions to be
222
 * in all lower case and to have an underscore postfixed it (Suns, Intel
223
 * compilers expect this).
224
 *
225
 * NoChange : the Fortran compiler expects the name of C functions to be
226
 * in all lower case (IBM RS6K compilers do this).
227
 *
228
 * UpCase   : the Fortran compiler expects the name of C functions to be
229
 * in all upcase. (Cray compilers expect this).
230
 *
231
 * Add__    : the Fortran compiler in use is f2c, a Fortran to C conver-
232
 * ter.
233
 */
234
#ifdef NoChange
235
/*
236
 * These defines  set  up  the  naming scheme required to have a FORTRAN
237
 * routine called by a C routine with the following  FORTRAN to C inter-
238
 * face:
239
 *
240
 *          FORTRAN DECLARATION            C CALL
241
 *          SUBROUTINE DGEMM(...)          dgemm(...)
242
 */
243
#define    F77dswap               dswap
244
#define    F77dscal               dscal
245
#define    F77dcopy               dcopy
246
#define    F77daxpy               daxpy
247
#define    F77idamax              idamax
248

    
249
#define    F77dgemv               dgemv
250
#define    F77dtrsv               dtrsv
251
#define    F77dger                dger
252

    
253
#define    F77dgemm               dgemm
254
#define    F77dtrsm               dtrsm
255

    
256
#endif
257

    
258
#ifdef UpCase
259
/*
260
 * These defines  set  up  the  naming scheme required to have a FORTRAN
261
 * routine called by a C routine with the following  FORTRAN to C inter-
262
 * face:
263
 *
264
 *          FORTRAN DECLARATION            C CALL
265
 *          SUBROUTINE DGEMM(...)          DGEMM(...)
266
 */
267
#ifdef CRAY_BLAS
268
                                                                                
269
#define    F77dswap               SSWAP
270
#define    F77dscal               SSCAL
271
#define    F77dcopy               SCOPY
272
#define    F77daxpy               SAXPY
273
#define    F77idamax              ISAMAX
274
                                                                                
275
#define    F77dgemv               SGEMV
276
#define    F77dtrsv               STRSV
277
#define    F77dger                SGER
278
                                                                                
279
#define    F77dgemm               SGEMM
280
#define    F77dtrsm               STRSM
281
                                                                                
282
#else
283

    
284
#define    F77dswap               DSWAP
285
#define    F77dscal               DSCAL
286
#define    F77dcopy               DCOPY
287
#define    F77daxpy               DAXPY
288
#define    F77idamax              IDAMAX
289

    
290
#define    F77dgemv               DGEMV
291
#define    F77dtrsv               DTRSV
292
#define    F77dger                DGER
293

    
294
#define    F77dgemm               DGEMM
295
#define    F77dtrsm               DTRSM
296

    
297
#endif
298

    
299
#endif
300

    
301
#ifdef Add_
302
/*
303
 * These defines  set  up  the  naming scheme required to have a FORTRAN
304
 * routine called by a C routine  with the following  FORTRAN to C inter-
305
 * face:
306
 *
307
 *          FORTRAN DECLARATION            C CALL
308
 *          SUBROUTINE DGEMM(...)          dgemm_(...)
309
 */
310
#define    F77dswap               dswap_
311
#define    F77dscal               dscal_
312
#define    F77dcopy               dcopy_
313
#define    F77daxpy               daxpy_
314
#define    F77idamax              idamax_
315

    
316
#define    F77dgemv               dgemv_
317
#define    F77dtrsv               dtrsv_
318
#define    F77dger                dger_
319

    
320
#define    F77dgemm               dgemm_
321
#define    F77dtrsm               dtrsm_
322

    
323
#endif
324

    
325
#ifdef Add__
326
/*
327
 * These defines  set  up  the  naming scheme required to have a FORTRAN
328
 * routine called by a C routine  with the following  FORTRAN to C inter-
329
 * face:
330
 *
331
 *          FORTRAN DECLARATION            C CALL
332
 *          SUBROUTINE DGEMM(...)          dgemm_(...)
333
 */
334
#define    F77dswap               dswap_
335
#define    F77dscal               dscal_
336
#define    F77dcopy               dcopy_
337
#define    F77daxpy               daxpy_
338
#define    F77idamax              idamax_
339
 
340
#define    F77dgemv               dgemv_
341
#define    F77dtrsv               dtrsv_
342
#define    F77dger                dger_
343
 
344
#define    F77dgemm               dgemm_
345
#define    F77dtrsm               dtrsm_
346
 
347
#endif
348
/*
349
 * ---------------------------------------------------------------------
350
 * Typedef definitions and conversion utilities
351
 * ---------------------------------------------------------------------
352
 */
353
#ifdef StringCrayStyle
354

    
355
#include <fortran.h>
356
                      /* Type of character argument in a FORTRAN call */
357
#define    F77_CHAR            _fcd
358
                                    /* Character conversion utilities */
359
#define    HPL_F2C_CHAR(c)     (*(_fcdtocp(c) ))
360
#define    HPL_C2F_CHAR(c)     (_cptofcd(&(c), 1))
361

    
362
#define    F77_CHAR_DECL       F77_CHAR          /* input CHARACTER*1 */
363

    
364
#endif
365
/* ------------------------------------------------------------------ */
366
#ifdef StringStructVal
367
                      /* Type of character argument in a FORTRAN call */
368
typedef struct { char *cp; F77_INTEGER len; } F77_CHAR;
369
                                    /* Character conversion utilities */
370
#define    HPL_F2C_CHAR(c)     (*(c.cp))
371

    
372
#define    F77_CHAR_DECL       F77_CHAR          /* input CHARACTER*1 */
373

    
374
#endif
375
/* ------------------------------------------------------------------ */
376
#ifdef StringStructPtr
377
                      /* Type of character argument in a FORTRAN call */
378
typedef struct { char *cp; F77_INTEGER len; } F77_CHAR;
379
                                    /* Character conversion utilities */
380
#define    HPL_F2C_CHAR(c)     (*(c->cp))
381

    
382
#define    F77_CHAR_DECL       F77_CHAR *        /* input CHARACTER*1 */
383

    
384
#endif
385
/* ------------------------------------------------------------------ */
386
#ifdef StringSunStyle
387
                      /* Type of character argument in a FORTRAN call */
388
#define    F77_CHAR            char *
389
                                    /* Character conversion utilities */
390
#define    HPL_F2C_CHAR(c)     (*(c))
391
#define    HPL_C2F_CHAR(c)     (&(c))
392

    
393
#define    F77_CHAR_DECL       F77_CHAR          /* input CHARACTER*1 */
394
#define    F77_1_CHAR          , F77_INTEGER
395
#define    F77_2_CHAR          F77_1_CHAR F77_1_CHAR
396
#define    F77_3_CHAR          F77_2_CHAR F77_1_CHAR
397
#define    F77_4_CHAR          F77_3_CHAR F77_1_CHAR
398

    
399
#endif
400
/* ------------------------------------------------------------------ */
401

    
402
#ifndef F77_1_CHAR
403
#define    F77_1_CHAR
404
#define    F77_2_CHAR
405
#define    F77_3_CHAR
406
#define    F77_4_CHAR
407
#endif
408

    
409
#define    F77_INT_DECL        const F77_INTEGER *   /* input integer */
410
#define    F77_SIN_DECL        const double *         /* input scalar */
411
#define    F77_VIN_DECL        const double *         /* input vector */
412
#define    F77_VINOUT_DECL     double *        /* input/output matrix */
413
#define    F77_MIN_DECL        const double *         /* input matrix */
414
#define    F77_MINOUT_DECL     double *        /* input/output matrix */
415
 
416
#ifdef CRAY_PVP_ENV                      /* Type of FORTRAN functions */
417
#define    F77_VOID_FUN        extern fortran void      /* subroutine */
418
#define    F77_INT_FUN         extern fortran int /* integer function */
419
#else
420
#define    F77_VOID_FUN        extern void              /* subroutine */
421
#define    F77_INT_FUN         extern int         /* integer function */
422
#endif
423
/*
424
 * ---------------------------------------------------------------------
425
 * Fortran 77 BLAS function prototypes
426
 * ---------------------------------------------------------------------
427
 */
428
F77_VOID_FUN    F77dswap
429
STDC_ARGS(
430
(  F77_INT_DECL,    F77_VINOUT_DECL, F77_INT_DECL,    F77_VINOUT_DECL,
431
   F77_INT_DECL ) );
432
F77_VOID_FUN    F77dscal
433
STDC_ARGS(
434
(  F77_INT_DECL,    F77_SIN_DECL,    F77_VINOUT_DECL, F77_INT_DECL ) );
435
F77_VOID_FUN    F77dcopy
436
STDC_ARGS(
437
(  F77_INT_DECL,    F77_VIN_DECL,    F77_INT_DECL,    F77_VINOUT_DECL,
438
   F77_INT_DECL ) );
439
F77_VOID_FUN    F77daxpy
440
STDC_ARGS(
441
(  F77_INT_DECL,    F77_SIN_DECL,    F77_VIN_DECL,    F77_INT_DECL,
442
   F77_VINOUT_DECL, F77_INT_DECL ) );
443
F77_INT_FUN     F77idamax
444
STDC_ARGS(
445
(  F77_INT_DECL,    F77_VIN_DECL,    F77_INT_DECL ) );
446

    
447
F77_VOID_FUN    F77dgemv
448
STDC_ARGS(
449
(  F77_CHAR_DECL,   F77_INT_DECL,    F77_INT_DECL,    F77_SIN_DECL,
450
   F77_MIN_DECL,    F77_INT_DECL,    F77_VIN_DECL,    F77_INT_DECL,
451
   F77_SIN_DECL,    F77_VINOUT_DECL, F77_INT_DECL     F77_1_CHAR ) );
452
F77_VOID_FUN    F77dger
453
STDC_ARGS(
454
(  F77_INT_DECL,    F77_INT_DECL,    F77_SIN_DECL,    F77_VIN_DECL,
455
   F77_INT_DECL,    F77_VIN_DECL,    F77_INT_DECL,    F77_MINOUT_DECL,
456
   F77_INT_DECL ) );
457
F77_VOID_FUN    F77dtrsv
458
STDC_ARGS(
459
(  F77_CHAR_DECL,   F77_CHAR_DECL,   F77_CHAR_DECL,   F77_INT_DECL,
460
   F77_MIN_DECL,    F77_INT_DECL,    F77_VINOUT_DECL, F77_INT_DECL
461
   F77_3_CHAR ) );
462

    
463
F77_VOID_FUN    F77dgemm
464
STDC_ARGS(
465
(  F77_CHAR_DECL,   F77_CHAR_DECL,   F77_INT_DECL,    F77_INT_DECL,
466
   F77_INT_DECL,    F77_SIN_DECL,    F77_MIN_DECL,    F77_INT_DECL,
467
   F77_MIN_DECL,    F77_INT_DECL,    F77_SIN_DECL,    F77_MINOUT_DECL,
468
   F77_INT_DECL     F77_2_CHAR ) );
469
F77_VOID_FUN    F77dtrsm
470
STDC_ARGS(
471
(  F77_CHAR_DECL,   F77_CHAR_DECL,   F77_CHAR_DECL,   F77_CHAR_DECL,
472
   F77_INT_DECL,    F77_INT_DECL,    F77_SIN_DECL,    F77_MIN_DECL,
473
   F77_INT_DECL,    F77_MINOUT_DECL, F77_INT_DECL     F77_4_CHAR ) );
474

    
475
#endif
476
/*
477
 * ---------------------------------------------------------------------
478
 * HPL BLAS Function prototypes
479
 * ---------------------------------------------------------------------
480
 */
481
#ifndef HPL_CALL_CBLAS
482

    
483
int                              HPL_idamax
484
STDC_ARGS( (
485
   const int,
486
   const double *,
487
   const int
488
) );
489
void                             HPL_daxpy
490
STDC_ARGS( (
491
   const int,
492
   const double,
493
   const double *,
494
   const int,
495
   double *,
496
   const int
497
) );
498
void                             HPL_dcopy
499
STDC_ARGS( (
500
   const int,
501
   const double *,
502
   const int,
503
   double *,
504
   const int
505
) );
506
void                             HPL_dscal
507
STDC_ARGS( (
508
   const int,
509
   const double,
510
   double *,
511
   const int
512
) );
513
void                             HPL_dswap
514
STDC_ARGS( (
515
   const int,
516
   double *,
517
   const int,
518
   double *,
519
   const int
520
) );
521
void                             HPL_dgemv
522
STDC_ARGS( (
523
   const enum HPL_ORDER,
524
   const enum HPL_TRANS,
525
   const int,
526
   const int,
527
   const double,
528
   const double *,
529
   const int,
530
   const double *,
531
   const int,
532
   const double,
533
   double *,
534
   const int
535
) );
536
void                             HPL_dger
537
STDC_ARGS( (
538
   const enum HPL_ORDER,
539
   const int,
540
   const int,
541
   const double,
542
   const double *,
543
   const int,
544
   double *,
545
   const int,
546
   double *,
547
   const int
548
) );
549
void                             HPL_dtrsv
550
STDC_ARGS( (
551
   const enum HPL_ORDER,
552
   const enum HPL_UPLO,
553
   const enum HPL_TRANS,
554
   const enum HPL_DIAG,
555
   const int,
556
   const double *,
557
   const int,
558
   double *,
559
   const int
560
) );
561
void                             HPL_dgemm
562
STDC_ARGS( (
563
   const enum HPL_ORDER,
564
   const enum HPL_TRANS,
565
   const enum HPL_TRANS,
566
   const int,
567
   const int,
568
   const int,
569
   const double,
570
   const double *,
571
   const int,
572
   const double *,
573
   const int,
574
   const double,
575
   double *,
576
   const int
577
) );
578
void                             HPL_dtrsm
579
STDC_ARGS( (
580
   const enum HPL_ORDER,
581
   const enum HPL_SIDE,
582
   const enum HPL_UPLO,
583
   const enum HPL_TRANS,
584
   const enum HPL_DIAG,
585
   const int,
586
   const int,
587
   const double,
588
   const double *,
589
   const int,
590
   double *,
591
   const int
592
) );
593

    
594
#endif
595

    
596
#endif
597
/*
598
 * hpl_blas.h
599
 */