casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
casa::Applicator Class Reference

Class which provides an interface to the parallelization infrastructure. More...

#include <Applicator.h>

Public Types

enum  Status {
  FREE,
  ASSIGNED
}
 Enum to define the process status table. More...
 
enum  Signals {
  STOP,
  DONE
}
 Recognized signals. More...
 

Public Member Functions

 Applicator ()
 Default constructor, and destructor. More...
 
 ~Applicator ()
 
void init (casacore::Int argc, casacore::Char *argv[])
 Initialization (includes parallel transport initialization) More...
 
void initThreads (casacore::Int argc, casacore::Char *argv[])
 
void initThreads ()
 
void defineAlgorithm (Algorithm *)
 define an Algorithm if we need too; More...
 
casacore::Bool isController ()
 Status functions to indicate whether this Applicator is executing as a controller or worker process. More...
 
casacore::Bool isWorker ()
 
casacore::Bool isSerial ()
 true if executing serially More...
 
casacore::Int numProcs ()
 Return the number of processes. More...
 
casacore::Bool nextAvailProcess (Algorithm &a, casacore::Int &rank)
 Assign the next free worker process to a specified Algorithm. More...
 
casacore::Int nextProcessDone (Algorithm &a, casacore::Bool &allDone)
 Return the rank of the next process to complete the specified Algorithm. More...
 
void done ()
 Signal that a worker process is done. More...
 
void apply (Algorithm &a)
 Execute an algorithm directly. More...
 
casacore::Int put (const casacore::Array< casacore::Float > &an)
 Put and get methods to be executed on the parallel transport layer. More...
 
casacore::Int put (const casacore::Array< casacore::Double > &an)
 
casacore::Int put (const casacore::Array< casacore::Int > &an)
 
casacore::Int put (const casacore::Array< casacore::Complex > &an)
 
casacore::Int put (const casacore::Array< casacore::DComplex > &an)
 
casacore::Int put (const casacore::Float &n)
 
casacore::Int put (const casacore::Complex &n)
 
casacore::Int put (const casacore::DComplex &n)
 
casacore::Int put (const casacore::Double &n)
 
casacore::Int put (const casacore::Int &n)
 
casacore::Int put (const casacore::Bool &b)
 
casacore::Int put (const casacore::String &s)
 
casacore::Int put (const casacore::Record &r)
 
casacore::Int get (casacore::Array< casacore::Float > &an)
 
casacore::Int get (casacore::Array< casacore::Double > &an)
 
casacore::Int get (casacore::Array< casacore::Complex > &an)
 
casacore::Int get (casacore::Array< casacore::DComplex > &an)
 
casacore::Int get (casacore::Array< casacore::Int > &an)
 
casacore::Int get (casacore::Float &n)
 
casacore::Int get (casacore::Double &n)
 
casacore::Int get (casacore::Complex &n)
 
casacore::Int get (casacore::DComplex &n)
 
casacore::Int get (casacore::Int &n)
 
casacore::Int get (casacore::Bool &b)
 
casacore::Int get (casacore::String &s)
 
casacore::Int get (casacore::Record &r)
 

Private Member Functions

void loop ()
 Executed by worker process waiting for an assigned task. More...
 
void defineAlgorithms ()
 Fill algorithm map. More...
 
void setupProcStatus ()
 Utility functions for the current list of processes, and their status. More...
 
casacore::Int findFreeProc (casacore::Bool &lastOne)
 

Private Attributes

PTransportcomm
 Pointer to the parallel transport. More...
 
std::map< casacore::String,
casacore::Int
algorithmIds
 casacore::Map of known algorithm names and id. More...
 
std::map< casacore::Int,
Algorithm * > 
knownAlgorithms
 
casacore::Int LastID
 ID for the last Algorithm defined. More...
 
casacore::Bool usedAllThreads
 true if no more processes are free More...
 
casacore::Bool serial
 true if executing in serial More...
 
casacore::Int nProcs
 Number of processes. More...
 
casacore::Vector< casacore::IntprocStatus
 Process status list. More...
 

Detailed Description

Class which provides an interface to the parallelization infrastructure.

Intended use:

Internal

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Applies or controls the execution of parallelized algorithms.

Synopsis

The Applicator class provides the interface to parallel communication. It holds the parallel transport layer, and controls the execution of parallelized algorithms.

Example

Motivation

To provide a simple programming interface to parallelization, and to encapsulate the transport layer and parallel process control.

Definition at line 88 of file Applicator.h.

Member Enumeration Documentation

Recognized signals.

Enumerator
STOP 
DONE 

Definition at line 94 of file Applicator.h.

Enum to define the process status table.

Enumerator
FREE 
ASSIGNED 

Definition at line 91 of file Applicator.h.

Constructor & Destructor Documentation

casa::Applicator::Applicator ( )

Default constructor, and destructor.

casa::Applicator::~Applicator ( )

Member Function Documentation

void casa::Applicator::apply ( Algorithm a)

Execute an algorithm directly.

void casa::Applicator::defineAlgorithm ( Algorithm )

define an Algorithm if we need too;

void casa::Applicator::defineAlgorithms ( )
private

Fill algorithm map.

void casa::Applicator::done ( )

Signal that a worker process is done.

Referenced by casa::Algorithm::apply().

casacore::Int casa::Applicator::findFreeProc ( casacore::Bool lastOne)
private
casacore::Int casa::Applicator::get ( casacore::Array< casacore::Float > &  an)
inline

Definition at line 146 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Array< casacore::Double > &  an)
inline

Definition at line 147 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Array< casacore::Complex > &  an)
inline

Definition at line 148 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Array< casacore::DComplex > &  an)
inline

Definition at line 149 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Array< casacore::Int > &  an)
inline

Definition at line 150 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Float n)
inline

Definition at line 151 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Double n)
inline

Definition at line 152 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Complex &  n)
inline

Definition at line 153 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::DComplex &  n)
inline

Definition at line 154 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Int n)
inline

Definition at line 155 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Bool b)
inline

Definition at line 156 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::String s)
inline

Definition at line 157 of file Applicator.h.

References comm, and casa::PTransport::get().

casacore::Int casa::Applicator::get ( casacore::Record r)
inline

Definition at line 158 of file Applicator.h.

References comm, and casa::PTransport::get().

void casa::Applicator::init ( casacore::Int  argc,
casacore::Char argv[] 
)

Initialization (includes parallel transport initialization)

void casa::Applicator::initThreads ( casacore::Int  argc,
casacore::Char argv[] 
)
void casa::Applicator::initThreads ( )
casacore::Bool casa::Applicator::isController ( )

Status functions to indicate whether this Applicator is executing as a controller or worker process.

casacore::Bool casa::Applicator::isSerial ( )
inline

true if executing serially

Definition at line 114 of file Applicator.h.

References serial.

casacore::Bool casa::Applicator::isWorker ( )
void casa::Applicator::loop ( )
private

Executed by worker process waiting for an assigned task.

casacore::Bool casa::Applicator::nextAvailProcess ( Algorithm a,
casacore::Int rank 
)

Assign the next free worker process to a specified Algorithm.

casacore::Int casa::Applicator::nextProcessDone ( Algorithm a,
casacore::Bool allDone 
)

Return the rank of the next process to complete the specified Algorithm.

casacore::Int casa::Applicator::numProcs ( )
inline

Return the number of processes.

Definition at line 117 of file Applicator.h.

References nProcs.

casacore::Int casa::Applicator::put ( const casacore::Array< casacore::Float > &  an)
inline

Put and get methods to be executed on the parallel transport layer.

Definition at line 132 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Array< casacore::Double > &  an)
inline

Definition at line 133 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Array< casacore::Int > &  an)
inline

Definition at line 134 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Array< casacore::Complex > &  an)
inline

Definition at line 135 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Array< casacore::DComplex > &  an)
inline

Definition at line 136 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Float n)
inline

Definition at line 137 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Complex &  n)
inline

Definition at line 138 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::DComplex &  n)
inline

Definition at line 139 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Double n)
inline

Definition at line 140 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Int n)
inline

Definition at line 141 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Bool b)
inline

Definition at line 142 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::String s)
inline

Definition at line 143 of file Applicator.h.

References comm, and casa::PTransport::put().

casacore::Int casa::Applicator::put ( const casacore::Record r)
inline

Definition at line 144 of file Applicator.h.

References comm, and casa::PTransport::put().

void casa::Applicator::setupProcStatus ( )
private

Utility functions for the current list of processes, and their status.

Member Data Documentation

std::map<casacore::String, casacore::Int> casa::Applicator::algorithmIds
private

casacore::Map of known algorithm names and id.

's

Definition at line 165 of file Applicator.h.

PTransport* casa::Applicator::comm
private

Pointer to the parallel transport.

Definition at line 158 of file Applicator.h.

Referenced by get(), and put().

std::map<casacore::Int, Algorithm*> casa::Applicator::knownAlgorithms
private

Definition at line 166 of file Applicator.h.

casacore::Int casa::Applicator::LastID
private

ID for the last Algorithm defined.

Definition at line 169 of file Applicator.h.

casacore::Int casa::Applicator::nProcs
private

Number of processes.

Definition at line 178 of file Applicator.h.

Referenced by numProcs().

casacore::Vector<casacore::Int> casa::Applicator::procStatus
private

Process status list.

Definition at line 181 of file Applicator.h.

casacore::Bool casa::Applicator::serial
private

true if executing in serial

Definition at line 175 of file Applicator.h.

Referenced by isSerial().

casacore::Bool casa::Applicator::usedAllThreads
private

true if no more processes are free

Definition at line 172 of file Applicator.h.


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