LAMA
lama::Communicator Class Reference

Base and interface class for communicators used in LAMA. More...

#include <Communicator.hpp>

Inheritance diagram for lama::Communicator:

Public Types

enum  ThreadSafetyLevel { Funneled = 1, Serialized = 2, Multiple = 3 }
 Enumeration type for supported thread safety levels. More...

Public Member Functions

virtual ~Communicator ()
void factorize2 (const double sizeX, const double sizeY, PartitionId procgrid[2]) const
void factorize3 (const double sizeX, const double sizeY, const double sizeZ, PartitionId procgrid[3]) const
void getGrid2Rank (PartitionId pos[2], const PartitionId procgrid[2]) const
void getGrid3Rank (PartitionId pos[3], const PartitionId procgrid[3]) const
bool operator== (const Communicator &other) const
 Equality operator for two communicators.
bool operator!= (const Communicator &other) const
virtual bool isEqual (const Communicator &other) const =0
 Virtual method used for the equality operator.
virtual ThreadSafetyLevel getThreadSafetyLevel () const =0
virtual PartitionId getSize () const =0
 Number of partitions.
virtual PartitionId getRank () const =0
 Id of this partitinon.
PartitionId getNeighbor (int pos) const
 Help routine to get the rank of a neighbored position.
virtual void all2all (int *recvValues, const int *sendValues) const =0
 All-to-all exchange of an integer value between all processors.
virtual void exchangeByPlan (int *const recvData, const CommunicationPlan &recvPlan, const int *const sendData, const CommunicationPlan &sendPlan) const =0
 Exchange data between all processors by communication plans.
virtual void exchangeByPlan (float *const recvData, const CommunicationPlan &recvPlan, const float *const sendData, const CommunicationPlan &sendPlan) const =0
 Exchange of float values.
virtual void exchangeByPlan (double *const recvData, const CommunicationPlan &recvPlan, const double *const sendData, const CommunicationPlan &sendPlan) const =0
 Exchange of double values.
virtual std::auto_ptr< SyncTokenexchangeByPlanAsync (int *const recvData, const CommunicationPlan &recvPlan, const int *const sendData, const CommunicationPlan &sendPlan) const =0
virtual std::auto_ptr< SyncTokenexchangeByPlanAsync (float *const recvData, const CommunicationPlan &recvPlan, const float *const sendData, const CommunicationPlan &sendPlan) const =0
 Exchange of float values.
virtual std::auto_ptr< SyncTokenexchangeByPlanAsync (double *const recvData, const CommunicationPlan &recvPlan, const double *const sendData, const CommunicationPlan &sendPlan) const =0
 Exchange of double values.
template<typename T >
void exchangeByPlan (LAMAArray< T > &recvArray, const CommunicationPlan &recvPlan, const LAMAArray< T > &sendArray, const CommunicationPlan &sendPlan) const
template<typename T >
std::auto_ptr< SyncTokenexchangeByPlanAsync (LAMAArray< T > &recvArray, const CommunicationPlan &recvPlan, const LAMAArray< T > &sendArray, const CommunicationPlan &sendPlan) const
template<typename T >
void updateHalo (LAMAArray< T > &haloValues, const LAMAArray< T > &localValues, const Halo &halo) const
 Update of halo array via Halo object.
template<typename T >
std::auto_ptr< SyncTokenupdateHaloAsync (LAMAArray< T > &haloValues, const LAMAArray< T > &localValues, const Halo &halo) const
 Asynchronous update of halo array via Halo object.
template<typename T >
void shift (LAMAArray< T > &recv, const LAMAArray< T > &send, const int direction) const
 Shift on LAMA arrays.
template<typename T >
std::auto_ptr< SyncTokenshiftAsync (LAMAArray< T > &recvArray, const LAMAArray< T > &sendArray, const int direction) const
 Asychronous shift on LAMA arrays.
void computeOwners (const std::vector< IndexType > &requiredIndexes, const Distribution &distribution, std::vector< PartitionId > &owners) const
 Ownership computation for indexes where only each partition individually can determine whether an index is local or not.
virtual void bcast (double val[], const IndexType n, const PartitionId root) const =0
 Broadcast a typed array from root to all other processors.
virtual void bcast (float val[], const IndexType n, const PartitionId root) const =0
virtual void bcast (int val[], const IndexType n, const PartitionId root) const =0
virtual void scatter (double myvals[], const IndexType n, const PartitionId root, const double allvals[]) const =0
 Scatter of an array of values from root to all other processors.
virtual void scatter (float myvals[], const IndexType n, const PartitionId root, const float allvals[]) const =0
virtual void scatter (int myvals[], const IndexType n, const PartitionId root, const int allvals[]) const =0
virtual void scatter (double myvals[], const IndexType n, const PartitionId root, const double allvals[], const IndexType sizes[]) const =0
 Scatter of an array of values from root to all other processors.
virtual void scatter (float myvals[], const IndexType n, const PartitionId root, const float allvals[], const IndexType sizes[]) const =0
virtual void scatter (int myvals[], const IndexType n, const PartitionId root, const int allvals[], const IndexType sizes[]) const =0
virtual void gather (double allvals[], const IndexType n, const PartitionId root, const double myvals[]) const =0
 Gather of an array of values from all processors to root.
virtual void gather (float allvals[], const IndexType n, const PartitionId root, const float myvals[]) const =0
virtual void gather (int allvals[], const IndexType n, const PartitionId root, const int myvals[]) const =0
virtual void gather (double allvals[], const IndexType n, const PartitionId root, const double myvals[], const IndexType sizes[]) const =0
 Gather of an array of values from all processors to root.
virtual void gather (float allvals[], const IndexType n, const PartitionId root, const float myvals[], const IndexType sizes[]) const =0
virtual void gather (int allvals[], const IndexType n, const PartitionId root, const int myvals[], const IndexType sizes[]) const =0
virtual IndexType shift (double newVals[], const IndexType newSize, const double oldVals[], const IndexType oldSize, const int direction) const =0
 This routine shifts data between neighbored processors.
virtual IndexType shift (float newVals[], const IndexType newSize, const float oldVals[], const IndexType oldSize, const int direction) const =0
virtual IndexType shift (int newVals[], const IndexType newSize, const int oldVals[], const IndexType oldSize, const int direction) const =0
virtual std::auto_ptr< SyncTokenshiftAsync (double newVals[], const double oldVals[], const IndexType size, const int direction) const
 Asynchronous version of shift.
virtual std::auto_ptr< SyncTokenshiftAsync (float newVals[], const float oldVals[], const IndexType size, const int direction) const
virtual std::auto_ptr< SyncTokenshiftAsync (int newVals[], const int oldVals[], const IndexType size, const int direction) const
virtual float sum (const float value) const =0
 Sum operations sum up one single value from each partition to a global value.
virtual double sum (const double value) const =0
virtual int sum (const int value) const =0
virtual size_t sum (const size_t value) const =0
virtual float min (const float value) const =0
virtual float max (const float value) const =0
virtual double min (const double value) const =0
virtual double max (const double value) const =0
virtual int min (const int value) const =0
virtual int max (const int value) const =0
virtual void maxloc (double &val, int &location, const PartitionId root) const =0
 Maximal value combined with a location value where maximum was found.
virtual void maxloc (float &val, int &location, const PartitionId root) const =0
virtual void maxloc (int &val, int &location, const PartitionId root) const =0
virtual void swap (double val[], const IndexType n, const PartitionId partner) const =0
 Swap of an array with another processor.
virtual void swap (float val[], const IndexType n, const PartitionId partner) const =0
virtual void swap (int val[], const IndexType n, const PartitionId partner) const =0
virtual void gather (std::vector< float > &values, float value) const =0
 Gather single float value from each processor into a vector.
virtual void synchronize () const =0
 Barrier synchronization between all processors.
virtual void writeAt (std::ostream &stream) const
 Override virtual method of base class Printable.
const std::string & getType () const
 getter for the type of a communicator.

Protected Member Functions

 Communicator (const std::string &type)
 LAMA_LOG_DECL_STATIC_LOGGER (logger)
template<typename T >
IndexType shift0 (T newVals[], const IndexType newSize, const T oldVals[], const IndexType oldSize) const
 Shift implementation for direction == 0, just copies values.
template<typename T >
std::auto_ptr< SyncTokendefaultShiftAsync (T newVals[], const T oldVals[], const IndexType size, const int direction) const
 Default asynchronous shift uses synchronous shift.
virtual ContextPtr getCommunicationContext () const =0
 getter for Context needed for Communication

Static Protected Member Functions

static void getUserProcArray (PartitionId userProcArray[3])
 Read in the environment variable NP4LAMA for user processor array.

Protected Attributes

std::string mCommunicatorType

Detailed Description

Base and interface class for communicators used in LAMA.

This base class defines pure methods for communication and data exchange between the different partitions of a distributed application. These pure methods must be provided by base classes that implement a full communicator.

Furthermore, this class provides also some higher functionality communication methods especially for LAMA arrays that will use the pure virtual methods.

Communicator objects will be managed by the Communicator factory. All operations on a communicator are const methods. Communicators are referenced via shared pointers so that resources are freed only if no more reference to the communicator exists.

Default copy constructor and assignment operator are disabled.


Member Enumeration Documentation

Enumeration type for supported thread safety levels.

Enumerator:
Funneled 

The Program can be multithreaded but only the master thread should communicate.

Serialized 

The Program can be multithreaded but the communicator usage is serialized.

Multiple 

The Program can be multithreaded and the communicator can be used by all threads concurrently.


Constructor & Destructor Documentation

lama::Communicator::Communicator ( const std::string &  type) [protected]

Member Function Documentation

virtual void lama::Communicator::all2all ( int *  recvValues,
const int *  sendValues 
) const [pure virtual]

All-to-all exchange of an integer value between all processors.

Parameters:
[out]recvValueswill contain one value from each processor
[in]sendValuesmust contain one value for each processor

recvValues and sendValues must both have a size of communicator size. recvValues[i] on processor j contains sendValues[j] of processor i.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

Referenced by lama::CommunicationPlan::allocateTranspose().

virtual void lama::Communicator::bcast ( double  val[],
const IndexType  n,
const PartitionId  root 
) const [pure virtual]

Broadcast a typed array from root to all other processors.

Parameters:
[in,out]valin on root, out on all other processors
[in]nnumber of elements in vector val
[in]rootprocessor with correct values of val

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

Referenced by lama::SparseMatrix< T >::getRow(), and lama::DenseMatrix< T >::getRow().

virtual void lama::Communicator::bcast ( float  val[],
const IndexType  n,
const PartitionId  root 
) const [pure virtual]
virtual void lama::Communicator::bcast ( int  val[],
const IndexType  n,
const PartitionId  root 
) const [pure virtual]
void lama::Communicator::computeOwners ( const std::vector< IndexType > &  requiredIndexes,
const Distribution distribution,
std::vector< PartitionId > &  owners 
) const

Ownership computation for indexes where only each partition individually can determine whether an index is local or not.

This method should not be called for distributions where the owner can be computed by a closed formula.

References lama::WriteAccess< T >::get(), lama::Distribution::getCommunicator(), getRank(), getSize(), lama::Distribution::isLocal(), LAMA_ASSERT_ERROR, LAMA_THROWEXCEPTION, max(), lama::WriteAccess< T >::release(), shift(), and lama::LAMAArray< T >::swap().

Referenced by lama::HaloBuilder::build().

template<typename T >
template LAMA_DLL_IMPORTEXPORT auto_ptr< SyncToken > lama::Communicator::defaultShiftAsync ( newVals[],
const T  oldVals[],
const IndexType  size,
const int  direction 
) const [protected]

Default asynchronous shift uses synchronous shift.

References LAMA_ASSERT_ERROR, and shift().

Referenced by lama::PGASCommunicator::shiftAsync(), lama::MPICommunicator::shiftAsync(), and shiftAsync().

virtual void lama::Communicator::exchangeByPlan ( int *const  recvData,
const CommunicationPlan recvPlan,
const int *const  sendData,
const CommunicationPlan sendPlan 
) const [pure virtual]

Exchange data between all processors by communication plans.

Parameters:
[out]recvDatabuffer for data received from other processors
[in]recvPlannumber of elements and offsets for receiving
[in]sendDatabuffer for data to send to other processors
[in]sendPlancontains number of elements and offsets for sending data

All send and receive data between each pair of processors must be a contiguous part of the sendData or recvData.

The size of recvData must be recvPlan.totalQuantity(). The size of sendData must be sendPlan.totalQuantity().

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

Referenced by exchangeByPlan(), lama::StorageMethods< T >::exchangeHaloCSR(), lama::Redistributor::exchangeHaloN(), lama::SpecializedJacobi::iterateTyped(), and updateHalo().

virtual void lama::Communicator::exchangeByPlan ( float *const  recvData,
const CommunicationPlan recvPlan,
const float *const  sendData,
const CommunicationPlan sendPlan 
) const [pure virtual]

Exchange of float values.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual void lama::Communicator::exchangeByPlan ( double *const  recvData,
const CommunicationPlan recvPlan,
const double *const  sendData,
const CommunicationPlan sendPlan 
) const [pure virtual]

Exchange of double values.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual std::auto_ptr<SyncToken> lama::Communicator::exchangeByPlanAsync ( int *const  recvData,
const CommunicationPlan recvPlan,
const int *const  sendData,
const CommunicationPlan sendPlan 
) const [pure virtual]
virtual std::auto_ptr<SyncToken> lama::Communicator::exchangeByPlanAsync ( float *const  recvData,
const CommunicationPlan recvPlan,
const float *const  sendData,
const CommunicationPlan sendPlan 
) const [pure virtual]

Exchange of float values.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual std::auto_ptr<SyncToken> lama::Communicator::exchangeByPlanAsync ( double *const  recvData,
const CommunicationPlan recvPlan,
const double *const  sendData,
const CommunicationPlan sendPlan 
) const [pure virtual]

Exchange of double values.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

template<typename T >
std::auto_ptr< SyncToken > lama::Communicator::exchangeByPlanAsync ( LAMAArray< T > &  recvArray,
const CommunicationPlan recvPlan,
const LAMAArray< T > &  sendArray,
const CommunicationPlan sendPlan 
) const
void lama::Communicator::factorize2 ( const double  sizeX,
const double  sizeY,
PartitionId  procgrid[2] 
) const
void lama::Communicator::factorize3 ( const double  sizeX,
const double  sizeY,
const double  sizeZ,
PartitionId  procgrid[3] 
) const
virtual void lama::Communicator::gather ( double  allvals[],
const IndexType  n,
const PartitionId  root,
const double  myvals[] 
) const [pure virtual]

Gather of an array of values from all processors to root.

Parameters:
[out]allvalsvalues that I receive (size must be n * size() )
[in]nnumber of elements in vector val
[in]rootprocessor with values for all processors
[in]myvalsvalues for all processors

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

Referenced by updateHalo().

virtual void lama::Communicator::gather ( float  allvals[],
const IndexType  n,
const PartitionId  root,
const float  myvals[] 
) const [pure virtual]
virtual void lama::Communicator::gather ( int  allvals[],
const IndexType  n,
const PartitionId  root,
const int  myvals[] 
) const [pure virtual]
virtual void lama::Communicator::gather ( double  allvals[],
const IndexType  n,
const PartitionId  root,
const double  myvals[],
const IndexType  sizes[] 
) const [pure virtual]

Gather of an array of values from all processors to root.

Parameters:
[out]allvalsvalues that I receive (size must be sum(sizes) )
[in]nnumber of elements in vector val
[in]rootprocessor with values for all processors
[in]myvalsvalues for all processors
[in]sizesnumber of total values for all processors

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual void lama::Communicator::gather ( float  allvals[],
const IndexType  n,
const PartitionId  root,
const float  myvals[],
const IndexType  sizes[] 
) const [pure virtual]
virtual void lama::Communicator::gather ( int  allvals[],
const IndexType  n,
const PartitionId  root,
const int  myvals[],
const IndexType  sizes[] 
) const [pure virtual]
virtual void lama::Communicator::gather ( std::vector< float > &  values,
float  value 
) const [pure virtual]

Gather single float value from each processor into a vector.

Implemented in lama::NoCommunicator, lama::MPICommunicator, and lama::PGASCommunicator.

virtual ContextPtr lama::Communicator::getCommunicationContext ( ) const [protected, pure virtual]

getter for Context needed for Communication

Returns:
the ContextPtr

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

Referenced by exchangeByPlan().

void lama::Communicator::getGrid2Rank ( PartitionId  pos[2],
const PartitionId  procgrid[2] 
) const
void lama::Communicator::getGrid3Rank ( PartitionId  pos[3],
const PartitionId  procgrid[3] 
) const
PartitionId lama::Communicator::getNeighbor ( int  pos) const [inline]

Help routine to get the rank of a neighbored position.

Parameters:
[in]posis the distance to the neighbor (also negative)
Returns:
rank of the neighbored processor

This method assumes a circular ring formed by all processors.

References lama::abs(), getRank(), getSize(), and LAMA_ASSERT.

Referenced by lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::PGASCommunicator::shift(), lama::MPICommunicator::shift(), lama::PGASCommunicator::shiftAsync(), and lama::MPICommunicator::shiftAsync().

const std::string& lama::Communicator::getType ( ) const [inline]

getter for the type of a communicator.

void lama::Communicator::getUserProcArray ( PartitionId  userProcArray[3]) [static, protected]

Read in the environment variable NP4LAMA for user processor array.

Parameters:
[out]userProcArrayspecifies the user processor array.

Referenced by factorize2(), and factorize3().

virtual bool lama::Communicator::isEqual ( const Communicator other) const [pure virtual]

Virtual method used for the equality operator.

Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.

Referenced by operator!=(), and operator==().

virtual double lama::Communicator::max ( const double  value) const [pure virtual]
virtual int lama::Communicator::max ( const int  value) const [pure virtual]
virtual void lama::Communicator::maxloc ( double &  val,
int &  location,
const PartitionId  root 
) const [pure virtual]

Maximal value combined with a location value where maximum was found.

Parameters:
[in,out]valis a value on each processor, only out for root with maximal value
[in,out]locationis an additional int value, only out for root

Only root processor will contain the maximal value and the location loc.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual void lama::Communicator::maxloc ( float &  val,
int &  location,
const PartitionId  root 
) const [pure virtual]
virtual void lama::Communicator::maxloc ( int &  val,
int &  location,
const PartitionId  root 
) const [pure virtual]
virtual float lama::Communicator::min ( const float  value) const [pure virtual]
virtual double lama::Communicator::min ( const double  value) const [pure virtual]
virtual int lama::Communicator::min ( const int  value) const [pure virtual]
bool lama::Communicator::operator!= ( const Communicator other) const

References isEqual().

bool lama::Communicator::operator== ( const Communicator other) const

Equality operator for two communicators.

Parameters:
[in]othercommunicator for comparison
Returns:
true if this communicator is equal to other communicator.

Note: Logic of this operator is implemented via the virtual functions isEqual.

References isEqual().

virtual void lama::Communicator::scatter ( double  myvals[],
const IndexType  n,
const PartitionId  root,
const double  allvals[] 
) const [pure virtual]

Scatter of an array of values from root to all other processors.

Parameters:
[out]myvalsvalues that I receive
[in]nnumber of elements in vector val
[in]rootprocessor with values for all processors
[in]allvalsvalues for all processors (size must be n * size() )

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual void lama::Communicator::scatter ( float  myvals[],
const IndexType  n,
const PartitionId  root,
const float  allvals[] 
) const [pure virtual]
virtual void lama::Communicator::scatter ( int  myvals[],
const IndexType  n,
const PartitionId  root,
const int  allvals[] 
) const [pure virtual]
virtual void lama::Communicator::scatter ( double  myvals[],
const IndexType  n,
const PartitionId  root,
const double  allvals[],
const IndexType  sizes[] 
) const [pure virtual]

Scatter of an array of values from root to all other processors.

Parameters:
[out]myvalsvalues that I receive
[in]nnumber of elements in vector val
[in]rootprocessor with values for all processors
[in]allvalsvalues for all processors (size must be sum(sizes) )
[in]sizesnumber of total values for all processors

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual void lama::Communicator::scatter ( float  myvals[],
const IndexType  n,
const PartitionId  root,
const float  allvals[],
const IndexType  sizes[] 
) const [pure virtual]
virtual void lama::Communicator::scatter ( int  myvals[],
const IndexType  n,
const PartitionId  root,
const int  allvals[],
const IndexType  sizes[] 
) const [pure virtual]
template<typename T >
void lama::Communicator::shift ( LAMAArray< T > &  recv,
const LAMAArray< T > &  send,
const int  direction 
) const

Shift on LAMA arrays.

Parameters:
[in]recvarray to receive for this partition
[out]sendarray to send from this partition
[in]directionnumber of positions to shift, e.g. 1 or -1

Note: The recv array must have a capacity that is sufficent to receive all the data.

References lama::WriteAccess< T >::capacity(), lama::ReadAccess< T >::get(), lama::WriteAccess< T >::get(), getSize(), LAMA_ASSERT_ERROR, lama::WriteAccess< T >::resize(), and lama::ReadAccess< T >::size().

Referenced by computeOwners(), defaultShiftAsync(), lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::Distribution::replicate(), and lama::Distribution::replicateN().

virtual IndexType lama::Communicator::shift ( double  newVals[],
const IndexType  newSize,
const double  oldVals[],
const IndexType  oldSize,
const int  direction 
) const [pure virtual]

This routine shifts data between neighbored processors.

Parameters:
[out]newValsarray with data this partition get from neighbored partition
[in]newSizeallocated size of array newVals
[in]oldValsarray with data this partition sends to neighbored partition
[in]oldSizenumber of elements of array oldVals that will be sent
[in]directionspecifies the neighbored partitions to send and receive
Returns:
number of values received in newVals (newSize must have been larger before)

Each partition sends to rank() + direction and receives from rank() - direction.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual IndexType lama::Communicator::shift ( float  newVals[],
const IndexType  newSize,
const float  oldVals[],
const IndexType  oldSize,
const int  direction 
) const [pure virtual]
virtual IndexType lama::Communicator::shift ( int  newVals[],
const IndexType  newSize,
const int  oldVals[],
const IndexType  oldSize,
const int  direction 
) const [pure virtual]
template<typename T >
template LAMA_DLL_IMPORTEXPORT IndexType lama::Communicator::shift0 ( newVals[],
const IndexType  newSize,
const T  oldVals[],
const IndexType  oldSize 
) const [protected]

Shift implementation for direction == 0, just copies values.

References LAMA_ASSERT_ERROR.

Referenced by lama::NoCommunicator::shift(), lama::PGASCommunicator::shift(), and lama::MPICommunicator::shift().

template<typename T >
auto_ptr< SyncToken > lama::Communicator::shiftAsync ( LAMAArray< T > &  recvArray,
const LAMAArray< T > &  sendArray,
const int  direction 
) const

Asychronous shift on LAMA arrays.

Parameters:
[out]recvArrayarray to receive for this partition
[in]sendArrayarray to send from this partition
[in]directionnumber of positions to shift, e.g. 1 or -1

Note: All partitions must have the same size for send/recv array

References lama::LAMAArray< T >::clear(), LAMA_ASSERT_DEBUG, and LAMA_ASSERT_ERROR.

Referenced by lama::DenseMatrix< T >::matrixTimesVectorImpl().

std::auto_ptr< SyncToken > lama::Communicator::shiftAsync ( double  newVals[],
const double  oldVals[],
const IndexType  size,
const int  direction 
) const [virtual]

Asynchronous version of shift.

As there is no information about the received size this routine can only be called for arrays that have the same size on all partitions.

A default implementation is provided that returns a NoSyncToken. Derived classes should override this method if there is a benefit of using asynchronous transfers.

Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.

References defaultShiftAsync().

std::auto_ptr< SyncToken > lama::Communicator::shiftAsync ( float  newVals[],
const float  oldVals[],
const IndexType  size,
const int  direction 
) const [virtual]
std::auto_ptr< SyncToken > lama::Communicator::shiftAsync ( int  newVals[],
const int  oldVals[],
const IndexType  size,
const int  direction 
) const [virtual]
virtual float lama::Communicator::sum ( const float  value) const [pure virtual]

Sum operations sum up one single value from each partition to a global value.

Parameters:
[in]valuevalue on the calling partition
Returns:
global value, available for all partitions.

Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.

Referenced by lama::SparseMatrix< T >::getRow(), lama::DenseMatrix< T >::getRow(), lama::DenseMatrix< T >::getValue(), and lama::SparseMatrix< T >::getValue().

virtual double lama::Communicator::sum ( const double  value) const [pure virtual]
virtual int lama::Communicator::sum ( const int  value) const [pure virtual]
virtual size_t lama::Communicator::sum ( const size_t  value) const [pure virtual]
virtual void lama::Communicator::swap ( double  val[],
const IndexType  n,
const PartitionId  partner 
) const [pure virtual]

Swap of an array with another processor.

Parameters:
[in,out]valis the data array to be swapped
[in]nis the number of entries in array val
[in]partneris the rank of partition with which this partition swaps

This method can also be used if partner is same as this processor.

Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.

virtual void lama::Communicator::swap ( float  val[],
const IndexType  n,
const PartitionId  partner 
) const [pure virtual]
virtual void lama::Communicator::swap ( int  val[],
const IndexType  n,
const PartitionId  partner 
) const [pure virtual]
template<typename T >
template LAMA_DLL_IMPORTEXPORT void lama::Communicator::updateHalo ( LAMAArray< T > &  haloValues,
const LAMAArray< T > &  localValues,
const Halo halo 
) const

Update of halo array via Halo object.

Parameters:
[out]haloValueswill contain the non-local values from other processors
[in]localValuesis the local part of the array on each processor
[in]halois the Halo object containing all information about exchange

This method is not virtual but will use the pure virtual methods of base classes.

< temporary array for send communication

References lama::CommunicationPlan::allocated(), exchangeByPlan(), gather(), lama::Halo::getProvidesIndexes(), lama::Halo::getProvidesPlan(), lama::Halo::getRequiredPlan(), getSize(), LAMA_ASSERT_ERROR, LAMA_REGION, and lama::CommunicationPlan::size().

template<typename T >
template LAMA_DLL_IMPORTEXPORT auto_ptr< SyncToken > lama::Communicator::updateHaloAsync ( LAMAArray< T > &  haloValues,
const LAMAArray< T > &  localValues,
const Halo halo 
) const
void lama::Communicator::writeAt ( std::ostream &  stream) const [virtual]

Override virtual method of base class Printable.

Reimplemented from Printable.

Reimplemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.


Field Documentation

std::string lama::Communicator::mCommunicatorType [protected]

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