ProtoMol - an object-oriented component based framework for Molecular Dynamics simulations.

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

ProtoMol::Parallel Class Reference

#include <Parallel.h>

List of all members.

Static Public Member Functions

void init (int &argc, char **&argv)
void finalize ()
bool initialized ()
bool finalized ()
bool ok ()
int getId ()
int getMasterId ()
int getNum ()
int getAvailableId ()
int getAvailableNum ()
bool isParallel ()
bool iAmMaster ()
bool iAmSlave ()
ParallelType getMode ()
void setMode (ParallelType mode)
bool isDynamic ()
int getPipeSize ()
void setPipeSize (int n)
bool isBarrier ()
void setBarrier (bool b)
int getMaxPackages ()
void setMaxPackages (int n)
void bcast (Vector3DBlock *coords)
void bcast (int &n)
void distribute (ScalarStructure *energy, Vector3DBlock *coords)
void reduce (ScalarStructure *energy, Vector3DBlock *coords)
void reduceSlaves (Real *begin, Real *end)
void bcastSlaves (Real *begin, Real *end)
void sync ()
void syncSlave ()
unsigned int getNumberOfPackages (unsigned int n)
bool next ()
void resetNext ()
void resetNext (const std::vector< int > &blocks)

Static Public Attributes

const bool isMPI = false

Private Types

enum  WorkState {
  DONE,
  SEQUENTIAL,
  STATIC,
  SLAVE,
  MASTER
}

Private Member Functions

 Parallel ()
 ~Parallel ()
 Parallel (const Parallel &)
Paralleloperator= (const Parallel &)

Static Private Member Functions

void kill ()
Parallelinstance ()
bool ok (const std::string &err)
WorkState getWorkState ()
void nextMaster ()

Static Private Attributes

bool myInitialized = false
bool myFinalized = false
int myId = 0
int myMasterId = master
int myNum = 1
int myAvailableId = 0
int myAvailableNum = 1
bool myIsParallel = Parallel::isMPI
bool myIAmMaster = true
bool myIAmSlave = true
ParallelType myMode = ParallelType::STATIC
WorkState myWorkState = Parallel::SEQUENTIAL
int myPipeSize = 1
bool myUseBarrier = false
int myMaxPackages = -1
int * myBuffer = NULL
int myNext = 0
int myNextRange [2] = {0,0}
std::vector< int > myDone
std::vector< int > myBlockList
int myRecv
int myI
int myP
Parallelobj = NULL


Member Enumeration Documentation

enum ProtoMol::Parallel::WorkState [private]
 

< Enum specifing the actual working state of the node

Enumeration values:
DONE  next() always false, when slave has nothing more to compute
SEQUENTIAL  next() always true, traps calls of next() when running with 1 node (should not happen!)
STATIC  next() based on modulo, simple load balancing
SLAVE  slave
MASTER  master


Constructor & Destructor Documentation

ProtoMol::Parallel::Parallel  )  [private]
 

ProtoMol::Parallel::~Parallel  )  [private]
 

ProtoMol::Parallel::Parallel const Parallel  )  [inline, private]
 


Member Function Documentation

void ProtoMol::Parallel::bcast int &  n  )  [static]
 

void ProtoMol::Parallel::bcast Vector3DBlock coords  )  [static]
 

Broadcast a Vector3DBlock from the master to the rest. Handles also the case if the receiving nodes have an emty (other size) Vector3DBlock.

void ProtoMol::Parallel::bcastSlaves Real begin,
Real end
[static]
 

Broadcast over all nodes, exluding the master if running master-slave.

void ProtoMol::Parallel::distribute ScalarStructure energy,
Vector3DBlock coords
[static]
 

Does the preprocessing, clearing the energies and forces for all nodes except the master.

void ProtoMol::Parallel::finalize  )  [static]
 

MPI_Finialize.

bool ProtoMol::Parallel::finalized  )  [inline, static]
 

int ProtoMol::Parallel::getAvailableId  )  [inline, static]
 

int ProtoMol::Parallel::getAvailableNum  )  [inline, static]
 

int ProtoMol::Parallel::getId  )  [inline, static]
 

int ProtoMol::Parallel::getMasterId  )  [inline, static]
 

int ProtoMol::Parallel::getMaxPackages  )  [inline, static]
 

ParallelType ProtoMol::Parallel::getMode  )  [inline, static]
 

int ProtoMol::Parallel::getNum  )  [inline, static]
 

unsigned int ProtoMol::Parallel::getNumberOfPackages unsigned int  n  )  [static]
 

Returns the number of packages over all forces.

int ProtoMol::Parallel::getPipeSize  )  [inline, static]
 

Parallel::WorkState ProtoMol::Parallel::getWorkState  )  [static, private]
 

bool ProtoMol::Parallel::iAmMaster  )  [inline, static]
 

bool ProtoMol::Parallel::iAmSlave  )  [inline, static]
 

void ProtoMol::Parallel::init int &  argc,
char **&  argv
[static]
 

MPI_Init and sets id and number of process.

bool ProtoMol::Parallel::initialized  )  [inline, static]
 

Parallel & ProtoMol::Parallel::instance  )  [static, private]
 

bool ProtoMol::Parallel::isBarrier  )  [inline, static]
 

bool ProtoMol::Parallel::isDynamic  )  [inline, static]
 

bool ProtoMol::Parallel::isParallel  )  [inline, static]
 

void ProtoMol::Parallel::kill  )  [static, private]
 

bool ProtoMol::Parallel::next  )  [static]
 

true if the actual work package should computed, false skip it

void ProtoMol::Parallel::nextMaster  )  [static, private]
 

bool ProtoMol::Parallel::ok const std::string &  err  )  [static, private]
 

bool ProtoMol::Parallel::ok  )  [inline, static]
 

Parallel& ProtoMol::Parallel::operator= const Parallel  )  [inline, private]
 

void ProtoMol::Parallel::reduce ScalarStructure energy,
Vector3DBlock coords
[static]
 

Does a reduction and a broadcast, such that all nodes have the correct summed energies and forces locally.

void ProtoMol::Parallel::reduceSlaves Real begin,
Real end
[static]
 

Reduction over all nodes, exluding the master if running master-slave.

void ProtoMol::Parallel::resetNext const std::vector< int > &  blocks  )  [static]
 

void ProtoMol::Parallel::resetNext  )  [inline, static]
 

void ProtoMol::Parallel::setBarrier bool  b  )  [inline, static]
 

void ProtoMol::Parallel::setMaxPackages int  n  )  [static]
 

void ProtoMol::Parallel::setMode ParallelType  mode  )  [static]
 

void ProtoMol::Parallel::setPipeSize int  n  )  [static]
 

void ProtoMol::Parallel::sync  )  [static]
 

Syncronize all nodes.

void ProtoMol::Parallel::syncSlave  )  [static]
 

Syncronize all slaves, exluding the master if running master-slave.


Member Data Documentation

const bool ProtoMol::Parallel::isMPI = false [static]
 

int ProtoMol::Parallel::myAvailableId = 0 [static, private]
 

Actual master-slave id, -1 for the master.

int ProtoMol::Parallel::myAvailableNum = 1 [static, private]
 

Available number of nodes for computation.

vector< int > ProtoMol::Parallel::myBlockList [static, private]
 

List of of the force partitioning.

int * ProtoMol::Parallel::myBuffer = NULL [static, private]
 

Bsend buffer.

vector< int > ProtoMol::Parallel::myDone [static, private]
 

Master, keeps track of slave have got already their work.

bool ProtoMol::Parallel::myFinalized = false [static, private]
 

int ProtoMol::Parallel::myI [static, private]
 

Index of the actual work package (only master).

bool ProtoMol::Parallel::myIAmMaster = true [static, private]
 

If this node is master.

bool ProtoMol::Parallel::myIAmSlave = true [static, private]
 

If this node is slave/worker.

int ProtoMol::Parallel::myId = 0 [static, private]
 

Actual id of the node, [0,1,...,N-1].

bool ProtoMol::Parallel::myInitialized = false [static, private]
 

If Parallel is initialized.

bool ProtoMol::Parallel::myIsParallel = Parallel::isMPI [static, private]
 

If environment has more that 1 node.

int ProtoMol::Parallel::myMasterId = master [static, private]
 

Id of the master.

int ProtoMol::Parallel::myMaxPackages = -1 [static, private]
 

Number of max. packages per node per force.

ParallelType ProtoMol::Parallel::myMode = ParallelType::STATIC [static, private]
 

Parallelization scheme.

int ProtoMol::Parallel::myNext = 0 [static, private]
 

Counter of next() calls.

int ProtoMol::Parallel::myNextRange = {0,0} [static, private]
 

Actual work package to work on [from,to].

int ProtoMol::Parallel::myNum = 1 [static, private]
 

Number of nodes, N.

int ProtoMol::Parallel::myP [static, private]
 

Node number.

int ProtoMol::Parallel::myPipeSize = 1 [static, private]
 

Number of add. work packages to push to slaves.

int ProtoMol::Parallel::myRecv [static, private]
 

Number of outstanding receives.

bool ProtoMol::Parallel::myUseBarrier = false [static, private]
 

Flag to signal usage of MPI_Barrier.

Parallel::WorkState ProtoMol::Parallel::myWorkState = Parallel::SEQUENTIAL [static, private]
 

Actual work state.

Parallel * ProtoMol::Parallel::obj = NULL [static, private]
 

Instance.


The documentation for this class was generated from the following files: Last update: . GNU GENERAL PUBLIC LICENSE, copyrighted by the University of Notre Dame and the University of Bergen, Norway.