LAMA
|
The class NoCommunicator stands for objects that are replicated on each partition or processor. More...
#include <NoCommunicator.hpp>
Public Types | |
enum | ThreadSafetyLevel { Funneled = 1, Serialized = 2, Multiple = 3 } |
Enumeration type for supported thread safety levels. More... | |
Public Member Functions | |
NoCommunicator () | |
virtual | ~NoCommunicator () |
virtual bool | isEqual (const Communicator &other) const |
Virtual method used for the equality operator. | |
virtual ThreadSafetyLevel | getThreadSafetyLevel () const |
virtual PartitionId | getSize () const |
Number of partitions. | |
virtual PartitionId | getRank () const |
Id of this partitinon. | |
virtual void | all2all (int *recvValues, const int *sendValues) const |
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 |
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 |
Exchange of float values. | |
virtual void | exchangeByPlan (double *const recvData, const CommunicationPlan &recvPlan, const double *const sendData, const CommunicationPlan &sendPlan) const |
Exchange of double values. | |
virtual std::auto_ptr< SyncToken > | exchangeByPlanAsync (int *const recvData, const CommunicationPlan &recvPlan, const int *const sendData, const CommunicationPlan &sendPlan) const |
virtual std::auto_ptr< SyncToken > | exchangeByPlanAsync (float *const recvData, const CommunicationPlan &recvPlan, const float *const sendData, const CommunicationPlan &sendPlan) const |
Exchange of float values. | |
virtual std::auto_ptr< SyncToken > | exchangeByPlanAsync (double *const recvData, const CommunicationPlan &recvPlan, const double *const sendData, const CommunicationPlan &sendPlan) const |
Exchange of double values. | |
virtual IndexType | shift (double targetVals[], const IndexType targetSize, const double sourceVals[], const IndexType oldSize, const int direction) const |
This routine shifts data between neighbored processors. | |
virtual IndexType | shift (float targetVals[], const IndexType targetSize, const float sourceVals[], const IndexType oldSize, const int direction) const |
virtual IndexType | shift (int targetVals[], const IndexType targetSize, const int sourceVals[], const IndexType oldSize, const int direction) const |
virtual void | bcast (double val[], const IndexType n, const PartitionId root) const |
Broadcast a typed array from root to all other processors. | |
virtual void | bcast (float val[], const IndexType n, const PartitionId root) const |
virtual void | bcast (int val[], const IndexType n, const PartitionId root) const |
virtual void | scatter (double myvals[], const IndexType n, const PartitionId root, const double allvals[]) const |
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 |
virtual void | scatter (int myvals[], const IndexType n, const PartitionId root, const int allvals[]) const |
virtual void | scatter (double myvals[], const IndexType n, const PartitionId root, const double allvals[], const IndexType sizes[]) const |
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 |
virtual void | scatter (int myvals[], const IndexType n, const PartitionId root, const int allvals[], const IndexType sizes[]) const |
virtual void | gather (double allvals[], const IndexType n, const PartitionId root, const double myvals[]) const |
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 |
virtual void | gather (int allvals[], const IndexType n, const PartitionId root, const int myvals[]) const |
virtual void | gather (double allvals[], const IndexType n, const PartitionId root, const double myvals[], const IndexType sizes[]) const |
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 |
virtual void | gather (int allvals[], const IndexType n, const PartitionId root, const int myvals[], const IndexType sizes[]) const |
virtual float | sum (const float value) const |
Sum operations sum up one single value from each partition to a global value. | |
virtual double | sum (const double value) const |
virtual int | sum (const int value) const |
virtual size_t | sum (const size_t value) const |
virtual float | min (const float value) const |
virtual float | max (const float value) const |
virtual double | min (const double value) const |
virtual double | max (const double value) const |
virtual int | min (const int value) const |
virtual int | max (const int value) const |
virtual void | maxloc (double &val, int &location, const PartitionId root) const |
Maximal value combined with a location value where maximum was found. | |
virtual void | maxloc (float &val, int &location, const PartitionId root) const |
virtual void | maxloc (int &val, int &location, const PartitionId root) const |
virtual void | swap (double val[], const IndexType n, const PartitionId partner) const |
Swap of an array with another processor. | |
virtual void | swap (float val[], const IndexType n, const PartitionId partner) const |
virtual void | swap (int val[], const IndexType n, const PartitionId partner) const |
virtual void | gather (std::vector< float > &values, float value) const |
Gather single float value from each processor into a vector. | |
virtual void | synchronize () const |
Barrier synchronization between all processors. | |
virtual void | writeAt (std::ostream &stream) const |
Override virtual method of base class Printable. | |
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 |
PartitionId | getNeighbor (int pos) const |
Help routine to get the rank of a neighbored position. | |
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. | |
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 |
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. | |
const std::string & | getType () const |
getter for the type of a communicator. | |
Protected Member Functions | |
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. | |
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 |
Private Member Functions | |
void | exchangeByPlanImpl (void *const recvData, const CommunicationPlan &recvPlan, const void *const sendData, const CommunicationPlan &sendPlan, int elemSize) const |
virtual ContextPtr | getCommunicationContext () const |
getter for Context needed for Communication |
The class NoCommunicator stands for objects that are replicated on each partition or processor.
enum lama::Communicator::ThreadSafetyLevel [inherited] |
Enumeration type for supported thread safety levels.
lama::NoCommunicator::~NoCommunicator | ( | ) | [virtual] |
void lama::NoCommunicator::all2all | ( | int * | recvValues, |
const int * | sendValues | ||
) | const [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.
Implements lama::Communicator.
void lama::NoCommunicator::bcast | ( | double | val[], |
const IndexType | n, | ||
const PartitionId | root | ||
) | const [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 |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::bcast | ( | float | val[], |
const IndexType | n, | ||
const PartitionId | root | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::bcast | ( | int | val[], |
const IndexType | n, | ||
const PartitionId | root | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::Communicator::computeOwners | ( | const std::vector< IndexType > & | requiredIndexes, |
const Distribution & | distribution, | ||
std::vector< PartitionId > & | owners | ||
) | const [inherited] |
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(), lama::Communicator::getRank(), lama::Communicator::getSize(), lama::Distribution::isLocal(), LAMA_ASSERT_ERROR, LAMA_THROWEXCEPTION, lama::Communicator::max(), lama::WriteAccess< T >::release(), lama::Communicator::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, inherited] |
Default asynchronous shift uses synchronous shift.
References LAMA_ASSERT_ERROR, and lama::Communicator::shift().
Referenced by lama::PGASCommunicator::shiftAsync(), lama::MPICommunicator::shiftAsync(), and lama::Communicator::shiftAsync().
void lama::NoCommunicator::exchangeByPlan | ( | int *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const int *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [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().
Implements lama::Communicator.
References exchangeByPlanImpl().
void lama::NoCommunicator::exchangeByPlan | ( | float *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const float *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [virtual] |
void lama::NoCommunicator::exchangeByPlan | ( | double *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const double *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [virtual] |
void lama::Communicator::exchangeByPlan | ( | LAMAArray< T > & | recvArray, |
const CommunicationPlan & | recvPlan, | ||
const LAMAArray< T > & | sendArray, | ||
const CommunicationPlan & | sendPlan | ||
) | const [inherited] |
References lama::WriteAccess< T >::clear(), lama::Communicator::exchangeByPlan(), lama::ReadAccess< T >::get(), lama::WriteAccess< T >::get(), lama::Communicator::getCommunicationContext(), LAMA_ASSERT_ERROR, lama::WriteAccess< T >::resize(), lama::_LAMAArray::size(), and lama::CommunicationPlan::totalQuantity().
std::auto_ptr< SyncToken > lama::NoCommunicator::exchangeByPlanAsync | ( | int *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const int *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [virtual] |
Implements lama::Communicator.
References exchangeByPlanImpl().
std::auto_ptr< SyncToken > lama::NoCommunicator::exchangeByPlanAsync | ( | float *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const float *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [virtual] |
std::auto_ptr< SyncToken > lama::NoCommunicator::exchangeByPlanAsync | ( | double *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const double *const | sendData, | ||
const CommunicationPlan & | sendPlan | ||
) | const [virtual] |
std::auto_ptr< SyncToken > lama::Communicator::exchangeByPlanAsync | ( | LAMAArray< T > & | recvArray, |
const CommunicationPlan & | recvPlan, | ||
const LAMAArray< T > & | sendArray, | ||
const CommunicationPlan & | sendPlan | ||
) | const [inherited] |
void lama::NoCommunicator::exchangeByPlanImpl | ( | void *const | recvData, |
const CommunicationPlan & | recvPlan, | ||
const void *const | sendData, | ||
const CommunicationPlan & | sendPlan, | ||
int | elemSize | ||
) | const [private] |
References LAMA_ASSERT_ERROR, and lama::CommunicationPlan::size().
Referenced by exchangeByPlan(), and exchangeByPlanAsync().
void lama::Communicator::factorize2 | ( | const double | sizeX, |
const double | sizeY, | ||
PartitionId | procgrid[2] | ||
) | const [inherited] |
void lama::Communicator::factorize3 | ( | const double | sizeX, |
const double | sizeY, | ||
const double | sizeZ, | ||
PartitionId | procgrid[3] | ||
) | const [inherited] |
void lama::NoCommunicator::gather | ( | double | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const double | myvals[] | ||
) | const [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 |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::gather | ( | float | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const float | myvals[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::gather | ( | int | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | myvals[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::gather | ( | double | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const double | myvals[], | ||
const IndexType | sizes[] | ||
) | const [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 |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::gather | ( | float | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const float | myvals[], | ||
const IndexType | sizes[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR, and LAMA_ASSERT_ERROR.
void lama::NoCommunicator::gather | ( | int | allvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | myvals[], | ||
const IndexType | sizes[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR, and LAMA_ASSERT_ERROR.
void lama::NoCommunicator::gather | ( | std::vector< float > & | values, |
float | value | ||
) | const [virtual] |
Gather single float value from each processor into a vector.
Implements lama::Communicator.
ContextPtr lama::NoCommunicator::getCommunicationContext | ( | ) | const [private, virtual] |
getter for Context needed for Communication
Implements lama::Communicator.
References lama::ContextFactory::getContext(), and lama::Context::Host.
void lama::Communicator::getGrid2Rank | ( | PartitionId | pos[2], |
const PartitionId | procgrid[2] | ||
) | const [inherited] |
References lama::Communicator::getRank(), lama::Communicator::getSize(), and LAMA_ASSERT_ERROR.
void lama::Communicator::getGrid3Rank | ( | PartitionId | pos[3], |
const PartitionId | procgrid[3] | ||
) | const [inherited] |
References lama::Communicator::getRank(), lama::Communicator::getSize(), and LAMA_ASSERT_ERROR.
PartitionId lama::Communicator::getNeighbor | ( | int | pos | ) | const [inline, inherited] |
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(), lama::Communicator::getRank(), lama::Communicator::getSize(), and LAMA_ASSERT.
Referenced by lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::PGASCommunicator::shift(), lama::MPICommunicator::shift(), lama::PGASCommunicator::shiftAsync(), and lama::MPICommunicator::shiftAsync().
PartitionId lama::NoCommunicator::getRank | ( | ) | const [virtual] |
Id of this partitinon.
Implements lama::Communicator.
PartitionId lama::NoCommunicator::getSize | ( | ) | const [virtual] |
Number of partitions.
Implements lama::Communicator.
Communicator::ThreadSafetyLevel lama::NoCommunicator::getThreadSafetyLevel | ( | ) | const [virtual] |
Implements lama::Communicator.
References lama::Communicator::Multiple.
const std::string& lama::Communicator::getType | ( | ) | const [inline, inherited] |
getter for the type of a communicator.
void lama::Communicator::getUserProcArray | ( | PartitionId | userProcArray[3] | ) | [static, protected, inherited] |
Read in the environment variable NP4LAMA for user processor array.
[out] | userProcArray | specifies the user processor array. |
Referenced by lama::Communicator::factorize2(), and lama::Communicator::factorize3().
bool lama::NoCommunicator::isEqual | ( | const Communicator & | other | ) | const [virtual] |
Virtual method used for the equality operator.
Implements lama::Communicator.
lama::Communicator::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected, inherited] |
Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.
float lama::NoCommunicator::max | ( | const float | value | ) | const [virtual] |
Implements lama::Communicator.
double lama::NoCommunicator::max | ( | const double | value | ) | const [virtual] |
Implements lama::Communicator.
int lama::NoCommunicator::max | ( | const int | value | ) | const [virtual] |
Implements lama::Communicator.
void lama::NoCommunicator::maxloc | ( | double & | val, |
int & | location, | ||
const PartitionId | root | ||
) | const [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.
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::maxloc | ( | float & | val, |
int & | location, | ||
const PartitionId | root | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::maxloc | ( | int & | val, |
int & | location, | ||
const PartitionId | root | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
float lama::NoCommunicator::min | ( | const float | value | ) | const [virtual] |
Implements lama::Communicator.
double lama::NoCommunicator::min | ( | const double | value | ) | const [virtual] |
Implements lama::Communicator.
int lama::NoCommunicator::min | ( | const int | value | ) | const [virtual] |
Implements lama::Communicator.
bool lama::Communicator::operator!= | ( | const Communicator & | other | ) | const [inherited] |
References lama::Communicator::isEqual().
bool lama::Communicator::operator== | ( | const Communicator & | other | ) | const [inherited] |
Equality operator for two communicators.
[in] | other | communicator for comparison |
Note: Logic of this operator is implemented via the virtual functions isEqual.
References lama::Communicator::isEqual().
void lama::NoCommunicator::scatter | ( | double | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const double | allvals[] | ||
) | const [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() ) |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::scatter | ( | float | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const float | allvals[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::scatter | ( | int | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | allvals[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::scatter | ( | double | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const double | allvals[], | ||
const IndexType | sizes[] | ||
) | const [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 |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::scatter | ( | float | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const float | allvals[], | ||
const IndexType | sizes[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::scatter | ( | int | myvals[], |
const IndexType | n, | ||
const PartitionId | root, | ||
const int | allvals[], | ||
const IndexType | sizes[] | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
IndexType lama::NoCommunicator::shift | ( | double | newVals[], |
const IndexType | newSize, | ||
const double | oldVals[], | ||
const IndexType | oldSize, | ||
const int | direction | ||
) | const [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.
Implements lama::Communicator.
References lama::Communicator::shift0().
IndexType lama::NoCommunicator::shift | ( | float | targetVals[], |
const IndexType | targetSize, | ||
const float | sourceVals[], | ||
const IndexType | oldSize, | ||
const int | direction | ||
) | const [virtual] |
Implements lama::Communicator.
References lama::Communicator::shift0().
IndexType lama::NoCommunicator::shift | ( | int | targetVals[], |
const IndexType | targetSize, | ||
const int | sourceVals[], | ||
const IndexType | oldSize, | ||
const int | direction | ||
) | const [virtual] |
Implements lama::Communicator.
References lama::Communicator::shift0().
void lama::Communicator::shift | ( | LAMAArray< T > & | recv, |
const LAMAArray< T > & | send, | ||
const int | direction | ||
) | const [inherited] |
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(), lama::Communicator::getSize(), LAMA_ASSERT_ERROR, lama::WriteAccess< T >::resize(), and lama::ReadAccess< T >::size().
Referenced by lama::Communicator::computeOwners(), lama::Communicator::defaultShiftAsync(), lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::Distribution::replicate(), and lama::Distribution::replicateN().
template LAMA_DLL_IMPORTEXPORT IndexType lama::Communicator::shift0 | ( | T | newVals[], |
const IndexType | newSize, | ||
const T | oldVals[], | ||
const IndexType | oldSize | ||
) | const [protected, inherited] |
Shift implementation for direction == 0, just copies values.
References LAMA_ASSERT_ERROR.
Referenced by 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 [inherited] |
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, inherited] |
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 lama::Communicator::defaultShiftAsync().
std::auto_ptr< SyncToken > lama::Communicator::shiftAsync | ( | float | newVals[], |
const float | oldVals[], | ||
const IndexType | size, | ||
const int | direction | ||
) | const [virtual, inherited] |
Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.
References lama::Communicator::defaultShiftAsync().
std::auto_ptr< SyncToken > lama::Communicator::shiftAsync | ( | int | newVals[], |
const int | oldVals[], | ||
const IndexType | size, | ||
const int | direction | ||
) | const [virtual, inherited] |
Reimplemented in lama::MPICommunicator, and lama::PGASCommunicator.
References lama::Communicator::defaultShiftAsync().
float lama::NoCommunicator::sum | ( | const float | value | ) | const [virtual] |
Sum operations sum up one single value from each partition to a global value.
[in] | value | value on the calling partition |
Implements lama::Communicator.
double lama::NoCommunicator::sum | ( | const double | value | ) | const [virtual] |
Implements lama::Communicator.
int lama::NoCommunicator::sum | ( | const int | value | ) | const [virtual] |
Implements lama::Communicator.
size_t lama::NoCommunicator::sum | ( | const size_t | value | ) | const [virtual] |
Implements lama::Communicator.
void lama::NoCommunicator::swap | ( | double | val[], |
const IndexType | n, | ||
const PartitionId | partner | ||
) | const [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.
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::swap | ( | float | val[], |
const IndexType | n, | ||
const PartitionId | partner | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::swap | ( | int | val[], |
const IndexType | n, | ||
const PartitionId | partner | ||
) | const [virtual] |
Implements lama::Communicator.
References LAMA_ASSERT_EQUAL_ERROR.
void lama::NoCommunicator::synchronize | ( | ) | const [virtual] |
Barrier synchronization between all processors.
Implements lama::Communicator.
template LAMA_DLL_IMPORTEXPORT void lama::Communicator::updateHalo | ( | LAMAArray< T > & | haloValues, |
const LAMAArray< T > & | localValues, | ||
const Halo & | halo | ||
) | const [inherited] |
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(), lama::Communicator::exchangeByPlan(), lama::Communicator::gather(), lama::Halo::getProvidesIndexes(), lama::Halo::getProvidesPlan(), lama::Halo::getRequiredPlan(), lama::Communicator::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 [inherited] |
Asynchronous update of halo array via Halo object.
References lama::CommunicationPlan::allocated(), lama::Communicator::exchangeByPlanAsync(), lama::Halo::getProvidesIndexes(), lama::Halo::getProvidesPlan(), lama::Halo::getRequiredPlan(), lama::Communicator::getSize(), LAMA_ASSERT_ERROR, LAMA_REGION, and lama::CommunicationPlan::size().
void lama::NoCommunicator::writeAt | ( | std::ostream & | stream | ) | const [virtual] |
Override virtual method of base class Printable.
Reimplemented from lama::Communicator.
std::string lama::Communicator::mCommunicatorType [protected, inherited] |