00001
00032 #ifndef CONVERSE_H
00033 #define CONVERSE_H
00034
00035
00036
00037
00038
00039
00040
00041
00042 #if defined _MSC_VER
00043 # define CMK_THREADLOCAL __declspec(thread)
00044 #else
00045 # define CMK_THREADLOCAL __thread
00046 #endif
00047
00048 #if defined _MSC_VER
00049 # define CMI_FORCE_INLINE __forceinline
00050 #elif defined __GNUC__
00051 # define CMI_FORCE_INLINE inline __attribute__((always_inline))
00052 #else
00053 # define CMI_FORCE_INLINE inline
00054 #endif
00055
00056 #if defined(__GNUC__) && !defined(__clang__)
00057 #define CMI_NOOPTIMIZE __attribute__((optimize(0)))
00058 #else
00059 #define CMI_NOOPTIMIZE
00060 #endif
00061
00062 #include "conv-header.h"
00063
00064 #if CMK_ONESIDED_IMPL
00065 #define CMI_ZC_MSGTYPE(msg) ((CmiMsgHeaderBasic *)msg)->zcMsgType
00066 #define CMI_IS_ZC_BCAST(msg) (CMI_ZC_MSGTYPE(msg) == CMK_ZC_BCAST_SEND_MSG || CMI_ZC_MSGTYPE(msg) == CMK_ZC_BCAST_RECV_MSG)
00067 #define CMI_IS_ZC_RECV(msg) (CMI_ZC_MSGTYPE(msg) == CMK_ZC_P2P_RECV_MSG || CMI_ZC_MSGTYPE(msg) == CMK_ZC_BCAST_RECV_MSG)
00068 #endif
00069
00070 #define CMIALIGN(x,n) (size_t)((~((size_t)n-1))&((x)+(n-1)))
00071
00072 #define ALIGN8(x) CMIALIGN(x,8)
00073 #define ALIGN16(x) CMIALIGN(x,16)
00074
00075 #if !defined(ALIGN_BYTES)
00076 #if CMK_64BIT
00077 #define ALIGN_BYTES 16U
00078 #else
00079 #define ALIGN_BYTES 8U
00080 #endif
00081 #endif
00082
00083 #define ALIGN_DEFAULT(x) CMIALIGN(x, ALIGN_BYTES)
00084
00085 #define CMIPADDING(x, n) (CMIALIGN((x), (n)) - (size_t)(x))
00086
00090 #include "cmiqueue.h"
00091
00092 #include <stdio.h>
00093 #include <stdlib.h>
00094 #include <string.h>
00095 #include <stdint.h>
00096
00097 #if defined __cplusplus
00098 #include <atomic>
00099 #endif
00100
00101
00102 #if defined __cplusplus && defined __THROW
00103 # define CMK_THROW __THROW
00104 #else
00105 # define CMK_THROW
00106 #endif
00107
00108 #ifndef __has_builtin
00109 # define __has_builtin(x) 0 // Compatibility with non-clang compilers.
00110 #endif
00111 #if (defined __GNUC__ || __has_builtin(__builtin_unreachable)) && !defined _CRAYC
00112
00113 # define CMI_UNREACHABLE_SECTION(...) __builtin_unreachable()
00114 #elif _MSC_VER
00115 # define CMI_UNREACHABLE_SECTION(...) __assume(0)
00116 #else
00117 # define CMI_UNREACHABLE_SECTION(...) __VA_ARGS__
00118 #endif
00119
00120 #define CMI_NORETURN_FUNCTION_END CMI_UNREACHABLE_SECTION(while(1));
00121
00122 # if defined __cplusplus
00123 # define CMK_NORETURN [[noreturn]]
00124 # else
00125 # if defined _Noreturn
00126 # define CMK_NORETURN _Noreturn
00127 # elif defined _MSC_VER && 1200 <= _MSC_VER
00128 # define CMK_NORETURN __declspec (noreturn)
00129 # else
00130 # define CMK_NORETURN __attribute__ ((__noreturn__))
00131 # endif
00132 # endif
00133
00134
00135
00136
00137
00138 #define CMK_CONCAT(x,y) x##y
00139
00140 #define CMK_TAG(x,y) x##y##_
00141
00142 #include "pup_c.h"
00143
00144
00145
00146 #ifdef __cplusplus
00147
00148 #if ! CMK_HAS_OFFSETOF
00149 #undef offsetof
00150 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00151 #else
00152 #include <stddef.h>
00153 #endif
00154
00155 extern "C" {
00156 #endif
00157
00158
00159 extern void CpdSetInitializeMemory(int v);
00160 extern void CpdSystemEnter(void);
00161 extern void CpdSystemExit(void);
00162 #if CMK_CHARMDEBUG
00163 extern int memory_status_info;
00164 extern int memory_chare_id;
00165 #define setMemoryStatus(p) { \
00166 int tmp = memory_status_info; \
00167 memory_status_info = p; \
00168 p = tmp; \
00169 }
00170 int setMemoryChareIDFromPtr(void *p);
00171 void setMemoryChareID(int id);
00172 void setMemoryOwnedBy(void *p, int id);
00173 #else
00174 #define setMemoryStatus(p)
00175 #define setMemoryChareIDFromPtr(p)
00176 #define setMemoryChareID(p)
00177 #define setMemoryOwnedBy(p, id)
00178 #endif
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 #ifdef __cplusplus
00191
00192 # define CpvInit_Alloc(t,n) new t[n]()
00193 # define CpvInit_Alloc_scalar(t) new t()
00194 #else
00195 # define CpvInit_Alloc(t,n) (t *)calloc(n,sizeof(t))
00196 # define CpvInit_Alloc_scalar(t) (t *)calloc(1,sizeof(t))
00197 #endif
00198
00199 extern int CmiMyRank_(void);
00200
00201 #if CMK_HAS_PARTITION
00202
00203 typedef enum Partition_Type {
00204 PARTITION_SINGLETON,
00205 PARTITION_DEFAULT,
00206 PARTITION_MASTER,
00207 PARTITION_PREFIX
00208 } Partition_Type;
00209
00210
00211 typedef struct {
00212 Partition_Type type;
00213 int isTopoaware, scheme;
00214 int numPartitions;
00215 int *partitionSize;
00216 int *partitionPrefix;
00217 int *nodeMap;
00218 int myPartition;
00219 char *partsizes;
00220 } PartitionInfo;
00221
00222 void CmiCreatePartitions(char **argv);
00223 #if defined(__cplusplus)
00224 extern "C" {
00225 #endif
00226 void CmiSetNumPartitions(int nump);
00227 void CmiSetMasterPartition(void);
00228 void CmiSetPartitionSizes(char *size);
00229 void CmiSetPartitionScheme(int scheme);
00230 void CmiSetCustomPartitioning(void);
00231 #if defined(__cplusplus)
00232 }
00233 #endif
00234
00235 extern int _Cmi_mype_global;
00236 extern int _Cmi_numpes_global;
00237 extern int _Cmi_mynode_global;
00238 extern int _Cmi_numnodes_global;
00239 extern PartitionInfo _partitionInfo;
00240
00241 #define CmiNumPartitions() _partitionInfo.numPartitions
00242 #define CmiMyPartition() _partitionInfo.myPartition
00243 #define CmiPartitionSize(part) _partitionInfo.partitionSize[part]
00244 #define CmiMyPartitionSize() CmiPartitionSize(CmiMyPartition())
00245 #define CmiNumNodesGlobal() _Cmi_numnodes_global
00246 #define CmiMyNodeGlobal() _Cmi_mynode_global
00247 #define CmiNumPesGlobal() _Cmi_numpes_global
00248
00249 #if !CMK_SMP
00250 #define CmiMyPeGlobal() _Cmi_mype_global
00251 extern int _Cmi_mynodesize;
00252 #else
00253 extern int CmiMyPeGlobal(void);
00254 #endif
00255
00256
00257 int CmiNodeSpan(void);
00258
00259
00260 int node_lToGTranslate(int node, int partition);
00261 int node_gToLTranslate(int node);
00262 int pe_lToGTranslate(int pe, int partition);
00263 int pe_gToLTranslate(int pe);
00264
00265 #define CmiGetPeGlobal(pe,part) pe_lToGTranslate(pe,part)
00266 #define CmiGetNodeGlobal(node,part) node_lToGTranslate(node,part)
00267 #define CmiGetPeLocal(pe) pe_gToLTranslate(pe)
00268 #define CmiGetNodeLocal(node) node_gToLTranslate(node)
00269
00270
00271 #else
00272
00273 #define CmiMyPartition() 0
00274 #define CmiPartitionSize(part) CmiNumNodes()
00275 #define CmiMyPartitionSize() CmiNumNodes()
00276 #define CmiNumPartitions() 1
00277 #define CmiNumNodesGlobal() CmiNumNodes()
00278 #define CmiMyNodeGlobal() CmiMyNode()
00279 #define CmiNumPesGlobal() CmiNumPes()
00280 #define CmiMyPeGlobal() CmiMyPe()
00281 #if !CMK_SMP
00282 extern int _Cmi_mynodesize;
00283 #endif
00284 #define CmiGetPeGlobal(pe,part) (pe)
00285 #define CmiGetNodeGlobal(node,part) (node)
00286 #define CmiGetPeLocal(pe) (pe)
00287 #define CmiGetNodeLocal(node) (node)
00288 #endif
00289
00290 typedef struct {
00291 int parent;
00292 int child_count;
00293 int *children;
00294 } CmiSpanningTreeInfo;
00295
00296 extern CmiSpanningTreeInfo* _topoTree;
00297
00298 #if CMK_SHARED_VARS_UNAVAILABLE
00299 extern int _Cmi_mype;
00300 extern int _Cmi_numpes;
00301 extern int _Cmi_myrank;
00302 extern int _Cmi_mynode;
00303 extern int _Cmi_numnodes;
00304
00305 #define CmiMyPe() _Cmi_mype
00306 #define CmiMyRank() 0
00307 #define CmiNumPes() _Cmi_numpes
00308 #define CmiMyNodeSize() 1
00309 #define CmiMyNode() _Cmi_mype
00310 #define CmiNumNodes() _Cmi_numpes
00311 #define CmiNodeFirst(node) (node)
00312 #define CmiNodeSize(node) 1
00313 #define CmiNodeOf(pe) (pe)
00314 #define CmiRankOf(pe) 0
00315
00316 #define CpvDeclare(t,v) t CMK_TAG(Cpv_,v)[2]
00317 #define CpvExtern(t,v) extern t CMK_TAG(Cpv_,v)[2]
00318 #ifdef __cplusplus
00319 #define CpvCExtern(t,v) extern "C" t CMK_TAG(Cpv_,v)[2]
00320 #else
00321 #define CpvCExtern(t,v) CpvExtern(t,v)
00322 #endif
00323 #define CpvStaticDeclare(t,v) static t CMK_TAG(Cpv_,v)[2]
00324 #define CpvInitialize(t,v) do {} while(0)
00325 #define CpvInitialized(v) 1
00326 #define CpvAccess(v) CMK_TAG(Cpv_,v)[_Cmi_myrank]
00327 #define CpvAccessOther(v, r) CMK_TAG(Cpv_,v)[r]
00328
00329 extern void CmiMemLock(void);
00330 extern void CmiMemUnlock(void);
00331 #define CmiNodeBarrier()
00332 #define CmiNodeAllBarrier()
00333 #define CmiSvAlloc CmiAlloc
00334
00335 #if CMK_USE_LRTS
00336 #include "lrtslock.h"
00337 #else
00338 typedef int CmiNodeLock;
00339 #define CmiCreateLock() (0)
00340 #define CmiLock(lock) {(lock)++;}
00341 #define CmiUnlock(lock) {(lock)--;}
00342 #define CmiTryLock(lock) ((lock)?1:((lock)=1,0))
00343 #define CmiDestroyLock(lock)
00344 #endif // CMK_USE_LRTS
00345
00346 #define CmiInCommThread() (0)
00347
00348 #endif
00349
00350 #if CMK_SHARED_VARS_POSIX_THREADS_SMP
00351
00352 #include <pthread.h>
00353 #include <sched.h>
00354 #ifdef CMK_FAKE_SCHED_YIELD
00355 #include <unistd.h>
00356 #define sched_yield() sleep(0)
00357 #endif
00358
00359 extern int _Cmi_numpes;
00360 extern int _Cmi_mynodesize;
00361 extern int _Cmi_mynode;
00362 extern int _Cmi_numnodes;
00363 extern int _Cmi_sleepOnIdle;
00364 extern int _Cmi_forceSpinOnIdle;
00365
00366 int CmiMyPe(void);
00367 int CmiMyRank(void);
00368 #define CmiNumPes() _Cmi_numpes
00369 #define CmiMyNodeSize() _Cmi_mynodesize
00370 int CmiNodeSize(int node);
00371 #if CMK_MULTICORE
00372 #define CmiMyNode() 0
00373 #define CmiNumNodes() 1
00374 #define CmiNodeFirst(node) 0
00375 #define CmiNodeOf(pe) 0
00376 #define CmiRankOf(pe) pe
00377 #else
00378 #define CmiMyNode() _Cmi_mynode
00379 #define CmiNumNodes() _Cmi_numnodes
00380 int CmiNodeFirst(int node);
00381 int CmiNodeOf(int pe);
00382 int CmiRankOf(int pe);
00383 #endif
00384
00385 #define CMK_CPV_IS_SMP sched_yield();
00386
00387 extern void CmiNodeBarrier(void);
00388 extern void CmiNodeAllBarrier(void);
00389 #define CmiSvAlloc CmiAlloc
00390
00391 #if CMK_USE_LRTS
00392 #include "lrtslock.h"
00393 #else
00394 #if CMK_HAS_SPINLOCK && CMK_USE_SPINLOCK
00395 typedef pthread_spinlock_t *CmiNodeLock;
00396 #define CmiLock(lock) (pthread_spin_lock(lock))
00397 #define CmiUnlock(lock) (pthread_spin_unlock(lock))
00398 #define CmiTryLock(lock) (pthread_spin_trylock(lock))
00399 #else
00400 typedef pthread_mutex_t *CmiNodeLock;
00401 #define CmiLock(lock) (pthread_mutex_lock(lock))
00402 #define CmiUnlock(lock) (pthread_mutex_unlock(lock))
00403 #define CmiTryLock(lock) (pthread_mutex_trylock(lock))
00404 #endif
00405 extern CmiNodeLock CmiCreateLock(void);
00406 extern void CmiDestroyLock(CmiNodeLock lock);
00407 #endif // CMK_USE_LRTS
00408
00409 extern CmiNodeLock CmiMemLock_lock;
00410 #define CmiMemLock() do{if (CmiMemLock_lock) CmiLock(CmiMemLock_lock);} while (0)
00411
00412 #define CmiMemUnlock() do{if (CmiMemLock_lock) CmiUnlock(CmiMemLock_lock);} while (0)
00413
00414
00415 #if (CMK_BLUEGENEQ || CMK_PAMI_LINUX_PPC8) && CMK_ENABLE_ASYNC_PROGRESS
00416 extern CMK_THREADLOCAL int32_t _cmi_bgq_incommthread;
00417 #define CmiInCommThread() (_cmi_bgq_incommthread)
00418 #else
00419 #define CmiInCommThread() (CmiMyRank() == CmiMyNodeSize())
00420 #endif
00421
00422 #endif
00423
00424 #include "string.h"
00425
00426 #if CMK_BLUEGENEQ && CMK_BLUEGENEQ_OPTCOPY
00427 void CmiMemcpy_qpx (void *dst, const void *src, size_t n);
00428 #define CmiMemcpy(_dst, _src, _n) \
00429 do { \
00430 const void *_cmimemcpy_src = (_src); \
00431 void *_cmimemcpy_dst = (_dst); \
00432 size_t _cmimemcpy_n = (_n); \
00433 if ( (_cmimemcpy_n > 512+32) && \
00434 ((((size_t)_cmimemcpy_dst|(size_t)_cmimemcpy_src) & 0x1F)==0) ) \
00435 CmiMemcpy_qpx(_cmimemcpy_dst, _cmimemcpy_src, _cmimemcpy_n); \
00436 else \
00437 memcpy(_cmimemcpy_dst, _cmimemcpy_src, _cmimemcpy_n); \
00438 } while(0)
00439 #else
00440 #define CmiMemcpy(dest, src, size) memcpy((dest), (src), (size))
00441 #endif
00442
00443 #if CMK_SHARED_VARS_UNIPROCESSOR
00444
00445 extern int _Cmi_mype;
00446 extern int _Cmi_numpes;
00447
00448 #define CmiMyPe() _Cmi_mype
00449 #define CmiMyRank() _Cmi_mype
00450 #define CmiNumPes() _Cmi_numpes
00451 #define CmiMyNodeSize() _Cmi_numpes
00452 #define CmiMyNode() 0
00453 #define CmiNumNodes() 1
00454 #define CmiNodeFirst(node) 0
00455 #define CmiNodeSize(node) _Cmi_numpes
00456 #define CmiNodeOf(pe) 0
00457 #define CmiRankOf(pe) (pe)
00458
00459 #define CpvDeclare(t,v) t* CMK_TAG(Cpv_,v)
00460 #define CpvExtern(t,v) extern t* CMK_TAG(Cpv_,v)
00461 #ifdef __cplusplus
00462 #define CpvCExtern(t,v) extern "C" t* CMK_TAG(Cpv_,v)
00463 #else
00464 #define CpvCExtern(t,v) CpvExtern(t,v)
00465 #endif
00466 #define CpvStaticDeclare(t,v) static t* CMK_TAG(Cpv_,v)
00467 #define CpvInitialize(t,v)\
00468 do { if (CMK_TAG(Cpv_,v)==0)\
00469 { CMK_TAG(Cpv_,v) = CpvInit_Alloc(t,CmiNumPes()); }}\
00470 while(0)
00471 #define CpvInitialized(v) (0!=CMK_TAG(Cpv_,v))
00472 #define CpvAccess(v) CMK_TAG(Cpv_,v)[CmiMyPe()]
00473 #define CpvAccessOther(v, r) CMK_TAG(Cpv_,v)[r]
00474
00475 #define CmiMemLock() 0
00476 #define CmiMemUnlock() 0
00477 extern void CmiNodeBarrier(void);
00478 extern void CmiNodeAllBarrier(void);
00479 #define CmiSvAlloc CmiAlloc
00480
00481 typedef int *CmiNodeLock;
00482 extern CmiNodeLock CmiCreateLock(void);
00483 extern void CmiLock(CmiNodeLock lock);
00484 extern void CmiUnlock(CmiNodeLock lock);
00485 extern int CmiTryLock(CmiNodeLock lock);
00486 extern void CmiDestroyLock(CmiNodeLock lock);
00487
00488 #endif
00489
00490 #if CMK_SHARED_VARS_NT_THREADS
00491
00492 #ifndef WIN32_LEAN_AND_MEAN
00493 #define WIN32_LEAN_AND_MEAN
00494 #endif
00495 #include <windows.h>
00496 #include "lrtslock.h"
00497
00498 extern int _Cmi_numpes;
00499 extern int _Cmi_mynodesize;
00500 extern int _Cmi_mynode;
00501 extern int _Cmi_numnodes;
00502 extern int _Cmi_sleepOnIdle;
00503 extern int _Cmi_forceSpinOnIdle;
00504
00505 int CmiMyPe(void);
00506 int CmiMyRank(void);
00507 #define CmiNumPes() _Cmi_numpes
00508 #define CmiMyNodeSize() _Cmi_mynodesize
00509 int CmiNodeSize(int node);
00510 #if CMK_MULTICORE
00511 #define CmiMyNode() 0
00512 #define CmiNumNodes() 1
00513 #define CmiNodeFirst(node) 0
00514 #define CmiNodeOf(pe) 0
00515 #define CmiRankOf(pe) pe
00516 #else
00517 #define CmiMyNode() _Cmi_mynode
00518 #define CmiNumNodes() _Cmi_numnodes
00519 int CmiNodeFirst(int node);
00520 int CmiNodeOf(int pe);
00521 int CmiRankOf(int pe);
00522 #endif
00523
00524 #define CMK_CPV_IS_SMP Sleep(0);
00525
00526 extern void CmiNodeBarrier(void);
00527 extern void CmiNodeAllBarrier(void);
00528 #define CmiSvAlloc CmiAlloc
00529
00530 extern CmiNodeLock CmiMemLock_lock;
00531 #define CmiMemLock() do{if (CmiMemLock_lock) CmiLock(CmiMemLock_lock);} while (0)
00532 #define CmiMemUnlock() do{if (CmiMemLock_lock) CmiUnlock(CmiMemLock_lock);} while (0)
00533
00534 #endif
00535
00536 #if CMK_SHARED_VARS_UNAVAILABLE
00537
00538 typedef int CmiImmediateLockType;
00539 extern int _immediateLock;
00540 extern int _immediateFlag;
00541 #define CmiCreateImmediateLock() (0)
00542 #define CmiImmediateLock(ignored) { _immediateLock++; }
00543 #if CMK_IMMEDIATE_MSG
00544 #define CmiImmediateUnlock(ignored) \
00545 { _immediateLock--; \
00546 if(_immediateFlag) \
00547 CmiProbeImmediateMsg(); }
00548 #else
00549 #define CmiImmediateUnlock(ignored) { _immediateLock--; }
00550 #endif
00551 #define CmiCheckImmediateLock(ignored) \
00552 ((_immediateLock)?((_immediateFlag=1),1):0)
00553 #define CmiClearImmediateFlag() { _immediateFlag=0; }
00554
00555 #else
00556
00557 typedef CmiNodeLock CmiImmediateLockType;
00558 #define CmiCreateImmediateLock() CmiCreateLock()
00559 #define CmiImmediateLock(immediateLock) CmiLock((immediateLock))
00560 #define CmiImmediateUnlock(immediateLock) CmiUnlock((immediateLock))
00561 #define CmiCheckImmediateLock(ignored) (0)
00562 #define CmiClearImmediateFlag()
00563
00564 #endif
00565
00566
00567
00568
00569
00570 #ifdef CMK_CPV_IS_SMP
00571
00572 #if CMK_HAS_TLS_VARIABLES && !CMK_NOT_USE_TLS_THREAD
00573 #define CpvDeclare(t,v) CMK_THREADLOCAL t* CMK_TAG(Cpv_,v) = NULL; \
00574 int CMK_TAG(Cpv_inited_,v) = 0; \
00575 t ** CMK_TAG(Cpv_addr_,v)
00576 #define CpvExtern(t,v) extern CMK_THREADLOCAL t* CMK_TAG(Cpv_,v); \
00577 extern int CMK_TAG(Cpv_inited_,v); \
00578 extern t ** CMK_TAG(Cpv_addr_,v)
00579 #ifdef __cplusplus
00580 #define CpvCExtern(t,v) extern "C" CMK_THREADLOCAL t* CMK_TAG(Cpv_,v); \
00581 extern "C" int CMK_TAG(Cpv_inited_,v); \
00582 extern "C" t ** CMK_TAG(Cpv_addr_,v)
00583 #else
00584 #define CpvCExtern(t,v) CpvExtern(t,v)
00585 #endif
00586 #define CpvStaticDeclare(t,v) static CMK_THREADLOCAL t* CMK_TAG(Cpv_,v) = NULL; \
00587 static int CMK_TAG(Cpv_inited_,v) = 0; \
00588 static t ** CMK_TAG(Cpv_addr_,v)
00589 #define CpvInitialize(t,v)\
00590 do { \
00591 CmiMemLock(); \
00592 if (!(CMK_TAG(Cpv_inited_,v))) { \
00593 CMK_TAG(Cpv_addr_,v) = CpvInit_Alloc(t*, 1+CmiMyNodeSize()); \
00594 CMK_TAG(Cpv_inited_,v) = 1; \
00595 } \
00596 CmiMemUnlock(); \
00597 CMK_TAG(Cpv_,v) = CpvInit_Alloc_scalar(t); \
00598 CMK_TAG(Cpv_addr_,v)[CmiMyRank()] = CMK_TAG(Cpv_,v); \
00599 } while(0)
00600 #define CpvInitialized(v) (0!=CMK_TAG(Cpv_,v))
00601
00602 #if (CMK_BLUEGENEQ || CMK_PAMI_LINUX_PPC8) && CMK_ENABLE_ASYNC_PROGRESS && CMK_IMMEDIATE_MSG
00603 #define CpvAccess(v) (*(CMK_TAG(Cpv_addr_,v)[CmiMyRank()]))
00604 #else
00605 #define CpvAccess(v) (*CMK_TAG(Cpv_,v))
00606 #endif
00607
00608 #define CpvAccessOther(v, r) (*(CMK_TAG(Cpv_addr_,v)[r]))
00609 #else
00610
00611 #define CpvDeclare(t,v) t* CMK_TAG(Cpv_,v)
00612 #define CpvExtern(t,v) extern t* CMK_TAG(Cpv_,v)
00613 #ifdef __cplusplus
00614 #define CpvCExtern(t,v) extern "C" t* CMK_TAG(Cpv_,v)
00615 #else
00616 #define CpvCExtern(t,v) CpvExtern(t,v)
00617 #endif
00618 #define CpvStaticDeclare(t,v) static t* CMK_TAG(Cpv_,v)
00619 #define CpvInitialize(t,v)\
00620 do { \
00621 if (CmiMyRank()) { \
00622 CmiMemoryReadFence(); \
00623 while (!CpvInitialized(v)) { CMK_CPV_IS_SMP ; CmiMemoryReadFence(); } \
00624 } else { \
00625 t* tmp = CpvInit_Alloc(t,1+CmiMyNodeSize());\
00626 CmiMemoryWriteFence(); \
00627 CMK_TAG(Cpv_,v)=tmp; \
00628 \
00629 } \
00630 } while(0)
00631 #define CpvInitialized(v) (0!=CMK_TAG(Cpv_,v))
00632 #define CpvAccess(v) CMK_TAG(Cpv_,v)[CmiMyRank()]
00633 #define CpvAccessOther(v, r) CMK_TAG(Cpv_,v)[r]
00634 #endif
00635
00636 #endif
00637
00638
00639 #ifndef CsvDeclare
00640 #define CsvDeclare(t,v) t CMK_TAG(Csv_,v)
00641 #define CsvStaticDeclare(t,v) static t CMK_TAG(Csv_,v)
00642 #define CsvExtern(t,v) extern t CMK_TAG(Csv_,v)
00643 #define CsvInitialize(t,v) do{}while(0)
00644 #define CsvInitialized(v) 1
00645 #define CsvAccess(v) CMK_TAG(Csv_,v)
00646 #endif
00647
00648 extern CmiNodeLock _smp_mutex;
00649
00650 extern int CmiBarrier(void);
00651 extern int CmiBarrierZero(void);
00652
00653
00654 extern int CmiNumCores(void);
00655 extern int CmiCpuTopologyEnabled(void);
00656 extern int CmiPeOnSamePhysicalNode(int pe1, int pe2);
00657 extern int CmiNumPhysicalNodes(void);
00658 extern int CmiPhysicalNodeID(int pe);
00659 extern int CmiNumPesOnPhysicalNode(int node);
00660 extern void CmiGetPesOnPhysicalNode(int node, int **pelist, int *num);
00661 extern int CmiGetFirstPeOnPhysicalNode(int node);
00662 extern int CmiPhysicalRank(int pe);
00663 extern void CmiInitCPUAffinity(char **argv);
00664 extern int CmiPrintCPUAffinity(void);
00665 extern int CmiSetCPUAffinity(int core);
00666 extern void CmiInitCPUTopology(char **argv);
00667 extern int CmiOnCore(void);
00668
00669 typedef struct
00670 {
00671 int num_pus;
00672 int num_cores;
00673 int num_sockets;
00674 } CmiHwlocTopology;
00675
00676 extern CmiHwlocTopology CmiHwlocTopologyLocal;
00677
00678 extern void CmiInitHwlocTopology(void);
00679
00682 int CmiLongSendQueue(int forNode,int longerThanBytes);
00683
00684
00685
00686 typedef struct {
00687 CmiHandlerEx hdlr;
00688 void *userPtr;
00689 } CmiHandlerInfo;
00690
00691 #include "queueing.h"
00692
00693 CpvExtern(CmiHandlerInfo*, CmiHandlerTable);
00694 CpvExtern(int, CmiHandlerMax);
00695 CpvExtern(Queue, CsdSchedQueue);
00696 #if CMK_SMP && CMK_TASKQUEUE
00697 CpvExtern(Queue, CsdTaskQueue);
00698 CpvExtern(void*, CmiSuspendedTaskQueue);
00699 #endif
00700 #if CMK_GRID_QUEUE_AVAILABLE
00701 CpvExtern(Queue, CsdGridQueue);
00702 #endif
00703 #if CMK_OBJECT_QUEUE_AVAILABLE
00704 CpvExtern(Queue, CsdObjQueue);
00705 #endif
00706 #if CMK_NODE_QUEUE_AVAILABLE
00707 CsvExtern(Queue, CsdNodeQueue);
00708 CsvExtern(CmiNodeLock, CsdNodeQueueLock);
00709 #endif
00710 CpvExtern(int, CsdStopFlag);
00711 CpvExtern(int, CsdLocalCount);
00712 #define CSD_LOCAL_MAX_DEFAULT 0
00713
00714 extern void CmiAssignOnce(int* variable, int value);
00715
00716 extern int CmiRegisterHandler(CmiHandler h);
00717 extern int CmiRegisterHandlerEx(CmiHandlerEx h,void *userPtr);
00718 #if CMI_LOCAL_GLOBAL_AVAILABLE
00719 extern int CmiRegisterHandlerLocal(CmiHandler);
00720 extern int CmiRegisterHandlerGlobal(CmiHandler);
00721 #endif
00722 extern void CmiNumberHandler(int n, CmiHandler h);
00723 extern void CmiNumberHandlerEx(int n, CmiHandlerEx h,void *userPtr);
00724
00725 #define CmiGetHandler(m) (((CmiMsgHeaderExt*)m)->hdl)
00726 #define CmiGetXHandler(m) (((CmiMsgHeaderExt*)m)->xhdl)
00727 #define CmiGetInfo(m) (((CmiMsgHeaderExt*)m)->info)
00728 #define CmiGetRoot(m) (((CmiMsgHeaderExt*)m)->root)
00729 #define CmiGetRedID(m) (((CmiMsgHeaderExt*)m)->redID)
00730
00731 #define CmiSetHandler(m,v) do {((((CmiMsgHeaderExt*)m)->hdl)=(v));} while(0)
00732 #define CmiSetXHandler(m,v) do {((((CmiMsgHeaderExt*)m)->xhdl)=(v));} while(0)
00733 #define CmiSetInfo(m,v) do {((((CmiMsgHeaderExt*)m)->info)=(v));} while(0)
00734 #define CmiSetRoot(m,v) do {((((CmiMsgHeaderExt*)m)->root)=(v));} while(0)
00735 #define CmiSetRedID(m,v) do {((((CmiMsgHeaderExt*)m)->redID)=(v));} while(0)
00736
00737 #define CmiHandlerToInfo(n) (CpvAccess(CmiHandlerTable)[n])
00738 #define CmiHandlerToFunction(n) (CmiHandlerToInfo(n).hdlr)
00739 #define CmiGetHandlerInfo(env) (CmiHandlerToInfo(CmiGetHandler(env)))
00740 #define CmiGetHandlerFunction(env) (CmiHandlerToFunction(CmiGetHandler(env)))
00741
00742 #if __FAULT__
00743 CpvExtern(int, _curRestartPhase);
00744 #endif
00745
00746 #if CMK_MEM_CHECKPOINT
00747 #undef CmiSetHandler
00748 #define CmiSetHandler(m,v) do {(((CmiMsgHeaderExt*)m)->hdl)=(v); (((CmiMsgHeaderExt*)m)->pn)=CpvAccess(_curRestartPhase);} while(0)
00749 #define MESSAGE_PHASE_CHECK(msg) \
00750 { \
00751 int phase = CmiGetRestartPhase(msg); \
00752 if (phase != 9999 && phase < CpvAccess(_curRestartPhase)) { \
00753 \
00754 CmiFree(msg); \
00755 return; \
00756 } \
00757 \
00758 if (phase > CpvAccess(_curRestartPhase) && phase != 9999) { \
00759 \
00760 CsdEnqueueFifo(msg); \
00761 return; \
00762 } \
00763 }
00764 #else
00765 #define MESSAGE_PHASE_CHECK(msg)
00766 #endif
00767
00768 #if defined __cplusplus
00769
00773 struct CmiChunkHeader {
00774 int size;
00775 private:
00776 #if CMK_SMP
00777 std::atomic<int> ref;
00778 #else
00779 int ref;
00780 #endif
00781 #if ALIGN_BYTES > 8
00782 #if defined(__GNUC__) || defined(__clang__)
00783 #pragma GCC diagnostic push
00784 #pragma GCC diagnostic ignored "-Wpedantic"
00785 #if defined(__clang__)
00786 #pragma GCC diagnostic ignored "-Wunused-private-field"
00787 #endif
00788 #endif
00789 char align[ALIGN_BYTES
00790 - sizeof(int)*2
00791 #if (CMK_USE_IBVERBS || CMK_USE_IBUD)
00792 - sizeof(void *)
00793 #endif
00794 ];
00795 #if defined(__GNUC__) || defined(__clang__)
00796 #pragma GCC diagnostic pop
00797 #endif
00798 #endif
00799 public:
00800 CmiChunkHeader() = default;
00801 CmiChunkHeader(const CmiChunkHeader & x)
00802 : size{x.size}, ref{x.getRef()} { }
00803 #if CMK_SMP
00804 int getRef() const
00805 {
00806 return ref.load(std::memory_order_acquire);
00807 }
00808 void setRef(int r)
00809 {
00810 return ref.store(r, std::memory_order_release);
00811 }
00812 int incRef()
00813 {
00814 return ref.fetch_add(1, std::memory_order_release);
00815 }
00816 int decRef()
00817 {
00818 return ref.fetch_sub(1, std::memory_order_release);
00819 }
00820 #else
00821 int getRef() const { return ref; }
00822 void setRef(int r) { ref = r; }
00823 int incRef() { return ref++; }
00824 int decRef() { return ref--; }
00825 #endif
00826 };
00827
00828 #if CMK_USE_IBVERBS | CMK_USE_IBUD
00829 struct infiCmiChunkMetaDataStruct;
00830
00831 #define CMI_INFI_CHUNK_HEADER_FIELDS \
00832 struct infiCmiChunkMetaDataStruct *metaData;\
00833 CmiChunkHeader chunkHeader;
00834
00835 struct infiCmiChunkHeaderHelper{
00836 CMI_INFI_CHUNK_HEADER_FIELDS
00837 };
00838
00839 typedef struct infiCmiChunkHeaderStruct{
00840 CMI_INFI_CHUNK_HEADER_FIELDS
00841 } infiCmiChunkHeader;
00842
00843 struct infiCmiChunkMetaDataStruct *registerMultiSendMesg(char *msg,int msgSize);
00844 #endif
00845
00846
00847 #define BLKSTART(m) ((CmiChunkHeader *) (((intptr_t)m) - sizeof(CmiChunkHeader)))
00848 #define SIZEFIELD(m) ((BLKSTART(m))->size)
00849 #define REFFIELD(m) ((BLKSTART(m))->getRef())
00850 #define REFFIELDSET(m, r) ((BLKSTART(m))->setRef(r))
00851 #define REFFIELDINC(m) ((BLKSTART(m))->incRef())
00852 #define REFFIELDDEC(m) ((BLKSTART(m))->decRef())
00853
00854 #endif
00855
00856 #ifdef __cplusplus
00857 extern "C" {
00858 #endif
00859 void* malloc_nomigrate(size_t size);
00860 void free_nomigrate(void* ptr);
00861 #ifdef __cplusplus
00862 }
00863 #endif
00864
00874 void *CmiAlloc(int size);
00875 void CmiReference(void *blk);
00876 int CmiGetReference(void *blk);
00877 int CmiSize(void *blk);
00878 void CmiFree(void *blk);
00879 void CmiRdmaFree(void *blk);
00880 void CmiInitMsgHeader(void *msg, int size);
00881
00882 #ifndef CMI_TMP_SKIP
00883 void *CmiTmpAlloc(int size);
00884 void CmiTmpFree(void *);
00885 #endif
00886
00887
00888
00889
00890
00891 extern void * memory_stack_top;
00892 void CmiMemoryCheck(void);
00893 void CmiMemoryMark(void);
00894 void CmiMemoryMarkBlock(void *blk);
00895 void CmiMemorySweep(const char *where);
00896 CMK_TYPEDEF_UINT8 CmiMemoryUsage(void);
00897 const char *CmiMemoryUsageReporter(void);
00898 CMK_TYPEDEF_UINT8 CmiMaxMemoryUsageR(void);
00899 CMK_TYPEDEF_UINT8 CmiMaxMemoryUsage(void);
00900 void CmiResetMaxMemory(void);
00901 CMK_TYPEDEF_UINT8 CmiMinMemoryUsage(void);
00902 void CmiResetMinMemory(void);
00903
00904
00905 #define CmiRoundUpToPow2(s, p2) (s + ((p2 - (s & (p2 - 1))) & (p2 - 1)))
00906 void* CmiMallocAligned(const size_t size, const unsigned int alignment);
00907 void CmiFreeAligned(void* ptr);
00908
00909 #define CMI_MEMORY_IS_ISOMALLOC (1<<1)
00910 #define CMI_MEMORY_IS_PARANOID (1<<2)
00911 #define CMI_MEMORY_IS_GNU (1<<3)
00912 #define CMI_MEMORY_IS_GNUOLD (1<<4)
00913 #define CMI_MEMORY_IS_OS (1<<5)
00914 #define CMI_MEMORY_IS_CHARMDEBUG (1<<6)
00915 int CmiMemoryIs(int flag);
00916
00917 #define CMI_THREAD_IS_QT (1<<1)
00918 #define CMI_THREAD_IS_CONTEXT (1<<2)
00919 #define CMI_THREAD_IS_UJCONTEXT (1<<3)
00920 #define CMI_THREAD_IS_PTHREADS (1<<4)
00921 #define CMI_THREAD_IS_FIBERS (1<<5)
00922 #define CMI_THREAD_IS_ALIAS (1<<6)
00923 #define CMI_THREAD_IS_STACKCOPY (1<<7)
00924 #define CMI_THREAD_IS_TLS (1<<8)
00925 int CmiThreadIs(int flag);
00926
00927 void CmiMkdir(const char *dirName);
00928 int CmiGetPageSize(void);
00929
00930 double CmiCpuTimer(void);
00931
00932 #if CMK_TIMER_USE_RDTSC
00933 #ifndef __x86_64__
00934 # if !CMK_GCC_X86_ASM
00935
00936 # undef CMK_TIMER_USE_RDTSC
00937 # undef CMK_TIMER_USE_GETRUSAGE
00938 # define CMK_TIMER_USE_RDTSC 0
00939 # define CMK_TIMER_USE_GETRUSAGE 1
00940 # endif
00941 #endif
00942 #endif
00943
00944 #if CMK_TIMER_USE_RDTSC
00945 extern double _cpu_speed_factor;
00946
00947 static __inline__ unsigned long long int rdtsc(void)
00948 {
00949 unsigned long long int x;
00950 #ifdef __x86_64__
00951
00952 do {
00953 unsigned int a,d;
00954 asm volatile("rdtsc" : "=a" (a), "=d" (d));
00955 (x) = ((unsigned long)a) | (((unsigned long)d)<<32);
00956 } while(0);
00957 #elif CMK_GCC_X86_ASM
00958 __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
00959 #else
00960 # error "Unknown assembly format-- can't use CMK_TIMER_USE_RDTSC."
00961 #endif
00962 return x;
00963 }
00964
00965 #define CmiWallTimer() ((double)rdtsc()*(_cpu_speed_factor))
00966 #define CmiTimer CmiCpuTimer
00967 double CmiStartTimer(void);
00968 double CmiInitTime(void);
00969 #define CmiTimerIsSynchronized() (0)
00970 #define CmiTimerAbsolute() (0)
00971
00972 #else
00973 void CmiTimerInit(char **argv);
00974 int CmiTimerAbsolute(void);
00975 double CmiStartTimer(void);
00976 double CmiInitTime(void);
00977 double CmiTimer(void);
00978 double CmiWallTimer(void);
00979 int CmiTimerIsSynchronized(void);
00980 #endif
00981
00982 char *CmiPrintDate(void);
00983
00984 #if CMK_NODE_QUEUE_AVAILABLE
00985
00986 #define CsdNodeEnqueueGeneral(x,s,i,p) do { \
00987 CmiLock(CsvAccess(CsdNodeQueueLock));\
00988 CqsEnqueueGeneral((Queue)CsvAccess(CsdNodeQueue),(x),(s),(i),(p)); \
00989 CmiUnlock(CsvAccess(CsdNodeQueueLock)); \
00990 } while(0)
00991 #define CsdNodeEnqueueFifo(x) do { \
00992 CmiLock(CsvAccess(CsdNodeQueueLock));\
00993 CqsEnqueueFifo((Queue)CsvAccess(CsdNodeQueue),(x)); \
00994 CmiUnlock(CsvAccess(CsdNodeQueueLock)); \
00995 } while(0)
00996 #define CsdNodeEnqueueLifo(x) do { \
00997 CmiLock(CsvAccess(CsdNodeQueueLock));\
00998 CqsEnqueueLifo((Queue)CsvAccess(CsdNodeQueue),(x))); \
00999 CmiUnlock(CsvAccess(CsdNodeQueueLock)); \
01000 } while(0)
01001 #define CsdNodeEnqueue(x) do { \
01002 CmiLock(CsvAccess(CsdNodeQueueLock));\
01003 CqsEnqueueFifo((Queue)CsvAccess(CsdNodeQueue),(x));\
01004 CmiUnlock(CsvAccess(CsdNodeQueueLock)); \
01005 } while(0)
01006
01007 #define CsdNodeEmpty() (CqsEmpty(C(Queue)pvAccess(CsdNodeQueue)))
01008 #define CsdNodeLength() (CqsLength((Queue)CpvAccess(CsdNodeQueue)))
01009
01010 #else
01011
01012 #define CsdNodeEnqueueGeneral(x,s,i,p) (CsdEnqueueGeneral(x,s,i,p))
01013 #define CsdNodeEnqueueFifo(x) (CqsEnqueueFifo((Queue)CpvAccess(CsdSchedQueue),(x)))
01014 #define CsdNodeEnqueueLifo(x) (CqsEnqueueLifo((Queue)CpvAccess(CsdSchedQueue),(x)))
01015 #define CsdNodeEnqueue(x) (CsdEnqueue(x))
01016 #define CsdNodeEmpty() (CqsEmpty((Queue)CpvAccess(CsdSchedQueue)))
01017 #define CsdNodeLength() (CqsLength((Queue)CpvAccess(CsdSchedQueue)))
01018
01019 #endif
01020
01021 #define CsdEnqueueGeneral(x,s,i,p)\
01022 (CqsEnqueueGeneral((Queue)CpvAccess(CsdSchedQueue),(x),(s),(i),(p)))
01023 #define CsdEnqueueFifo(x) (CqsEnqueueFifo((Queue)CpvAccess(CsdSchedQueue),(x)))
01024 #define CsdEnqueueLifo(x) (CqsEnqueueLifo((Queue)CpvAccess(CsdSchedQueue),(x)))
01025 #define CsdEnqueue(x) (CqsEnqueueFifo((Queue)CpvAccess(CsdSchedQueue),(x)))
01026 #define CsdEmpty() (CqsEmpty((Queue)CpvAccess(CsdSchedQueue)))
01027 #define CsdLength() (CqsLength((Queue)CpvAccess(CsdSchedQueue)))
01028 #if CMK_CMIPRINTF_IS_A_BUILTIN
01029 void CmiPrintf(const char *, ...);
01030 void CmiError(const char *, ...);
01031 int CmiScanf(const char *, ...);
01032
01033 #define CmiFlush(stream)
01034
01035 #else
01036
01037 #include <stdio.h>
01038
01039
01040
01041
01042
01043
01044
01045
01046 #include <stdarg.h>
01047
01048 void CmiPrintf(const char *format, ...);
01049 void CmiError(const char *format, ...);
01050
01051 #define CmiFlush(stream) fflush(stream);
01052 #define CmiScanf scanf
01053
01054 #endif
01055
01056 #if defined(__STDC__) || defined(__cplusplus)
01057 #define __CMK_STRING(x) #x
01058 #else
01059 #define __CMK_STRING(x) "x"
01060 #endif
01061
01062 #define __CMK_XSTRING(x) __CMK_STRING(x)
01063
01064 extern void __cmi_assert(const char *);
01065 #define CmiEnforce(expr) \
01066 ((void) ((expr) ? 0 : \
01067 (__cmi_assert ("Assertion \"" __CMK_STRING(expr) \
01068 "\" failed in file " __FILE__ \
01069 " line " __CMK_XSTRING(__LINE__) "."), 0)))
01070
01071 #if ! CMK_ERROR_CHECKING
01072 #define CmiAssert(expr) ((void) 0)
01073 #else
01074 #define CmiAssert(expr) \
01075 ((void) ((expr) ? 0 : \
01076 (__cmi_assert ("Assertion \"" __CMK_STRING(expr) \
01077 "\" failed in file " __FILE__ \
01078 " line " __CMK_XSTRING(__LINE__) "."), 0)))
01079 #endif
01080
01081 typedef void (*CmiStartFn)(int argc, char **argv);
01082
01083
01084
01085
01086
01087 CpvExtern(int, _ccd_numchecks);
01088 extern void CcdCallBacks(void);
01089 #define CsdPeriodic() do{ if (CpvAccess(_ccd_numchecks)-- <= 0) CcdCallBacks(); } while(0)
01090 #define CsdResetPeriodic() CpvAccess(_ccd_numchecks) = 0;
01091
01092 extern void CsdEndIdle(void);
01093 extern void CsdStillIdle(void);
01094 extern void CsdBeginIdle(void);
01095
01096 typedef struct {
01097 void *localQ;
01098 Queue nodeQ;
01099 Queue schedQ;
01100 int *localCounter;
01101 #if CMK_OBJECT_QUEUE_AVAILABLE
01102 Queue objQ;
01103 #endif
01104 CmiNodeLock nodeLock;
01105 #if CMK_GRID_QUEUE_AVAILABLE
01106 Queue gridQ;
01107 #endif
01108 #if CMK_SMP && CMK_TASKQUEUE
01109 Queue taskQ;
01110 void *suspendedTaskQ;
01111 #endif
01112 } CsdSchedulerState_t;
01113 extern void CsdSchedulerState_new(CsdSchedulerState_t *state);
01114 extern void *CsdNextMessage(CsdSchedulerState_t *state);
01115 extern void *CsdNextLocalNodeMessage(CsdSchedulerState_t *state);
01116
01117 extern void *CmiGetNonLocal(void);
01118 extern void CmiNotifyIdle(void);
01119
01120
01121 extern int CsdScheduler(int maxmsgs);
01122 extern void CsdScheduleForever(void);
01123 extern int CsdScheduleCount(int maxmsgs);
01124 extern void CsdSchedulePoll(void);
01125 extern void CsdScheduleNodePoll(void);
01126
01127 #define CsdExitScheduler() (CpvAccess(CsdStopFlag)++)
01128
01130 #if CMK_SPANTREE_USE_COMMON_CODE
01131
01132 #define CST_W (CMK_SPANTREE_MAXSPAN)
01133 #define CST_NN (CmiNumNodes())
01134 #define CmiNodeSpanTreeParent(n) ((n)?(((n)-1)/CST_W):(-1))
01135 #define CmiNodeSpanTreeChildren(n,c) do {\
01136 int _i; \
01137 for(_i=0; _i<CST_W; _i++) { \
01138 int _x = (n)*CST_W+_i+1; \
01139 if(_x<CST_NN) (c)[_i]=_x; \
01140 }\
01141 } while(0)
01142 #define CmiNumNodeSpanTreeChildren(n) ((((n)+1)*CST_W<CST_NN)? CST_W : \
01143 ((((n)*CST_W+1)>=CST_NN)?0:((CST_NN-1)-(n)*CST_W)))
01144 #define CST_R(p) (CmiRankOf(p))
01145 #define CST_NF(n) (CmiNodeFirst(n))
01146 #define CST_SP(n) (CmiNodeSpanTreeParent(n))
01147 #define CST_ND(p) (CmiNodeOf(p))
01148 #define CST_NS(p) (CmiNodeSize(CST_ND(p)))
01149 #define CmiSpanTreeParent(p) ((p)?(CST_R(p)?(CST_NF(CST_ND(p))+(CST_R(p)-1)/CST_W):CST_NF(CST_SP(CST_ND(p)))):(-1))
01150 #define CST_C(p) (((CST_R(p)+1)*CST_W<CST_NS(p))?CST_W:(((CST_R(p)*CST_W+1)>=CST_NS(p))?0:((CST_NS(p)-1)-CST_R(p)*CST_W)))
01151 #define CST_SC(p) (CmiNumNodeSpanTreeChildren(CST_ND(p)))
01152 #define CmiNumSpanTreeChildren(p) (CST_R(p)?CST_C(p):(CST_SC(p)+CST_C(p)))
01153 #define CmiSpanTreeChildren(p,c) do {\
01154 int _i,_c=0; \
01155 if(CST_R(p)==0) { \
01156 for(_i=0;_i<CST_W;_i++) { \
01157 int _x = CST_ND(p)*CST_W+_i+1; \
01158 if(_x<CST_NN) (c)[_c++]=CST_NF(_x); \
01159 }\
01160 } \
01161 for(_i=0;_i<CST_W;_i++) { \
01162 int _x = CST_R(p)*CST_W+_i+1; \
01163 if(_x<CST_NS(p)) (c)[_c++]=CST_NF(CST_ND(p))+_x; \
01164 }\
01165 } while(0)
01166
01167 #else
01168
01169 int CmiNumSpanTreeChildren(int) ;
01170 int CmiSpanTreeParent(int) ;
01171 void CmiSpanTreeChildren(int node, int *children);
01172 int CmiNumNodeSpanTreeChildren(int);
01173 int CmiNodeSpanTreeParent(int) ;
01174 void CmiNodeSpanTreeChildren(int node, int *children) ;
01175 #endif
01176
01177
01178
01179 typedef CMK_MULTICAST_GROUP_TYPE CmiGroup;
01180
01181 void CmiGroupInit(void);
01182 CmiGroup CmiEstablishGroup(int npes, int *pes);
01183 void CmiLookupGroup(CmiGroup grp, int *npes, int **pes);
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202 #define VECTOR_COMPACT(outsize,outdata,inndata,insizes,indatas,chunkHeaderSize) {\
01203 int i;\
01204 char *tmp;\
01205 outsize=0;\
01206 if (inndata>=0) for(i=0; i<inndata; ++i) outsize += insizes[i];\
01207 else {\
01208 for(i=0; i<-inndata; ++i) outsize += ALIGN_DEFAULT(insizes[i]);\
01209 outsize -= (inndata+1) * chunkHeaderSize;\
01210 }\
01211 outdata = (char *)CmiAlloc(outsize);\
01212 if (!outdata) fprintf(stderr, "%d: Out of mem\n", CmiMyNode());\
01213 tmp = outdata;\
01214 if (inndata>=0) {\
01215 for (i=0; i<inndata; ++i) {\
01216 memcpy(tmp, indatas[i], insizes[i]);\
01217 tmp += insizes[i];\
01218 }\
01219 } else {\
01220 memcpy(tmp, indatas[0], insizes[0]);\
01221 tmp += ALIGN_DEFAULT(insizes[0]);\
01222 for (i=0; i<-inndata; ++i) {\
01223 memcpy(tmp, indatas[i]-chunkHeaderSize, insizes[i]+chunkHeaderSize);\
01224 tmp += ALIGN_DEFAULT(insizes[i])+chunkHeaderSize;\
01225 }\
01226 }\
01227 }
01228
01229 void CmiPushPE(int, void*);
01230 #if CMK_OMP
01231 void CmiSuspendedTaskEnqueue(int targetRank, void *msg);
01232 void * CmiSuspendedTaskPop(void);
01233 #endif
01234 void CmiSyncSendFn(int, int, char *);
01235 CmiCommHandle CmiAsyncSendFn(int, int, char *);
01236 void CmiFreeSendFn(int, int, char *);
01237
01238 void CmiSyncBroadcastFn(int, char *);
01239 CmiCommHandle CmiAsyncBroadcastFn(int, char *);
01240 void CmiFreeBroadcastFn(int, char *);
01241
01242 void CmiSyncBroadcastAllFn(int, char *);
01243 CmiCommHandle CmiAsyncBroadcastAllFn(int, char *);
01244 void CmiFreeBroadcastAllFn(int, char *);
01245
01246 void CmiSyncListSendFn(int, const int *, int, char*);
01247 CmiCommHandle CmiAsyncListSendFn(int, const int *, int, char*);
01248 void CmiFreeListSendFn(int, const int *, int, char*);
01249 void CmiFreeNodeListSendFn(int, const int *, int, char*);
01250
01251 void CmiSyncMulticastFn(CmiGroup, int, char*);
01252 CmiCommHandle CmiAsyncMulticastFn(CmiGroup, int, char*);
01253 void CmiFreeMulticastFn(CmiGroup, int, char*);
01254
01255
01256 void CmiInterSyncSendFn(int, int, int, char *);
01257 void CmiInterFreeSendFn(int, int, int, char *);
01258
01259 typedef void * (*CmiReduceMergeFn)(int*,void*,void**,int);
01260 typedef void (*CmiReducePupFn)(void*,void*);
01261 typedef void (*CmiReduceDeleteFn)(void*);
01262
01263 typedef struct {
01264 void *localData;
01265 char **remoteData;
01266 int localSize;
01267 short int numRemoteReceived;
01268 short int numChildren;
01269 int parent;
01270 CmiUInt2 seqID;
01271 char localContributed;
01272 struct {
01273 CmiHandler destination;
01274 CmiReduceMergeFn mergeFn;
01275 CmiReducePupFn pupFn;
01276 CmiReduceDeleteFn deleteFn;
01277 } ops;
01278 } CmiReduction;
01279
01280 typedef CmiUInt2 CmiReductionID;
01281
01282 void * CmiReduceMergeFn_random(int*, void*, void**, int);
01283
01284 void CmiReduce(void *msg, int size, CmiReduceMergeFn mergeFn);
01285 void CmiReduceStruct(void *data, CmiReducePupFn pupFn,
01286 CmiReduceMergeFn mergeFn, CmiHandler dest,
01287 CmiReduceDeleteFn deleteFn);
01288 void CmiReduceID(void *msg, int size, CmiReduceMergeFn mergeFn, CmiReductionID id);
01289 void CmiReduceStructID(void *data, CmiReducePupFn pupFn,
01290 CmiReduceMergeFn mergeFn, CmiHandler dest,
01291 CmiReduceDeleteFn deleteFn, CmiReductionID id);
01292 void CmiListReduce(int npes, int *pes, void *msg, int size, CmiReduceMergeFn mergeFn, CmiReductionID id);
01293 void CmiListReduceStruct(int npes, int *pes,
01294 void *data, CmiReducePupFn pupFn,
01295 CmiReduceMergeFn mergeFn, CmiHandler dest,
01296 CmiReduceDeleteFn deleteFn, CmiReductionID id);
01297 void CmiGroupReduce(CmiGroup grp, void *msg, int size, CmiReduceMergeFn mergeFn, CmiReductionID id);
01298 void CmiGroupReduceStruct(CmiGroup grp, void *data, CmiReducePupFn pupFn,
01299 CmiReduceMergeFn mergeFn, CmiHandler dest,
01300 CmiReduceDeleteFn deleteFn, CmiReductionID id);
01301 void CmiNodeReduce(void *msg, int size, CmiReduceMergeFn mergeFn, int, int, int);
01302 void CmiNodeReduceStruct(void *data, CmiReducePupFn pupFn,
01303 CmiReduceMergeFn mergeFn, CmiHandler dest,
01304 CmiReduceDeleteFn deleteFn);
01305 int CmiGetReductionHandler(void);
01306 CmiHandler CmiGetReductionDestination(void);
01307 CmiReductionID CmiGetGlobalReduction(void);
01308 CmiReductionID CmiGetDynamicReduction(void);
01309 void CmiGetDynamicReductionRemote(int handlerIdx, int pe, int dataSize, void *data);
01310
01311 void CmiResetGlobalReduceSeqID(void);
01312
01313
01314
01315
01316
01317
01318 void CmiSyncVectorSend(int, int, int *, char **);
01319 CmiCommHandle CmiAsyncVectorSend(int, int, int *, char **);
01320 void CmiSyncVectorSendAndFree(int, int, int *, char **);
01321
01322 void CmiMultipleSend(unsigned int, int, int *, char **);
01323 void CmiMultipleIsend(unsigned int, int, int *, char **);
01324
01325 int CmiAsyncMsgSent(CmiCommHandle);
01326 void CmiReleaseCommHandle(CmiCommHandle);
01327
01328 #define CmiSyncSend(p,s,m) (CmiSyncSendFn((p),(s),(char *)(m)))
01329 #define CmiAsyncSend(p,s,m) (CmiAsyncSendFn((p),(s),(char *)(m)))
01330 #define CmiSyncSendAndFree(p,s,m) (CmiFreeSendFn((p),(s),(char *)(m)))
01331
01332 #define CmiSyncBroadcast(s,m) (CmiSyncBroadcastFn((s),(char *)(m)))
01333 #define CmiAsyncBroadcast(s,m) (CmiAsyncBroadcastFn((s),(char *)(m)))
01334 #define CmiSyncBroadcastAndFree(s,m) (CmiFreeBroadcastFn((s),(char *)(m)))
01335
01336 #define CmiSyncBroadcastAll(s,m) (CmiSyncBroadcastAllFn((s),(char *)(m)))
01337 #define CmiAsyncBroadcastAll(s,m) (CmiAsyncBroadcastAllFn((s),(char *)(m)))
01338 #define CmiSyncBroadcastAllAndFree(s,m) (CmiFreeBroadcastAllFn((s),(char *)(m)))
01339
01340 #define CmiSyncListSend(n,l,s,m) (CmiSyncListSendFn((n),(l),(s),(char *)(m)))
01341 #define CmiAsyncListSend(n,l,s,m) (CmiAsyncListSendFn((n),(l),(s),(char *)(m)))
01342 #define CmiSyncListSendAndFree(n,l,s,m) (CmiFreeListSendFn((n),(l),(s),(char *)(m)))
01343
01344 #define CmiSyncMulticast(g,s,m) (CmiSyncMulticastFn((g),(s),(char*)(m)))
01345 #define CmiAsyncMulticast(g,s,m) (CmiAsyncMulticastFn((g),(s),(char*)(m)))
01346 #define CmiSyncMulticastAndFree(g,s,m) (CmiFreeMulticastFn((g),(s),(char*)(m)))
01347
01348
01349
01350
01351 #if CMK_HAS_PARTITION
01352 #define CmiInterSyncSend(pe,p,s,m) (CmiInterSyncSendFn((pe),(p),(s),(char *)(m)))
01353 #define CmiInterSyncSendAndFree(pe,p,s,m) (CmiInterFreeSendFn((pe),(p),(s),(char *)(m)))
01354 #else
01355 #define CmiInterSyncSend(pe,p,s,m) (CmiSyncSendFn((pe),(s),(char *)(m)))
01356 #define CmiInterSyncSendAndFree(pe,p,s,m) (CmiFreeSendFn((pe),(s),(char *)(m)))
01357 #endif
01358
01359
01360
01361 #if CMK_NODE_QUEUE_AVAILABLE
01362 void CmiSyncNodeSendFn(int, int, char *);
01363 CmiCommHandle CmiAsyncNodeSendFn(int, int, char *);
01364 void CmiFreeNodeSendFn(int, int, char *);
01365
01366 void CmiSyncNodeBroadcastFn(int, char *);
01367 CmiCommHandle CmiAsyncNodeBroadcastFn(int, char *);
01368 void CmiFreeNodeBroadcastFn(int, char *);
01369
01370 void CmiSyncNodeBroadcastAllFn(int, char *);
01371 CmiCommHandle CmiAsyncNodeBroadcastAllFn(int, char *);
01372 void CmiFreeNodeBroadcastAllFn(int, char *);
01373
01374
01375 void CmiInterSyncNodeSendFn(int, int, int, char *);
01376 void CmiInterFreeNodeSendFn(int, int, int, char *);
01377 #endif
01378
01379 #if CMK_NODE_QUEUE_AVAILABLE
01380 #define CmiSyncNodeSend(p,s,m) (CmiSyncNodeSendFn((p),(s),(char *)(m)))
01381 #define CmiAsyncNodeSend(p,s,m) (CmiAsyncNodeSendFn((p),(s),(char *)(m)))
01382 #define CmiSyncNodeSendAndFree(p,s,m) (CmiFreeNodeSendFn((p),(s),(char *)(m)))
01383 #define CmiSyncNodeBroadcast(s,m) (CmiSyncNodeBroadcastFn((s),(char *)(m)))
01384 #define CmiAsyncNodeBroadcast(s,m) (CmiAsyncNodeBroadcastFn((s),(char *)(m)))
01385 #define CmiSyncNodeBroadcastAndFree(s,m) (CmiFreeNodeBroadcastFn((s),(char *)(m)))
01386 #define CmiSyncNodeBroadcastAll(s,m) (CmiSyncNodeBroadcastAllFn((s),(char *)(m)))
01387 #define CmiAsyncNodeBroadcastAll(s,m) (CmiAsyncNodeBroadcastAllFn((s),(char *)(m)))
01388 #define CmiSyncNodeBroadcastAllAndFree(s,m) (CmiFreeNodeBroadcastAllFn((s),(char *)(m)))
01389
01390
01391 #if CMK_HAS_PARTITION
01392 #define CmiInterSyncNodeSend(pe,p,s,m) (CmiInterSyncNodeSendFn((pe),(p),(s),(char *)(m)))
01393 #define CmiInterSyncNodeSendAndFree(pe,p,s,m) (CmiInterFreeNodeSendFn((pe),(p),(s),(char *)(m)))
01394 #else
01395 #define CmiInterSyncNodeSend(pe,p,s,m) (CmiSyncNodeSendFn((pe),(s),(char *)(m)))
01396 #define CmiInterSyncNodeSendAndFree(pe,p,s,m) (CmiFreeNodeSendFn((pe),(s),(char *)(m)))
01397 #endif
01398
01399 #else
01400
01401 #define CmiSyncNodeSend(n,s,m) CmiSyncSend(CmiNodeFirst(n),s,m)
01402 #define CmiAsyncNodeSend(n,s,m) CmiAsyncSend(CmiNodeFirst(n),s,m)
01403 #define CmiSyncNodeSendAndFree(n,s,m) CmiSyncSendAndFree(CmiNodeFirst(n),s,m)
01404 #if CMK_UTH_VERSION || CMK_MULTICORE
01405 #define CmiSyncNodeBroadcast(s,m) do { \
01406 int _i; \
01407 for(_i=0; _i<CmiNumNodes(); _i++) \
01408 if(_i != CmiMyNode()) \
01409 CmiSyncSend(CmiNodeFirst(_i),s,m); \
01410 } while(0)
01411 #define CmiAsyncNodeBroadcast(s,m) CmiSyncNodeBroadcast(s,m)
01412 #define CmiSyncNodeBroadcastAndFree(s,m) do { \
01413 CmiSyncNodeBroadcast(s,m); \
01414 CmiFree(m); \
01415 } while(0)
01416 #define CmiSyncNodeBroadcastAll(s,m) do { \
01417 int _i; \
01418 for(_i=0; _i<CmiNumNodes(); _i++) \
01419 CmiSyncSend(CmiNodeFirst(_i),s,m); \
01420 } while(0)
01421 #define CmiAsyncNodeBroadcastAll(s,m) CmiSyncNodeBroadcastAll(s,m)
01422 #define CmiSyncNodeBroadcastAllAndFree(s,m) do { \
01423 CmiSyncNodeBroadcastAll(s,m); \
01424 CmiFree(m); \
01425 } while(0)
01426 #else
01427 #define CmiSyncNodeBroadcast(s,m) CmiSyncBroadcast(s,m)
01428 #define CmiAsyncNodeBroadcast(s,m) CmiAsyncBroadcast(s,m)
01429 #define CmiSyncNodeBroadcastAndFree(s,m) CmiSyncBroadcastAndFree(s,m)
01430 #define CmiSyncNodeBroadcastAll(s,m) CmiSyncBroadcastAll(s,m)
01431 #define CmiAsyncNodeBroadcastAll(s,m) CmiAsyncBroadcastAll(s,m)
01432 #define CmiSyncNodeBroadcastAllAndFree(s,m) CmiSyncBroadcastAllAndFree(s,m)
01433 #endif
01434
01435 #if CMK_HAS_PARTITION
01436 #define CmiInterSyncNodeSend(n,p,s,m) CmiInterSyncSend(CmiNodeFirst(n),p,s,m)
01437 #define CmiInterSyncNodeSendAndFree(n,p,s,m) CmiInterSyncSendAndFree(CmiNodeFirst(n),p,s,m)
01438 #else
01439 #define CmiInterSyncNodeSend(n,p,s,m) CmiSyncSend(CmiNodeFirst(n),s,m)
01440 #define CmiInterSyncNodeSendAndFree(n,p,s,m) CmiSyncSendAndFree(CmiNodeFirst(n),s,m)
01441 #endif
01442 #endif
01443
01444
01445
01446 void CmiDeliversInit(void);
01447 int CmiDeliverMsgs(int maxmsgs);
01448 void CmiDeliverSpecificMsg(int handler);
01449 void CmiHandleMessage(void *msg);
01450
01451
01452
01453
01454
01455 #define CQS_QUEUEING_FIFO 2
01456 #define CQS_QUEUEING_LIFO 3
01457 #define CQS_QUEUEING_IFIFO 4
01458 #define CQS_QUEUEING_ILIFO 5
01459 #define CQS_QUEUEING_BFIFO 6
01460 #define CQS_QUEUEING_BLIFO 7
01461 #define CQS_QUEUEING_LFIFO 8
01462 #define CQS_QUEUEING_LLIFO 9
01463
01466
01467
01468 typedef struct CthThreadStruct *CthThread;
01469 typedef struct {
01470
01471
01472
01473 char cmicore[CmiReservedHeaderSize];
01474 CthThread thread;
01475 int serialNo;
01476 } CthThreadToken;
01477
01478 CthThreadToken *CthGetToken(CthThread);
01479
01480 typedef void (*CthVoidFn)(void *);
01481 typedef void (*CthAwkFn)(CthThreadToken *,int,
01482 int prioBits,unsigned int *prioptr);
01483 typedef CthThread (*CthThFn)(void);
01484
01485 void CthSetSerialNo(CthThread t, int no);
01486 int CthImplemented(void);
01487
01488 int CthMigratable(void);
01489 CthThread CthPup(pup_er, CthThread);
01490
01491 CthThread CthSelf(void);
01492 CthThread CthCreate(CthVoidFn, void *, int);
01493 CthThread CthCreateMigratable(CthVoidFn, void *, int);
01494 void CthResume(CthThread);
01495 void CthFree(CthThread);
01496
01497 void CthSetSuspendable(CthThread, int);
01498 int CthIsSuspendable(CthThread);
01499
01500
01501 void CthPrintThdMagic(CthThread);
01502 void CthPrintThdStack(CthThread);
01503
01504 void CthSuspend(void);
01505 void CthAwaken(CthThread);
01506 void CthAwakenPrio(CthThread, int, int, unsigned int *);
01507 void CthSetStrategy(CthThread, CthAwkFn, CthThFn);
01508 void CthSetStrategyDefault(CthThread);
01509 #if CMK_OMP
01510 void CthSetStrategyWorkStealing(CthThread);
01511 void CthSetStrategySuspendedWorkStealing(CthThread);
01512 int CthScheduled(CthThread t);
01513 void CthScheduledDecrement(void);
01514 CthThread CthGetCurrentThread(void);
01515 CpvExtern(int, prevGtid);
01516 void CthSetPrev(CthThread t, CthThread prev);
01517 #endif
01518 void CthYield(void);
01519 void CthYieldPrio(int,int,unsigned int*);
01520
01521 void CthSetNext(CthThread t, CthThread next);
01522 CthThread CthGetNext(CthThread t);
01523 #if CMK_TRACE_ENABLED
01524 void CthSetEventInfo(CthThread t, int event, int srcPE);
01525 #endif
01526 void CthSwitchThread(CthThread t);
01527
01528 size_t CthStackOffset(CthThread t, char *p);
01529 char * CthPointer(CthThread t, size_t pos);
01530
01531
01532 void CthAutoYield(CthThread t, int flag);
01533 double CthAutoYieldFreq(CthThread t);
01534 void CthAutoYieldBlock(void);
01535 void CthAutoYieldUnblock(void);
01536
01537
01538 typedef struct CtgGlobalStruct *CtgGlobals;
01539
01541 void CtgInit(void);
01542
01544 #define CMI_PIC_NOP 0
01545 #define CMI_PIC_ELFGOT 1
01546 CpvExtern(int, CmiPICMethod);
01547
01549 CtgGlobals CtgCreate(CthThread tid);
01551 void CtgInstall(CtgGlobals g);
01553 CtgGlobals CtgPup(pup_er, CtgGlobals g);
01555 void CtgFree(CtgGlobals g);
01557 CtgGlobals CtgCurrentGlobals(void);
01558
01560 void CtgInstallTLS(void *cur, void *next);
01561 void CtgInstallMainThreadTLS(void *cur);
01562 void CtgInstallCthTLS(void *cur, void *next);
01563 void CmiEnableTLS(void);
01564 void CmiDisableTLS(void);
01565
01566
01567
01568
01569
01570
01571 struct CthThreadListener;
01572
01573 typedef void (*CthThreadListener_suspend)(struct CthThreadListener *l);
01574 typedef void (*CthThreadListener_resume)(struct CthThreadListener *l);
01575 typedef void (*CthThreadListener_free)(struct CthThreadListener *l);
01576
01577 struct CthThreadListener {
01579 CthThreadListener_suspend suspend;
01580
01582 CthThreadListener_resume resume;
01583
01585 CthThreadListener_free free;
01586
01590 void *data;
01591
01595 CthThread thread;
01596
01600 struct CthThreadListener *next;
01601 };
01602
01610 void CthAddListener(CthThread th,struct CthThreadListener *l);
01611
01617 void CthUserAddListeners(CthThread th);
01618
01619
01620
01621 #if CMK_THREADS_REQUIRE_NO_CPV
01622
01623 #define CthCpvDeclare(t,v) t v
01624 #define CthCpvExtern(t,v) extern t v
01625 #define CthCpvStatic(t,v) static t v
01626 #define CthCpvInitialize(t,v) do {} while(0)
01627 #define CthCpvAccess(x) x
01628
01629 #else
01630
01631 #define CthCpvDeclare(t,v) CpvDeclare(t,v)
01632 #define CthCpvExtern(t,v) CpvExtern(t,v)
01633 #define CthCpvStatic(t,v) CpvStaticDeclare(t,v)
01634 #define CthCpvInitialize(t,v) CpvInitialize(t,v)
01635 #define CthCpvAccess(x) CpvAccess(x)
01636
01637 #endif
01638
01639 CthCpvExtern(char *,CthData);
01640 extern size_t CthRegister(size_t dataSize);
01641 extern void CthRegistered(size_t dataOffMax);
01642 extern char *CthGetData(CthThread t);
01643
01644 #define CtvDeclare(t,v) typedef t CtvType##v; CsvDeclare(int,CtvOffs##v)=(-1)
01645 #define CtvStaticDeclare(t,v) typedef t CtvType##v; CsvStaticDeclare(int,CtvOffs##v)=(-1)
01646 #define CtvExtern(t,v) typedef t CtvType##v; CsvExtern(int,CtvOffs##v)
01647 #define CtvAccess(v) (*((CtvType##v *)(CthCpvAccess(CthData)+CsvAccess(CtvOffs##v))))
01648 #define CtvAccessOther(t,v) (*((CtvType##v *)(CthGetData(t)+CsvAccess(CtvOffs##v))))
01649 #define CtvInitialize(t,v) do { \
01650 if(CsvAccess(CtvOffs##v)==(-1)) \
01651 CsvAccess(CtvOffs##v)=CthRegister(sizeof(CtvType##v));\
01652 else CthRegistered(CsvAccess(CtvOffs##v)+sizeof(CtvType##v));\
01653 } while(0)
01654
01655 #define CtvInitialized(v) (CsvAccess(CtvOffs##v)!=(-1))
01656
01657
01658
01659 typedef struct Cfuture_s
01660 {
01661 int pe;
01662 struct Cfuture_data_s *data;
01663 }
01664 Cfuture;
01665
01666 #define CfutureValueData(v) ((void*)((v)->rest))
01667
01668 Cfuture CfutureCreate(void);
01669 void CfutureSet(Cfuture f, void *val, int len);
01670 void *CfutureWait(Cfuture f);
01671 void CfutureDestroy(Cfuture f);
01672
01673 void *CfutureCreateBuffer(int bytes);
01674 void CfutureDestroyBuffer(void *val);
01675 void CfutureStoreBuffer(Cfuture f, void *value);
01676
01677 #define CfuturePE(f) ((f).pe)
01678
01679 void CfutureInit(void);
01680
01681
01682
01683 #define CLD_ANYWHERE (-1)
01684 #define CLD_BROADCAST (-2)
01685 #define CLD_BROADCAST_ALL (-3)
01686
01687 typedef void (*CldPackFn)(void *msg);
01688
01689 typedef void (*CldInfoFn)(void *msg,
01690 CldPackFn *packer,
01691 int *len,
01692 int *queueing,
01693 int *priobits,
01694 unsigned int **prioptr);
01695
01696 typedef int (*CldEstimator)(void);
01697
01698 int CldRegisterInfoFn(CldInfoFn fn);
01699 int CldRegisterPackFn(CldPackFn fn);
01700 void CldRegisterEstimator(CldEstimator fn);
01701 int CldEstimate(void);
01702 const char *CldGetStrategy(void);
01703
01704 void CldEnqueue(int pe, void *msg, int infofn);
01705 void CldEnqueueMulti(int npes, const int *pes, void *msg, int infofn);
01706 void CldEnqueueGroup(CmiGroup grp, void *msg, int infofn);
01707 void CldNodeEnqueue(int node, void *msg, int infofn);
01708
01709
01710
01711 typedef struct CmmTableStruct *CmmTable;
01712
01713 #define CmmWildCard (-1)
01714
01715 typedef void (*CmmPupMessageFn)(pup_er p,void **msg);
01716 CmmTable CmmPup(pup_er p, CmmTable t, CmmPupMessageFn msgpup);
01717
01718 CmmTable CmmNew(void);
01719 void CmmFree(CmmTable t);
01720 void CmmFreeAll(CmmTable t);
01721 void CmmPut(CmmTable t, int ntags, int *tags, void *msg);
01722 void *CmmFind(CmmTable t, int ntags, int *tags, int *returntags, int del);
01723 int CmmEntries(CmmTable t);
01724 int CmmGetLastTag(CmmTable t, int ntags, int *tags);
01725 #define CmmGet(t,nt,tg,rt) (CmmFind((t),(nt),(tg),(rt),1))
01726 #define CmmProbe(t,nt,tg,rt) (CmmFind((t),(nt),(tg),(rt),0))
01727
01728
01729
01730 void ConverseInit(int, char**, CmiStartFn, int, int);
01731
01732
01733
01734
01735 void realConverseExit(int exitcode);
01736
01737 #define CONVEXIT_1(x) realConverseExit(x)
01738 #define CONVEXIT_0() CONVEXIT_1(0)
01739
01740 #define CONV_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
01741 #define CONV_FUNC_RECOMPOSER(argsWithParentheses) CONV_FUNC_CHOOSER argsWithParentheses
01742 #define CONV_CHOOSE_FROM_ARG_COUNT(...) CONV_FUNC_RECOMPOSER((__VA_ARGS__, CONVEXIT_2, CONVEXIT_1, ))
01743 #define CONV_NO_ARG_EXPANDER() ,,CONVEXIT_0
01744 #define CONV_MACRO_CHOOSER(...) CONV_CHOOSE_FROM_ARG_COUNT(CONV_NO_ARG_EXPANDER __VA_ARGS__ ())
01745 #define ConverseExit(...) CONV_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__)
01746
01747
01748 #if CMK_SHRINK_EXPAND
01749 void ConverseCleanup(void);
01750 #endif
01751 CMK_NORETURN void CmiAbort(const char *);
01752 void CmiOutOfMemory(int nBytes);
01753
01754 #if CMK_MEMCHECK_OFF
01755 #define _MEMCHECK(p) do{}while(0)
01756 #else
01757 #define _MEMCHECK(p) do { \
01758 if ((p)==0) CmiOutOfMemory(-1);\
01759 } while(0)
01760 #endif
01761
01762
01763
01764 typedef void (*CcdVoidFn)(void *userParam,double curWallTime);
01765
01766
01767 #define CcdPROCESSOR_BEGIN_BUSY 0
01768 #define CcdPROCESSOR_END_IDLE 0
01769 #define CcdPROCESSOR_BEGIN_IDLE 1
01770 #define CcdPROCESSOR_END_BUSY 1
01771 #define CcdPROCESSOR_STILL_IDLE 2
01772
01773
01774 #define CcdPERIODIC 3
01775 #define CcdPERIODIC_10ms 4
01776 #define CcdPERIODIC_100ms 5
01777 #define CcdPERIODIC_1second 6
01778 #define CcdPERIODIC_1s 6
01779 #define CcdPERIODIC_5s 7
01780 #define CcdPERIODIC_5seconds 7
01781 #define CcdPERIODIC_10second 8
01782 #define CcdPERIODIC_10seconds 8
01783 #define CcdPERIODIC_10s 8
01784 #define CcdPERIODIC_1minute 9
01785 #define CcdPERIODIC_2minute 10
01786 #define CcdPERIODIC_5minute 11
01787 #define CcdPERIODIC_10minute 12
01788 #define CcdPERIODIC_1hour 13
01789 #define CcdPERIODIC_12hour 14
01790 #define CcdPERIODIC_1day 15
01791
01792
01793 #define CcdQUIESCENCE 16
01794 #define CcdTOPOLOGY_AVAIL 17
01795 #define CcdSIGUSR1 18
01796 #define CcdSIGUSR2 19
01797
01798
01799 #define CcdUSER 20
01800
01801
01802
01803 #ifndef CcdUSERMAX
01804 #define CcdUSERMAX 127
01805 #endif
01806
01807 #define CcdIGNOREPE -2
01808 #if CMK_CONDS_USE_SPECIAL_CODE
01809 typedef int (*CmiSwitchToPEFnPtr)(int pe);
01810 extern CmiSwitchToPEFnPtr CmiSwitchToPE;
01811 #else
01812 #define CmiSwitchToPE(pe) pe
01813 #endif
01814 void CcdCallFnAfter(CcdVoidFn fnp, void *arg, double msecs);
01815 int CcdCallOnCondition(int condnum, CcdVoidFn fnp, void *arg);
01816 int CcdCallOnConditionKeep(int condnum, CcdVoidFn fnp, void *arg);
01817 void CcdCallFnAfterOnPE(CcdVoidFn fnp, void *arg, double msecs, int pe);
01818 int CcdCallOnConditionOnPE(int condnum, CcdVoidFn fnp, void *arg, int pe);
01819 int CcdCallOnConditionKeepOnPE(int condnum, CcdVoidFn fnp, void *arg, int pe);
01820 void CcdCancelCallOnCondition(int condnum, int idx);
01821 void CcdCancelCallOnConditionKeep(int condnum, int idx);
01822 void CcdRaiseCondition(int condnum);
01823 double CcdSetResolution(double newResolution);
01824 double CcdResetResolution(void);
01825 double CcdIncreaseResolution(double newResolution);
01826
01827
01828 void CmiArgGroup(const char *parentName,const char *groupName);
01829 int CmiGetArgInt(char **argv,const char *arg,int *optDest);
01830 int CmiGetArgIntDesc(char **argv,const char *arg,int *optDest,const char *desc);
01831 int CmiGetArgLong(char **argv,const char *arg,CmiInt8 *optDest);
01832 int CmiGetArgLongDesc(char **argv,const char *arg,CmiInt8 *optDest,const char *desc);
01833 int CmiGetArgDouble(char **argv,const char *arg,double *optDest);
01834 int CmiGetArgDoubleDesc(char **argv,const char *arg,double *optDest,const char *desc);
01835 int CmiGetArgString(char **argv,const char *arg,char **optDest);
01836 int CmiGetArgStringDesc(char **argv,const char *arg,char **optDest,const char *desc);
01837 int CmiGetArgFlag(char **argv,const char *arg);
01838 int CmiGetArgFlagDesc(char **argv,const char *arg,const char *desc);
01839 void CmiDeleteArgs(char **argv,int k);
01840 int CmiGetArgc(char **argv);
01841 char **CmiCopyArgs(char **argv);
01842 int CmiArgGivingUsage(void);
01843 void CmiDeprecateArgInt(char **argv,const char *arg,const char *desc,const char *warning);
01844
01853 void CmiBacktraceRecord(void **retPtrs,int nSkip,int *nLevels);
01854
01859 char **CmiBacktraceLookup(void **srcPtrs,int nLevels);
01860
01862 void CmiBacktracePrint(void **retPtrs,int nLevels);
01863
01864
01865
01866
01867 void CmiPrintStackTrace(int nSkip);
01868 int CmiIsFortranLibraryCall(void);
01869
01870 #if CMK_CMIDELIVERS_USE_COMMON_CODE
01871 CpvExtern(void*, CmiLocalQueue);
01872 #endif
01873
01874 char *CmiCopyMsg(char *msg, int len);
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891 int HypercubeGetBcastDestinations(int mype, int total_pes, int k, int *dest_pes);
01892
01893
01894
01895 CpvExtern(int, CmiImmediateMsgHandlerIdx);
01896
01897
01898 CpvExtern(unsigned, networkProgressCount);
01899 extern int networkProgressPeriod;
01900
01901 #if !CMK_MACHINE_PROGRESS_DEFINED
01902
01903 #define CmiNetworkProgress()
01904 #define CmiNetworkProgressAfter(p)
01905 #define CmiMachineProgressImpl()
01906
01907 #else
01908
01909
01910
01911
01912 void CmiMachineProgressImpl(void);
01913
01914 #if CMK_USE_PXSHM
01915 void CommunicationServerPxshm(void);
01916 #define CmiNetworkProgress() {CpvAccess(networkProgressCount) ++; \
01917 if(CpvAccess(networkProgressCount) >= networkProgressPeriod) { \
01918 CmiMachineProgressImpl(); \
01919 CommunicationServerPxshm(); \
01920 CpvAccess(networkProgressCount) = 0; \
01921 } \
01922 }
01923 #else
01924 #define CmiNetworkProgress() {CpvAccess(networkProgressCount) ++; \
01925 if(CpvAccess(networkProgressCount) >= networkProgressPeriod) { \
01926 CmiMachineProgressImpl(); \
01927 CpvAccess(networkProgressCount) = 0; \
01928 } \
01929 }
01930 #endif
01931
01932 #if CMK_USE_PXSHM
01933 #define CmiNetworkProgressAfter(p) {CpvAccess(networkProgressCount) ++; \
01934 if(CpvAccess(networkProgressCount) >= p) { \
01935 CmiMachineProgressImpl(); \
01936 CommunicationServerPxshm(); \
01937 CpvAccess(networkProgressCount) = 0; \
01938 } \
01939 }
01940 #else
01941 #define CmiNetworkProgressAfter(p) {CpvAccess(networkProgressCount) ++; \
01942 if(CpvAccess(networkProgressCount) >= p) { \
01943 CmiMachineProgressImpl(); \
01944 CpvAccess(networkProgressCount) = 0; \
01945 } \
01946 }
01947 #endif
01948
01949 #endif
01950
01951 #define CmiProbeImmediateMsg CmiMachineProgressImpl
01952
01953
01954
01955
01956
01957 #if CMK_IMMEDIATE_MSG
01958 void CmiDelayImmediate(void);
01959 # define CmiBecomeImmediate(msg) do { \
01960 CmiSetHandler(msg, (CmiGetHandler(msg))|0x8000); \
01961 } while (0)
01962 # define CmiResetImmediate(msg) do { \
01963 CmiSetHandler(msg, (CmiGetHandler(msg))&(~0x8000)); \
01964 } while (0)
01965 # define CmiIsImmediate(msg) ((CmiGetHandler(msg)) & 0x8000)
01966 # define CmiImmediateHandler(msg) ((CmiGetHandler(msg)) ^ 0x8000)
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980 #if CMK_NET_VERSION && ! CMK_SMP && ! defined(CMK_CPV_IS_SMP)
01981 extern int _immRunning;
01982 # define CmiImmIsRunning() (_immRunning)
01983 #else
01984 # define CmiImmIsRunning() (0)
01985 #endif
01986
01987 #else
01988 # define CmiBecomeImmediate(msg)
01989 # define CmiResetImmediate(msg)
01990 # define CmiIsImmediate(msg) (0)
01991 # define CmiImmIsRunning() (0)
01992 #endif
01993
01994
01995
01996 #if CMK_SMP
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009 #define ImplSelect2(_1, _2, NAME, ...) NAME
02010 #define ImplSelect3(_1, _2, _3, NAME, ...) NAME
02011 #define CmiMemoryAtomicIncrement(...) ImplSelect2(__VA_ARGS__, CmiMemoryAtomicIncrementMemOrder, CmiMemoryAtomicIncrementSimple, )(__VA_ARGS__)
02012 #define CmiMemoryAtomicDecrement(...) ImplSelect2(__VA_ARGS__, CmiMemoryAtomicDecrementMemOrder, CmiMemoryAtomicDecrementSimple, )(__VA_ARGS__)
02013 #define CmiMemoryAtomicFetchAndInc(...) ImplSelect3(__VA_ARGS__, CmiMemoryAtomicFetchAndIncMemOrder, CmiMemoryAtomicFetchAndIncSimple, )(__VA_ARGS__)
02014
02015 #if CMK_C_SYNC_ADD_AND_FETCH_PRIMITIVE
02016 #if __GNUC__ && __STDC_VERSION__ >= 201112L && !__STDC_NO_ATOMICS__
02017 #ifndef _STDATOMIC_H
02018 typedef enum
02019 {
02020 memory_order_relaxed = __ATOMIC_RELAXED,
02021 memory_order_consume = __ATOMIC_CONSUME,
02022 memory_order_acquire = __ATOMIC_ACQUIRE,
02023 memory_order_release = __ATOMIC_RELEASE,
02024 memory_order_acq_rel = __ATOMIC_ACQ_REL,
02025 memory_order_seq_cst = __ATOMIC_SEQ_CST
02026 } memory_order;
02027 #endif
02028
02029 #define CmiMemoryAtomicIncrementMemOrder(someInt, MemModel) __atomic_fetch_add(&(someInt),1, MemModel);
02030 #define CmiMemoryAtomicDecrementMemOrder(someInt, MemModel) __atomic_fetch_sub(&(someInt),1, MemModel);
02031 #define CmiMemoryAtomicFetchAndIncMemOrder(input,output, MemModel) (output) = __atomic_fetch_add(&(input),1, MemModel);
02032
02033 #else
02034 #define CmiMemoryAtomicIncrementMemOrder(someInt, MemModel) CmiMemoryAtomicIncrementSimple(someInt);
02035 #define CmiMemoryAtomicDecrementMemOrder(someInt, MemModel) CmiMemoryAtomicDecrementSimple(someInt);
02036 #define CmiMemoryAtomicFetchAndIncMemOrder(input,output, MemModel) CmiMemoryAtomicFetchAndIncSimple(input, output);
02037 #endif
02038 #define CmiMemoryAtomicIncrementSimple(someInt) __sync_fetch_and_add(&(someInt), 1)
02039 #define CmiMemoryAtomicDecrementSimple(someInt) __sync_fetch_and_sub(&(someInt), 1)
02040 #define CmiMemoryAtomicFetchAndIncSimple(input,output) (output) =__sync_fetch_and_add(&(input), 1)
02041
02042 #else
02043 #define CmiMemoryAtomicIncrementMemOrder(someInt, MemModel) CmiMemoryAtomicIncrementSimple(someInt);
02044 #define CmiMemoryAtomicDecrementMemOrder(someInt, MemModel) CmiMemoryAtomicDecrementSimple(someInt);
02045 #define CmiMemoryAtomicFetchAndIncMemOrder(input,output, MemModel) CmiMemoryAtomicFetchAndIncSimple(input, output);
02046 #if CMK_GCC_X86_ASM
02047 #if 1
02048 #define CmiMemoryAtomicIncrementSimple(someInt) __asm__ __volatile__("lock incl (%0)" :: "r" (&(someInt)))
02049 #define CmiMemoryAtomicDecrementSimple(someInt) __asm__ __volatile__("lock decl (%0)" :: "r" (&(someInt)))
02050 #else
02051
02052 #define CmiMemoryAtomicIncrement(someInt) __asm__ __volatile__("lock incl %0" :: "m" (someInt))
02053 #define CmiMemoryAtomicDecrement(someInt) __asm__ __volatile__("lock decl %0" :: "m" (someInt))
02054 #endif
02055 #define CmiMemoryAtomicFetchAndIncSimple(input,output) __asm__ __volatile__( \
02056 "movl $1, %1\n\t" \
02057 "lock xaddl %1, %0" \
02058 : "=m"(input), "=r"(output) : "m"(input) : "memory")
02059 #else
02060 #define CMK_NO_ASM_AVAILABLE 1
02061 extern CmiNodeLock cmiMemoryLock;
02062 #define CmiMemoryAtomicIncrementSimple(someInt) { CmiLock(cmiMemoryLock); someInt=someInt+1; CmiUnlock(cmiMemoryLock); }
02063 #define CmiMemoryAtomicDecrementSimple(someInt) { CmiLock(cmiMemoryLock); someInt=someInt-1; CmiUnlock(cmiMemoryLock); }
02064 #define CmiMemoryAtomicFetchAndIncSimple(input,output) { CmiLock(cmiMemoryLock); output=input; input=output+1; CmiUnlock(cmiMemoryLock); }
02065 #endif
02066 #endif
02067
02068 #if CMK_C_SYNC_SYNCHRONIZE_PRIMITIVE
02069 #define CmiMemoryReadFence() __sync_synchronize()
02070 #define CmiMemoryWriteFence() __sync_synchronize()
02071 #else
02072 #define CMK_NO_ASM_AVAILABLE 1
02073 extern CmiNodeLock cmiMemoryLock;
02074 #define CmiMemoryReadFence() { CmiLock(cmiMemoryLock); CmiUnlock(cmiMemoryLock); }
02075 #define CmiMemoryWriteFence() { CmiLock(cmiMemoryLock); CmiUnlock(cmiMemoryLock); }
02076 #endif
02077
02078 #else
02079 #define CmiMemoryReadFence()
02080 #define CmiMemoryWriteFence()
02081 #define CmiMemoryAtomicIncrement(someInt) someInt=someInt+1
02082 #define CmiMemoryAtomicDecrement(someInt) someInt=someInt-1
02083 #define CmiMemoryAtomicFetchAndInc(input,output) output=input; input=output+1;
02084 #endif
02085
02086
02087 void CmiInitCounters(void);
02088 void CmiStartCounters(int events[], int numEvents);
02089 void CmiStopCounters(int events[], CMK_TYPEDEF_INT8 values[], int numEvents);
02090
02091
02092
02093
02094 #define OBJ_ID_SZ 4
02095 typedef struct _CmiObjId {
02096 int id[OBJ_ID_SZ];
02097
02098
02099
02100
02101
02102 #ifdef __cplusplus
02103 _CmiObjId() {
02104 for (int i=0; i<OBJ_ID_SZ; i++) {
02105 id[i] = -1;
02106 }
02107 }
02108 bool isNull() {
02109 for (int i=0; i<OBJ_ID_SZ; i++) {
02110 if (id[i] != -1) return false;
02111 }
02112 return true;
02113 }
02114 bool operator==(const struct _CmiObjId& objid) const {
02115 for (int i=0; i<OBJ_ID_SZ; i++) if (id[i] != objid.id[i]) return false;
02116 return true;
02117 }
02118 #endif
02119 } CmiObjId;
02120
02121
02122 CmiObjId *CthGetThreadID(CthThread th);
02123 void CthSetThreadID(CthThread th, int a, int b, int c);
02124
02125 void CthTraceResume(CthThread t);
02126
02127 #if CMK_FAULT_EVAC
02128 #if CMK_BIGSIM_CHARM
02129 #define CmiNodeAlive(x) (1)
02130 #else
02131 CpvExtern(char *,_validProcessors);
02132 #define CmiNodeAlive(x) (CpvAccess(_validProcessors)[x])
02133 #endif
02134 #endif
02135
02136 int CmiEndianness(void);
02137
02138 #if CMK_CHARMDEBUG
02139 extern void setMemoryTypeChare(void*);
02140 extern void setMemoryTypeMessage(void*);
02141 #else
02142 #define setMemoryTypeChare(p)
02143 #define setMemoryTypeMessage(p)
02144 #endif
02145
02146 #include "conv-cpm.h"
02147 #include "conv-cpath.h"
02148 #include "conv-qd.h"
02149 #include "conv-random.h"
02150 #include "conv-lists.h"
02151 #include "conv-trace.h"
02152 #include "persistent.h"
02153 #if CMK_CELL
02154 #include "cell-api.h"
02155 #endif
02156
02157 #include "conv-rdma.h"
02158
02159
02160 extern int _BgOutOfCoreFlag;
02161 extern int _BgInOutOfCoreMode;
02162
02163 #ifdef ADAPT_SCHED_MEM
02164 extern int numMemCriticalEntries;
02165 extern int *memCriticalEntries;
02166 #endif
02167
02168 double CmiReadSize(const char *str);
02169
02170 #if CMK_CONVERSE_UGNI
02171 void CmiTurnOnStats(void);
02172 void CmiTurnOffStats(void);
02173 #else
02174 #define CmiTurnOnStats()
02175 #define CmiTurnOffStats()
02176 #endif
02177
02178
02179
02180
02181 extern int CharmLibInterOperate;
02182 CpvExtern(int,charmLibExitFlag);
02183
02184
02185
02186 size_t CmiFwrite(const void *ptr, size_t size, size_t nmemb, FILE *f);
02187 CmiInt8 CmiPwrite(int fd, const char *buf, size_t bytes, size_t offset);
02188 int CmiOpen(const char *pathname, int flags, int mode);
02189 FILE *CmiFopen(const char *path, const char *mode);
02190 int CmiFclose(FILE *fp);
02191
02192 #if CMK_HAS_LOG2
02193 #define CmiLog2 log2
02194 #define CmiILog2 log2
02195 #else
02196 extern unsigned int CmiILog2(unsigned int);
02197 extern double CmiLog2(double);
02198 #endif
02199
02200 #if defined(__cplusplus)
02201 }
02202 #endif
02203
02204 #if CMK_GRID_QUEUE_AVAILABLE
02205 #if defined(__cplusplus)
02206 extern "C" {
02207 #endif
02208 extern int CmiGetCluster (int pe);
02209 extern int CmiGridQueueGetInterval (void);
02210 extern int CmiGridQueueGetThreshold (void);
02211 extern void CmiGridQueueRegister (int gid, int nInts, int index1, int index2, int index3);
02212 extern void CmiGridQueueDeregister (int gid, int nInts, int index1, int index2, int index3);
02213 extern void CmiGridQueueDeregisterAll (void);
02214 extern int CmiGridQueueLookup (int gid, int nInts, int index1, int index2, int index3);
02215 extern int CmiGridQueueLookupMsg (char *msg);
02216 #if defined(__cplusplus)
02217 }
02218 #endif
02219 #endif
02220
02221 #include "debug-conv.h"
02222
02223 typedef struct {
02224 CmiUInt4 msgSize;
02225 CmiUInt2 senderPe;
02226 CmiUInt2 destination;
02227 } CmiFragmentHeader;
02228
02229 #if CMK_SMP && CMK_LEVERAGE_COMMTHREAD
02230 #if defined(__cplusplus)
02231 #define EXTERN extern "C"
02232 #else
02233 #define EXTERN extern
02234 #endif
02235 typedef void (*CmiCommThdFnPtr)(int numParams, void *params);
02236 typedef struct CmiNotifyCommThdMsg {
02237 char core[CmiMsgHeaderSizeBytes];
02238 CmiCommThdFnPtr fn;
02239 int numParams;
02240 void *params;
02241 int toKeep;
02242 }CmiNotifyCommThdMsg;
02243
02244 EXTERN CmiNotifyCommThdMsg *CmiCreateNotifyCommThdMsg(CmiCommThdFnPtr fn, int numParams, void *params, int toKeep);
02245 EXTERN void CmiFreeNotifyCommThdMsg(CmiNotifyCommThdMsg *msg);
02246
02247 EXTERN void CmiResetNotifyCommThdMsg(CmiNotifyCommThdMsg *msg, CmiCommThdFnPtr fn, int numParams, void *params, int toKeep);
02248
02249 EXTERN void CmiNotifyCommThd(CmiNotifyCommThdMsg *msg);
02250 #endif
02251
02252 CpvExtern(int, _urgentSend);
02253 #if CMK_USE_OOB
02254 #define CmiEnableUrgentSend(yn) CpvAccess(_urgentSend)=(yn)
02255 #else
02256 #define CmiEnableUrgentSend(yn)
02257 #endif
02258
02259 #if CMK_SMP && CMK_TASKQUEUE
02260 #include "taskqueue.h"
02261 #include "conv-taskQ.h"
02262 #define CsdTaskEnqueue(x) TaskQueuePush((TaskQueue)CpvAccess(CsdTaskQueue),x)
02263 #define CsdTaskPop() TaskQueuePop((TaskQueue)CpvAccess(CsdTaskQueue))
02264 #if CMK_OMP
02265 #if defined(__cplusplus)
02266 extern "C"
02267 #endif
02268 int CmiGetCurKnownOmpThreads(void);
02269 #endif
02270 #endif
02271 CpvCExtern(int, isHelperOn);
02272 #if defined(__cplusplus)
02273 extern "C"
02274 #endif
02275 void CmiSetPeHelpsOtherThreads(int);
02276 #endif
02277
02278