PLASMA 2.3.1

/home/mathieu/ICL/Plasma/svn/trunk/tools/plasma_2.4.0/control/common.h

00001 
00016 /***************************************************************************/
00020 #ifndef _PLASMA_COMMON_H_
00021 #define _PLASMA_COMMON_H_
00022 
00023 #if defined( _WIN32 ) || defined( _WIN64 )
00024 #include <io.h>
00025 #else
00026 #include <unistd.h>
00027 #endif
00028 
00029 #include "global.h"
00030 #include "context.h"
00031 #include "control.h"
00032 #include "core_blas.h"
00033 #include "core_blas_dag.h"
00034 #include "allocate.h"
00035 #include "auxiliary.h"
00036 #include "descriptor.h"
00037 #include "tile.h"
00038 #include "async.h"
00039 
00043 #if defined(linux) || defined(__linux) || defined(__linux__)
00044 #if defined(__GNUC_EXCL__) || defined(__GNUC__) 
00045 #define PLASMA_HAVE_WEAK 1
00046 #endif
00047 #endif
00048 
00052 #if defined(ADD_)
00053 #define PLASMA_FNAME(lcname, UCNAME)        plasma_##lcname##_
00054 #define PLASMA_TILE_FNAME(lcname, UCNAME)   plasma_tile_##lcname##_
00055 #define PLASMA_ASYNC_FNAME(lcname, UCNAME)  plasma_tile_async_##lcname##_
00056 #elif defined(NOCHANGE)
00057 #define PLASMA_FNAME(lcname, UCNAME)        plasma_##lcname
00058 #define PLASMA_TILE_FNAME(lcname, UCNAME)   plasma_tile_##lcname##
00059 #define PLASMA_ASYNC_FNAME(lcname, UCNAME)  plasma_tile_async_##lcname##
00060 #elif defined(UPCASE)
00061 #define PLASMA_FNAME(lcname, UCNAME)        PLASMA_##UCNAME
00062 #define PLASMA_TILE_FNAME(lcname, UCNAME)   PLASMA_TILE_##UCNAME##
00063 #define PLASMA_ASYNC_FNAME(lcname, UCNAME)  PLASMA_TILE_ASYNC_##UCNAME##
00064 #endif
00065 
00066 /***************************************************************************/
00069 #define PLASMA_RANK        plasma_rank(plasma)
00070 #define PLASMA_SIZE        plasma->world_size
00071 #define PLASMA_GRPSIZE     plasma->group_size
00072 #define PLASMA_NB          plasma->nb
00073 #define PLASMA_IB          plasma->ib
00074 #define PLASMA_NBNBSIZE    plasma->nbnbsize
00075 #define PLASMA_IBNBSIZE    plasma->ibnbsize
00076 #define PLASMA_SCHEDULING  plasma->scheduling
00077 #define PLASMA_RHBLK       plasma->rhblock
00078 #define PLASMA_TRANSLATION plasma->translation
00079 
00080 /***************************************************************************/
00083 #define PlasmaIPT_NoDep   0
00084 #define PlasmaIPT_Panel   1
00085 #define PlasmaIPT_All     2
00086 
00087 /***************************************************************************/
00090 #ifndef max
00091 #define max(a, b) ((a) > (b) ? (a) : (b))
00092 #endif
00093 #ifndef min
00094 #define min(a, b) ((a) < (b) ? (a) : (b))
00095 #endif
00096 #ifndef roundup
00097 #define roundup(a, b) (b <= 0) ? (a) : (((a) + (b)-1) & ~((b)-1))
00098 #endif
00099 
00100 /***************************************************************************/
00103 #define ss_init(m, n, init_val) \
00104 { \
00105     if (PLASMA_RANK == 0) { \
00106         plasma->ss_progress = (volatile int *)plasma_shared_alloc(plasma, (m)*(n), PlasmaInteger); \
00107         plasma_memset_int((int*)plasma->ss_progress, (m)*(n), (init_val)); \
00108     } \
00109     plasma->ss_ld = (m); \
00110     plasma->ss_abort = 0; \
00111     plasma_barrier(plasma); \
00112 }
00113 
00114 #define ss_abort()   plasma->ss_abort = 1;
00115 #define ss_aborted() plasma->ss_abort
00116 
00117 #define ss_cond_set(m, n, val) \
00118 { \
00119     plasma->ss_progress[(m)+plasma->ss_ld*(n)] = (val); \
00120 }
00121 
00122 #define ss_cond_wait(m, n, val) \
00123 { \
00124     while (!plasma->ss_abort && \
00125             plasma->ss_progress[(m)+plasma->ss_ld*(n)] != (val)) \
00126         plasma_yield(); \
00127     if (plasma->ss_abort) \
00128         break; \
00129 }
00130 
00131 #define ss_finalize() \
00132 { \
00133     plasma_barrier(plasma); \
00134     if (PLASMA_RANK == 0) \
00135         plasma_shared_free(plasma, (void*)plasma->ss_progress); \
00136 }
00137 
00138 /***************************************************************************/
00141 extern char *plasma_lapack_constants[];
00142 
00143 #ifdef __cplusplus
00144 extern "C" {
00145 #endif
00146 
00147 #include "compute_s.h"
00148 #include "compute_d.h"
00149 #define COMPLEX
00150 #include "compute_c.h"
00151 #include "compute_z.h"
00152 #undef COMPLEX
00153 
00154 void plasma_pdlag2s(plasma_context_t *plasma);
00155 void plasma_pzlag2c(plasma_context_t *plasma);
00156 void plasma_pslag2d(plasma_context_t *plasma);
00157 void plasma_pclag2z(plasma_context_t *plasma);
00158 
00159 #ifdef __cplusplus
00160 }
00161 #endif
00162 
00163 #endif
 All Data Structures