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_struct * | prio |
| typedef struct deq_struct * | deq |
| typedef struct prioqelt_struct * | prioqelt |
| typedef struct prioq_struct * | prioq |
| typedef struct Queue_struct * | Queue |
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 |
| int * | memCriticalEntries = NULL |
| int | schedAdaptMemThresholdMB |
| A memory limit threshold for adaptively scheduling. | |
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 struct prio_struct * prio |
| typedef struct deq_struct * deq |
| typedef struct prioqelt_struct * prioqelt |
| typedef struct prioq_struct * prioq |
| typedef struct Queue_struct * Queue |
| 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.
| [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.
| [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().
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 | ) |
Search Queue for messages associated with memory-critical entry methods.
Definition at line 50 of file modifyScheduler.C.
References CqsEnqueueGeneral(), CqsFindRemoveSpecificDeq(), CqsFindRemoveSpecificPrioq(), memCriticalEntries, Queue_struct::negprioq, numMemCriticalEntries, Queue_struct::posprioq, traceUserSuppliedNote(), and Queue_struct::zeroprio.
Referenced by CqsDequeue().
| 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] |
Initialize a Priority Queue.
Definition at line 117 of file queueing.c.
References CmiAlloc(), prioq_struct::hash_entry_size, prioq_struct::hash_key_size, prioq_struct::hashtab, prioq_struct::heap, prioq_struct::heapnext, and prioq_struct::heapsize.
Referenced by CqsCreate().
| 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().
Compare two priorities (treated as unsigned).
? 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().
Find or create a bucket in the hash table for the specified priority.
Definition at line 229 of file queueing.c.
References prio_struct::bits, CmiAlloc(), CqsDeqInit(), CqsPrioGT(), CqsPrioqExpand(), CqsPrioqRehash(), prioqelt_struct::data, prio_struct::data, prioq_struct::hash_entry_size, prioq_struct::hash_key_size, prioq_struct::hashtab, prioq_struct::heap, prioq_struct::heapnext, prioq_struct::heapsize, prioqelt_struct::ht_handle, prioqelt_struct::ht_left, prioqelt_struct::ht_next, prioqelt_struct::ht_parent, prioqelt_struct::ht_right, parent, and prioqelt_struct::pri.
Referenced by CqsEnqueueGeneral().
| void* CqsPrioqDequeue | ( | prioq | pq | ) |
Dequeue an entry.
Definition at line 343 of file queueing.c.
References deq_struct::bgn, CmiFree(), CqsDeqDequeue(), CqsPrioGT(), prioqelt_struct::data, data, prioq_struct::hash_entry_size, deq_struct::head, prioq_struct::heap, prioq_struct::heapnext, prioqelt_struct::ht_handle, prioqelt_struct::ht_left, prioqelt_struct::ht_next, prioqelt_struct::ht_parent, prioqelt_struct::ht_right, prioqelt_struct::pri, deq_struct::space, and deq_struct::tail.
Referenced by CqsDequeue().
| 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().
Definition at line 560 of file queueing.c.
References Queue_struct::length.
Referenced by CldLoadRank(), getSchedQlen(), CkObjectMsgQ::length(), and retryTicketRequest().
Definition at line 570 of file queueing.c.
References Queue_struct::length.
Referenced by CmiNotifyStillIdle(), CsdNextMessage(), preProcessReceivedMessage(), and PumpMsgsBlocking().
Enqueue something (usually an envelope*) into the queue in a manner consistent with the specified strategy and priority.
Definition at line 575 of file queueing.c.
References CmiAbort(), CmiEndianness(), CqsDeqEnqueueFifo(), CqsDeqEnqueueLifo(), CqsPrioqGetDeq(), Queue_struct::length, Queue_struct::maxlen, Queue_struct::negprioq, Queue_struct::posprioq, and Queue_struct::zeroprio.
Referenced by _enqObjQueue(), _ObjectQHandler(), _skipCldEnqueue(), _skipCldHandler(), CqsIncreasePriorityForEntryMethod(), CqsIncreasePriorityForMemCriticalEntries(), preProcessReceivedMessage(), and resendMessageForChare().
| 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 | |||
| ) |
Retrieve the highest priority message (one with most negative priority).
Definition at line 673 of file queueing.c.
References CmiMemoryUsage(), CqsDeqDequeue(), CqsIncreasePriorityForMemCriticalEntries(), CqsPrioqDequeue(), deq_struct::head, prioq_struct::heapnext, Queue_struct::length, Queue_struct::negprioq, Queue_struct::posprioq, deq_struct::tail, and Queue_struct::zeroprio.
Referenced by CsdNextMessage(), preProcessReceivedMessage(), and CkObjectMsgQ::process().
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().
Produce an array containing all the entries in a deq.
| [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().
Produce an array containing all the entries in a prioq.
| [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.
| [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.
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.
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().
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.
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.
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().
| int* memCriticalEntries = NULL |
Definition at line 894 of file queueing.c.
Referenced by _initCharm(), and CqsIncreasePriorityForMemCriticalEntries().
1.5.5