arch/shmem/machine.c File Reference

Shared memory machine layer. More...

Go to the source code of this file.

Data Structures

struct  McDistListS
struct  McMsgHdrS
struct  McQueueS
struct  McMultiMsg
enum  boolean { false = 0, true = 1, false = 0, true = 1 }
enum  { list_empty = -1 }
int _Cmi_mype
int _Cmi_numpes
int _Cmi_myrank
static McQueuein_transit_queue
static McQueuein_transit_tmp_queue
static McQueuetmp_queue
static McQueuereceived_queue
static McQueuereceived_token_queue
static McQueuebroadcast_queue
static McQueuebroadcast_tmp_queue
static McDistList head
static long * my_lock
static long head_lock [MAX_PES]
static long bcast_lock [MAX_PES]
int inside_comm = 0
static double clocktick
static long inittime_wallclock
static long inittime_virtual
static volatile int memflag
typedef McDistListS McDistList
typedef McMsgHdrS McMsgHdr
typedef McQueueS McQueue
 CpvDeclare (void *, CmiLocalQueue)
static void McInit ()
static void McInitList ()
static void McEnqueueRemote (void *msg, int msg_sz, int dst_pe)
static void McRetrieveRemote (void)
static void McCleanUpInTransit (void)
static McQueueMcQueueCreate (void)
static void McQueueAddToBack (McQueue *queue, void *element)
static void * McQueueRemoveFromFront (McQueue *queue)
static void * McQueueRemoveFromBack (McQueue *queue)
int McChecksum (char *msg, int size)
void CmiSyncSendFn (int dest_pe, int size, char *msg)
CmiCommHandle CmiAsyncSendFn (int dest_pe, int size, char *msg)
void CmiFreeSendFn (int dest_pe, int size, char *msg)
void CmiSyncBroadcastFn (int size, char *msg)
CmiCommHandle CmiAsyncBroadcastFn (int size, char *msg)
void CmiFreeBroadcastFn (int size, char *msg)
void CmiSyncBroadcastAllFn (int size, char *msg)
CmiCommHandle CmiAsyncBroadcastAllFn (int size, char *msg)
void CmiFreeBroadcastAllFn (int size, char *msg)
void CmiSyncListSendFn (int npes, int *pes, int size, char *msg)
CmiCommHandle CmiAsyncListSendFn (int npes, int *pes, int size, char *msg)
void CmiFreeListSendFn (int npes, int *pes, int size, char *msg)
 CpvDeclare (int, McMulticastWaitHandler)
void CmiSyncMulticastFn (CmiGroup grp, int size, char *msg)
void McMulticastWaitFn (McMultiMsg *msg)
void CmiMulticastInit (void)
CmiCommHandle CmiAsyncMulticastFn (CmiGroup grp, int size, char *msg)
void CmiFreeMulticastFn (CmiGroup grp, int size, char *msg)
void CmiAbort (const char *message)
 Serial version of common Charm++ routines:.
void * CmiGetNonLocal ()
void ConverseInit (int argc, char **argv, CmiStartFn fn, int usched, int initret)
void ConverseExit ()
void CmiNotifyIdle (void)
void set_lock (long *lock, int pe)
void clear_lock (long *lock, int pe)
static void ** McQueueAllocBlock (unsigned int len)
static void McQueueSpillBlock (void **srcblk, void **destblk, unsigned int first, unsigned int len)
void CmiTimerInit ()
double CmiWallTimer ()
double CmiCpuTimer ()
double CmiTimer ()
 CpvStaticDeclare (double, inittime_wallclock)
 CpvStaticDeclare (double, inittime_virtual)
void CmiMemLock ()
void CmiMemUnlock ()


Detailed Description

Shared memory machine layer.

This is a complete port, but could be made considerably more efficient by handling asynchronous messages correctly, ie. without doing an extra copy and synchronous send

Definition in file machine.c.


Typedef Documentation

typedef struct McDistListS McDistList

typedef struct McMsgHdrS McMsgHdr

typedef struct McQueueS McQueue


Enumeration Type Documentation

enum boolean

Enumerator:
false 
true 
false 
true 

Definition at line 36 of file machine.c.

anonymous enum

Enumerator:
list_empty 

Definition at line 37 of file machine.c.


Function Documentation

CpvDeclare ( void *  ,
CmiLocalQueue   
)

static void McInit (  )  [static]

Definition at line 523 of file machine.c.

References _Cmi_mype, _Cmi_myrank, _Cmi_numpes, CdsFifo_Create(), and McInitList().

Referenced by ConverseInit().

static void McInitList (  )  [static]

Definition at line 536 of file machine.c.

References _Cmi_mype, _Cmi_numpes, bcast_lock, broadcast_queue, broadcast_tmp_queue, CmiPrintf(), head, head_lock, in_transit_queue, in_transit_tmp_queue, list_empty, McQueueCreate(), McDistListS::msg_sz, my_lock, McDistListS::nxt_addr, McDistListS::nxt_node, received_queue, received_token_queue, and tmp_queue.

Referenced by McInit().

static void McEnqueueRemote ( void *  msg,
int  msg_sz,
int  dst_pe 
) [static]

Definition at line 570 of file machine.c.

References _Cmi_mype, clear_lock(), head, head_lock, in_transit_queue, McCleanUpInTransit(), McQueueAddToBack(), McDistListS::msg_sz, McDistListS::nxt_addr, McDistListS::nxt_node, printf(), and set_lock().

Referenced by CmiFreeSendFn(), CmiSyncBroadcastFn(), CmiSyncListSendFn(), and CmiSyncSendFn().

static void McRetrieveRemote ( void   )  [static]

Definition at line 635 of file machine.c.

References _Cmi_mype, McMsgHdrS::bcast, bcast_lock, clear_lock(), CmiAlloc(), CmiError(), CmiFree(), head, list_empty, McQueueAddToBack(), McQueueRemoveFromBack(), McDistListS::msg_sz, my_lock, McDistListS::nxt_addr, McDistListS::nxt_node, McMsgHdrS::ptr, McMsgHdrS::received_f, received_queue, received_token_queue, set_lock(), and tmp_queue.

Referenced by CmiFreeSendFn(), CmiGetNonLocal(), and CmiSyncSendFn().

static void McCleanUpInTransit ( void   )  [static]

Definition at line 757 of file machine.c.

References _Cmi_mype, McMsgHdrS::bcast, broadcast_queue, broadcast_tmp_queue, CmiFree(), CmiPrintf(), McMsgHdrS::count, in_transit_queue, in_transit_tmp_queue, McQueue::len, McQueueAddToBack(), McQueueRemoveFromFront(), and McMsgHdrS::received_f.

Referenced by CmiNotifyIdle(), and McEnqueueRemote().

static McQueue * McQueueCreate ( void   )  [static]

Definition at line 842 of file machine.c.

References abort(), McQueue::blk, McQueue::blk_len, CmiError(), McQueue::first, McQueue::len, malloc(), and McQueueAllocBlock().

static void McQueueAddToBack ( McQueue queue,
void *  element 
) [static]

Definition at line 860 of file machine.c.

References _Cmi_mype, McQueue::blk, McQueue::blk_len, CmiPrintf(), McQueue::first, free(), inside_comm, McQueue::len, McQueueAllocBlock(), and McQueueSpillBlock().

static void * McQueueRemoveFromFront ( McQueue queue  )  [static]

Definition at line 891 of file machine.c.

References McQueue::blk, McQueue::blk_len, McQueue::first, and McQueue::len.

static void * McQueueRemoveFromBack ( McQueue queue  )  [static]

Definition at line 880 of file machine.c.

References McQueue::blk, McQueue::blk_len, McQueue::first, and McQueue::len.

Referenced by McRetrieveRemote().

int McChecksum ( char *  msg,
int  size 
)

Definition at line 157 of file machine.c.

References size.

void CmiSyncSendFn ( int  dest_pe,
int  size,
char *  msg 
)

Definition at line 178 of file machine.c.

References _Cmi_mype, CdsFifo_Enqueue(), CmiAlloc(), CQdCreate(), McEnqueueRemote(), McRetrieveRemote(), McMsgHdrS::msg_type, and size.

CmiCommHandle CmiAsyncSendFn ( int  dest_pe,
int  size,
char *  msg 
)

Definition at line 197 of file machine.c.

References CmiSyncSendFn(), and size.

void CmiFreeSendFn ( int  dest_pe,
int  size,
char *  msg 
)

Definition at line 203 of file machine.c.

References _Cmi_mype, CdsFifo_Enqueue(), CQdCreate(), McEnqueueRemote(), McRetrieveRemote(), and size.

void CmiSyncBroadcastFn ( int  size,
char *  msg 
)

Definition at line 218 of file machine.c.

References _Cmi_mype, _Cmi_numpes, McMsgHdrS::bcast, McMsgHdrS::bcast_msg_size, broadcast_queue, CmiAlloc(), McMsgHdrS::count, CQdCreate(), McEnqueueRemote(), McQueueAddToBack(), McMsgHdrS::msg_type, McMsgHdrS::ptr, and size.

CmiCommHandle CmiAsyncBroadcastFn ( int  size,
char *  msg 
)

Definition at line 264 of file machine.c.

References CmiSyncBroadcastFn(), and size.

void CmiFreeBroadcastFn ( int  size,
char *  msg 
)

Definition at line 270 of file machine.c.

References CmiFree(), CmiSyncBroadcastFn(), and size.

void CmiSyncBroadcastAllFn ( int  size,
char *  msg 
)

Definition at line 276 of file machine.c.

References _Cmi_mype, CmiSyncBroadcastFn(), CmiSyncSendFn(), and size.

CmiCommHandle CmiAsyncBroadcastAllFn ( int  size,
char *  msg 
)

Definition at line 283 of file machine.c.

References CmiSyncBroadcastAllFn(), and size.

void CmiFreeBroadcastAllFn ( int  size,
char *  msg 
)

Definition at line 289 of file machine.c.

References CmiFree(), CmiSyncBroadcastAllFn(), and size.

CpvDeclare ( int  ,
McMulticastWaitHandler   
)

void McMulticastWaitFn ( McMultiMsg msg  ) 

Definition at line 408 of file machine.c.

References CmiFreeMulticastFn(), McMultiMsg::grp, McMultiMsg::size, and McMultiMsg::user_msg.

Referenced by CmiMulticastInit().

void CmiMulticastInit ( void   ) 

Definition at line 413 of file machine.c.

References CmiRegisterHandler(), and McMulticastWaitFn().

void CmiAbort ( const char *  message  ) 

Serial version of common Charm++ routines:.

Currently only used for FEM_ALONE mode.

Orion Sky Lawlor, olawlor@acm.org, 2003/8/15

Definition at line 438 of file machine.c.

References CmiError().

void* CmiGetNonLocal ( void   ) 

Definition at line 453 of file machine.c.

References McQueueRemoveFromFront(), McRetrieveRemote(), and received_queue.

void ConverseInit ( int  argc,
char **  argv,
CmiStartFn  fn,
int  usched,
int  initret 
)

Definition at line 461 of file machine.c.

References ConverseCommonInit(), ConverseExit(), CsdScheduler(), CthInit(), and McInit().

void ConverseExit ( void   ) 

Definition at line 475 of file machine.c.

References CmiMyPe(), CmiPrintf(), and ConverseCommonExit().

void set_lock ( long *  lock,
int  pe 
)

Definition at line 497 of file machine.c.

Referenced by McEnqueueRemote(), and McRetrieveRemote().

void clear_lock ( long *  lock,
int  pe 
)

Definition at line 505 of file machine.c.

Referenced by McEnqueueRemote(), and McRetrieveRemote().

static void** McQueueAllocBlock ( unsigned int  len  )  [static]

Definition at line 822 of file machine.c.

References abort(), CmiError(), and malloc().

Referenced by McQueueAddToBack(), and McQueueCreate().

static void McQueueSpillBlock ( void **  srcblk,
void **  destblk,
unsigned int  first,
unsigned int  len 
) [static]

Definition at line 835 of file machine.c.

Referenced by McQueueAddToBack().

CpvStaticDeclare ( double  ,
inittime_wallclock   
)

CpvStaticDeclare ( double  ,
inittime_virtual   
)

void CmiMemLock ( void   ) 

Definition at line 991 of file machine.c.

References memflag.

void CmiMemUnlock ( void   ) 

Definition at line 992 of file machine.c.

References memflag.


Variable Documentation

int _Cmi_mype

Definition at line 44 of file machine.c.

int _Cmi_numpes

Definition at line 45 of file machine.c.

int _Cmi_myrank

Definition at line 46 of file machine.c.

McQueue* in_transit_queue [static]

Definition at line 123 of file machine.c.

Referenced by McCleanUpInTransit(), McEnqueueRemote(), and McInitList().

McQueue* in_transit_tmp_queue [static]

Definition at line 124 of file machine.c.

Referenced by McCleanUpInTransit(), and McInitList().

McQueue* tmp_queue [static]

Definition at line 127 of file machine.c.

Referenced by McInitList(), and McRetrieveRemote().

McQueue* received_queue [static]

Definition at line 132 of file machine.c.

Referenced by CmiGetNonLocal(), McInitList(), and McRetrieveRemote().

McQueue* received_token_queue [static]

Definition at line 137 of file machine.c.

Referenced by McInitList(), and McRetrieveRemote().

McQueue* broadcast_queue [static]

Definition at line 142 of file machine.c.

Referenced by CmiSyncBroadcastFn(), CmiSyncListSendFn(), McCleanUpInTransit(), and McInitList().

McQueue* broadcast_tmp_queue [static]

Definition at line 143 of file machine.c.

Referenced by McCleanUpInTransit(), and McInitList().

McDistList head [static]

Definition at line 148 of file machine.c.

Referenced by ImageData::AddImage(), ImageData::ConstructImage(), CqsDeqDequeue(), CqsDeqEnqueueLifo(), CqsEnumerateDeq(), CqsEnumeratePrioq(), splitter::createMesh(), EnqueueOutgoingDgram(), McEnqueueRemote(), McInitList(), McRetrieveRemote(), MMDOrder(), ReceiveDatagram(), TransmitAckDatagram(), TransmitImplicitDgram(), and TransmitImplicitDgram1().

long* my_lock [static]

Definition at line 151 of file machine.c.

Referenced by McInitList(), and McRetrieveRemote().

long head_lock[MAX_PES] [static]

Definition at line 152 of file machine.c.

Referenced by McEnqueueRemote(), and McInitList().

long bcast_lock[MAX_PES] [static]

Definition at line 153 of file machine.c.

Referenced by McInitList(), and McRetrieveRemote().

int inside_comm = 0

Definition at line 858 of file machine.c.

double clocktick [static]

Definition at line 907 of file machine.c.

long inittime_wallclock [static]

Definition at line 908 of file machine.c.

long inittime_virtual [static]

Definition at line 909 of file machine.c.

Referenced by CmiCpuTimer(), and CmiTimerInit().

volatile int memflag [static]

Definition at line 990 of file machine.c.

Referenced by CmiMemLock(), CmiMemUnlock(), and KillOnAllSigs().


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