arch/util/machine-smp.c File Reference

Common function reimplementation for SMP machines. More...

Go to the source code of this file.

Functions

void CmiStateInit (int pe, int rank, CmiState state)
void CommunicationServerInit ()
CmiState CmiGetState ()
CmiNodeLock CmiCreateLock (void)
void CmiDestroyLock (CmiNodeLock lk)
void CmiYield (void)
static DWORD WINAPI call_startfn (LPVOID vindex)
void CmiNodeBarrierCount (int nThreads)
static void CmiStartThreads (char **argv)
static void CmiDestoryLocks ()
void CmiCommLock (void)
void CmiCommUnlock (void)
static void * call_startfn (void *vindex)
void CmiNodeBarrier (void)
void CmiNodeAllBarrier (void)
static void CmiIdleLock_init (CmiIdleLock *l)
static void CmiIdleLock_sleep (CmiIdleLock *l, int msTimeout)
static void CmiIdleLock_addMessage (CmiIdleLock *l)
static void CmiIdleLock_checkMessage (CmiIdleLock *l)
static void getTimespec (int msFromNow, struct timespec *dest)
static void CmiIdleLock_wakeup (CmiIdleLock *l)
void CmiNodeStateInit (CmiNodeState *nodeState)

Variables

static struct CmiStateStruct Cmi_default_state
CmiNodeLock CmiMemLock_lock
static HANDLE comm_mutex
static DWORD Cmi_state_key = 0xFFFFFFFF
static CmiState Cmi_state_vector = 0
static volatile HANDLE barrier_mutex
static volatile int barrier_wait [2] = {0,0}
static volatile int barrier_which = 0
CmiNodeLock CmiMemLock_lock
int _Cmi_noprocforcommthread = 0
static __thread struct CmiStateStruct Cmi_mystate
static CmiStateCmi_state_vector
static pthread_key_t Cmi_state_key = (pthread_key_t)(-1)
static CmiState Cmi_state_vector
int barrier = 0
pthread_cond_t barrier_cond = PTHREAD_COND_INITIALIZER
pthread_mutex_t barrier_mutex = PTHREAD_MUTEX_INITIALIZER
static CmiNodeLock comm_mutex
static int comm_mutex_isLocked = 0


Detailed Description

Common function reimplementation for SMP machines.

OS Threads

This version of converse is for multiple-processor workstations, and we assume that the OS provides threads to gain access to those multiple processors. This section contains an interface layer for the OS specific threads package. It contains routines to start the threads, routines to access their thread-specific state, and routines to control mutual exclusion between them.

In addition, we wish to support nonthreaded operation. To do this, we provide a version of these functions that uses the main/only thread as a single PE, and simulates a communication thread using interrupts.

CmiStartThreads()

Allocates one CmiState structure per PE. Initializes all of the CmiState structures using the function CmiStateInit. Starts processor threads 1..N (not 0, that's the one that calls CmiStartThreads), as well as the communication thread. Each processor thread (other than 0) must call ConverseInitPE followed by Cmi_startfn. The communication thread must be an infinite loop that calls the function CommunicationServer over and over.

CmiGetState()

When called by a PE-thread, returns the processor-specific state structure for that PE.

CmiGetStateN(int n)

returns processor-specific state structure for the PE of rank n.

CmiMemLock() and CmiMemUnlock()

The memory module calls these functions to obtain mutual exclusion in the memory routines, and to keep interrupts from reentering malloc.

CmiCommLock() and CmiCommUnlock()

These functions lock a mutex that insures mutual exclusion in the communication routines.

CmiMyPe() and CmiMyRank()

The usual. Implemented here, since a highly-optimized version is possible in the nonthreaded case.

FIXME: There is horrible duplication of code (e.g. locking code) both here and in converse.h. It could be much shorter. OSL 9/9/2000

Definition in file machine-smp.c.


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