Template Numerical Library version\ main:bb09b17
|
Distributed array view. More...
#include <TNL/Containers/DistributedArrayView.h>
Public Types | |
using | ConstLocalViewType = Containers::ArrayView< std::add_const_t< Value >, Device, Index > |
using | ConstViewType = DistributedArrayView< std::add_const_t< Value >, Device, Index > |
using | DeviceType = Device |
using | IndexType = Index |
using | LocalRangeType = Subrange< Index > |
using | LocalViewType = Containers::ArrayView< Value, Device, Index > |
template<typename _Value , typename _Device = Device, typename _Index = Index> | |
using | Self = DistributedArrayView< _Value, _Device, _Index > |
A template which allows to quickly obtain a DistributedArrayView type with changed template parameters. | |
using | SynchronizerType = ByteArraySynchronizer< DeviceType, IndexType > |
using | ValueType = Value |
using | ViewType = DistributedArrayView< Value, Device, Index > |
Public Member Functions | |
DistributedArrayView (const DistributedArrayView &)=default | |
template<typename Value_ > | |
DistributedArrayView (const DistributedArrayView< Value_, Device, Index > &) | |
DistributedArrayView (const LocalRangeType &localRange, IndexType ghosts, IndexType globalSize, MPI::Comm communicator, LocalViewType localData) | |
DistributedArrayView (DistributedArrayView &&) noexcept=default | |
void | bind (const LocalRangeType &localRange, IndexType ghosts, IndexType globalSize, const MPI::Comm &communicator, LocalViewType localData) |
void | bind (DistributedArrayView view) |
template<typename Value_ > | |
void | bind (Value_ *data, IndexType localSize) |
void | copyFromGlobal (ConstLocalViewType globalArray) |
bool | empty () const |
template<typename Function > | |
void | forElements (IndexType begin, IndexType end, Function &&f) |
Process the lambda function f for each array element in interval [ begin, end). | |
template<typename Function > | |
void | forElements (IndexType begin, IndexType end, Function &&f) const |
Process the lambda function f for each array element in interval [ begin, end) for constant instances of the array. | |
const MPI::Comm & | getCommunicator () const |
ConstLocalViewType | getConstLocalView () const |
ConstLocalViewType | getConstLocalViewWithGhosts () const |
ConstViewType | getConstView () const |
Returns a non-modifiable view of the array view. | |
ValueType | getElement (IndexType i) const |
IndexType | getGhosts () const |
const LocalRangeType & | getLocalRange () const |
LocalViewType | getLocalView () |
LocalViewType | getLocalViewWithGhosts () |
IndexType | getSize () const |
std::shared_ptr< SynchronizerType > | getSynchronizer () const |
int | getValuesPerElement () const |
ViewType | getView () |
Returns a modifiable view of the array view. | |
void | loadFromGlobalFile (const String &fileName, bool allowCasting=false) |
void | loadFromGlobalFile (File &file, bool allowCasting=false) |
template<typename Array > | |
bool | operator!= (const Array &array) const |
template<typename Array , typename... , typename = std::enable_if_t< HasSubscriptOperator< Array >::value >> | |
DistributedArrayView & | operator= (const Array &array) |
template<typename Array , typename... , typename > | |
DistributedArrayView< Value, Device, Index > & | operator= (const Array &array) |
DistributedArrayView & | operator= (const DistributedArrayView &view) |
DistributedArrayView & | operator= (DistributedArrayView &&) noexcept=default |
template<typename Array > | |
bool | operator== (const Array &array) const |
__cuda_callable__ ValueType & | operator[] (IndexType i) |
__cuda_callable__ const ValueType & | operator[] (IndexType i) const |
void | reset () |
void | setElement (IndexType i, ValueType value) |
void | setSynchronizer (std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement=1) |
void | setValue (ValueType value) |
void | startSynchronization () |
void | waitForSynchronization () const |
Protected Attributes | |
MPI::Comm | communicator = MPI_COMM_NULL |
IndexType | ghosts = 0 |
IndexType | globalSize = 0 |
LocalViewType | localData |
LocalRangeType | localRange |
std::shared_ptr< SynchronizerType > | synchronizer = nullptr |
int | valuesPerElement = 1 |
Distributed array view.
void TNL::Containers::DistributedArrayView< Value, Device, Index >::forElements | ( | IndexType | begin, |
IndexType | end, | ||
Function && | f ) |
Process the lambda function f for each array element in interval [ begin, end).
The lambda function is supposed to be declared as
where
This is performed at the same place where the array is allocated, i.e. it is efficient even on GPU.
begin | The beginning of the array elements interval. |
end | The end of the array elements interval. |
f | The lambda function to be processed. |
void TNL::Containers::DistributedArrayView< Value, Device, Index >::forElements | ( | IndexType | begin, |
IndexType | end, | ||
Function && | f ) const |
Process the lambda function f for each array element in interval [ begin, end) for constant instances of the array.
The lambda function is supposed to be declared as
where
This is performed at the same place where the array is allocated, i.e. it is efficient even on GPU.
begin | The beginning of the array elements interval. |
end | The end of the array elements interval. |
f | The lambda function to be processed. |