LAMA
|
Base and interface class for communicators used in LAMA. More...
#include <Communicator.hpp>
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< SyncToken > | exchangeByPlanAsync (int *const recvData, const CommunicationPlan &recvPlan, const int *const sendData, const CommunicationPlan &sendPlan) const =0 |
virtual std::auto_ptr< SyncToken > | exchangeByPlanAsync (float *const recvData, const CommunicationPlan &recvPlan, const float *const sendData, const CommunicationPlan &sendPlan) const =0 |
Exchange of float values. | |
virtual std::auto_ptr< SyncToken > | exchangeByPlanAsync (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< SyncToken > | exchangeByPlanAsync (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< SyncToken > | updateHaloAsync (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< SyncToken > | shiftAsync (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< SyncToken > | shiftAsync (double newVals[], const double oldVals[], const IndexType size, const int direction) const |
Asynchronous version of shift. | |
virtual std::auto_ptr< SyncToken > | shiftAsync (float newVals[], const float oldVals[], const IndexType size, const int direction) const |
virtual std::auto_ptr< SyncToken > | shiftAsync (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< SyncToken > | defaultShiftAsync (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 |
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.
Enumeration type for supported thread safety levels.
lama::Communicator::~Communicator | ( | ) | [virtual] |
lama::Communicator::Communicator | ( | const std::string & | type | ) | [protected] |
virtual void lama::Communicator::all2all | ( | int * | recvValues, |
const int * | sendValues | ||
) | const [pure virtual] |
All-to-all exchange of an integer value between all processors.
[out] | recvValues | will contain one value from each processor |
[in] | sendValues | must 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.
[in,out] | val | in on root, out on all other processors |
[in] | n | number of elements in vector val |
[in] | root | processor 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::bcast | ( | int | val[], |
const IndexType | n, | ||
const PartitionId | root | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
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 LAMA_DLL_IMPORTEXPORT auto_ptr< SyncToken > lama::Communicator::defaultShiftAsync | ( | T | 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.
[out] | recvData | buffer for data received from other processors |
[in] | recvPlan | number of elements and offsets for receiving |
[in] | sendData | buffer for data to send to other processors |
[in] | sendPlan | contains 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.
void lama::Communicator::exchangeByPlan | ( | LAMAArray< T > & | recvArray, |
const CommunicationPlan & | recvPlan, | ||
const LAMAArray< T > & | sendArray, | ||
const CommunicationPlan & | sendPlan | ||
) | const |
virtual std::auto_ptr<SyncToken> lama::Communicator::exchangeByPlanAsync | ( | int *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const int *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
Referenced by lama::HaloBuilder::build(), exchangeByPlanAsync(), lama::Redistributor::exchangeHalo(), lama::Redistributor::exchangeVHalo(), and updateHaloAsync().
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.
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 |
References getSize(), getUserProcArray(), and LAMA_THROWEXCEPTION.
void lama::Communicator::factorize3 | ( | const double | sizeX, |
const double | sizeY, | ||
const double | sizeZ, | ||
PartitionId | procgrid[3] | ||
) | const |
References getSize(), getUserProcArray(), and LAMA_THROWEXCEPTION.
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.
[out] | allvals | values that I receive (size must be n * size() ) |
[in] | n | number of elements in vector val |
[in] | root | processor with values for all processors |
[in] | myvals | values 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::gather | ( | int | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | myvals[] | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
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.
[out] | allvals | values that I receive (size must be sum(sizes) ) |
[in] | n | number of elements in vector val |
[in] | root | processor with values for all processors |
[in] | myvals | values for all processors |
[in] | sizes | number 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::gather | ( | int | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | myvals[], | ||
const IndexType | sizes[] | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
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
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
Referenced by exchangeByPlan().
void lama::Communicator::getGrid2Rank | ( | PartitionId | pos[2], |
const PartitionId | procgrid[2] | ||
) | const |
References getRank(), getSize(), and LAMA_ASSERT_ERROR.
void lama::Communicator::getGrid3Rank | ( | PartitionId | pos[3], |
const PartitionId | procgrid[3] | ||
) | const |
References getRank(), getSize(), and LAMA_ASSERT_ERROR.
PartitionId lama::Communicator::getNeighbor | ( | int | pos | ) | const [inline] |
Help routine to get the rank of a neighbored position.
[in] | pos | is the distance to the neighbor (also negative) |
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().
virtual PartitionId lama::Communicator::getRank | ( | ) | const [pure virtual] |
Id of this partitinon.
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
Referenced by lama::HaloBuilder::build(), computeOwners(), lama::MatrixCreator< T >::fillRandom(), getGrid2Rank(), getGrid3Rank(), getNeighbor(), lama::SparseMatrix< T >::getRow(), lama::DenseMatrix< T >::getRow(), lama::DenseMatrix< T >::getValue(), lama::OpenMPSCALAPACK::inverse(), lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::DenseMatrix< T >::setIdentity(), lama::DenseMatrix< T >::writeToFile(), and lama::SparseMatrix< T >::writeToFile().
virtual PartitionId lama::Communicator::getSize | ( | ) | const [pure virtual] |
Number of partitions.
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
Referenced by lama::CommunicationPlan::allocateTranspose(), computeOwners(), factorize2(), factorize3(), getGrid2Rank(), getGrid3Rank(), getNeighbor(), lama::OpenMPSCALAPACK::inverse(), lama::Distribution::replicate(), lama::Distribution::replicateN(), lama::DenseMatrix< T >::setIdentity(), shift(), updateHalo(), updateHaloAsync(), and lama::SparseMatrix< T >::writeToFile().
virtual ThreadSafetyLevel lama::Communicator::getThreadSafetyLevel | ( | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
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.
[out] | userProcArray | specifies 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==().
lama::Communicator::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected] |
Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.
virtual float lama::Communicator::max | ( | const float | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
Referenced by computeOwners(), lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::DenseMatrix< T >::maxDiffNormImpl(), lama::SparseMatrix< T >::maxDiffNormImpl(), lama::DenseVector< T >::maxNorm(), lama::Distribution::replicate(), and lama::Distribution::replicateN().
virtual double lama::Communicator::max | ( | const double | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
virtual int lama::Communicator::max | ( | const int | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
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.
[in,out] | val | is a value on each processor, only out for root with maximal value |
[in,out] | location | is 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::maxloc | ( | int & | val, |
int & | location, | ||
const PartitionId | root | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual float lama::Communicator::min | ( | const float | value | ) | const [pure virtual] |
Implemented in lama::NoCommunicator, lama::MPICommunicator, and lama::PGASCommunicator.
virtual double lama::Communicator::min | ( | const double | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
virtual int lama::Communicator::min | ( | const int | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
bool lama::Communicator::operator!= | ( | const Communicator & | other | ) | const |
References isEqual().
bool lama::Communicator::operator== | ( | const Communicator & | other | ) | const |
Equality operator for two communicators.
[in] | other | communicator for comparison |
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.
[out] | myvals | values that I receive |
[in] | n | number of elements in vector val |
[in] | root | processor with values for all processors |
[in] | allvals | values 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::scatter | ( | int | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | allvals[] | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
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.
[out] | myvals | values that I receive |
[in] | n | number of elements in vector val |
[in] | root | processor with values for all processors |
[in] | allvals | values for all processors (size must be sum(sizes) ) |
[in] | sizes | number 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::scatter | ( | int | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | allvals[], | ||
const IndexType | sizes[] | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
void lama::Communicator::shift | ( | LAMAArray< T > & | recv, |
const LAMAArray< T > & | send, | ||
const int | direction | ||
) | const |
Shift on LAMA arrays.
[in] | recv | array to receive for this partition |
[out] | send | array to send from this partition |
[in] | direction | number 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.
[out] | newVals | array with data this partition get from neighbored partition |
[in] | newSize | allocated size of array newVals |
[in] | oldVals | array with data this partition sends to neighbored partition |
[in] | oldSize | number of elements of array oldVals that will be sent |
[in] | direction | specifies the neighbored partitions to send and receive |
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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual IndexType lama::Communicator::shift | ( | int | newVals[], |
const IndexType | newSize, | ||
const int | oldVals[], | ||
const IndexType | oldSize, | ||
const int | direction | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
template LAMA_DLL_IMPORTEXPORT IndexType lama::Communicator::shift0 | ( | T | 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().
auto_ptr< SyncToken > lama::Communicator::shiftAsync | ( | LAMAArray< T > & | recvArray, |
const LAMAArray< T > & | sendArray, | ||
const int | direction | ||
) | const |
Asychronous shift on LAMA arrays.
[out] | recvArray | array to receive for this partition |
[in] | sendArray | array to send from this partition |
[in] | direction | number 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] |
Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.
References defaultShiftAsync().
std::auto_ptr< SyncToken > lama::Communicator::shiftAsync | ( | int | newVals[], |
const int | oldVals[], | ||
const IndexType | size, | ||
const int | direction | ||
) | const [virtual] |
Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.
References defaultShiftAsync().
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.
[in] | value | value on the calling partition |
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] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
virtual int lama::Communicator::sum | ( | const int | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
virtual size_t lama::Communicator::sum | ( | const size_t | value | ) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::NoCommunicator, and lama::PGASCommunicator.
virtual void lama::Communicator::swap | ( | double | val[], |
const IndexType | n, | ||
const PartitionId | partner | ||
) | const [pure virtual] |
Swap of an array with another processor.
[in,out] | val | is the data array to be swapped |
[in] | n | is the number of entries in array val |
[in] | partner | is 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] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::swap | ( | int | val[], |
const IndexType | n, | ||
const PartitionId | partner | ||
) | const [pure virtual] |
Implemented in lama::MPICommunicator, lama::PGASCommunicator, and lama::NoCommunicator.
virtual void lama::Communicator::synchronize | ( | ) | const [pure virtual] |
Barrier synchronization between all processors.
Implemented in lama::NoCommunicator, lama::MPICommunicator, and lama::PGASCommunicator.
Referenced by lama::CommunicationPlan::allocateTranspose(), lama::DenseMatrix< T >::writeToFile(), and lama::SparseMatrix< T >::writeToFile().
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.
[out] | haloValues | will contain the non-local values from other processors |
[in] | localValues | is the local part of the array on each processor |
[in] | halo | is 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 LAMA_DLL_IMPORTEXPORT auto_ptr< SyncToken > lama::Communicator::updateHaloAsync | ( | LAMAArray< T > & | haloValues, |
const LAMAArray< T > & | localValues, | ||
const Halo & | halo | ||
) | const |
Asynchronous update of halo array via Halo object.
References lama::CommunicationPlan::allocated(), exchangeByPlanAsync(), lama::Halo::getProvidesIndexes(), lama::Halo::getProvidesPlan(), lama::Halo::getRequiredPlan(), getSize(), LAMA_ASSERT_ERROR, LAMA_REGION, and lama::CommunicationPlan::size().
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.
std::string lama::Communicator::mCommunicatorType [protected] |