arch/util/machine-smp.h

Go to the documentation of this file.
00001 
00011 #ifndef MACHINE_SMP_H
00012 #define MACHINE_SMP_H
00013 
00014 /*
00015 CmiIdleLock
00016 CmiState
00017 */
00018 
00019 /***********************************************************
00020  * SMP Idle Locking
00021  *   In an SMP system, idle processors need to sleep on a
00022  * lock so that if a message for them arrives, they can be
00023  * woken up.
00024  **********************************************************/
00025 
00026 #if CMK_SHARED_VARS_NT_THREADS
00027 
00028 typedef struct {
00029   int hasMessages; /*Is there a message waiting?*/
00030   volatile int isSleeping; /*Are we asleep in this cond?*/
00031   HANDLE sem;
00032 } CmiIdleLock;
00033 
00034 #elif CMK_SHARED_VARS_POSIX_THREADS_SMP
00035 
00036 typedef struct {
00037   volatile int hasMessages; /*Is there a message waiting?*/
00038   volatile int isSleeping; /*Are we asleep in this cond?*/
00039   pthread_mutex_t mutex;
00040   pthread_cond_t cond;
00041 } CmiIdleLock;
00042 
00043 #else        /* non SMP */
00044 
00045 typedef struct {
00046   int hasMessages;
00047 } CmiIdleLock;
00048 
00049 #endif
00050 
00051 /************************************************************
00052  *
00053  * Processor state structure
00054  *
00055  ************************************************************/
00056 
00057 typedef struct CmiStateStruct
00058 {
00059   int pe, rank;
00060   PCQueue recv; 
00061   void *localqueue;
00062   CmiIdleLock idle;
00063 }
00064 *CmiState;
00065 
00066 typedef struct CmiNodeStateStruct
00067 {
00068   CmiNodeLock immSendLock; /* lock for pushing into immediate queues */
00069   CmiNodeLock immRecvLock; /* lock for processing immediate messages */
00070   PCQueue     immQ;        /* immediate messages to handle ASAP: 
00071                               Locks: push(SendLock), pop(RecvLock) */
00072   PCQueue     delayedImmQ; /* delayed immediate messages:
00073                               Locks: push(RecvLock), pop(RecvLock) */
00074 #if CMK_NODE_QUEUE_AVAILABLE
00075   CmiNodeLock CmiNodeRecvLock;
00076   PCQueue     NodeRecv;
00077 #endif
00078 }
00079 CmiNodeState;
00080 
00081 #endif
00082 

Generated on Sun Jun 29 13:29:06 2008 for Charm++ by  doxygen 1.5.1