PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
common.h
Go to the documentation of this file.
1 
16 /***************************************************************************/
20 #ifndef _PLASMA_COMMON_H_
21 #define _PLASMA_COMMON_H_
22 
23 #include "global.h"
24 #include "context.h"
25 #include "control.h"
26 #include "core_blas.h"
27 #include "core_blas_dag.h"
28 #include "allocate.h"
29 #include "auxiliary.h"
30 #include "descriptor.h"
31 #include "tile.h"
32 #include "async.h"
33 
34 #if defined( _WIN32 ) || defined( _WIN64 )
35 # include <io.h>
36 #else /* NOT WIN32 */
37 # include <unistd.h>
38 #endif /* IF WIN32 */
39 
40 
44 #if defined(linux) || defined(__linux) || defined(__linux__)
45 #if defined(__GNUC_EXCL__) || defined(__GNUC__)
46 #define PLASMA_HAVE_WEAK 1
47 #endif
48 #endif
49 
53 #if defined(ADD_)
54 #define PLASMA_FNAME(lcname, UCNAME) plasma_##lcname##_
55 #define PLASMA_TILE_FNAME(lcname, UCNAME) plasma_tile_##lcname##_
56 #define PLASMA_ASYNC_FNAME(lcname, UCNAME) plasma_tile_async_##lcname##_
57 #define PLASMA_WS_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##_
58 #define PLASMA_WST_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##_tile_
59 #elif defined(NOCHANGE)
60 #define PLASMA_FNAME(lcname, UCNAME) plasma_##lcname
61 #define PLASMA_TILE_FNAME(lcname, UCNAME) plasma_tile_##lcname##
62 #define PLASMA_ASYNC_FNAME(lcname, UCNAME) plasma_tile_async_##lcname##
63 #define PLASMA_WS_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##
64 #define PLASMA_WST_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##_tile
65 #elif defined(UPCASE)
66 #define PLASMA_FNAME(lcname, UCNAME) PLASMA_##UCNAME
67 #define PLASMA_TILE_FNAME(lcname, UCNAME) PLASMA_TILE_##UCNAME##
68 #define PLASMA_ASYNC_FNAME(lcname, UCNAME) PLASMA_TILE_ASYNC_##UCNAME##
69 #define PLASMA_WS_FNAME(lcname, UCNAME) PLASMA_ALLOC_WORKSPACE_##UCNAME##
70 #define PLASMA_WST_FNAME(lcname, UCNAME) PLASMA_ALLOC_WORKSPACE_##UCNAME##_TILE
71 #endif
72 
73 /***************************************************************************/
76 #define PLASMA_RANK plasma_rank(plasma)
77 #define PLASMA_SIZE plasma->world_size
78 #define PLASMA_GRPSIZE plasma->group_size
79 #define PLASMA_NB plasma->nb
80 #define PLASMA_IB plasma->ib
81 #define PLASMA_NBNBSIZE plasma->nbnbsize
82 #define PLASMA_IBNBSIZE plasma->ibnbsize
83 #define PLASMA_SCHEDULING plasma->scheduling
84 #define PLASMA_RHBLK plasma->rhblock
85 #define PLASMA_TRANSLATION plasma->translation
86 
87 /***************************************************************************/
90 #define PlasmaIPT_NoDep 0
91 #define PlasmaIPT_Panel 1
92 #define PlasmaIPT_All 2
93 
94 /***************************************************************************/
97 #ifndef max
98 #define max(a, b) ((a) > (b) ? (a) : (b))
99 #endif
100 #ifndef min
101 #define min(a, b) ((a) < (b) ? (a) : (b))
102 #endif
103 #ifndef roundup
104 #define roundup(a, b) (b <= 0) ? (a) : (((a) + (b)-1) & ~((b)-1))
105 #endif
106 
107 /***************************************************************************/
110 #define ss_init(m, n, init_val) \
111 { \
112  if (PLASMA_RANK == 0) { \
113  plasma->ss_progress = (volatile int *)plasma_shared_alloc(plasma, (m)*(n), PlasmaInteger); \
114  plasma_memset_int((int*)plasma->ss_progress, (m)*(n), (init_val)); \
115  } \
116  plasma->ss_ld = (m); \
117  plasma->ss_abort = 0; \
118  plasma_barrier(plasma); \
119 }
120 
121 #define ss_abort() plasma->ss_abort = 1;
122 #define ss_aborted() plasma->ss_abort
123 
124 #define ss_cond_set(m, n, val) \
125 { \
126  plasma->ss_progress[(m)+plasma->ss_ld*(n)] = (val); \
127 }
128 
129 #define ss_cond_wait(m, n, val) \
130 { \
131  while (!plasma->ss_abort && \
132  plasma->ss_progress[(m)+plasma->ss_ld*(n)] != (val)) \
133  plasma_yield(); \
134  if (plasma->ss_abort) \
135  break; \
136 }
137 
138 #define ss_finalize() \
139 { \
140  plasma_barrier(plasma); \
141  if (PLASMA_RANK == 0) \
142  plasma_shared_free(plasma, (void*)plasma->ss_progress); \
143 }
144 
145 /***************************************************************************/
148 extern char *plasma_lapack_constants[];
149 
150 #ifdef __cplusplus
151 extern "C" {
152 #endif
153 
154 #include "compute_s.h"
155 #include "compute_d.h"
156 #define COMPLEX
157 #include "compute_c.h"
158 #include "compute_z.h"
159 #undef COMPLEX
160 
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif