- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# AlpsKnowledgeBrokerMPI Class Reference

`#include <AlpsKnowledgeBrokerMPI.h>`

Inheritance diagram for AlpsKnowledgeBrokerMPI:

[legend]
Collaboration diagram for AlpsKnowledgeBrokerMPI:

[legend]
List of all members.

## Public Member Functions
| AlpsKnowledgeBrokerMPI ()
| Default construtor.
| AlpsKnowledgeBrokerMPI (int argc, char *argv[], AlpsModel &model)
| Useful construtor.
| ~AlpsKnowledgeBrokerMPI ()
| Destructor.
virtual int | getProcRank () const
| Query the global rank of the process.
virtual int | getMasterRank () const
| Query the global rank of the Master.
virtual AlpsProcessType | getProcType () const
| Query the type (master, hub, or worker) of the process.
void | initializeSearch (int argc, char *argv[], AlpsModel &model)
| This function.
void | search (AlpsModel *model)
| Search best solution for a given model.
void | rootSearch (AlpsTreeNode *root)
| This function.
Report search results.
virtual double | getIncumbentValue () const
| The process queries the quality of the incumbent this process stores.
virtual double | getBestQuality () const
| The master queries the quality of the best solution it knowns.
virtual double | getBestEstimateQuality ()
| Get best estimalted quality in system.
virtual void | printBestSolution (char *outputFile=0) const
| Master prints out the best solution that it knows.
virtual void | searchLog ()
| Log search statistics.
Knowledge sharing functions
void | sendKnowledge (AlpsKnowledgeType type, int sender, int receiver, char *&msgBuffer, int msgSize, int msgTag, MPI_Comm comm, bool blocking)
| Set knowlege.
void | receiveKnowledge (AlpsKnowledgeType type, int sender, int receiver, char *&msgBuffer, int msgSize, int msgTag, MPI_Comm comm, MPI_Status *status, bool blocking)
| Receive knowlege.
void | requestKnowledge (AlpsKnowledgeType type, int sender, int receiver, char *&msgBuffer, int msgSize, int msgTag, MPI_Comm comm, bool blocking)
| Request knowlege.
## Protected Member Functions
void | init ()
| Initialize member data.
AlpsReturnStatus | doOneUnitWork (int unitWork, double unitTime, AlpsExitStatus &exitStatus, int &numNodesProcessed, int &depth, bool &betterSolution)
| Explore a subtree from subtree pool for certain units of work/time.
void | processMessages (char *&buffer, MPI_Status &status, MPI_Request &request)
| Processing messages.
void | rootInitMaster (AlpsTreeNode *root)
| Static load balancing: Root Initialization.
void | rootInitHub ()
void | rootInitWorker ()
void | spiralMaster (AlpsTreeNode *root)
| Static load balancing: spiral.
void | spiralHub ()
void | spiralWorker ()
void | deleteSubTrees ()
| Delete subTrees in pools and the active subtree.
void | forwardModelKnowledge ()
void | sendModelKnowledge (MPI_Comm comm, int receiver=-1)
| Set generated knowlege (related to model) to receiver.
void | receiveModelKnowledge (MPI_Comm comm)
| Receive generated knowlege (related to model) from sender.
void | masterForceHubTerm ()
| Master tell hubs to terminate due to reaching limits or other reason.
void | hubForceWorkerTerm ()
| Hub tell workers to terminate due to reaching limits or other reason.
void | changeWorkingSubTree (double &changeWorkThreshold)
| Change subtree to be explored if it is too worse.
void | sendErrorCodeToMaster (int errorCode)
| Send error code to master.
void | recvErrorCode (char *&bufLarge)
| Receive error code and set solution status.
void | spiralRecvProcessNode ()
| Unpack the node, explore it and send load info to master.
void | spiralDonateNode ()
| Unpack msg and donate a node.
Core member functions for master, hubs and workers.
void | masterMain (AlpsTreeNode *root)
| Master generates subtrees and sends them to hubs in Round-Robin way.
void | hubMain ()
| Hub generates subtrees and sends them to workers in Round-Robin way.
void | workerMain ()
| Worker first receive subtrees, then start to explore them.
Load balancing member functions
void | masterAskHubDonate (int donorID, int receiverID, double receiverWorkload)
| Master asks a hub to donate its workload to another hub.
void | hubAskWorkerDonate (int donorID, int receiverID, double receiverWorkload)
| Hub asks a worker to donate its workload to another worker.
void | updateWorkloadInfo ()
| Calculate the work quality and quantity on this process.
virtual int | getNumNodeLeftSystem ()
| Master asks a hub to donate its workload to another hub.
void | donateWork (char *&buf, int tag, MPI_Status *status, int recvID=-1, double recvWL=0.0)
| A worker donate its workload to the specified worker.
void | hubAllocateDonation (char *&buf, MPI_Status *status)
| Hub allocates the donated workload to its workers.
void | hubBalanceWorkers ()
| Hub balances the workloads of its workers.
void | hubSatisfyWorkerRequest (char *&buf, MPI_Status *status)
| Hub satisfies the workload rquest from a worker.
void | hubReportStatus (int tag, MPI_Comm comm)
| A hub reports its status (workload and msg counts) to the master.
void | hubUpdateCluStatus (char *&buf, MPI_Status *status, MPI_Comm comm)
| A hub unpacks the status of a worker from buffer.
void | hubsShareWork (char *&buf, MPI_Status *status)
| Two hubs share their workload.
void | masterBalanceHubs ()
| Master balance the workload of hubs.
void | masterUpdateSysStatus (char *&buf, MPI_Status *status, MPI_Comm comm)
| Master unpack the status of a hub from buf and update system status.
void | refreshSysStatus ()
| The master re-calculate the system status.
void | refreshClusterStatus ()
| A hub adds its status to the cluster's status.
void | workerReportStatus (int tag, MPI_Comm comm)
| A worker report its status (workload and msg counts) to its hub.
Node index functions // msg counts is modified inside
void | workerAskIndices ()
| A worker ask for node index from master.
void | workerRecvIndices (char *&bufLarge)
| A worker receive node index from master.
void | masterSendIndices (char *&bufLarge)
| Master send a batch of node indices to the receiving worker.
Other message passing member functions
void | broadcastModel (const int id, const int source)
| Broadcast the model from source to other processes.
void | sendIncumbent ()
| Sent the incumbent value and rank to its two child if eixt.
bool | unpackSetIncumbent (char *&buf, MPI_Status *status)
| unpack the incumbent value, then store it and the id of the process having the incumbent in AlpsDataPool.
void | collectBestSolution (int destination)
| Send the best solution from the process having it to destination.
void | tellMasterRecv ()
| Inform master that a proc has received workload during a load balance initialized by master.
void | tellHubRecv ()
| Inform hub that a proc has received workload during a load balance initialized by a hub.
void | packEncoded (AlpsEncoded *enc, char *&buf, int &size, int &position, MPI_Comm comm)
| Pack an AlpsEncoded instance into buf.
AlpsEncoded * | unpackEncoded (char *&buf, int &position, MPI_Comm comm, int size=-1)
| Unpack the given buffer into an AlpsEncoded instance.
void | receiveSizeBuf (char *&buf, int sender, int tag, MPI_Comm comm, MPI_Status *status)
| Receive the size of buffer, allocate memory for buffer, then receive the message and put it in buffer.
void | receiveRampUpNode (int sender, MPI_Comm comm, MPI_Status *status)
| First receive the size and the contend of a node, then construct a subtree with this received node.
void | receiveSubTree (char *&buf, int sender, MPI_Status *status)
| Receive a subtree from the sender process and add it into the subtree pool.
void | sendSizeBuf (char *&buf, int size, int position, const int target, const int tag, MPI_Comm comm)
| Send the size and content of a buffer to the target process.
void | sendRampUpNode (const int target, MPI_Comm comm)
| Send the size and the content of the best node of a given subtree to the target process.
void | sendNodeModelGen (int receiver, int doUnitWork)
| Send a node from rampUpSubTree's node pool and generated model knowledge.
bool | sendSubTree (const int target, AlpsSubTree *&st, int tag)
| Send a given subtree to the target process.
void | sendFinishInit (const int target, MPI_Comm comm)
| Send finish initialization signal to the target process.
Change message counts functions
void | incSendCount (const char *how, int s=1)
| Increment the number of sent message.
void | decSendCount (const char *how, int s=1)
| Decrement the number of sent message.
void | incRecvCount (const char *how, int s=1)
| Increment the number of received message.
void | decRecvCount (const char *how, int s=1)
| Decrement the number of sent message.
## Protected Attributes
bool | forceTerminate_
| Terminate due to reaching limits (time and node) or other reason.
bool | blockTermCheck_
| Indicate whether do termination check.
bool | blockHubReport_
| Indicate whether a hub need to report state to master.
bool | blockWorkerReport_
| Indicate whether a worker need to report state to its hub.
bool | blockAskForWork_
| Indicate whether a worker need to as for work from its hub.
char * | attachBuffer_
| Buffer attached to MPI when sharing generated knowledge.
char * | largeBuffer_
| Large message buffer.
char * | largeBuffer2_
| Large message buffer.
char * | smallBuffer_
| Small message buffer.
double | masterBalancePeriod_
| The period that master do load balancing.
double | hubReportPeriod_
| The period that a hub load balancing and report cluster status.
int | modelGenID_
| The global rank of the process that share generated model knowledge.
int | modelGenPos_
| Size of the shared knowledge.
AlpsSubTree * | rampUpSubTree_
| A subtree used in during up.
int | unitWorkNodes_
| Number of nodes in one unit of work.
int | haltSearch_
| Temporily halt search.
Process information
int | processNum_
| The Number of processes launched.
int | hubNum_
| The Number of hubs.
int | globalRank_
| The rank of the process in MPI_COMM_WORLD.
MPI_Comm | clusterComm_
| Communicator of the cluster to which the process belongs.
MPI_Comm | hubComm_
| Communicator consists of all hubs.
MPI_Group | hubGroup_
| MPI_Group consists of all hubs.
int | clusterSize_
| The actual size of the cluster to which the process belongs.
int | userClusterSize_
| The user reqested size of a cluster.
int | clusterRank_
| The local rank of the process in clusterComm_.
int * | hubRanks_
| The global ranks of the hubs.
int | myHubRank_
| The global rank of its hub for a worker.
int | masterRank_
| The global rank of the master.
AlpsProcessType | processType_
| The AlpsProcessType of this process.
AlpsProcessType * | processTypeList_
| The AlpsProcessType of all process.
bool | hubWork_
| Whether hub should also work as a worker.
MPI_Request | subTreeRequest_
| Send subtree request.
MPI_Request | solRequestL_
| Send model knoledge request.
MPI_Request | solRequestR_
| The Number of processes launched.
MPI_Request | modelKnowRequestL_
| Send model knoledge request.
MPI_Request | modelKnowRequestR_
| The Number of processes launched.
MPI_Request | forwardRequestL_
| Forward model knoledge request.
MPI_Request | forwardRequestR_
| The Number of processes launched.
Incumbent data
double | incumbentValue_
| Incumbent value.
int | incumbentID_
| The process id that store the incumbent.
bool | updateIncumbent_
| Indicate whether the incumbent value is updated between two checking point.
Workload balancing
double | workQuality_
| The workload quality of the process.
double | clusterWorkQuality_
| The workload quality of the cluster to which the process belong.
double | systemWorkQuality_
| The workload quality of the whole system.
double * | hubWorkQualities_
| The workload qualities of hubs.
double * | workerWorkQualities_
| The workload qualities of workers in the cluster to which this proces belongs.
double | workQuantity_
| The workload quantity of the workload on the process.
double | clusterWorkQuantity_
| The workload quantity of the cluster to which the process belongs.
double | systemWorkQuantity_
| The workload quantity of the whole system.
double | systemWorkQuantityForce_
| The workload quantity of the whole system before forcing termination.
double * | hubWorkQuantities_
| The workload quantities of all clusters/hubs.
double * | workerWorkQuantities_
| The workload quantities of workers in the cluster to which this proces belongs.
bool * | workerReported_
| Indicate which worker has been reported its work.
bool * | hubReported_
| Indicate which hub has been reported its work.
bool | allHubReported_
| Indicate whether all hubs have reported status to master at least once.
int | masterDoBalance_
| Whether master do load balance.
int | hubDoBalance_
| Whether a hub do load balance.
int * | workerNodeProcesseds_
| To record how many nodes processed for each worker in a cluster.
int | clusterNodeProcessed_
| To record how many nodes by a cluster.
int * | hubNodeProcesseds_
| To record how many nodes processed for each hub.
Message counts
int | sendCount_
| The number of new messages sent by the process after last survey.
int | recvCount_
| The number of new messages received by the process after last survey.
int | clusterSendCount_
| The number of new messages sent by the processes in clusterComm_ after last survey.
int | clusterRecvCount_
| The number of new messages received by the processes in clusterComm_ after last survey.
int | systemSendCount_
| The total number of messages sent by the all processes.
int | systemRecvCount_
| The total number of messages sent by the all processes.
Node index
int | masterIndexBatch_
Parallel statistics
AlpsTimer | masterTimer_
| Master timer.
AlpsTimer | hubTimer_
| Hub timer.
AlpsTimer | workerTimer_
| Worker timer.
double | rampUpTime_
| The time spent in ramp up.
double | rampDownTime_
| The time spent in ramp down.
double | idleTime_
| The time spent waiting for work.
double | msgTime_
| The time spent processing messages (include idle).
AlpsPsStats | psStats_
| More statistics.
## Private Member Functions
| AlpsKnowledgeBrokerMPI (const AlpsKnowledgeBrokerMPI &)
| Disable copy construct and assignment operator.
AlpsKnowledgeBrokerMPI & | operator= (const AlpsKnowledgeBrokerMPI &)

## Detailed Description

Definition at line 41 of file AlpsKnowledgeBrokerMPI.h.

## Constructor & Destructor Documentation

AlpsKnowledgeBrokerMPI::AlpsKnowledgeBrokerMPI | ( | const AlpsKnowledgeBrokerMPI & |  | ) | `[private]`

Disable copy construct and assignment operator.

AlpsKnowledgeBrokerMPI::AlpsKnowledgeBrokerMPI | ( |  | ) | `[inline]`

Default construtor.

NOTE: must call initializeSearch() later.

Definition at line 576 of file AlpsKnowledgeBrokerMPI.h.

References init().

AlpsKnowledgeBrokerMPI::AlpsKnowledgeBrokerMPI | ( | int | argc,
|  | char * | argv[],
|  | AlpsModel & | model |
| ) |  |  | `[inline]`

Useful construtor.

Definition at line 584 of file AlpsKnowledgeBrokerMPI.h.

References init(), and initializeSearch().

AlpsKnowledgeBrokerMPI::~AlpsKnowledgeBrokerMPI | ( |  | ) |

Destructor.

## Member Function Documentation

AlpsKnowledgeBrokerMPI& AlpsKnowledgeBrokerMPI::operator= | ( | const AlpsKnowledgeBrokerMPI & |  | ) | `[private]`

void AlpsKnowledgeBrokerMPI::init | ( |  | ) | `[protected]`

Initialize member data.

Referenced by AlpsKnowledgeBrokerMPI().

void AlpsKnowledgeBrokerMPI::masterMain | ( | AlpsTreeNode * | root | ) | `[protected]`

Master generates subtrees and sends them to hubs in Round-Robin way.

Master periodically do inter-cluster load balancing, and termination check.

void AlpsKnowledgeBrokerMPI::hubMain | ( |  | ) | `[protected]`

Hub generates subtrees and sends them to workers in Round-Robin way.

Hub do intra-cluster load balancing.

void AlpsKnowledgeBrokerMPI::workerMain | ( |  | ) | `[protected]`

Worker first receive subtrees, then start to explore them.

Worker also peroidically check message and process message.

AlpsReturnStatus AlpsKnowledgeBrokerMPI::doOneUnitWork | ( | int | unitWork,
|  | double | unitTime,
|  | AlpsExitStatus & | exitStatus,
|  | int & | numNodesProcessed,
|  | int & | depth,
|  | bool & | betterSolution |
| ) |  |  | `[protected]`

Explore a subtree from subtree pool for certain units of work/time.

void AlpsKnowledgeBrokerMPI::processMessages | ( | char *& | buffer,
|  | MPI_Status & | status,
|  | MPI_Request & | request |
| ) |  |  | `[protected]`

Processing messages.

void AlpsKnowledgeBrokerMPI::rootInitMaster | ( | AlpsTreeNode * | root | ) | `[protected]`

Static load balancing: Root Initialization.

void AlpsKnowledgeBrokerMPI::rootInitHub | ( |  | ) | `[protected]`

void AlpsKnowledgeBrokerMPI::rootInitWorker | ( |  | ) | `[protected]`

void AlpsKnowledgeBrokerMPI::spiralMaster | ( | AlpsTreeNode * | root | ) | `[protected]`

Static load balancing: spiral.

void AlpsKnowledgeBrokerMPI::spiralHub | ( |  | ) | `[protected]`

void AlpsKnowledgeBrokerMPI::spiralWorker | ( |  | ) | `[protected]`

void AlpsKnowledgeBrokerMPI::masterAskHubDonate | ( | int | donorID,
|  | int | receiverID,
|  | double | receiverWorkload |
| ) |  |  | `[protected]`

Master asks a hub to donate its workload to another hub.

void AlpsKnowledgeBrokerMPI::hubAskWorkerDonate | ( | int | donorID,
|  | int | receiverID,
|  | double | receiverWorkload |
| ) |  |  | `[protected]`

Hub asks a worker to donate its workload to another worker.

void AlpsKnowledgeBrokerMPI::updateWorkloadInfo | ( |  | ) | `[protected]`

Calculate the work quality and quantity on this process.

virtual int AlpsKnowledgeBrokerMPI::getNumNodeLeftSystem | ( |  | ) | `[inline, protected, virtual]`

Master asks a hub to donate its workload to another hub.

Reimplemented from AlpsKnowledgeBroker.

Definition at line 370 of file AlpsKnowledgeBrokerMPI.h.

References systemWorkQuantity_.

void AlpsKnowledgeBrokerMPI::donateWork | ( | char *& | buf,
|  | int | tag,
|  | MPI_Status * | status,
|  | int | recvID = `-1`,
|  | double | recvWL = `0.0` |
| ) |  |  | `[protected]`

A worker donate its workload to the specified worker.

void AlpsKnowledgeBrokerMPI::hubAllocateDonation | ( | char *& | buf,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

Hub allocates the donated workload to its workers.

void AlpsKnowledgeBrokerMPI::hubBalanceWorkers | ( |  | ) | `[protected]`

Hub balances the workloads of its workers.

void AlpsKnowledgeBrokerMPI::hubSatisfyWorkerRequest | ( | char *& | buf,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

Hub satisfies the workload rquest from a worker.

void AlpsKnowledgeBrokerMPI::hubReportStatus | ( | int | tag,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

A hub reports its status (workload and msg counts) to the master.

void AlpsKnowledgeBrokerMPI::hubUpdateCluStatus | ( | char *& | buf,
|  | MPI_Status * | status,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

A hub unpacks the status of a worker from buffer.

void AlpsKnowledgeBrokerMPI::hubsShareWork | ( | char *& | buf,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

Two hubs share their workload.

void AlpsKnowledgeBrokerMPI::masterBalanceHubs | ( |  | ) | `[protected]`

Master balance the workload of hubs.

void AlpsKnowledgeBrokerMPI::masterUpdateSysStatus | ( | char *& | buf,
|  | MPI_Status * | status,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

Master unpack the status of a hub from buf and update system status.

void AlpsKnowledgeBrokerMPI::refreshSysStatus | ( |  | ) | `[protected]`

The master re-calculate the system status.

void AlpsKnowledgeBrokerMPI::refreshClusterStatus | ( |  | ) | `[protected]`

A hub adds its status to the cluster's status.

void AlpsKnowledgeBrokerMPI::workerReportStatus | ( | int | tag,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

A worker report its status (workload and msg counts) to its hub.

void AlpsKnowledgeBrokerMPI::workerAskIndices | ( |  | ) | `[protected]`

A worker ask for node index from master.

void AlpsKnowledgeBrokerMPI::workerRecvIndices | ( | char *& | bufLarge | ) | `[protected]`

A worker receive node index from master.

void AlpsKnowledgeBrokerMPI::masterSendIndices | ( | char *& | bufLarge | ) | `[protected]`

Master send a batch of node indices to the receiving worker.

void AlpsKnowledgeBrokerMPI::broadcastModel | ( | const int | id,
|  | const int | source |
| ) |  |  | `[protected]`

Broadcast the model from source to other processes.

void AlpsKnowledgeBrokerMPI::sendIncumbent | ( |  | ) | `[protected]`

Sent the incumbent value and rank to its two child if eixt.

bool AlpsKnowledgeBrokerMPI::unpackSetIncumbent | ( | char *& | buf,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

unpack the incumbent value, then store it and the id of the process having the incumbent in AlpsDataPool.

void AlpsKnowledgeBrokerMPI::collectBestSolution | ( | int | destination | ) | `[protected]`

Send the best solution from the process having it to destination.

void AlpsKnowledgeBrokerMPI::tellMasterRecv | ( |  | ) | `[protected]`

Inform master that a proc has received workload during a load balance initialized by master.

void AlpsKnowledgeBrokerMPI::tellHubRecv | ( |  | ) | `[protected]`

Inform hub that a proc has received workload during a load balance initialized by a hub.

void AlpsKnowledgeBrokerMPI::packEncoded | ( | AlpsEncoded * | enc,
|  | char *& | buf,
|  | int & | size,
|  | int & | position,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

Pack an AlpsEncoded instance into buf.

Return filled buf and size of packed message. position: where to start if buf is allocated.

AlpsEncoded* AlpsKnowledgeBrokerMPI::unpackEncoded | ( | char *& | buf,
|  | int & | position,
|  | MPI_Comm | comm,
|  | int | size = `-1` |
| ) |  |  | `[protected]`

Unpack the given buffer into an AlpsEncoded instance.

void AlpsKnowledgeBrokerMPI::receiveSizeBuf | ( | char *& | buf,
|  | int | sender,
|  | int | tag,
|  | MPI_Comm | comm,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

Receive the size of buffer, allocate memory for buffer, then receive the message and put it in buffer.

void AlpsKnowledgeBrokerMPI::receiveRampUpNode | ( | int | sender,
|  | MPI_Comm | comm,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

First receive the size and the contend of a node, then construct a subtree with this received node.

void AlpsKnowledgeBrokerMPI::receiveSubTree | ( | char *& | buf,
|  | int | sender,
|  | MPI_Status * | status |
| ) |  |  | `[protected]`

Receive a subtree from the sender process and add it into the subtree pool.

void AlpsKnowledgeBrokerMPI::sendSizeBuf | ( | char *& | buf,
|  | int | size,
|  | int | position,
|  | const int | target,
|  | const int | tag,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

Send the size and content of a buffer to the target process.

void AlpsKnowledgeBrokerMPI::sendRampUpNode | ( | const int | target,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

Send the size and the content of the best node of a given subtree to the target process.

void AlpsKnowledgeBrokerMPI::sendNodeModelGen | ( | int | receiver,
|  | int | doUnitWork |
| ) |  |  | `[protected]`

Send a node from rampUpSubTree's node pool and generated model knowledge.

bool AlpsKnowledgeBrokerMPI::sendSubTree | ( | const int | target,
|  | AlpsSubTree *& | st,
|  | int | tag |
| ) |  |  | `[protected]`

Send a given subtree to the target process.

void AlpsKnowledgeBrokerMPI::sendFinishInit | ( | const int | target,
|  | MPI_Comm | comm |
| ) |  |  | `[protected]`

Send finish initialization signal to the target process.

void AlpsKnowledgeBrokerMPI::deleteSubTrees | ( |  | ) | `[protected]`

Delete subTrees in pools and the active subtree.

void AlpsKnowledgeBrokerMPI::forwardModelKnowledge | ( |  | ) | `[protected]`

void AlpsKnowledgeBrokerMPI::sendModelKnowledge | ( | MPI_Comm | comm,
|  | int | receiver = `-1` |
| ) |  |  | `[protected]`

Set generated knowlege (related to model) to receiver.

void AlpsKnowledgeBrokerMPI::receiveModelKnowledge | ( | MPI_Comm | comm | ) | `[protected]`

Receive generated knowlege (related to model) from sender.

void AlpsKnowledgeBrokerMPI::incSendCount | ( | const char * | how,
|  | int | s = `1` |
| ) |  |  | `[protected]`

Increment the number of sent message.

void AlpsKnowledgeBrokerMPI::decSendCount | ( | const char * | how,
|  | int | s = `1` |
| ) |  |  | `[protected]`

Decrement the number of sent message.

void AlpsKnowledgeBrokerMPI::incRecvCount | ( | const char * | how,
|  | int | s = `1` |
| ) |  |  | `[protected]`

Increment the number of received message.

void AlpsKnowledgeBrokerMPI::decRecvCount | ( | const char * | how,
|  | int | s = `1` |
| ) |  |  | `[protected]`

Decrement the number of sent message.

void AlpsKnowledgeBrokerMPI::masterForceHubTerm | ( |  | ) | `[protected]`

Master tell hubs to terminate due to reaching limits or other reason.

void AlpsKnowledgeBrokerMPI::hubForceWorkerTerm | ( |  | ) | `[protected]`

Hub tell workers to terminate due to reaching limits or other reason.

void AlpsKnowledgeBrokerMPI::changeWorkingSubTree | ( | double & | changeWorkThreshold | ) | `[protected]`

Change subtree to be explored if it is too worse.

void AlpsKnowledgeBrokerMPI::sendErrorCodeToMaster | ( | int | errorCode | ) | `[protected]`

Send error code to master.

void AlpsKnowledgeBrokerMPI::recvErrorCode | ( | char *& | bufLarge | ) | `[protected]`

Receive error code and set solution status.

void AlpsKnowledgeBrokerMPI::spiralRecvProcessNode | ( |  | ) | `[protected]`

Unpack the node, explore it and send load info to master.

void AlpsKnowledgeBrokerMPI::spiralDonateNode | ( |  | ) | `[protected]`

Unpack msg and donate a node.

virtual int AlpsKnowledgeBrokerMPI::getProcRank | ( |  | ) | const`[inline, virtual]`

Query the global rank of the process.

Reimplemented from AlpsKnowledgeBroker.

Definition at line 598 of file AlpsKnowledgeBrokerMPI.h.

References globalRank_.

virtual int AlpsKnowledgeBrokerMPI::getMasterRank | ( |  | ) | const`[inline, virtual]`

Query the global rank of the Master.

Reimplemented from AlpsKnowledgeBroker.

Definition at line 601 of file AlpsKnowledgeBrokerMPI.h.

References masterRank_.

virtual AlpsProcessType AlpsKnowledgeBrokerMPI::getProcType | ( |  | ) | const`[inline, virtual]`

Query the type (master, hub, or worker) of the process.

Reimplemented from AlpsKnowledgeBroker.

Definition at line 604 of file AlpsKnowledgeBrokerMPI.h.

References processType_.

void AlpsKnowledgeBrokerMPI::initializeSearch | ( | int | argc,
|  | char * | argv[],
|  | AlpsModel & | model |
| ) |  |  | `[virtual]`

This function.

- initializes the message environment;
- the master reads in ALPS and user's parameter sets. If the model data is input from file, then it reads in the model data.
- sets up user params and model;
- broadcast parameters from the master to all other processes;
- creates MPI communicators and groups;
- classifies process types, sets up subtree and pools
- determines their hub's global rank for workers

Implements AlpsKnowledgeBroker.

Referenced by AlpsKnowledgeBrokerMPI().

void AlpsKnowledgeBrokerMPI::search | ( | AlpsModel * | model | ) | `[virtual]`

Search best solution for a given model.

Reimplemented from AlpsKnowledgeBroker.

void AlpsKnowledgeBrokerMPI::rootSearch | ( | AlpsTreeNode * | root | ) | `[virtual]`

This function.

- broadcasts model data from the master to all other processes;
- calls its associated main function to explore the sub tree;
- collects the best solution found.

Implements AlpsKnowledgeBroker.

virtual double AlpsKnowledgeBrokerMPI::getIncumbentValue | ( |  | ) | const`[inline, virtual]`

The process queries the quality of the incumbent this process stores.

Implements AlpsKnowledgeBroker.

Definition at line 635 of file AlpsKnowledgeBrokerMPI.h.

References ALPS_OBJ_MAX, AlpsKnowledgeTypeSolution, AlpsKnowledgeBroker::getBestKnowledge(), AlpsKnowledgeBroker::hasKnowledge(), and incumbentValue_.

virtual double AlpsKnowledgeBrokerMPI::getBestQuality | ( |  | ) | const`[inline, virtual]`

The master queries the quality of the best solution it knowns.

Implements AlpsKnowledgeBroker.

Definition at line 647 of file AlpsKnowledgeBrokerMPI.h.

References ALPS_OBJ_MAX, AlpsKnowledgeTypeSolution, AlpsKnowledgeBroker::getBestKnowledge(), AlpsKnowledgeBroker::getNumKnowledges(), globalRank_, and masterRank_.

virtual double AlpsKnowledgeBrokerMPI::getBestEstimateQuality | ( |  | ) | `[inline, virtual]`

Get best estimalted quality in system.

Reimplemented from AlpsKnowledgeBroker.

Definition at line 662 of file AlpsKnowledgeBrokerMPI.h.

References systemWorkQuality_.

virtual void AlpsKnowledgeBrokerMPI::printBestSolution | ( | char * | outputFile = `0` | ) | const`[virtual]`

Master prints out the best solution that it knows.

Implements AlpsKnowledgeBroker.

virtual void AlpsKnowledgeBrokerMPI::searchLog | ( |  | ) | `[virtual]`

Log search statistics.

Implements AlpsKnowledgeBroker.

void AlpsKnowledgeBrokerMPI::sendKnowledge | ( | AlpsKnowledgeType | type,
|  | int | sender,
|  | int | receiver,
|  | char *& | msgBuffer,
|  | int | msgSize,
|  | int | msgTag,
|  | MPI_Comm | comm,
|  | bool | blocking |
| ) |  |  |

Set knowlege.

void AlpsKnowledgeBrokerMPI::receiveKnowledge | ( | AlpsKnowledgeType | type,
|  | int | sender,
|  | int | receiver,
|  | char *& | msgBuffer,
|  | int | msgSize,
|  | int | msgTag,
|  | MPI_Comm | comm,
|  | MPI_Status * | status,
|  | bool | blocking |
| ) |  |  |

Receive knowlege.

void AlpsKnowledgeBrokerMPI::requestKnowledge | ( | AlpsKnowledgeType | type,
|  | int | sender,
|  | int | receiver,
|  | char *& | msgBuffer,
|  | int | msgSize,
|  | int | msgTag,
|  | MPI_Comm | comm,
|  | bool | blocking |
| ) |  |  |

Request knowlege.

## Member Data Documentation

int AlpsKnowledgeBrokerMPI::processNum_`[protected]`

The Number of processes launched.

Definition at line 55 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::hubNum_`[protected]`

The Number of hubs.

Definition at line 58 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::globalRank_`[protected]`

The rank of the process in MPI_COMM_WORLD.

Definition at line 61 of file AlpsKnowledgeBrokerMPI.h.

Referenced by getBestQuality(), and getProcRank().

MPI_Comm AlpsKnowledgeBrokerMPI::clusterComm_`[protected]`

Communicator of the cluster to which the process belongs.

Definition at line 64 of file AlpsKnowledgeBrokerMPI.h.

MPI_Comm AlpsKnowledgeBrokerMPI::hubComm_`[protected]`

Communicator consists of all hubs.

Definition at line 67 of file AlpsKnowledgeBrokerMPI.h.

MPI_Group AlpsKnowledgeBrokerMPI::hubGroup_`[protected]`

MPI_Group consists of all hubs.

Definition at line 70 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::clusterSize_`[protected]`

The actual size of the cluster to which the process belongs.

Definition at line 73 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::userClusterSize_`[protected]`

The user reqested size of a cluster.

Definition at line 76 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::clusterRank_`[protected]`

The local rank of the process in clusterComm_.

Definition at line 79 of file AlpsKnowledgeBrokerMPI.h.

int* AlpsKnowledgeBrokerMPI::hubRanks_`[protected]`

The global ranks of the hubs.

Definition at line 82 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::myHubRank_`[protected]`

The global rank of its hub for a worker.

Definition at line 85 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::masterRank_`[protected]`

The global rank of the master.

Definition at line 88 of file AlpsKnowledgeBrokerMPI.h.

Referenced by getBestQuality(), and getMasterRank().

AlpsProcessType AlpsKnowledgeBrokerMPI::processType_`[protected]`

The AlpsProcessType of this process.

Definition at line 91 of file AlpsKnowledgeBrokerMPI.h.

Referenced by getProcType().

AlpsProcessType* AlpsKnowledgeBrokerMPI::processTypeList_`[protected]`

The AlpsProcessType of all process.

Definition at line 94 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::hubWork_`[protected]`

Whether hub should also work as a worker.

Definition at line 97 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::subTreeRequest_`[protected]`

Send subtree request.

Definition at line 100 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::solRequestL_`[protected]`

Send model knoledge request.

Definition at line 103 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::solRequestR_`[protected]`

The Number of processes launched.

Definition at line 104 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::modelKnowRequestL_`[protected]`

Send model knoledge request.

Definition at line 107 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::modelKnowRequestR_`[protected]`

The Number of processes launched.

Definition at line 108 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::forwardRequestL_`[protected]`

Forward model knoledge request.

Definition at line 111 of file AlpsKnowledgeBrokerMPI.h.

MPI_Request AlpsKnowledgeBrokerMPI::forwardRequestR_`[protected]`

The Number of processes launched.

Definition at line 112 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::incumbentValue_`[protected]`

Incumbent value.

Definition at line 120 of file AlpsKnowledgeBrokerMPI.h.

Referenced by getIncumbentValue().

int AlpsKnowledgeBrokerMPI::incumbentID_`[protected]`

The process id that store the incumbent.

Definition at line 123 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::updateIncumbent_`[protected]`

Indicate whether the incumbent value is updated between two checking point.

Definition at line 127 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::workQuality_`[protected]`

The workload quality of the process.

Definition at line 135 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::clusterWorkQuality_`[protected]`

The workload quality of the cluster to which the process belong.

Definition at line 138 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::systemWorkQuality_`[protected]`

The workload quality of the whole system.

Definition at line 141 of file AlpsKnowledgeBrokerMPI.h.

Referenced by getBestEstimateQuality().

double* AlpsKnowledgeBrokerMPI::hubWorkQualities_`[protected]`

The workload qualities of hubs.

Definition at line 144 of file AlpsKnowledgeBrokerMPI.h.

double* AlpsKnowledgeBrokerMPI::workerWorkQualities_`[protected]`

The workload qualities of workers in the cluster to which this proces belongs.

Number of nodes is used as the quantities criteria.

Definition at line 148 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::workQuantity_`[protected]`

The workload quantity of the workload on the process.

Definition at line 151 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::clusterWorkQuantity_`[protected]`

The workload quantity of the cluster to which the process belongs.

Definition at line 154 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::systemWorkQuantity_`[protected]`

The workload quantity of the whole system.

Definition at line 157 of file AlpsKnowledgeBrokerMPI.h.

Referenced by getNumNodeLeftSystem().

double AlpsKnowledgeBrokerMPI::systemWorkQuantityForce_`[protected]`

The workload quantity of the whole system before forcing termination.

Definition at line 160 of file AlpsKnowledgeBrokerMPI.h.

double* AlpsKnowledgeBrokerMPI::hubWorkQuantities_`[protected]`

The workload quantities of all clusters/hubs.

Definition at line 163 of file AlpsKnowledgeBrokerMPI.h.

double* AlpsKnowledgeBrokerMPI::workerWorkQuantities_`[protected]`

The workload quantities of workers in the cluster to which this proces belongs.

Definition at line 167 of file AlpsKnowledgeBrokerMPI.h.

bool* AlpsKnowledgeBrokerMPI::workerReported_`[protected]`

Indicate which worker has been reported its work.

Definition at line 170 of file AlpsKnowledgeBrokerMPI.h.

bool* AlpsKnowledgeBrokerMPI::hubReported_`[protected]`

Indicate which hub has been reported its work.

Definition at line 173 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::allHubReported_`[protected]`

Indicate whether all hubs have reported status to master at least once.

Definition at line 176 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::masterDoBalance_`[protected]`

Whether master do load balance.

0: do; >0: blocked.

Definition at line 179 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::hubDoBalance_`[protected]`

Whether a hub do load balance.

0: do; >0: blocked.

Definition at line 182 of file AlpsKnowledgeBrokerMPI.h.

int* AlpsKnowledgeBrokerMPI::workerNodeProcesseds_`[protected]`

To record how many nodes processed for each worker in a cluster.

Definition at line 185 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::clusterNodeProcessed_`[protected]`

To record how many nodes by a cluster.

Definition at line 188 of file AlpsKnowledgeBrokerMPI.h.

int* AlpsKnowledgeBrokerMPI::hubNodeProcesseds_`[protected]`

To record how many nodes processed for each hub.

Definition at line 191 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::sendCount_`[protected]`

The number of new messages sent by the process after last survey.

Definition at line 199 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::recvCount_`[protected]`

The number of new messages received by the process after last survey.

Definition at line 202 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::clusterSendCount_`[protected]`

The number of new messages sent by the processes in clusterComm_ after last survey.

Definition at line 206 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::clusterRecvCount_`[protected]`

The number of new messages received by the processes in clusterComm_ after last survey.

Definition at line 210 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::systemSendCount_`[protected]`

The total number of messages sent by the all processes.

Definition at line 213 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::systemRecvCount_`[protected]`

The total number of messages sent by the all processes.

Definition at line 216 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::masterIndexBatch_`[protected]`

Definition at line 223 of file AlpsKnowledgeBrokerMPI.h.

AlpsTimer AlpsKnowledgeBrokerMPI::masterTimer_`[protected]`

Master timer.

Definition at line 231 of file AlpsKnowledgeBrokerMPI.h.

AlpsTimer AlpsKnowledgeBrokerMPI::hubTimer_`[protected]`

Hub timer.

Definition at line 234 of file AlpsKnowledgeBrokerMPI.h.

AlpsTimer AlpsKnowledgeBrokerMPI::workerTimer_`[protected]`

Worker timer.

Definition at line 237 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::rampUpTime_`[protected]`

The time spent in ramp up.

Definition at line 240 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::rampDownTime_`[protected]`

The time spent in ramp down.

Definition at line 243 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::idleTime_`[protected]`

The time spent waiting for work.

Definition at line 246 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::msgTime_`[protected]`

The time spent processing messages (include idle).

Definition at line 249 of file AlpsKnowledgeBrokerMPI.h.

AlpsPsStats AlpsKnowledgeBrokerMPI::psStats_`[protected]`

More statistics.

Definition at line 252 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::forceTerminate_`[protected]`

Terminate due to reaching limits (time and node) or other reason.

Definition at line 256 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::blockTermCheck_`[protected]`

Indicate whether do termination check.

Definition at line 259 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::blockHubReport_`[protected]`

Indicate whether a hub need to report state to master.

Definition at line 262 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::blockWorkerReport_`[protected]`

Indicate whether a worker need to report state to its hub.

Definition at line 265 of file AlpsKnowledgeBrokerMPI.h.

bool AlpsKnowledgeBrokerMPI::blockAskForWork_`[protected]`

Indicate whether a worker need to as for work from its hub.

Definition at line 268 of file AlpsKnowledgeBrokerMPI.h.

char* AlpsKnowledgeBrokerMPI::attachBuffer_`[protected]`

Buffer attached to MPI when sharing generated knowledge.

Definition at line 271 of file AlpsKnowledgeBrokerMPI.h.

char* AlpsKnowledgeBrokerMPI::largeBuffer_`[protected]`

Large message buffer.

Definition at line 274 of file AlpsKnowledgeBrokerMPI.h.

char* AlpsKnowledgeBrokerMPI::largeBuffer2_`[protected]`

Large message buffer.

Used for sharing model knowledge

Definition at line 277 of file AlpsKnowledgeBrokerMPI.h.

char* AlpsKnowledgeBrokerMPI::smallBuffer_`[protected]`

Small message buffer.

Definition at line 280 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::masterBalancePeriod_`[protected]`

The period that master do load balancing.

It changes as search progresses.

Definition at line 284 of file AlpsKnowledgeBrokerMPI.h.

double AlpsKnowledgeBrokerMPI::hubReportPeriod_`[protected]`

The period that a hub load balancing and report cluster status.

It changes as search progresses.

Definition at line 288 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::modelGenID_`[protected]`

The global rank of the process that share generated model knowledge.

Definition at line 291 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::modelGenPos_`[protected]`

Size of the shared knowledge.

Definition at line 294 of file AlpsKnowledgeBrokerMPI.h.

AlpsSubTree* AlpsKnowledgeBrokerMPI::rampUpSubTree_`[protected]`

A subtree used in during up.

Definition at line 297 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::unitWorkNodes_`[protected]`

Number of nodes in one unit of work.

Definition at line 300 of file AlpsKnowledgeBrokerMPI.h.

int AlpsKnowledgeBrokerMPI::haltSearch_`[protected]`

Temporily halt search.

Definition at line 303 of file AlpsKnowledgeBrokerMPI.h.

The documentation for this class was generated from the following file:

- /home/coin/SVN-release/Blis-0.91.2/Alps/src/AlpsKnowledgeBrokerMPI.h