$PTOLEMY/src/domains/cg/HuScheduler. All classes, except the HuScheduler class in this directory, are derived from the classes for the dynamic level schedulers.
int getLevel();Just returns
StaticLevelof the node.
A HuNode has two private variables to indicate the available time of the node (or the time the node becomes runnable) and the index of the processor on which the node wants to be assigned. The latter is usually set to the index of the processor that its immediate ancestor is assigned. There are five public methods to manipulate these private variables.
int availTime();The first three methods get and set the available time of the node. If no argument is given in
void setAvailTime(int t);
void setPreferredProc(int i);
setAvailTime,the available time is set to the earliest time when all ancestors are completed. The last two methods get and set the index of the processor on which the node is preferred to be scheduled.
EGNode* newNode(DataFlowStar* s, int invoc);Creates a HuNode as a node in the APEG.
void resetNodes();This method resets the variables of the HuNodes: visit flag,
waitNum,the available time, and the index of the preferred processor.
void sortedInsert(EGNodeList& nlist, ParNode* n, int flag);In the ParGraph class, this method sorts the nodes in order of decreasing
StaticLevelof nodes. Now, we redefine it to sort the nodes in order of increasing available time first, and decreasing the static level next.
HuScheduler(MultiTarget* t, const char* log);The constructor has two arguments: one for the multiprocessor target and the other for the log file name.
The HuScheduler class has a pointer to the HuParProcs object that will provide the details of the Hu's level scheduling algorithm.
HuParProcs* parSched;This is the protected member to point to the HuParProcs object. That object is created in the following method:
void setUpProcs(int num);This method first calls
ParScheduler::setUpProcsand next creates a HuParProcs object. The HuParProcs is deallocated in the destructor.
int scheduleIt();The scheduling procedure is exactly same as that of the Dynamic Level Scheduler except that the actual scheduling routines are provided by a HuParProcs object rather than a DLParProcs object. Refer to the
scheduleItmethod of class DLScheduler . Also note that the runnable nodes in this scheduling algorithm are sorted by their available time first.
StringList displaySchedule();Displays the scheduling result textually.
void fireNode(DLNode* n);This redefined protected method sets the available time and index of the preferred processor of the descendants, if they are runnable after node
nis completed. This is done before putting them into the list of runnable nodes (
sortedInsertmethod of the HuGraph class).
void scheduleSmall(DLNode* n);When this method is called, the node
nis one of the earliest runnable nodes. We examine a processor that could schedule the node at the same time as the available time of the node. If the node is at the wormhole boundary, we examine the first processor only. If the node should be assigned to the same processor on which any earlier invocations were already assigned, we examine that processor whether it can schedule the node at that time or not. If no processor is found, we increase the available time of the node to the earliest time when any processor can schedule it, and put the node back into the list of runnable nodes. If we find a processor to schedule the node at the available time of the node, we assign and fire the node, then update the variables of the HuGraph. Recall that no communication overhead is considered.