ABA_PARMASTER Class Reference

Class ABA_PARMASTER contains all data and operations specific to the parallel ABACUS. More...

#include <parmaster.h>

Inheritance diagram for ABA_PARMASTER:

ABA_ABACUSROOT List of all members.

Public Member Functions

 ABA_PARMASTER (ABA_MASTER *master)
 ~ABA_PARMASTER ()
 The destructor.
void initializeParameters ()
void setDefaultParameters ()
 Sets default values of the parameters specific to the parallel version of ABACUS.
void printParameters ()
 Prints the settings of the parameters specific to the parallel version of ABACUS.
void outputStatistics ()
int hostId () const
int hostCount () const
bool isHostZero () const
const ABA_STRINGhostname (int i) const
const ABA_STRINGhostname () const
int registerPool (void *pool)
void unregisterPool (int index)
void * getPool (int index)
ABA_IDMAP< ABA_SUB > * subIdentificationMap () const
void connectService (int port, ABA_MESSAGE &msg, int destId)
ACE_SOCK_Stream & notifyStream (int i)
void newHostDualBound (double x)
 Updates the dual bound of this host, i.e.~the minimum (maximum) dual bound of all subproblems of this host.
void newHostDualBound (ABA_MESSAGE &msg)
 This version of the function newHostDualBound() receives a new dual bound of another host from a message and updates the corresponding element in the array hostDualBounds_.
void newPrimalBound (double x)
void newPrimalBound (ABA_MESSAGE &msg)
 This version of the function newPrimalBound() receives a new primal bound.
void newOpenSubCount (int n, double best)
 Broadcasts the new number of open subproblems and the best bound of all subproblems in the openSub list of this host to all other hosts if it has changed.
void newOpenSubCount (ABA_MESSAGE &msg)
 Receives the new number of open subproblems and the best bound of the openSub list broadcast by another host.
bool balance ()
 Is called before a new subproblem is selected for optimization to perform a loadbalancing step.
void terminationCheck ()
 Tests, if all hosts are idle and no subproblems are staying arround anywhere.
void terminationCheck (ABA_MESSAGE &msg)
 This version of the function terminationCheck() handles the termination test phases I and II.
void startTerminationCheck ()
void incWorkCount ()
void decWorkCount ()
void terminate ()
int newId (int fatherId)
void incSubSentCount ()
void incSubReceivedCount ()
void startIdleTime ()
void stopIdleTime ()
void updateIdleTimers (bool first)
void printId (int id)
 Prints an ID. If the IDs are not requested continuous (vbcLog!=NoVbc) a pair consisting of the nmae of the host which has generated the subproblem and the local number of the subproblem is output.

Private Attributes

ABA_MASTERmaster_
int hostId_
int hostCount_
ABA_STRING myHostname_
ABA_ARRAY< ABA_STRING * > hostname_
int connectTimeout_
ABA_ARRAY< void * > registeredPools_
int lastRegisteredPool_
ABA_DUALBOUND hostDualBounds_
ACE_Thread_Mutex newHostDualBoundMutex_
ACE_Thread_Mutex newPrimalBoundMutex_
int notifyPort_
ACE_SOCK_Stream * notifyStreams_
ABA_NOTIFYSERVER * notify_
int subserverPort_
ABA_SUBSERVERsubserver_
int balancerPort_
double bestFirstTolerance_
ABA_BALANCER * balancer_
ABA_ARRAY< int > openSubCount_
ABA_DUALBOUND openSubBest_
ACE_Thread_Mutex newOpenSubCountMutex_
ACE_Thread_Mutex terminationCheckMutex_
volatile bool terminationCheckAgain_
ACE_Thread_Mutex terminationMutex_
volatile bool terminationOk_
volatile bool hasTerminated_
int workCount_
ACE_Thread_Mutex idCounterMutex_
int idCounter_
int subSentCount_
int subReceivedCount_
ABA_COWTIMER idleCowTimeFirst_
ABA_COWTIMER idleCowTimeMiddle_
ABA_COWTIMER idleCowTimeLast_

Detailed Description

Class ABA_PARMASTER contains all data and operations specific to the parallel ABACUS.

Definition at line 51 of file parmaster.h.


Constructor & Destructor Documentation

ABA_PARMASTER::ABA_PARMASTER ( ABA_MASTER master  ) 

The constructor.

Parameters:
master A pointer to the master object.

ABA_PARMASTER::~ABA_PARMASTER (  ) 

The destructor.


Member Function Documentation

void ABA_PARMASTER::initializeParameters (  ) 

Initializes the parameters specific to the parallel version of ABACUS.

void ABA_PARMASTER::setDefaultParameters (  ) 

Sets default values of the parameters specific to the parallel version of ABACUS.

void ABA_PARMASTER::printParameters (  ) 

Prints the settings of the parameters specific to the parallel version of ABACUS.

void ABA_PARMASTER::outputStatistics (  ) 

Prints statistics specific to the parallel version of ABACUS.

int ABA_PARMASTER::hostId (  )  const [inline]

Definition at line 271 of file parmaster.h.

int ABA_PARMASTER::hostCount (  )  const [inline]

Definition at line 275 of file parmaster.h.

bool ABA_PARMASTER::isHostZero (  )  const [inline]

Definition at line 279 of file parmaster.h.

const ABA_STRING & ABA_PARMASTER::hostname ( int  i  )  const [inline]

Definition at line 283 of file parmaster.h.

const ABA_STRING & ABA_PARMASTER::hostname (  )  const [inline]

Definition at line 287 of file parmaster.h.

int ABA_PARMASTER::registerPool ( void *  pool  ) 

Registers an ABA_POOL with the master.

Parameters:
pool A pointer to the ABA_POOL.
Returns:
An integer identifying the pool.

void ABA_PARMASTER::unregisterPool ( int  index  ) 

Unregisters a previously registered ABA_POOL.

Parameters:
index The index of the ABA_POOL which was returned by the function registerPool() when the ABA_POOL was registered.

void* ABA_PARMASTER::getPool ( int  index  ) 

Returns:
A Pointer to the registered ABA_POOL.
Parameters:
index The index of the registered ABA_POOL.

ABA_IDMAP<ABA_SUB>* ABA_PARMASTER::subIdentificationMap (  )  const

void ABA_PARMASTER::connectService ( int  port,
ABA_MESSAGE msg,
int  destId 
)

Parameters:
port The port number of the service to connect to.
msg The ABA_MESSAGE where the connection will be established into.

ACE_SOCK_Stream & ABA_PARMASTER::notifyStream ( int  i  )  [inline]

Definition at line 291 of file parmaster.h.

void ABA_PARMASTER::newHostDualBound ( double  x  ) 

Updates the dual bound of this host, i.e.~the minimum (maximum) dual bound of all subproblems of this host.

The new bound is broadcast to all other hosts if it has changed. The global dual bound stored in the master is also updated, if needed.

void ABA_PARMASTER::newHostDualBound ( ABA_MESSAGE msg  ) 

This version of the function newHostDualBound() receives a new dual bound of another host from a message and updates the corresponding element in the array hostDualBounds_.

The global dual bound stored in the master is also updated, if needed.

void ABA_PARMASTER::newPrimalBound ( double  x  ) 

Broadcasts a new primal bound to all hosts.

void ABA_PARMASTER::newPrimalBound ( ABA_MESSAGE msg  ) 

This version of the function newPrimalBound() receives a new primal bound.

void ABA_PARMASTER::newOpenSubCount ( int  n,
double  best 
)

Broadcasts the new number of open subproblems and the best bound of all subproblems in the openSub list of this host to all other hosts if it has changed.

void ABA_PARMASTER::newOpenSubCount ( ABA_MESSAGE msg  ) 

Receives the new number of open subproblems and the best bound of the openSub list broadcast by another host.

bool ABA_PARMASTER::balance (  ) 

Is called before a new subproblem is selected for optimization to perform a loadbalancing step.

bestFirstTolerance_ defines the allowed deviation of the dual bound of the best subproblem at this host compared to the global best dual bound. If the best locally available subproblem is not within the tolerance, the best subproblem available at some other host is requested for. The location of the best subproblem is determined by inspecting hostDualBounds_.

Returns:
true if successful

false otherwise.

void ABA_PARMASTER::terminationCheck (  ) 

Tests, if all hosts are idle and no subproblems are staying arround anywhere.

This is done by a two phase protocol initiated by host 0. In the first phase host 0 broadcasts a state request to all other hosts. Each host sets its local flag terminationOk_ if it is idle and want's to terminate. This local flag is cleared immediately if work (e.g. a subproblem) is received since that time. Then each host sends a reply with dummy data. After all hosts replies are received the second phase is started. Host 0 broadcasts a state request again. This time, each host replies the value of its local flag terminationOk_. The flag is true if no work (i.e. subproblem) was received since the first phase. If all hosts reply true the system is out of work and termination can be initiated.

void ABA_PARMASTER::terminationCheck ( ABA_MESSAGE msg  ) 

This version of the function terminationCheck() handles the termination test phases I and II.

void ABA_PARMASTER::startTerminationCheck (  ) 

Sets the local flag terminationOk_ if this host is idle.

void ABA_PARMASTER::incWorkCount (  ) 

Has to be called if the host got new work, e.g.~if a new subproblem is created.

The local variable workCount_ is incremented and the flag terminationOk_ is cleared.

void ABA_PARMASTER::decWorkCount (  ) 

Has to be called if the host has finished some work, e.g.~if a new subproblem is created.

The local variable workCount_ is decremented. If workCount_ is zero the processor is idle.

void ABA_PARMASTER::terminate (  ) 

Terminates all threads.

int ABA_PARMASTER::newId ( int  fatherId  ) 

Requests a new ID for the subproblem.

If master_->vbcLog() is true a globally unique ID is requested from host 0 to get a continuous sequence of IDs. Otherwise the ID is generated by adding 1000000*hostId_ a local counter.

void ABA_PARMASTER::incSubSentCount (  )  [inline]

Definition at line 295 of file parmaster.h.

void ABA_PARMASTER::incSubReceivedCount (  )  [inline]

Definition at line 299 of file parmaster.h.

void ABA_PARMASTER::startIdleTime (  )  [inline]

Definition at line 303 of file parmaster.h.

void ABA_PARMASTER::stopIdleTime (  )  [inline]

Definition at line 307 of file parmaster.h.

void ABA_PARMASTER::updateIdleTimers ( bool  first  )  [inline]

Definition at line 311 of file parmaster.h.

void ABA_PARMASTER::printId ( int  id  ) 

Prints an ID. If the IDs are not requested continuous (vbcLog!=NoVbc) a pair consisting of the nmae of the host which has generated the subproblem and the local number of the subproblem is output.


Member Data Documentation

ABA_MASTER* ABA_PARMASTER::master_ [private]

Definition at line 234 of file parmaster.h.

int ABA_PARMASTER::hostId_ [private]

Definition at line 235 of file parmaster.h.

int ABA_PARMASTER::hostCount_ [private]

Definition at line 236 of file parmaster.h.

ABA_STRING ABA_PARMASTER::myHostname_ [private]

Definition at line 237 of file parmaster.h.

ABA_ARRAY<ABA_STRING*> ABA_PARMASTER::hostname_ [private]

Definition at line 238 of file parmaster.h.

int ABA_PARMASTER::connectTimeout_ [private]

Definition at line 239 of file parmaster.h.

ABA_ARRAY<void*> ABA_PARMASTER::registeredPools_ [private]

Definition at line 240 of file parmaster.h.

int ABA_PARMASTER::lastRegisteredPool_ [private]

Definition at line 241 of file parmaster.h.

ABA_DUALBOUND ABA_PARMASTER::hostDualBounds_ [private]

Definition at line 242 of file parmaster.h.

ACE_Thread_Mutex ABA_PARMASTER::newHostDualBoundMutex_ [private]

Definition at line 243 of file parmaster.h.

ACE_Thread_Mutex ABA_PARMASTER::newPrimalBoundMutex_ [private]

Definition at line 244 of file parmaster.h.

int ABA_PARMASTER::notifyPort_ [private]

Definition at line 245 of file parmaster.h.

ACE_SOCK_Stream* ABA_PARMASTER::notifyStreams_ [private]

Definition at line 246 of file parmaster.h.

ABA_NOTIFYSERVER* ABA_PARMASTER::notify_ [private]

Definition at line 247 of file parmaster.h.

int ABA_PARMASTER::subserverPort_ [private]

Definition at line 248 of file parmaster.h.

ABA_SUBSERVER* ABA_PARMASTER::subserver_ [private]

Definition at line 249 of file parmaster.h.

int ABA_PARMASTER::balancerPort_ [private]

Definition at line 250 of file parmaster.h.

double ABA_PARMASTER::bestFirstTolerance_ [private]

Definition at line 251 of file parmaster.h.

ABA_BALANCER* ABA_PARMASTER::balancer_ [private]

Definition at line 252 of file parmaster.h.

ABA_ARRAY<int> ABA_PARMASTER::openSubCount_ [private]

Definition at line 253 of file parmaster.h.

ABA_DUALBOUND ABA_PARMASTER::openSubBest_ [private]

Definition at line 254 of file parmaster.h.

ACE_Thread_Mutex ABA_PARMASTER::newOpenSubCountMutex_ [private]

Definition at line 255 of file parmaster.h.

ACE_Thread_Mutex ABA_PARMASTER::terminationCheckMutex_ [private]

Definition at line 256 of file parmaster.h.

volatile bool ABA_PARMASTER::terminationCheckAgain_ [private]

Definition at line 257 of file parmaster.h.

ACE_Thread_Mutex ABA_PARMASTER::terminationMutex_ [private]

Definition at line 258 of file parmaster.h.

volatile bool ABA_PARMASTER::terminationOk_ [private]

Definition at line 259 of file parmaster.h.

volatile bool ABA_PARMASTER::hasTerminated_ [private]

Definition at line 260 of file parmaster.h.

int ABA_PARMASTER::workCount_ [private]

Definition at line 261 of file parmaster.h.

ACE_Thread_Mutex ABA_PARMASTER::idCounterMutex_ [private]

Definition at line 262 of file parmaster.h.

int ABA_PARMASTER::idCounter_ [private]

Definition at line 263 of file parmaster.h.

int ABA_PARMASTER::subSentCount_ [private]

Definition at line 264 of file parmaster.h.

int ABA_PARMASTER::subReceivedCount_ [private]

Definition at line 265 of file parmaster.h.

ABA_COWTIMER ABA_PARMASTER::idleCowTimeFirst_ [private]

Definition at line 266 of file parmaster.h.

ABA_COWTIMER ABA_PARMASTER::idleCowTimeMiddle_ [private]

Definition at line 267 of file parmaster.h.

ABA_COWTIMER ABA_PARMASTER::idleCowTimeLast_ [private]

Definition at line 268 of file parmaster.h.


The documentation for this class was generated from the following file:
Generated on Tue Aug 14 18:09:58 2007 for ABACUS by  doxygen 1.5.1