ECF 1.5
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Comm::Communicator Class Reference

Communicator class for interprocess communication. More...

#include <Communicator.h>

Public Member Functions

bool initialize (StateP, int, char **)
 
bool finalize ()
 
bool isInitialized ()
 
bool sendIndividuals (std::vector< IndividualP >, uint, uint nIndividuals=0)
 
bool sendIndividualsGlobal (std::vector< IndividualP >, uint, uint nIndividuals=0)
 
bool sendFitness (std::vector< IndividualP >, uint, uint nIndividuals=0)
 
bool sendValuesGlobal (std::vector< double >, uint)
 
bool sendLogsGlobal (std::string, uint iProcess=0, bool blocking=false)
 
bool sendDataGlobal (voidP, uint, uint)
 
uint recvDemeIndividuals (std::vector< IndividualP > &, uint)
 
std::vector< IndividualP > recvIndividuals (uint iProcess=MPI::ANY_SOURCE)
 
std::vector< IndividualP > recvIndividualsGlobal (uint iProcess=MPI::ANY_SOURCE)
 
uint recvReplaceIndividuals (std::vector< IndividualP > &, uint)
 
uint recvDemeFitness (std::vector< IndividualP > &, uint)
 
std::vector< uint > recvFitnessVector (std::vector< IndividualP > &, uint)
 
std::vector< double > recvValuesGlobal (uint iProcess=MPI::ANY_SOURCE)
 
std::string recvLogsGlobal ()
 
voidP recvDataGlobal (uint iProcess=MPI::ANY_SOURCE)
 
bool messageWaiting (uint iProcess=MPI::ANY_SOURCE, uint tag=MPI::ANY_TAG)
 
void synchronize ()
 
bool sendControlMessage (uint, int)
 
int recvControlMessage (uint)
 
bool sendTerminateMessage (uint, bool)
 
bool recvTerminateMessage (uint)
 
bool checkTerminationMessage (uint master=0)
 
uint createDemeCommunicator (uint nDemes)
 
uint getDemeMaster (uint iDeme)
 
uint getLastSource ()
 
uint getCommRank ()
 
uint getCommSize ()
 
uint getCommGlobalRank ()
 
uint getCommGlobalSize ()
 
bool initialize (StateP state, int argc, char **argv)
 
bool finalize ()
 
uint getCommRank ()
 
uint getCommGlobalRank ()
 
uint getCommSize ()
 

Protected Member Functions

double time (enum timing T)
 

Protected Attributes

uint mpiGlobalSize_
 
uint mpiGlobalRank_
 
uint mpiSize_
 
uint mpiRank_
 
std::string processorName_
 
StateP state_
 
MPI::Status status_
 
MPI::Status controlStatus_
 
int logLevel_
 
std::vector< uint > demeMasters
 
bool bInitialized_
 
MPI::Intercomm frameworkComm_
 
MPI::Intercomm demeComm_
 
double currentTime_
 
double lastTime_
 
double beginTime_
 
double endTime_
 
double idleTime_
 
double sendTime_
 
double recvTime_
 
double compTime_
 
double packTime_
 
double unpackTime_
 
uint sendCnt_
 
uint recvCnt_
 

Detailed Description

Communicator class for interprocess communication.

Wraps MPI calls for message passing between processes. Note: will be reimplemented as an abstract class with MPI specialization.

Definition at line 42 of file Communicator.h.

Constructor & Destructor Documentation

◆ Communicator()

Comm::Communicator::Communicator ( )

Definition at line 9 of file Communicator.cpp.

Member Function Documentation

◆ checkTerminationMessage()

bool Comm::Communicator::checkTerminationMessage ( uint  master = 0)

Definition at line 222 of file Communicator.cpp.

◆ createDemeCommunicator()

uint Comm::Communicator::createDemeCommunicator ( uint  nDemes)

Definition at line 62 of file Communicator.cpp.

◆ finalize() [1/2]

bool Comm::Communicator::finalize ( )

Definition at line 83 of file Communicator.cpp.

◆ finalize() [2/2]

bool Comm::Communicator::finalize ( )
inline

Definition at line 147 of file Communicator.h.

◆ getCommGlobalRank() [1/2]

uint Comm::Communicator::getCommGlobalRank ( )
inline

Definition at line 132 of file Communicator.h.

◆ getCommGlobalRank() [2/2]

uint Comm::Communicator::getCommGlobalRank ( )
inline

Definition at line 151 of file Communicator.h.

◆ getCommGlobalSize()

uint Comm::Communicator::getCommGlobalSize ( )
inline

Definition at line 134 of file Communicator.h.

◆ getCommRank() [1/2]

uint Comm::Communicator::getCommRank ( )
inline

Definition at line 128 of file Communicator.h.

◆ getCommRank() [2/2]

uint Comm::Communicator::getCommRank ( )
inline

Definition at line 149 of file Communicator.h.

◆ getCommSize() [1/2]

uint Comm::Communicator::getCommSize ( )
inline

Definition at line 130 of file Communicator.h.

◆ getCommSize() [2/2]

uint Comm::Communicator::getCommSize ( )
inline

Definition at line 153 of file Communicator.h.

◆ getDemeMaster()

uint Comm::Communicator::getDemeMaster ( uint  iDeme)

Definition at line 161 of file Communicator.cpp.

◆ getLastSource()

uint Comm::Communicator::getLastSource ( )

Definition at line 167 of file Communicator.cpp.

◆ initialize() [1/2]

bool Comm::Communicator::initialize ( StateP  state,
int  argc,
char **  argv 
)
inline

Definition at line 145 of file Communicator.h.

◆ initialize() [2/2]

bool Comm::Communicator::initialize ( StateP  state,
int  argc,
char **  argv 
)

Definition at line 18 of file Communicator.cpp.

◆ isInitialized()

bool Comm::Communicator::isInitialized ( )
inline

Definition at line 93 of file Communicator.h.

◆ messageWaiting()

bool Comm::Communicator::messageWaiting ( uint  iProcess = MPI::ANY_SOURCE,
uint  tag = MPI::ANY_TAG 
)

Definition at line 180 of file Communicator.cpp.

◆ recvControlMessage()

int Comm::Communicator::recvControlMessage ( uint  iProcess)

Definition at line 193 of file Communicator.cpp.

◆ recvDataGlobal()

voidP Comm::Communicator::recvDataGlobal ( uint  iProcess = MPI::ANY_SOURCE)

Definition at line 752 of file Communicator.cpp.

◆ recvDemeFitness()

uint Comm::Communicator::recvDemeFitness ( std::vector< IndividualP > &  deme,
uint  iProcess 
)

Definition at line 551 of file Communicator.cpp.

◆ recvDemeIndividuals()

uint Comm::Communicator::recvDemeIndividuals ( std::vector< IndividualP > &  deme,
uint  iProcess 
)

Definition at line 312 of file Communicator.cpp.

◆ recvFitnessVector()

std::vector< uint > Comm::Communicator::recvFitnessVector ( std::vector< IndividualP > &  deme,
uint  iProcess 
)

Definition at line 597 of file Communicator.cpp.

◆ recvIndividuals()

std::vector< IndividualP > Comm::Communicator::recvIndividuals ( uint  iProcess = MPI::ANY_SOURCE)

Definition at line 356 of file Communicator.cpp.

◆ recvIndividualsGlobal()

std::vector< IndividualP > Comm::Communicator::recvIndividualsGlobal ( uint  iProcess = MPI::ANY_SOURCE)

Definition at line 404 of file Communicator.cpp.

◆ recvLogsGlobal()

std::string Comm::Communicator::recvLogsGlobal ( )

Definition at line 685 of file Communicator.cpp.

◆ recvReplaceIndividuals()

uint Comm::Communicator::recvReplaceIndividuals ( std::vector< IndividualP > &  pool,
uint  iProcess 
)

Definition at line 454 of file Communicator.cpp.

◆ recvTerminateMessage()

bool Comm::Communicator::recvTerminateMessage ( uint  iProcess)

Definition at line 210 of file Communicator.cpp.

◆ recvValuesGlobal()

std::vector< double > Comm::Communicator::recvValuesGlobal ( uint  iProcess = MPI::ANY_SOURCE)

Definition at line 659 of file Communicator.cpp.

◆ sendControlMessage()

bool Comm::Communicator::sendControlMessage ( uint  iProcess,
int  control 
)

Definition at line 186 of file Communicator.cpp.

◆ sendDataGlobal()

bool Comm::Communicator::sendDataGlobal ( voidP  data,
uint  size,
uint  iProcess 
)

Definition at line 735 of file Communicator.cpp.

◆ sendFitness()

bool Comm::Communicator::sendFitness ( std::vector< IndividualP >  pool,
uint  iProcess,
uint  nIndividuals = 0 
)

Definition at line 510 of file Communicator.cpp.

◆ sendIndividuals()

bool Comm::Communicator::sendIndividuals ( std::vector< IndividualP >  pool,
uint  iProcess,
uint  nIndividuals = 0 
)

Definition at line 237 of file Communicator.cpp.

◆ sendIndividualsGlobal()

bool Comm::Communicator::sendIndividualsGlobal ( std::vector< IndividualP >  pool,
uint  iProcess,
uint  nIndividuals = 0 
)

Definition at line 275 of file Communicator.cpp.

◆ sendLogsGlobal()

bool Comm::Communicator::sendLogsGlobal ( std::string  logs,
uint  iProcess = 0,
bool  blocking = false 
)

Definition at line 713 of file Communicator.cpp.

◆ sendTerminateMessage()

bool Comm::Communicator::sendTerminateMessage ( uint  iProcess,
bool  termination 
)

Definition at line 201 of file Communicator.cpp.

◆ sendValuesGlobal()

bool Comm::Communicator::sendValuesGlobal ( std::vector< double >  values,
uint  iProcess 
)

Definition at line 642 of file Communicator.cpp.

◆ synchronize()

void Comm::Communicator::synchronize ( )

Definition at line 173 of file Communicator.cpp.

◆ time()

double Comm::Communicator::time ( enum timing  T)
protected

Gets current time and adds elapsed time to a category

Returns
: elapsed time (since last function call)

Definition at line 130 of file Communicator.cpp.

Member Data Documentation

◆ beginTime_

double Comm::Communicator::beginTime_
protected

Definition at line 80 of file Communicator.h.

◆ bInitialized_

bool Comm::Communicator::bInitialized_
protected

Definition at line 54 of file Communicator.h.

◆ compTime_

double Comm::Communicator::compTime_
protected

Definition at line 84 of file Communicator.h.

◆ controlStatus_

MPI::Status Comm::Communicator::controlStatus_
protected

Definition at line 51 of file Communicator.h.

◆ currentTime_

double Comm::Communicator::currentTime_
protected

Definition at line 79 of file Communicator.h.

◆ demeComm_

MPI::Intercomm Comm::Communicator::demeComm_
protected

deme communicator - initially includes all processes (MPI_COMM_WORLD) but may be split into subcomms if multiple deme population is used Used by:

  • the active algorithm, for algorithm implementation and broadcast of termination signal

Definition at line 76 of file Communicator.h.

◆ demeMasters

std::vector<uint> Comm::Communicator::demeMasters
protected

Definition at line 53 of file Communicator.h.

◆ endTime_

double Comm::Communicator::endTime_
protected

Definition at line 80 of file Communicator.h.

◆ frameworkComm_

MPI::Intercomm Comm::Communicator::frameworkComm_
protected

framework communicator - equivalent to MPI_COMM_WORLD Used by:

  • State
    • for termination condition messages
  • Migration
    • for individual exchange between demes
  • Population
    • for statistics and hall-of-fame updates
  • Logger
    • for accumulation of logs to process 0

Definition at line 69 of file Communicator.h.

◆ idleTime_

double Comm::Communicator::idleTime_
protected

Definition at line 81 of file Communicator.h.

◆ lastTime_

double Comm::Communicator::lastTime_
protected

Definition at line 79 of file Communicator.h.

◆ logLevel_

int Comm::Communicator::logLevel_
protected

Definition at line 52 of file Communicator.h.

◆ mpiGlobalRank_

uint Comm::Communicator::mpiGlobalRank_
protected

Definition at line 46 of file Communicator.h.

◆ mpiGlobalSize_

uint Comm::Communicator::mpiGlobalSize_
protected

Definition at line 46 of file Communicator.h.

◆ mpiRank_

uint Comm::Communicator::mpiRank_
protected

Definition at line 47 of file Communicator.h.

◆ mpiSize_

uint Comm::Communicator::mpiSize_
protected

Definition at line 47 of file Communicator.h.

◆ packTime_

double Comm::Communicator::packTime_
protected

Definition at line 85 of file Communicator.h.

◆ processorName_

std::string Comm::Communicator::processorName_
protected

Definition at line 48 of file Communicator.h.

◆ recvCnt_

uint Comm::Communicator::recvCnt_
protected

Definition at line 87 of file Communicator.h.

◆ recvTime_

double Comm::Communicator::recvTime_
protected

Definition at line 83 of file Communicator.h.

◆ sendCnt_

uint Comm::Communicator::sendCnt_
protected

Definition at line 86 of file Communicator.h.

◆ sendTime_

double Comm::Communicator::sendTime_
protected

Definition at line 82 of file Communicator.h.

◆ state_

StateP Comm::Communicator::state_
protected

Definition at line 49 of file Communicator.h.

◆ status_

MPI::Status Comm::Communicator::status_
protected

Definition at line 50 of file Communicator.h.

◆ unpackTime_

double Comm::Communicator::unpackTime_
protected

Definition at line 85 of file Communicator.h.


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