LAMA
|
HostWriteOnlyAccess is a write access where no existing values of the array are needed (keepFlag = false). More...
#include <HostWriteAccess.hpp>
Public Types | |
typedef T | ValueType |
ValueType is the type stored in the wrapped container. | |
Public Member Functions | |
HostWriteOnlyAccess (LAMAArray< ValueType > &array) | |
Create a write access with keep flag = false. | |
HostWriteOnlyAccess (LAMAArray< ValueType > &array, const IndexType size) | |
Create a write access with keep flag = false and do also a resize. | |
~HostWriteOnlyAccess () | |
ValueType & | operator[] (const IndexType i) |
access to the element i of the wrapped LAMAArray | |
operator ValueType * () | |
conversion to a ValueType pointer (shortcut for get() ) | |
void | push_back (const ValueType val) |
appends val to the end of the wrapped LAMAArray. | |
ValueType * | get () |
returns a pointer to the data of the wrapped LAMAArray | |
void | clear () |
Set the size of the LAMAArray to 0. | |
void | resize (const IndexType newSize) |
resizes the wrapped LAMAArray | |
void | reserve (const IndexType capacity) |
reserve storage for wth wrapped LAMAArray at the associated location | |
IndexType | capacity () const |
query the capacity of the array on the reserved context | |
virtual void | release () |
Releases the WriteAccess on the associated LAMAArray. | |
virtual void | writeAt (std::ostream &stream) const |
Writes some Information about this to the passed stream. | |
IndexType | size () const |
Returns the size of the wrapped LAMAArray. | |
Protected Member Functions | |
LAMA_LOG_DECL_STATIC_LOGGER (logger) | |
Protected Attributes | |
ValueType * | mData |
LAMAArrayView< ValueType > * | mArrayView |
size_t | mIndex |
HostWriteOnlyAccess is a write access where no existing values of the array are needed (keepFlag = false).
This derived class has been added for more convenience as it avoids the use of the keepFlag param.
A HostWriteOnlyAccess should be used whenever possible. It avoids any memory transfer of no more needed values between devices and in case of a reallocation it avoids copying of old values.
typedef T lama::HostWriteOnlyAccess< T >::ValueType |
ValueType is the type stored in the wrapped container.
Reimplemented from lama::HostWriteAccess< T >.
lama::HostWriteOnlyAccess< T >::HostWriteOnlyAccess | ( | LAMAArray< ValueType > & | array | ) | [inline] |
Create a write access with keep flag = false.
lama::HostWriteOnlyAccess< T >::HostWriteOnlyAccess | ( | LAMAArray< ValueType > & | array, |
const IndexType | size | ||
) | [inline] |
Create a write access with keep flag = false and do also a resize.
lama::HostWriteOnlyAccess< T >::~HostWriteOnlyAccess | ( | ) | [inline] |
IndexType lama::WriteAccess< T >::capacity | ( | ) | const [inherited] |
query the capacity of the array on the reserved context
References LAMA_ASSERT_ERROR.
Referenced by lama::Communicator::shift().
void lama::WriteAccess< T >::clear | ( | ) | [inherited] |
Set the size of the LAMAArray to 0.
This operation only sets the size but does not free any reserved memory.
This operation should always be called when an array is completely rewritten. to avoid that data will be transfered from other locations or copying of old values during the resize.
LAMAArray& arr = ... arr.clear(); HostWriteAccess writeArr( arr ); writeArr.resize( 100 ); for ( int i = 0; i < 100; i++) { writeArr[i] = 0.0; }
References LAMA_ASSERT_ERROR.
Referenced by lama::Communicator::exchangeByPlan(), and lama::_MatrixStorage::offsets2sizes().
T * lama::WriteAccess< T >::get | ( | ) | [inherited] |
returns a pointer to the data of the wrapped LAMAArray
References LAMA_THROWEXCEPTION.
Referenced by lama::JDSStorage< T >::allocate(), lama::CSRStorage< T >::allocate(), lama::CommunicationPlan::allocateTranspose(), lama::DenseStorageView< T >::assignDenseStorageImpl(), lama::LAMAArrayUtils::assignImpl2(), lama::HaloBuilder::build(), lama::COOStorage< T >::buildCSR(), lama::ELLStorage< T >::buildCSR(), lama::JDSStorage< T >::buildCSR(), lama::DIAStorage< T >::buildCSR(), lama::DenseStorageView< T >::buildCSR(), lama::SparseAssemblyStorage< T >::buildCSR(), lama::CSRStorage< T >::buildCSR(), lama::ELLStorage< T >::buildRowIndexes(), lama::CSRStorage< T >::buildRowIndexes(), lama::ELLStorage< T >::compress(), lama::LUSolver::computeLUFactorization(), lama::Communicator::computeOwners(), lama::MatrixStorage< T >::convertCSR2CSC(), lama::DenseStorage< T >::DenseStorage(), lama::ELLStorage< T >::ELLStorage(), lama::Communicator::exchangeByPlan(), lama::StorageMethods< T >::exchangeHaloCSR(), lama::LAMAArrayUtils::gather(), lama::COOStorage< T >::getDiagonalImpl(), lama::ELLStorage< T >::getDiagonalImpl(), lama::CSRStorage< T >::getDiagonalImpl(), lama::DenseStorageView< T >::getDiagonalImpl(), lama::DIAStorage< T >::getDiagonalImpl(), lama::JDSStorage< T >::getDiagonalImpl(), lama::ELLStorage< T >::getRowImpl(), lama::JDSStorage< T >::getRowImpl(), lama::DenseVector< T >::invert(), lama::DenseMatrixOps::invertCyclic(), lama::DenseMatrix< T >::invertCyclic(), lama::DenseStorageView< T >::invertDense(), lama::JDSStorage< T >::jacobiIterate(), lama::DIAStorage< T >::jacobiIterate(), lama::COOStorage< T >::jacobiIterate(), lama::ELLStorage< T >::jacobiIterate(), lama::CSRStorage< T >::jacobiIterate(), lama::JDSStorage< T >::jacobiIterateHalo(), lama::ELLStorage< T >::jacobiIterateHalo(), lama::CSRStorage< T >::jacobiIterateHalo(), lama::JDSStorage< T >::JDSStorage(), lama::MatrixStorage< T >::joinRows(), lama::StorageMethods< T >::localizeCSR(), lama::CSRStorage< T >::matrixAddMatrixCSR(), lama::ELLStorage< T >::matrixAddMatrixELL(), lama::CSRStorage< T >::matrixTimesMatrixCSR(), lama::DenseStorageView< T >::matrixTimesMatrixDense(), lama::ELLStorage< T >::matrixTimesMatrixELL(), lama::JDSStorage< T >::matrixTimesVector(), lama::DIAStorage< T >::matrixTimesVector(), lama::DenseStorageView< T >::matrixTimesVector(), lama::COOStorage< T >::matrixTimesVector(), lama::ELLStorage< T >::matrixTimesVector(), lama::CSRStorage< T >::matrixTimesVector(), lama::CSRStorage< T >::matrixTimesVectorN(), lama::LUSolver::plaswp(), lama::LUSolver::ptrsm(), lama::StorageIO< T >::readCSRFromBinaryFile(), lama::StorageIO< T >::readCSRFromMMFile(), lama::StorageIO< T >::readCSRFromXDRFile(), lama::DenseVector< T >::readVectorDataFromBinaryFile(), lama::DenseVector< T >::redistribute(), lama::StorageMethods< T >::redistributeCSR(), lama::StorageMethods< T >::replicateCSR(), lama::ELLStorage< T >::scaleImpl(), lama::CSRStorage< T >::scaleImpl(), lama::JDSStorage< T >::scaleImpl(), lama::DenseStorageView< T >::scaleImpl(), lama::DenseStorageView< T >::setCSRDataImpl(), lama::CSRStorage< T >::setCSRDataImpl(), lama::COOStorage< T >::setCSRDataImpl(), lama::JDSStorage< T >::setCSRDataImpl(), lama::ELLStorage< T >::setCSRDataImpl(), lama::COOStorage< T >::setDiagonalImpl(), lama::ELLStorage< T >::setDiagonalImpl(), lama::CSRStorage< T >::setDiagonalImpl(), lama::JDSStorage< T >::setDiagonalImpl(), lama::DenseStorageView< T >::setDiagonalImpl(), lama::DIAStorage< T >::setDiagonalImpl(), lama::DenseStorageView< T >::setIdentity(), lama::COOStorage< T >::setIdentity(), lama::ELLStorage< T >::setIdentity(), lama::CSRStorage< T >::setIdentity(), lama::JDSStorage< T >::setIdentity(), lama::DIAStorage< T >::setIdentity(), lama::JDSStorage< T >::setupData(), lama::DenseStorageView< T >::setZero(), lama::Communicator::shift(), lama::JDSStorage< T >::sortRows(), lama::StorageMethods< T >::splitCSR(), and lama::DenseVector< T >::vectorPlusVector().
lama::WriteAccess< T >::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected, inherited] |
lama::HostWriteAccess< T >::operator ValueType * | ( | ) | [inline, inherited] |
T & lama::HostWriteAccess< T >::operator[] | ( | const IndexType | i | ) | [inline, inherited] |
access to the element i of the wrapped LAMAArray
[in] | i | the index of the element of the wrapped LAMAArray to access |
References LAMA_ASSERT_ERROR.
void lama::HostWriteAccess< T >::push_back | ( | const ValueType | val | ) | [inherited] |
appends val to the end of the wrapped LAMAArray.
[in] | val | the value to append |
void lama::WriteAccess< T >::release | ( | ) | [virtual, inherited] |
Releases the WriteAccess on the associated LAMAArray.
Implements lama::BaseAccess.
References lama::max().
Referenced by lama::CommunicationPlan::allocateTranspose(), lama::HaloBuilder::build(), lama::CSRStorage< T >::compress(), lama::LUSolver::computeLUFactorization(), lama::Communicator::computeOwners(), lama::LUSolver::pgetf2(), lama::CSRStorage< T >::setCSRDataImpl(), lama::DenseVector< T >::updateHalo(), and lama::DenseVector< T >::updateHaloAsync().
void lama::WriteAccess< T >::reserve | ( | const IndexType | capacity | ) | [inherited] |
reserve storage for wth wrapped LAMAArray at the associated location
[in] | capacity | the number of elements that should fit into the new storage |
References LAMA_ASSERT_ERROR.
Referenced by lama::SparseMatrix< T >::setComputeKind(), lama::DenseVector< T >::updateHalo(), and lama::DenseVector< T >::updateHaloAsync().
void lama::WriteAccess< T >::resize | ( | const IndexType | newSize | ) | [inherited] |
resizes the wrapped LAMAArray
[in] | newSize | the new size of the wrapped LAMAArray |
If a reallocation is necessary it is only done at the associated location for all other locations this is done lazy.
References LAMA_ASSERT_ERROR.
Referenced by lama::DenseVector< T >::assign(), lama::HaloBuilder::build(), lama::COOStorage< T >::buildCSR(), lama::ELLStorage< T >::buildCSR(), lama::JDSStorage< T >::buildCSR(), lama::DIAStorage< T >::buildCSR(), lama::DenseStorageView< T >::buildCSR(), lama::SparseAssemblyStorage< T >::buildCSR(), lama::MatrixCreator< T >::buildPoisson(), lama::Communicator::exchangeByPlan(), lama::StorageMethods< T >::exchangeHaloCSR(), lama::MatrixStorage< T >::joinRows(), lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::SparseMatrix< T >::matrixTimesVectorImpl(), lama::_MatrixStorage::offsets2sizes(), lama::DenseVector< T >::readVectorFromXDRFile(), lama::StorageMethods< T >::redistributeCSR(), lama::Redistributor::Redistributor(), lama::DenseVector< T >::resizeImpl(), lama::ELLStorage< T >::setCSRDataImpl(), lama::Communicator::shift(), lama::_MatrixStorage::sizes2offsets(), and lama::LUSolver::solve().
IndexType lama::WriteAccess< T >::size | ( | ) | const [inline, inherited] |
Returns the size of the wrapped LAMAArray.
References LAMA_THROWEXCEPTION.
Referenced by lama::LUSolver::computeLUFactorization(), lama::MatrixStorage< T >::joinRows(), lama::Redistributor::Redistributor(), lama::ELLStorage< T >::setCSRDataImpl(), and lama::DIAStorage< T >::setOffsets().
void lama::WriteAccess< T >::writeAt | ( | std::ostream & | stream | ) | const [virtual, inherited] |
Writes some Information about this to the passed stream.
If a deriving class does not overrides writeAt, typeid(this).name() is written to stream.
[out] | stream | the stream to write to. |
Reimplemented from lama::BaseAccess.
LAMAArrayView<ValueType>* lama::WriteAccess< T >::mArrayView [protected, inherited] |
Referenced by lama::WriteAccess< T >::WriteAccess().
ValueType* lama::WriteAccess< T >::mData [protected, inherited] |
Referenced by lama::WriteAccess< T >::WriteAccess().
size_t lama::WriteAccess< T >::mIndex [protected, inherited] |
Referenced by lama::WriteAccess< T >::WriteAccess().