casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Private Attributes
casa::Applicator Class Reference

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

#include <Applicator.h>

List of all members.

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

Private Member Functions

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

Private Attributes

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

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

Default constructor, and destructor.


Member Function Documentation

Execute an algorithm directly.

define an Algorithm if we need too;

Fill algorithm map.

Signal that a worker process is done.

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

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

Definition at line 146 of file Applicator.h.

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

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

Definition at line 147 of file Applicator.h.

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

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

Definition at line 148 of file Applicator.h.

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

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

Definition at line 149 of file Applicator.h.

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

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

Definition at line 150 of file Applicator.h.

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

Int casa::Applicator::get ( Float n) [inline]

Definition at line 151 of file Applicator.h.

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

Int casa::Applicator::get ( Double n) [inline]

Definition at line 152 of file Applicator.h.

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

Int casa::Applicator::get ( Complex &  n) [inline]

Definition at line 153 of file Applicator.h.

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

Int casa::Applicator::get ( DComplex &  n) [inline]

Definition at line 154 of file Applicator.h.

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

Int casa::Applicator::get ( Int n) [inline]

Definition at line 155 of file Applicator.h.

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

Int casa::Applicator::get ( Bool b) [inline]

Definition at line 156 of file Applicator.h.

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

Int casa::Applicator::get ( String s) [inline]

Definition at line 157 of file Applicator.h.

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

Int casa::Applicator::get ( Record r) [inline]

Definition at line 158 of file Applicator.h.

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

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

Initialization (includes parallel transport initialization)

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

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

True if executing serially.

Definition at line 114 of file Applicator.h.

References serial.

void casa::Applicator::loop ( ) [private]

Executed by worker process waiting for an assigned task.

Assign the next free worker process to a specified Algorithm.

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

Return the number of processes.

Definition at line 117 of file Applicator.h.

References nProcs.

Int casa::Applicator::put ( const Array< 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().

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

Definition at line 133 of file Applicator.h.

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

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

Definition at line 134 of file Applicator.h.

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

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

Definition at line 135 of file Applicator.h.

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

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

Definition at line 136 of file Applicator.h.

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

Int casa::Applicator::put ( const Float n) [inline]

Definition at line 137 of file Applicator.h.

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

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

Definition at line 138 of file Applicator.h.

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

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

Definition at line 139 of file Applicator.h.

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

Int casa::Applicator::put ( const Double n) [inline]

Definition at line 140 of file Applicator.h.

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

Int casa::Applicator::put ( const Int n) [inline]

Definition at line 141 of file Applicator.h.

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

Int casa::Applicator::put ( const Bool b) [inline]

Definition at line 142 of file Applicator.h.

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

Int casa::Applicator::put ( const String s) [inline]

Definition at line 143 of file Applicator.h.

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

Int casa::Applicator::put ( const Record r) [inline]

Definition at line 144 of file Applicator.h.

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

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


Member Data Documentation

Map of known algorithm names and id.

's

Definition at line 165 of file Applicator.h.

Pointer to the parallel transport.

Definition at line 158 of file Applicator.h.

Referenced by get(), and put().

Definition at line 166 of file Applicator.h.

ID for the last Algorithm defined.

Definition at line 169 of file Applicator.h.

Number of processes.

Definition at line 178 of file Applicator.h.

Referenced by numProcs().

Process status list.

Definition at line 181 of file Applicator.h.

True if executing in serial.

Definition at line 175 of file Applicator.h.

Referenced by isSerial().

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: