PPL Logo

arch/util/machine-smp.C File Reference

Common function reimplementation for SMP machines

OS Threads. More...

Go to the source code of this file.

Functions

void CmiStateInit (int pe, int rank, CmiState state)
void CommunicationServerInit (void)
CmiState CmiGetState (void)
void CmiYield (void)
void CommunicationServerThread (int sleepTime)
static DWORD WINAPI call_startfn (LPVOID vindex)
void CmiNodeBarrierCount (int nThreads, uint8_t mode)
static void CmiStartThreads (char **argv)
static void CmiDestroyLocks (void)
void CharmScheduler (void)
CmiNodeLock CmiCreateLock (void)
void CmiDestroyLock (CmiNodeLock lk)
void CmiCommLock (void)
void CmiCommUnlock (void)
void StartInteropScheduler (void)
static void * call_startfn (void *vindex)
void PerrorExit (const char *)
void CmiNodeBarrier (void)
void CmiNodeAllBarrier (void)
static int CmiIdleLock_hasMessage (CmiState cs)
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
CmiNodeLock cmiMemoryLock
static CmiNodeLock comm_mutex
static DWORD Cmi_state_key = 0xFFFFFFFF
static CmiState Cmi_state_vector = 0
static volatile LONG entered_barrier_count [CMI_NUM_NODE_BARRIER_TYPES] = {0}
static volatile LONG exited_barrier_count [CMI_NUM_NODE_BARRIER_TYPES] = {0}
static HANDLE entrance_semaphore [CMI_NUM_NODE_BARRIER_TYPES]
static HANDLE exit_semaphore [CMI_NUM_NODE_BARRIER_TYPES]
int _Cmi_sleepOnIdle = 0
int _Cmi_forceSpinOnIdle = 0
int _cleanUp
static CMK_THREADLOCAL struct
CmiStateStruct 
Cmi_mystate
int barrier = 0
pthread_cond_t barrier_cond = PTHREAD_COND_INITIALIZER
pthread_mutex_t barrier_mutex = PTHREAD_MUTEX_INITIALIZER
static int comm_mutex_isLocked = 0
pthread_t * _Cmi_mypidlist


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 Mon Sep 21 07:56:48 2020 for Charm++ by  doxygen 1.5.5