OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
pblas.h
Go to the documentation of this file.
1/* ---------------------------------------------------------------------
2*
3* -- PBLAS routine (version 2.0) --
4* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5* and University of California, Berkeley.
6* April 1, 1998
7*
8* ---------------------------------------------------------------------
9*/
10/*
11* This file includes the standard C libraries, as well as system depen-
12* dent include files. All PBLAS routines include this file.
13*
14* ---------------------------------------------------------------------
15* Machine Specific PBLAS macros
16* ---------------------------------------------------------------------
17*/
18#define _HAL_ 0
19#define _T3D_ 1
20#define _T3E_ 2
21
22#ifdef T3D
23#define _MACH_ _T3D_
24#endif
25#ifdef T3E
26#define _MACH_ _T3E_
27#endif
28#ifndef _MACH_
29#define _MACH_ _HAL_
30#endif
31/*
32* CBRATIO is the ratio of the transfer cost per element for the combine
33* sum to one process and the broadcast operation. This value is used
34* within the Level 3 PBLAS routines to decide on which algorithm to se-
35* lect.
36*/
37#define CBRATIO 1.3
38/*
39* ---------------------------------------------------------------------
40* Include files
41* ---------------------------------------------------------------------
42*/
43#include <stdio.h>
44#include <stdlib.h>
45
46#ifdef __STDC__
47#include <stdarg.h>
48#else
49#include <varargs.h>
50#endif
51
52#if( ( _MACH_ == _T3D_ ) || ( _MACH_ == _T3E_ ) )
53#include <fortran.h>
54#endif
55/*
56* ---------------------------------------------------------------------
57* FORTRAN <-> C interface
58* ---------------------------------------------------------------------
59*
60* These macros identifies how the PBLAS will be called as follows:
61*
62* _F2C_ADD_: the FORTRAN compiler expects the name of C functions to be
63* in all lower case and to have an underscore postfixed it (Suns, Intel
64* compilers expect this).
65*
66* _F2C_NOCHANGE: the FORTRAN compiler expects the name of C functions
67* to be in all lower case (IBM RS6K compilers do this).
68*
69* _F2C_UPCASE: the FORTRAN compiler expects the name of C functions
70* to be in all upcase. (Cray compilers expect this).
71*
72* _F2C_F77ISF2C: the FORTRAN compiler in use is f2c, a FORTRAN to C
73* converter.
74*/
75#define _F2C_ADD_ 0
76#define _F2C_NOCHANGE 1
77#define _F2C_UPCASE 2
78#define _F2C_F77ISF2C 3
79
80#ifdef UpCase
81#define _F2C_CALL_ _F2C_UPCASE
82#endif
83
84#ifdef NoChange
85#define _F2C_CALL_ _F2C_NOCHANGE
86#endif
87
88#ifdef Add_
89#define _F2C_CALL_ _F2C_ADD_
90#endif
91
92#ifdef f77IsF2C
93#define _F2C_CALL_ _F2C_F77ISF2C
94#endif
95
96#ifndef _F2C_CALL_
97#define _F2C_CALL_ _F2C_ADD_
98#endif
99/*
100* ---------------------------------------------------------------------
101* TYPE DEFINITIONS AND CONVERSION UTILITIES
102* ---------------------------------------------------------------------
103*/
104#ifndef Int
105#define Int int
106#endif
107
108#if( ( _MACH_ == _T3D_ ) || ( _MACH_ == _T3E_ ) )
109
110#define float double
111 /* Type of character argument in a FORTRAN call */
112#define F_CHAR_T _fcd
113 /* Character conversion utilities */
114#define F2C_CHAR(a) ( _fcdtocp( (a) ) )
115#define C2F_CHAR(a) ( _cptofcd( (a), 1 ) )
116 /* Type of FORTRAN functions */
117#define F_VOID_FCT void fortran /* Subroutine */
118#define F_INTG_FCT Int fortran /* INTEGER function */
119
120#else /* Type of character argument in a FORTRAN call */
121
122typedef char * F_CHAR_T;
123 /* Character conversion utilities */
124#define F2C_CHAR(a) (a)
125#define C2F_CHAR(a) (a)
126 /* Type of FORTRAN functions */
127#define F_VOID_FCT void /* Subroutine */
128#define F_INTG_FCT Int /* INTEGER function */
129
130#endif
131/*
132* ----------------------------------------------------------------------
133* #typedef definitions
134* ---------------------------------------------------------------------
135*/
136typedef float cmplx [2];
137typedef double cmplx16[2];
138
139#define REAL_PART 0
140#define IMAG_PART 1
141
142#ifdef __STDC__
143
144typedef void (*GESD2D_T) ( Int, Int, Int,
145 char *, Int, Int,
146 Int );
147typedef void (*GERV2D_T) ( Int, Int, Int,
148 char *, Int, Int,
149 Int );
150typedef void (*GEBS2D_T) ( Int, char *, char *,
151 Int, Int, char *,
152 Int );
153typedef void (*GEBR2D_T) ( Int, char *, char *,
154 Int, Int, char *,
155 Int, Int, Int );
156typedef void (*GSUM2D_T) ( Int, char *, char *,
157 Int, Int, char *,
158 Int, Int, Int );
159
160typedef F_VOID_FCT (*MMADD_T) ( Int *, Int *, char *,
161 char *, Int *, char *,
162 char *, Int * );
163typedef F_VOID_FCT (*MMSHFT_T) ( Int *, Int *, Int *,
164 char *, Int * );
165typedef F_VOID_FCT (*VVDOT_T) ( Int *, char *, char *,
166 Int *, char *, Int * );
167typedef F_VOID_FCT (*VVSET_T) ( Int *, char *, char *,
168 Int * );
169typedef F_VOID_FCT (*TZPAD_T) ( F_CHAR_T, F_CHAR_T, Int *,
170 Int *, Int *, char *,
171 char *, char *, Int * );
172typedef F_VOID_FCT (*TZPADCPY_T) ( F_CHAR_T, F_CHAR_T, Int *,
173 Int *, Int *, char *,
174 Int *, char *, Int * );
175typedef F_VOID_FCT (*TZSET_T) ( F_CHAR_T, Int *, Int *,
176 Int *, char *, char *,
177 char *, Int * );
178typedef F_VOID_FCT (*TZSCAL_T) ( F_CHAR_T, Int *, Int *,
179 Int *, char *, char *,
180 Int * );
181
182typedef F_VOID_FCT (*AXPY_T) ( Int *, char *, char *,
183 Int *, char *, Int * );
184typedef F_VOID_FCT (*COPY_T) ( Int *, char *, Int *,
185 char *, Int * );
186typedef F_VOID_FCT (*SWAP_T) ( Int *, char *, Int *,
187 char *, Int * );
188
189typedef F_VOID_FCT (*GEMV_T) ( F_CHAR_T, Int *, Int *,
190 char *, char *, Int *,
191 char *, Int *, char *,
192 char *, Int * );
193typedef F_VOID_FCT (*AGEMV_T) ( F_CHAR_T, Int *, Int *,
194 char *, char *, Int *,
195 char *, Int *, char *,
196 char *, Int * );
197typedef F_VOID_FCT (*SYMV_T) ( F_CHAR_T, Int *, char *,
198 char *, Int *, char *,
199 Int *, char *, char *,
200 Int * );
201typedef F_VOID_FCT (*ASYMV_T) ( F_CHAR_T, Int *, char *,
202 char *, Int *, char *,
203 Int *, char *, char *,
204 Int * );
205typedef F_VOID_FCT (*HEMV_T) ( F_CHAR_T, Int *, char *,
206 char *, Int *, char *,
207 Int *, char *, char *,
208 Int * );
209typedef F_VOID_FCT (*AHEMV_T) ( F_CHAR_T, Int *, char *,
210 char *, Int *, char *,
211 Int *, char *, char *,
212 Int * );
214 Int *, char *, Int *,
215 char *, Int * );
217 Int *, char *, char *,
218 Int *, char *, Int *,
219 char *, char *, Int * );
221 Int *, char *, Int *,
222 char *, Int * );
223typedef F_VOID_FCT (*GERC_T) ( Int *, Int *, char *,
224 char *, Int *, char *,
225 Int *, char *, Int * );
226typedef F_VOID_FCT (*GERU_T) ( Int *, Int *, char *,
227 char *, Int *, char *,
228 Int *, char *, Int * );
229typedef F_VOID_FCT (*SYR_T) ( F_CHAR_T, Int *, char *,
230 char *, Int *, char *,
231 Int * );
232typedef F_VOID_FCT (*HER_T) ( F_CHAR_T, Int *, char *,
233 char *, Int *, char *,
234 Int * );
235typedef F_VOID_FCT (*SYR2_T) ( F_CHAR_T, Int *, char *,
236 char *, Int *, char *,
237 Int *, char *, Int * );
238typedef F_VOID_FCT (*HER2_T) ( F_CHAR_T, Int *, char *,
239 char *, Int *, char *,
240 Int *, char *, Int * );
241
242typedef F_VOID_FCT (*GEMM_T) ( F_CHAR_T, F_CHAR_T, Int *,
243 Int *, Int *, char *,
244 char *, Int *, char *,
245 Int *, char *, char *,
246 Int * );
247typedef F_VOID_FCT (*SYMM_T) ( F_CHAR_T, F_CHAR_T, Int *,
248 Int *, char *, char *,
249 Int *, char *, Int *,
250 char *, char *, Int * );
251typedef F_VOID_FCT (*HEMM_T) ( F_CHAR_T, F_CHAR_T, Int *,
252 Int *, char *, char *,
253 Int *, char *, Int *,
254 char *, char *, Int * );
255typedef F_VOID_FCT (*SYRK_T) ( F_CHAR_T, F_CHAR_T, Int *,
256 Int *, char *, char *,
257 Int *, char *, char *,
258 Int * );
259typedef F_VOID_FCT (*HERK_T) ( F_CHAR_T, F_CHAR_T, Int *,
260 Int *, char *, char *,
261 Int *, char *, char *,
262 Int * );
263typedef F_VOID_FCT (*SYR2K_T) ( F_CHAR_T, F_CHAR_T, Int *,
264 Int *, char *, char *,
265 Int *, char *, Int *,
266 char *, char *, Int * );
267typedef F_VOID_FCT (*HER2K_T) ( F_CHAR_T, F_CHAR_T, Int *,
268 Int *, char *, char *,
269 Int *, char *, Int *,
270 char *, char *, Int * );
272 F_CHAR_T, Int *, Int *,
273 char *, char *, Int *,
274 char *, Int * );
276 F_CHAR_T, Int *, Int *,
277 char *, char *, Int *,
278 char *, Int * );
279
280#else
281
282typedef void (*GESD2D_T) ();
283typedef void (*GERV2D_T) ();
284typedef void (*GEBS2D_T) ();
285typedef void (*GEBR2D_T) ();
286typedef void (*GSUM2D_T) ();
287
288typedef F_VOID_FCT (*MMADD_T) ();
289typedef F_VOID_FCT (*MMSHFT_T) ();
290typedef F_VOID_FCT (*VVDOT_T) ();
291typedef F_VOID_FCT (*VVSET_T) ();
292typedef F_VOID_FCT (*TZPAD_T) ();
293typedef F_VOID_FCT (*TZPADCPY_T) ();
294typedef F_VOID_FCT (*TZSET_T) ();
295typedef F_VOID_FCT (*TZSCAL_T) ();
296
297typedef F_VOID_FCT (*AXPY_T) ();
298typedef F_VOID_FCT (*COPY_T) ();
299typedef F_VOID_FCT (*SWAP_T) ();
300
301typedef F_VOID_FCT (*GEMV_T) ();
302typedef F_VOID_FCT (*AGEMV_T) ();
303typedef F_VOID_FCT (*SYMV_T) ();
304typedef F_VOID_FCT (*ASYMV_T) ();
305typedef F_VOID_FCT (*HEMV_T) ();
306typedef F_VOID_FCT (*AHEMV_T) ();
307typedef F_VOID_FCT (*TRMV_T) ();
308typedef F_VOID_FCT (*ATRMV_T) ();
309typedef F_VOID_FCT (*TRSV_T) ();
310typedef F_VOID_FCT (*GERC_T) ();
311typedef F_VOID_FCT (*GERU_T) ();
312typedef F_VOID_FCT (*SYR_T) ();
313typedef F_VOID_FCT (*HER_T) ();
314typedef F_VOID_FCT (*SYR2_T) ();
315typedef F_VOID_FCT (*HER2_T) ();
316
317typedef F_VOID_FCT (*GEMM_T) ();
318typedef F_VOID_FCT (*SYMM_T) ();
319typedef F_VOID_FCT (*HEMM_T) ();
320typedef F_VOID_FCT (*SYRK_T) ();
321typedef F_VOID_FCT (*HERK_T) ();
322typedef F_VOID_FCT (*SYR2K_T) ();
323typedef F_VOID_FCT (*HER2K_T) ();
324typedef F_VOID_FCT (*TRMM_T) ();
325typedef F_VOID_FCT (*TRSM_T) ();
326
327#endif
328
329typedef struct
330{
331 char type; /* Encoding of the data type */
332 Int usiz; /* length in bytes of elementary data type */
333 Int size; /* length in bytes of data type */
334
335 char * zero,
337 * negone; /* pointers to contants of correct type */
338
339 GESD2D_T Cgesd2d; /* BLACS functions */
344
345 MMADD_T Fmmadd; /* Addition functions */
353
354 MMSHFT_T Fcshft; /* Shift functions */
356
357 VVDOT_T Fvvdotu; /* Dot functions */
359
360 TZPAD_T Ftzpad; /* Array pad function */
363
364 TZSCAL_T Ftzscal; /* Scaling functions */
367
368 AXPY_T Faxpy; /* Level 1 BLAS */
371
372 GEMV_T Fgemv; /* Level 2 BLAS */
377
382
389
390 GEMM_T Fgemm; /* Level 3 BLAS */
399
400} PBTYP_T;
401
402#ifdef __STDC__
403
404typedef void (*TZSYR_T) ( PBTYP_T *, char *, Int,
405 Int, Int, Int,
406 char *, char *, Int,
407 char *, Int, char *,
408 Int );
409typedef void (*TZSYR2_T) ( PBTYP_T *, char *, Int,
410 Int, Int, Int,
411 char *, char *, Int,
412 char *, Int, char *,
413 Int, char *, Int,
414 char *, Int );
415typedef void (*TZTRM_T) ( PBTYP_T *, char *, char *,
416 char *, char *, Int,
417 Int, Int, Int,
418 char *, char *, Int,
419 char *, Int, char *,
420 Int );
421typedef void (*TZSYM_T) ( PBTYP_T *, char *, char *,
422 Int, Int, Int,
423 Int, char *, char *,
424 Int, char *, Int,
425 char *, Int, char *,
426 Int, char *, Int );
427#else
428
429typedef void (*TZSYR_T) ();
430typedef void (*TZSYR2_T) ();
431typedef void (*TZTRM_T) ();
432typedef void (*TZSYM_T) ();
433
434#endif
435
436typedef struct
437{
438 Int offd; /* Global diagonal offset */
439 Int lcmt00; /* LCM value of first block */
440
441 Int mp; /* Local number of rows */
442 Int imb1; /* Size of first row block (global) */
443 Int imbloc; /* Size of first local row block */
444 Int mb; /* Row block size */
445 Int lmbloc; /* Size of last local row block */
446 Int mblks; /* Number of local row blocks */
447 Int iupp; /* LCM row bound for first diagonal block */
448 Int upp; /* LCM row bound for diagonal block */
449 Int prow; /* Relative row process coordinate */
450 Int nprow; /* Number of process rows */
451
452 Int nq; /* Local number of columns */
453 Int inb1; /* Size of first column block (global) */
454 Int inbloc; /* Size of first local column block */
455 Int nb; /* Column block size */
456 Int lnbloc; /* Size of last local column block */
457 Int nblks; /* Number of local column blocks */
458 Int ilow; /* LCM column bound for first diagonal block */
459 Int low; /* LCM column bound for diagonal block */
460 Int pcol; /* Relative column process coordinate */
461 Int npcol; /* Number of process columns */
462
463 Int lcmb; /* Least common multiple of nprow * mb and npcol * nb */
464
465} PB_VM_T;
466
467/*
468* ---------------------------------------------------------------------
469* #define macro constants
470* ---------------------------------------------------------------------
471*/
472#define INT 'I' /* type identifiers */
473#define SREAL 'S'
474#define DREAL 'D'
475#define SCPLX 'C'
476#define DCPLX 'Z'
477
478#define crot_ CROT
#define Int
Definition Bconfig.h:22
void(* GEBR2D_T)()
Definition pblas.h:285
F_VOID_FCT(* HER2_T)()
Definition pblas.h:315
F_VOID_FCT(* SYR_T)()
Definition pblas.h:312
void(* TZSYR2_T)()
Definition pblas.h:430
F_VOID_FCT(* ATRMV_T)()
Definition pblas.h:308
F_VOID_FCT(* HEMV_T)()
Definition pblas.h:305
F_VOID_FCT(* SYMV_T)()
Definition pblas.h:303
F_VOID_FCT(* VVDOT_T)()
Definition pblas.h:290
float cmplx[2]
Definition pblas.h:136
F_VOID_FCT(* SYR2_T)()
Definition pblas.h:314
F_VOID_FCT(* MMSHFT_T)()
Definition pblas.h:289
F_VOID_FCT(* GEMM_T)()
Definition pblas.h:317
#define F_VOID_FCT
Definition pblas.h:127
F_VOID_FCT(* HEMM_T)()
Definition pblas.h:319
double cmplx16[2]
Definition pblas.h:137
F_VOID_FCT(* TRMV_T)()
Definition pblas.h:307
F_VOID_FCT(* COPY_T)()
Definition pblas.h:298
F_VOID_FCT(* TZPADCPY_T)()
Definition pblas.h:293
F_VOID_FCT(* MMADD_T)()
Definition pblas.h:288
F_VOID_FCT(* SYMM_T)()
Definition pblas.h:318
void(* GSUM2D_T)()
Definition pblas.h:286
F_VOID_FCT(* SWAP_T)()
Definition pblas.h:299
#define Int
Definition pblas.h:105
F_VOID_FCT(* GERU_T)()
Definition pblas.h:311
F_VOID_FCT(* ASYMV_T)()
Definition pblas.h:304
void(* TZTRM_T)()
Definition pblas.h:431
F_VOID_FCT(* SYRK_T)()
Definition pblas.h:320
F_VOID_FCT(* AGEMV_T)()
Definition pblas.h:302
void(* GESD2D_T)()
Definition pblas.h:282
F_VOID_FCT(* TRMM_T)()
Definition pblas.h:324
F_VOID_FCT(* HER_T)()
Definition pblas.h:313
void(* GERV2D_T)()
Definition pblas.h:283
void(* GEBS2D_T)()
Definition pblas.h:284
F_VOID_FCT(* GERC_T)()
Definition pblas.h:310
F_VOID_FCT(* TRSV_T)()
Definition pblas.h:309
F_VOID_FCT(* HERK_T)()
Definition pblas.h:321
void(* TZSYR_T)()
Definition pblas.h:429
F_VOID_FCT(* AHEMV_T)()
Definition pblas.h:306
F_VOID_FCT(* TZSCAL_T)()
Definition pblas.h:295
F_VOID_FCT(* HER2K_T)()
Definition pblas.h:323
F_VOID_FCT(* GEMV_T)()
Definition pblas.h:301
F_VOID_FCT(* TZPAD_T)()
Definition pblas.h:292
F_VOID_FCT(* TZSET_T)()
Definition pblas.h:294
char * F_CHAR_T
Definition pblas.h:122
F_VOID_FCT(* AXPY_T)()
Definition pblas.h:297
F_VOID_FCT(* VVSET_T)()
Definition pblas.h:291
void(* TZSYM_T)()
Definition pblas.h:432
F_VOID_FCT(* TRSM_T)()
Definition pblas.h:325
F_VOID_FCT(* SYR2K_T)()
Definition pblas.h:322
ATRMV_T Fatrmv
Definition pblas.h:381
char type
Definition pblas.h:331
Int usiz
Definition pblas.h:332
TRSM_T Ftrsm
Definition pblas.h:398
TZPADCPY_T Ftzpadcpy
Definition pblas.h:361
COPY_T Fcopy
Definition pblas.h:369
VVDOT_T Fvvdotc
Definition pblas.h:358
MMADD_T Fmmddac
Definition pblas.h:350
AHEMV_T Fahemv
Definition pblas.h:380
VVDOT_T Fvvdotu
Definition pblas.h:357
AGEMV_T Fagemv
Definition pblas.h:378
SYMM_T Fsymm
Definition pblas.h:391
SYR2K_T Fsyr2k
Definition pblas.h:395
SWAP_T Fswap
Definition pblas.h:370
HEMV_T Fhemv
Definition pblas.h:374
TRMM_T Ftrmm
Definition pblas.h:397
SYMV_T Fsymv
Definition pblas.h:373
MMADD_T Fmmadd
Definition pblas.h:345
SYR2_T Fsyr2
Definition pblas.h:387
TRSV_T Ftrsv
Definition pblas.h:376
MMADD_T Fmmdda
Definition pblas.h:349
HER_T Fher
Definition pblas.h:386
HER2K_T Fher2k
Definition pblas.h:396
GEMV_T Fgemv
Definition pblas.h:372
Int size
Definition pblas.h:333
GSUM2D_T Cgsum2d
Definition pblas.h:343
GERV2D_T Cgerv2d
Definition pblas.h:340
TZSCAL_T Ftzcnjg
Definition pblas.h:366
GEMM_T Fgemm
Definition pblas.h:390
HEMM_T Fhemm
Definition pblas.h:392
MMADD_T Fmmddact
Definition pblas.h:352
ASYMV_T Fasymv
Definition pblas.h:379
TZSCAL_T Fhescal
Definition pblas.h:365
MMADD_T Fmmddat
Definition pblas.h:351
GEBR2D_T Cgebr2d
Definition pblas.h:342
GERU_T Fgeru
Definition pblas.h:384
SYRK_T Fsyrk
Definition pblas.h:393
MMADD_T Fmmtcadd
Definition pblas.h:348
GESD2D_T Cgesd2d
Definition pblas.h:339
char * zero
Definition pblas.h:335
MMSHFT_T Fcshft
Definition pblas.h:354
TRMV_T Ftrmv
Definition pblas.h:375
HERK_T Fherk
Definition pblas.h:394
TZSCAL_T Ftzscal
Definition pblas.h:364
char * negone
Definition pblas.h:337
char * one
Definition pblas.h:336
MMADD_T Fmmcadd
Definition pblas.h:346
VVSET_T Fset
Definition pblas.h:362
TZPAD_T Ftzpad
Definition pblas.h:360
GEBS2D_T Cgebs2d
Definition pblas.h:341
SYR_T Fsyr
Definition pblas.h:385
GERC_T Fgerc
Definition pblas.h:383
MMADD_T Fmmtadd
Definition pblas.h:347
MMSHFT_T Frshft
Definition pblas.h:355
AXPY_T Faxpy
Definition pblas.h:368
HER2_T Fher2
Definition pblas.h:388
Int lcmb
Definition pblas.h:463
Int lnbloc
Definition pblas.h:456
Int low
Definition pblas.h:459
Int iupp
Definition pblas.h:447
Int npcol
Definition pblas.h:461
Int nprow
Definition pblas.h:450
Int lcmt00
Definition pblas.h:439
Int pcol
Definition pblas.h:460
Int inbloc
Definition pblas.h:454
Int ilow
Definition pblas.h:458
Int offd
Definition pblas.h:438
Int inb1
Definition pblas.h:453
Int nblks
Definition pblas.h:457
Int mp
Definition pblas.h:441
Int prow
Definition pblas.h:449
Int imbloc
Definition pblas.h:443
Int nq
Definition pblas.h:452
Int lmbloc
Definition pblas.h:445
Int nb
Definition pblas.h:455
Int imb1
Definition pblas.h:442
Int mblks
Definition pblas.h:446
Int mb
Definition pblas.h:444
Int upp
Definition pblas.h:448