|
FEAT 3
Finite Element Analysis Toolbox
|
Raw memory view class. More...
#include <memory_arbiter.hpp>
Public Member Functions | |
| View () | |
| default constructor More... | |
| View (const View &)=delete | |
| no copy allowed | |
| View (View &&other) | |
| move-constructor More... | |
| virtual | ~View () |
| virtual destructor More... | |
| Access | access () const |
| std::size_t | bytes () const |
| void | copy_from (const View &src) |
| Copies the contents of another view's memory region into the memory of this memory view. More... | |
| void | copy_raw_from (const void *src_ptr, Location src_loc) |
| Copies the contents of a given memory region into the memory of this memory view. More... | |
| bool | empty () const |
| Checks whether the memory view has a size of 0 bytes. More... | |
| void | format_to_one () |
| Formats all bits of the memory view to one (yields NaN for floating point types) More... | |
| void | format_to_zero () |
| Formats all bits of the memory view to zero. More... | |
| bool | is_nullptr () const |
| Checks whether the memory pointer is a nullptr. More... | |
| Location | location () const |
| View & | operator= (const View &)=delete |
| no copy-assign allowed | |
| View & | operator= (View &&other) |
| move-assign operator More... | |
| const void * | raw_r () const |
| Returns a const raw pointer to the memory block that grants read access. More... | |
| void * | raw_w () |
| Returns a raw pointer to the memory block that grants write (and read) access. More... | |
| bool | readable () const |
| void | release () const |
| Releases this view. More... | |
| bool | writeable () const |
Protected Member Functions | |
| View (Block *blk, Location l, Access a, std::size_t b, void *p) | |
| protected constructor; only the Arbiter is allowed to create views via this constructor More... | |
| void | _reset () |
| reset all attributes to null More... | |
Protected Attributes | |
| Access | _access |
| the granted memory access More... | |
| Block * | _block |
| the block that this view belongs to More... | |
| std::size_t | _bytes |
| the size of the memory block in bytes More... | |
| Location | _location |
| the current memory location More... | |
| void * | _ptr |
| the actual memory pointer (may be a main or cuda or whatever pointer) More... | |
Friends | |
| class | Arbiter |
| class | Block |
Raw memory view class.
This class represents a raw view for a (region of a bigger) memory block that is managed by the Memory::Arbiter class. This class stores a void pointer and the size of the memory block in bytes and it therefore does not offer any functionality related to array elements etc. as this class has no knowledge of how the data is to be interpreted.
If you need a view for a memory block that is interpreted as an (array of) object(s) of a certain data type or class, then consider the documentation of the Memory::TypedView class template, which is derived from this class.
See Memory Views, Locations and Access Rights for more information.
Definition at line 228 of file memory_arbiter.hpp.
|
explicitprotected |
protected constructor; only the Arbiter is allowed to create views via this constructor
Definition at line 1012 of file memory_arbiter.cpp.
| FEAT::Memory::View::View | ( | ) |
default constructor
Definition at line 1003 of file memory_arbiter.cpp.
|
virtual |
| FEAT::Memory::View::View | ( | View && | other | ) |
move-constructor
Definition at line 1030 of file memory_arbiter.cpp.
|
protected |
reset all attributes to null
Definition at line 1063 of file memory_arbiter.cpp.
References _access, _block, _bytes, _location, _ptr, and FEAT::Memory::none.
Referenced by release().
|
inline |
Definition at line 324 of file memory_arbiter.hpp.
References _access.
|
inline |
Definition at line 286 of file memory_arbiter.hpp.
References _bytes.
Referenced by copy_from(), and FEAT::Memory::TypedView< T_ >::size().
|
inline |
Copies the contents of another view's memory region into the memory of this memory view.
In other words: this function performs a deep copy of the source view.
| [in] | src | A transient reference to the view whose memory is to be copied into this view's memory. The source view may be larger than this view, but it must not be smaller. |
Definition at line 369 of file memory_arbiter.hpp.
References bytes(), copy_raw_from(), location(), and raw_r().
| void FEAT::Memory::View::copy_raw_from | ( | const void * | src_ptr, |
| Location | src_loc | ||
| ) |
Copies the contents of a given memory region into the memory of this memory view.
| [in] | src_ptr | A transient pointer to a memory block that is to be copied into this view's memory |
| [in] | src_loc | The location of the source memory pointer src_ptr. |
Definition at line 1098 of file memory_arbiter.cpp.
References _bytes, _location, _ptr, FEAT::Memory::cuda, FEAT::Memory::main, FEAT::Memory::memcopy_cuda(), FEAT::Memory::memcopy_cuda_to_main(), FEAT::Memory::memcopy_main(), FEAT::Memory::memcopy_main_to_cuda(), writeable(), XABORTM, and XASSERT.
Referenced by FEAT::LAFEM::Container< DT_, IT_ >::_deserialize(), FEAT::Memory::TypedView< T_ >::convert_from(), and copy_from().
|
inline |
Checks whether the memory view has a size of 0 bytes.
Definition at line 272 of file memory_arbiter.hpp.
References _bytes.
Referenced by format_to_one(), and format_to_zero().
| void FEAT::Memory::View::format_to_one | ( | ) |
Formats all bits of the memory view to one (yields NaN for floating point types)
Definition at line 1085 of file memory_arbiter.cpp.
References _bytes, _location, _ptr, empty(), FEAT::Memory::memset_cuda(), FEAT::Memory::memset_main(), and writeable().
| void FEAT::Memory::View::format_to_zero | ( | ) |
Formats all bits of the memory view to zero.
Definition at line 1072 of file memory_arbiter.cpp.
References _bytes, _location, _ptr, empty(), FEAT::Memory::memset_cuda(), FEAT::Memory::memset_main(), and writeable().
|
inline |
Checks whether the memory pointer is a nullptr.
Definition at line 280 of file memory_arbiter.hpp.
References _ptr.
|
inline |
Definition at line 318 of file memory_arbiter.hpp.
References _location.
Referenced by FEAT::Memory::TypedView< T_ >::convert_from(), copy_from(), and FEAT::Memory::TypedView< T_ >::format().
|
inline |
Returns a const raw pointer to the memory block that grants read access.
Definition at line 311 of file memory_arbiter.hpp.
References _ptr.
Referenced by FEAT::LAFEM::Container< DT_, IT_ >::_serialize(), and copy_from().
|
inline |
Returns a raw pointer to the memory block that grants write (and read) access.
Definition at line 301 of file memory_arbiter.hpp.
References _ptr, and writeable().
|
inline |
Definition at line 330 of file memory_arbiter.hpp.
References FEAT::Memory::read.
| void FEAT::Memory::View::release | ( | ) | const |
Releases this view.
Definition at line 1056 of file memory_arbiter.cpp.
References _block, and _reset().
Referenced by FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::SparseMatrixBanded(), FEAT::Solver::ILUPrecondWithBackend< PreferredBackend::generic, LAFEM::SparseMatrixCSR< DT_, IT_ >, Filter_ >::apply(), FEAT::Solver::ILUPrecondWithBackend< PreferredBackend::generic, LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, dim_ >, Filter_ >::apply(), FEAT::Memory::Arbiter::convert(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::convert(), FEAT::LAFEM::PointstarFactoryFD2< DataType_, IndexType_ >::eigenvector_min(), FEAT::LAFEM::PointstarFactoryFD2< DataType_, IndexType_ >::matrix_banded(), FEAT::LAFEM::PointstarFactoryFD< DataType_, IndexType_ >::matrix_csr(), FEAT::LAFEM::PointstarFactoryFE< DataType_, IndexType_ >::matrix_csr(), operator=(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::read_from(), FEAT::LAFEM::DenseVector< DT_, IT_ >::read_from(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, block_size_ >::read_from(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::shrink(), FEAT::LAFEM::PointstarStructureFE::value(), and FEAT::LAFEM::PointstarFactoryFD2< DataType_, IndexType_ >::vector_q2_bubble().
|
inline |
Definition at line 336 of file memory_arbiter.hpp.
References FEAT::Memory::write.
Referenced by copy_raw_from(), format_to_one(), format_to_zero(), FEAT::Memory::TypedView< T_ >::get_w(), and raw_w().
|
friend |
Definition at line 231 of file memory_arbiter.hpp.
|
friend |
Definition at line 232 of file memory_arbiter.hpp.
|
protected |
the granted memory access
Definition at line 240 of file memory_arbiter.hpp.
Referenced by _reset(), access(), and operator=().
|
protected |
the block that this view belongs to
Definition at line 236 of file memory_arbiter.hpp.
Referenced by ~View(), _reset(), operator=(), and release().
|
protected |
the size of the memory block in bytes
Definition at line 242 of file memory_arbiter.hpp.
Referenced by _reset(), bytes(), copy_raw_from(), empty(), format_to_one(), format_to_zero(), and operator=().
|
protected |
the current memory location
Definition at line 238 of file memory_arbiter.hpp.
Referenced by _reset(), copy_raw_from(), format_to_one(), format_to_zero(), location(), and operator=().
|
protected |
the actual memory pointer (may be a main or cuda or whatever pointer)
Definition at line 244 of file memory_arbiter.hpp.
Referenced by ~View(), _reset(), copy_raw_from(), format_to_one(), format_to_zero(), FEAT::Memory::TypedView< T_ >::get_r(), FEAT::Memory::TypedView< T_ >::get_w(), is_nullptr(), operator=(), raw_r(), and raw_w().