CharmScheduler

The portion of Charm++ responsible for scheduling the execution of Charm++ entry methods. More...


Files

file  converse.h
 Main Converse header file.
file  modifyScheduler.C
 Routines for modifying the Charm++ prioritized message queue.
file  queueing.c
 Implementation of queuing data structure functions.
file  queueing.h
 Declarations of queuing data structure functions.

Data Structures

struct  prio_struct
 Stores a variable bit length priority. More...
struct  deq_struct
 A double ended queue of void* pointers stored in a circular buffer, with internal space for 4 entries. More...
struct  prioqelt_struct
 A bucket in a priority queue which contains a deque(storing the void* pointers) and references to other buckets in the hash table. More...
struct  prioq_struct
 A priority queue, implemented as a heap of prioqelt_struct buckets (each bucket represents a single priority value and contains a deque of void* pointers). More...
struct  Queue_struct
 A set of 3 queues: a positive priority prioq_struct, a negative priority prioq_struct, and a zero priority deq_struct. More...

Typedefs

typedef struct prio_structprio
typedef struct deq_structdeq
typedef struct prioqelt_structprioqelt
typedef struct prioq_structprioq
typedef struct Queue_structQueue

Functions

int CqsFindRemoveSpecificPrioq (prioq q, void *&msgPtr, const int *entryMethod, const int numEntryMethods)
 Find and remove the first 1 occurences of messages that matches a specified entry method index.
int CqsFindRemoveSpecificDeq (deq q, void *&msgPtr, const int *entryMethod, const int numEntryMethods)
 Find and remove the first 1 occurences of messages that matches a specified entry method index.
void CqsIncreasePriorityForEntryMethod (Queue q, const int entrymethod)
 Search Queue for messages associated with a specified entry method.
void CqsIncreasePriorityForMemCriticalEntries (Queue q)
 Search Queue for messages associated with memory-critical entry methods.
static void CqsDeqInit (deq d)
 Initialize a deq.
static void CqsDeqExpand (deq d)
 Double the size of a deq.
void CqsDeqEnqueueFifo (deq d, void *data)
 Insert a data pointer at the tail of a deq.
void CqsDeqEnqueueLifo (deq d, void *data)
 Insert a data pointer at the head of a deq.
void * CqsDeqDequeue (deq d)
 Remove a data pointer from the head of a deq.
static void CqsPrioqInit (prioq pq)
 Initialize a Priority Queue.
static void CqsPrioqExpand (prioq pq)
 Double the size of a Priority Queue's heap.
void CqsPrioqRehash (prioq pq)
 Double the size of a Priority Queue's hash table.
int CqsPrioGT (prio prio1, prio prio2)
 Compare two priorities (treated as unsigned).
deq CqsPrioqGetDeq (prioq pq, unsigned int priobits, unsigned int *priodata)
 Find or create a bucket in the hash table for the specified priority.
void * CqsPrioqDequeue (prioq pq)
 Dequeue an entry.
Queue CqsCreate (void)
 Initialize a Queue and its three internal queues (for positive, negative, and zero priorities).
void CqsDelete (Queue)
 Delete a Queue.
unsigned int CqsLength (Queue q)
unsigned int CqsMaxLength (Queue q)
int CqsEmpty (Queue q)
void CqsEnqueueGeneral (Queue, void *msg, int strategy, int priobits, unsigned int *prioPtr)
 Enqueue something (usually an envelope*) into the queue in a manner consistent with the specified strategy and priority.
void CqsEnqueueFifo (Queue, void *msg)
 Enqueue behind other elements of priority 0.
void CqsEnqueueLifo (Queue, void *msg)
 Enqueue ahead of other elements of priority 0.
void CqsEnqueue (Queue, void *msg)
 Enqueue with priority 0.
void CqsDequeue (Queue, void **msgPtr)
 Retrieve the highest priority message (one with most negative priority).
prio CqsGetPriority (Queue)
 Get the priority of the highest priority message in q.
void ** CqsEnumerateDeq (deq q, int *num)
 Produce an array containing all the entries in a deq.
void ** CqsEnumeratePrioq (prioq q, int *num)
 Produce an array containing all the entries in a prioq.
void CqsEnumerateQueue (Queue q, void ***resp)
 Produce an array containing all the entries in a Queue.
int CqsRemoveSpecificDeq (deq q, const void *msgPtr)
 Remove first occurence of a specified entry from the deq by setting the entry to NULL.
int CqsRemoveSpecificPrioq (prioq q, const void *msgPtr)
 Remove first occurence of a specified entry from the prioq by setting the entry to NULL.
void CqsRemoveSpecific (Queue, const void *msgPtr)
 Remove an occurence of a specified entry from the Queue by setting its entry to NULL.

Variables

int schedAdaptMemThresholdMB
 A memory limit threshold for adaptively scheduling.
static struct prio_struct kprio_zero = { 0, 0, {0} }
static struct prio_struct kprio_max = { 32, 1, {((unsigned int)(-1))} }
int numMemCriticalEntries = 0
intmemCriticalEntries = NULL
int schedAdaptMemThresholdMB
 A memory limit threshold for adaptively scheduling.

Detailed Description

The portion of Charm++ responsible for scheduling the execution of Charm++ entry methods.

CqsEnqueueGeneral() is the main function that is responsible for enqueueing messages. It will store the messages in one of three queues based on the specified priorities or strategies. The Charm++ message queue is really three queues, one for positive priorities, one for zero priorities, and one for negative priorities. The positive and negative priorty queues are actually heaps.

The charm++ messages are only scheduled after the converse message queues have been emptied:


Typedef Documentation

typedef struct prio_struct * prio

typedef struct deq_struct * deq

typedef struct prioqelt_struct * prioqelt

typedef struct prioq_struct * prioq

typedef struct Queue_struct * Queue


Function Documentation

int CqsFindRemoveSpecificPrioq ( prioq  q,
void *&  msgPtr,
const int entryMethod,
const int  numEntryMethods 
)

Find and remove the first 1 occurences of messages that matches a specified entry method index.

The size of the prioq will not change, it will just contain an entry for a NULL pointer.

Returns:
number of entries that were replaced with NULL
Parameters:
[in] q A priority queue
[out] msgPtr returns the message that was removed from the prioq
[in] entryMethod An array of entry method ids that should be considered for removal
[in] numEntryMethods The number of the values in the entryMethod array.

< An iterator used to iterate through a circular queue

< The end of the circular queue

Definition at line 127 of file modifyScheduler.C.

References prioqelt_struct::data, ForArrayEltMsg, ForChareMsg, envelope::getMsgtype(), envelope::getsetArrayEp(), deq_struct::head, head, prioq_struct::heap, prioq_struct::heapnext, and deq_struct::tail.

Referenced by CqsIncreasePriorityForEntryMethod(), and CqsIncreasePriorityForMemCriticalEntries().

int CqsFindRemoveSpecificDeq ( deq  q,
void *&  msgPtr,
const int entryMethod,
const int  numEntryMethods 
)

Find and remove the first 1 occurences of messages that matches a specified entry method index.

The size of the deq will not change, it will just contain an entry for a NULL pointer.

Returns:
number of entries that were replaced with NULL
Parameters:
[in] q A circular double ended queue
[out] msgPtr returns the message that was removed from the prioq
[in] entryMethod An array of entry method ids that should be considered for removal
[in] numEntryMethods The number of the values in the entryMethod array.

< An iterator used to iterate through the circular queue

Definition at line 84 of file modifyScheduler.C.

References deq_struct::bgn, deq_struct::end, ForArrayEltMsg, ForChareMsg, envelope::getMsgtype(), envelope::getsetArrayEp(), deq_struct::head, and deq_struct::tail.

Referenced by CqsIncreasePriorityForEntryMethod(), and CqsIncreasePriorityForMemCriticalEntries().

void CqsIncreasePriorityForEntryMethod ( Queue  q,
const int  entrymethod 
)

Search Queue for messages associated with a specified entry method.

Definition at line 22 of file modifyScheduler.C.

References CqsEnqueueGeneral(), CqsFindRemoveSpecificDeq(), CqsFindRemoveSpecificPrioq(), Queue_struct::negprioq, Queue_struct::posprioq, traceUserSuppliedNote(), and Queue_struct::zeroprio.

void CqsIncreasePriorityForMemCriticalEntries ( Queue  q  ) 

static void CqsDeqInit ( deq  d  )  [static]

Initialize a deq.

Definition at line 52 of file queueing.c.

References deq_struct::bgn, deq_struct::end, deq_struct::head, deq_struct::space, and deq_struct::tail.

Referenced by CqsCreate(), and CqsPrioqGetDeq().

static void CqsDeqExpand ( deq  d  )  [static]

Double the size of a deq.

Definition at line 61 of file queueing.c.

References deq_struct::bgn, CmiAlloc(), CmiFree(), deq_struct::end, deq_struct::head, deq_struct::space, and deq_struct::tail.

Referenced by CqsDeqEnqueueFifo(), and CqsDeqEnqueueLifo().

void CqsDeqEnqueueFifo ( deq  d,
void *  data 
)

Insert a data pointer at the tail of a deq.

Definition at line 79 of file queueing.c.

References deq_struct::bgn, CqsDeqExpand(), deq_struct::end, deq_struct::head, and deq_struct::tail.

Referenced by CqsEnqueue(), CqsEnqueueFifo(), and CqsEnqueueGeneral().

void CqsDeqEnqueueLifo ( deq  d,
void *  data 
)

Insert a data pointer at the head of a deq.

Definition at line 90 of file queueing.c.

References deq_struct::bgn, CqsDeqExpand(), deq_struct::end, deq_struct::head, head, and deq_struct::tail.

Referenced by CqsEnqueueGeneral(), and CqsEnqueueLifo().

void* CqsDeqDequeue ( deq  d  ) 

Remove a data pointer from the head of a deq.

Definition at line 101 of file queueing.c.

References deq_struct::bgn, data, deq_struct::end, deq_struct::head, head, and deq_struct::tail.

Referenced by CqsDequeue(), and CqsPrioqDequeue().

static void CqsPrioqInit ( prioq  pq  )  [static]

static void CqsPrioqExpand ( prioq  pq  )  [inline, static]

Double the size of a Priority Queue's heap.

Definition at line 133 of file queueing.c.

References CmiAlloc(), CmiFree(), prioq_struct::heap, and prioq_struct::heapsize.

Referenced by CqsPrioqGetDeq().

void CqsPrioqRehash ( prioq  pq  ) 

Double the size of a Priority Queue's hash table.

Definition at line 146 of file queueing.c.

References prio_struct::bits, CmiAlloc(), CmiFree(), prio_struct::data, prioqelt_struct::ht_handle, prioqelt_struct::ht_next, prio_struct::ints, and prioqelt_struct::pri.

Referenced by CqsPrioqGetDeq().

int CqsPrioGT ( prio  prio1,
prio  prio2 
)

Compare two priorities (treated as unsigned).

Returns:
1 if prio1 > prio2

? if prio1 == prio2

0 if prio1 < prio2

Definition at line 190 of file queueing.c.

References prio_struct::data, and prio_struct::ints.

Referenced by CqsPrioqDequeue(), CqsPrioqGetDeq(), and CsdNextMessage().

deq CqsPrioqGetDeq ( prioq  pq,
unsigned int  priobits,
unsigned int priodata 
)

void* CqsPrioqDequeue ( prioq  pq  ) 

Queue CqsCreate ( void   ) 

Initialize a Queue and its three internal queues (for positive, negative, and zero priorities).

Definition at line 539 of file queueing.c.

References CmiAlloc(), CqsDeqInit(), CqsPrioqInit(), Queue_struct::length, Queue_struct::maxlen, Queue_struct::negprioq, Queue_struct::posprioq, and Queue_struct::zeroprio.

Referenced by _messageLoggingInit(), CkObjectMsgQ::create(), and CsdInit().

void CqsDelete ( Queue  q  ) 

Delete a Queue.

Definition at line 553 of file queueing.c.

References CmiFree(), prioq_struct::heap, Queue_struct::negprioq, and Queue_struct::posprioq.

Referenced by CkObjectMsgQ::~CkObjectMsgQ().

unsigned int CqsLength ( Queue  q  ) 

Definition at line 560 of file queueing.c.

References Queue_struct::length.

Referenced by CldLoadRank(), getSchedQlen(), CkObjectMsgQ::length(), and retryTicketRequest().

unsigned int CqsMaxLength ( Queue  q  ) 

Definition at line 565 of file queueing.c.

References Queue_struct::maxlen.

int CqsEmpty ( Queue  q  ) 

void CqsEnqueueGeneral ( Queue  q,
void *  data,
int  strategy,
int  priobits,
unsigned int prioptr 
)

void CqsEnqueueFifo ( Queue  q,
void *  data 
)

Enqueue behind other elements of priority 0.

Definition at line 655 of file queueing.c.

References CqsDeqEnqueueFifo(), Queue_struct::length, Queue_struct::maxlen, and Queue_struct::zeroprio.

void CqsEnqueueLifo ( Queue  q,
void *  data 
)

Enqueue ahead of other elements of priority 0.

Definition at line 661 of file queueing.c.

References CqsDeqEnqueueLifo(), Queue_struct::length, Queue_struct::maxlen, and Queue_struct::zeroprio.

void CqsEnqueue ( Queue  q,
void *  data 
)

Enqueue with priority 0.

Definition at line 667 of file queueing.c.

References CqsDeqEnqueueFifo(), Queue_struct::length, Queue_struct::maxlen, and Queue_struct::zeroprio.

Referenced by preProcessReceivedMessage().

void CqsDequeue ( Queue  q,
void **  resp 
)

prio CqsGetPriority ( Queue  q  ) 

Get the priority of the highest priority message in q.

Definition at line 697 of file queueing.c.

References deq_struct::head, prioq_struct::heap, prioq_struct::heapnext, Queue_struct::negprioq, Queue_struct::posprioq, prioqelt_struct::pri, deq_struct::tail, and Queue_struct::zeroprio.

Referenced by CsdNextMessage().

void** CqsEnumerateDeq ( deq  q,
int num 
)

Produce an array containing all the entries in a deq.

Returns:
a newly allocated array filled with copies of the (void*) elements in the deq.
Parameters:
[in] q a deq
[out] num the number of pointers in the returned array

Definition at line 718 of file queueing.c.

References deq_struct::bgn, CmiAlloc(), deq_struct::end, deq_struct::head, head, and deq_struct::tail.

Referenced by CqsEnumerateQueue().

void** CqsEnumeratePrioq ( prioq  q,
int num 
)

Produce an array containing all the entries in a prioq.

Returns:
a newly allocated array filled with copies of the (void*) elements in the prioq.
Parameters:
[in] q a deq
[out] num the number of pointers in the returned array

Definition at line 754 of file queueing.c.

References CmiAlloc(), prioqelt_struct::data, deq_struct::head, head, prioq_struct::heap, prioq_struct::heapnext, and deq_struct::tail.

Referenced by CqsEnumerateQueue().

void CqsEnumerateQueue ( Queue  q,
void ***  resp 
)

Produce an array containing all the entries in a Queue.

Returns:
a newly allocated array filled with copies of the (void*) elements in the Queue.
Parameters:
[in] q a Queue
[out] resp an array of pointer entries found in the Queue, with as many entries as the Queue's length. The caller must CmiFree this.

Definition at line 793 of file queueing.c.

References CmiAlloc(), CmiFree(), CqsEnumerateDeq(), CqsEnumeratePrioq(), Queue_struct::length, Queue_struct::negprioq, Queue_struct::posprioq, and Queue_struct::zeroprio.

int CqsRemoveSpecificDeq ( deq  q,
const void *  msgPtr 
)

Remove first occurence of a specified entry from the deq by setting the entry to NULL.

The size of the deq will not change, it will now just contain an entry for a NULL pointer.

Returns:
number of entries that were replaced with NULL

Definition at line 832 of file queueing.c.

References deq_struct::bgn, deq_struct::end, deq_struct::head, head, and deq_struct::tail.

Referenced by CqsRemoveSpecific().

int CqsRemoveSpecificPrioq ( prioq  q,
const void *  msgPtr 
)

Remove first occurence of a specified entry from the prioq by setting the entry to NULL.

The size of the prioq will not change, it will now just contain an entry for a NULL pointer.

Returns:
number of entries that were replaced with NULL

Definition at line 860 of file queueing.c.

References prioqelt_struct::data, deq_struct::head, head, prioq_struct::heap, prioq_struct::heapnext, and deq_struct::tail.

Referenced by CqsRemoveSpecific().

void CqsRemoveSpecific ( Queue  ,
const void *  msgPtr 
)

Remove an occurence of a specified entry from the Queue by setting its entry to NULL.

The size of the Queue will not change, it will now just contain an entry for a NULL pointer.

Definition at line 884 of file queueing.c.

References CmiPrintf(), CqsRemoveSpecificDeq(), CqsRemoveSpecificPrioq(), Queue_struct::negprioq, Queue_struct::posprioq, and Queue_struct::zeroprio.


Variable Documentation

A memory limit threshold for adaptively scheduling.

Definition at line 48 of file queueing.c.

struct prio_struct kprio_zero = { 0, 0, {0} } [static]

Definition at line 694 of file queueing.c.

struct prio_struct kprio_max = { 32, 1, {((unsigned int)(-1))} } [static]

Definition at line 695 of file queueing.c.

Definition at line 893 of file queueing.c.

Referenced by _initCharm(), CkRegisterEp(), and CqsIncreasePriorityForMemCriticalEntries().

Definition at line 894 of file queueing.c.

Referenced by _initCharm(), and CqsIncreasePriorityForMemCriticalEntries().

A memory limit threshold for adaptively scheduling.

Definition at line 48 of file queueing.c.


Generated on Mon Nov 23 07:56:03 2009 for Charm++ by  doxygen 1.5.5