PLASMA  2.4.6
 All Data Structures Functions Groups
common.h
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 #include "bulge.h"
34 
35 #if defined( _WIN32 ) || defined( _WIN64 )
36 # include <io.h>
37 #else /* NOT WIN32 */
38 # include <unistd.h>
39 #endif /* IF WIN32 */
40 
41 
45 #if defined(linux) || defined(__linux) || defined(__linux__)
46 #if defined(__GNUC_EXCL__) || defined(__GNUC__)
47 #define PLASMA_HAVE_WEAK 1
48 #endif
49 #endif
50 
54 #if defined(ADD_)
55 #define PLASMA_FNAME(lcname, UCNAME) plasma_##lcname##_
56 #define PLASMA_TILE_FNAME(lcname, UCNAME) plasma_##lcname##_tile_
57 #define PLASMA_ASYNC_FNAME(lcname, UCNAME) plasma_##lcname##_tile_async_
58 #define PLASMA_WS_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##_
59 #define PLASMA_WST_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##_tile_
60 #elif defined(NOCHANGE)
61 #define PLASMA_FNAME(lcname, UCNAME) plasma_##lcname
62 #define PLASMA_TILE_FNAME(lcname, UCNAME) plasma_##lcname##_tile
63 #define PLASMA_ASYNC_FNAME(lcname, UCNAME) plasma_##lcname##_tile_async
64 #define PLASMA_WS_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname
65 #define PLASMA_WST_FNAME(lcname, UCNAME) plasma_alloc_workspace_##lcname##_tile
66 #elif defined(UPCASE)
67 #define PLASMA_FNAME(lcname, UCNAME) PLASMA_##UCNAME
68 #define PLASMA_TILE_FNAME(lcname, UCNAME) PLASMA_##UCNAME##_TILE
69 #define PLASMA_ASYNC_FNAME(lcname, UCNAME) PLASMA_##UCNAME##_TILE_ASYNC
70 #define PLASMA_WS_FNAME(lcname, UCNAME) PLASMA_ALLOC_WORKSPACE_##UCNAME
71 #define PLASMA_WST_FNAME(lcname, UCNAME) PLASMA_ALLOC_WORKSPACE_##UCNAME##_TILE
72 #endif
73 
74 /***************************************************************************/
77 #define PLASMA_RANK plasma_rank(plasma)
78 #define PLASMA_SIZE plasma->world_size
79 #define PLASMA_GRPSIZE plasma->group_size
80 #define PLASMA_NB plasma->nb
81 #define PLASMA_IB plasma->ib
82 #define PLASMA_NBNBSIZE plasma->nbnbsize
83 #define PLASMA_IBNBSIZE plasma->ibnbsize
84 #define PLASMA_SCHEDULING plasma->scheduling
85 #define PLASMA_RHBLK plasma->rhblock
86 #define PLASMA_TRANSLATION plasma->translation
87 
88 /***************************************************************************/
91 #define PlasmaIPT_NoDep 0
92 #define PlasmaIPT_Panel 1
93 #define PlasmaIPT_All 2
94 
95 /***************************************************************************/
98 #ifndef max
99 #define max(a, b) ((a) > (b) ? (a) : (b))
100 #endif
101 #ifndef min
102 #define min(a, b) ((a) < (b) ? (a) : (b))
103 #endif
104 #ifndef roundup
105 #define roundup(a, b) (b <= 0) ? (a) : (((a) + (b)-1) & ~((b)-1))
106 #endif
107 
108 /***************************************************************************/
111 #define ss_init(m, n, init_val) \
112 { \
113  if (PLASMA_RANK == 0) { \
114  plasma->ss_progress = (volatile int *)plasma_shared_alloc(plasma, (m)*(n), PlasmaInteger); \
115  plasma_memset_int((int*)plasma->ss_progress, (m)*(n), (init_val)); \
116  } \
117  plasma->ss_ld = (m); \
118  plasma->ss_abort = 0; \
119  plasma_barrier(plasma); \
120 }
121 
122 #define ss_abort() plasma->ss_abort = 1;
123 #define ss_aborted() plasma->ss_abort
124 
125 #define ss_cond_set(m, n, val) \
126 { \
127  plasma->ss_progress[(m)+plasma->ss_ld*(n)] = (val); \
128 }
129 
130 #define ss_cond_wait(m, n, val) \
131 { \
132  while (!plasma->ss_abort && \
133  plasma->ss_progress[(m)+plasma->ss_ld*(n)] != (val)) \
134  plasma_yield(); \
135  if (plasma->ss_abort) \
136  break; \
137 }
138 
139 #define ss_finalize() \
140 { \
141  plasma_barrier(plasma); \
142  if (PLASMA_RANK == 0) \
143  plasma_shared_free(plasma, (void*)plasma->ss_progress); \
144 }
145 
146 /***************************************************************************/
149 extern char *plasma_lapack_constants[];
150 
151 #ifdef __cplusplus
152 extern "C" {
153 #endif
154 
155 #include "compute_s.h"
156 #include "compute_d.h"
157 #define COMPLEX
158 #include "compute_c.h"
159 #include "compute_z.h"
160 #undef COMPLEX
161 
162 void plasma_pdlag2s(plasma_context_t *plasma);
163 void plasma_pzlag2c(plasma_context_t *plasma);
164 void plasma_pslag2d(plasma_context_t *plasma);
165 void plasma_pclag2z(plasma_context_t *plasma);
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif