SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
|
The Matrix class is a two dimensional container which makes its data accessible on the host as well as on the devices. More...
#include <Matrix.h>
Classes | |
struct | coordinate |
This struct represents two dimensional coordinates. More... | |
Public Types | |
typedef std::vector< T > | host_buffer_type |
The type used to store the elements on the host. | |
typedef host_buffer_type::value_type | value_type |
The type of the elements. | |
typedef host_buffer_type::pointer | pointer |
The type of a pointer to an element. | |
typedef host_buffer_type::const_pointer | const_pointer |
The type of a const pointer to an element. | |
typedef host_buffer_type::reference | reference |
The type of a reference to an element. | |
typedef host_buffer_type::const_reference | const_reference |
The type of a const reference to an element. | |
typedef host_buffer_type::iterator | iterator |
The type of an iterator. | |
typedef host_buffer_type::const_iterator | const_iterator |
The type of an const iterator. | |
typedef skelcl::MatrixSize | size_type |
The integral type used to define the number of the rows and columns in the Matrix. | |
typedef host_buffer_type::difference_type | difference_type |
The integral type used to define differences of two size_type values. | |
typedef host_buffer_type::allocator_type | allocator_type |
The type of the allocator used on the host. | |
Public Member Functions | |
Matrix () | |
Creates a new empty Matrix. | |
Matrix (const size_type size, const value_type &value=value_type(), const detail::Distribution< Matrix< T >> &distribution=detail::Distribution< Matrix< T >>()) | |
Creates a new Matrix with the given MatrixSize and Distribution. The newly created Matrix is filled with the given value. More... | |
Matrix (const std::vector< T > &vector, const typename size_type::size_type columnCount, const detail::Distribution< Matrix< T >> &distribution=detail::Distribution< Matrix< T >>()) | |
Constructor with a std::vector and the number of columns as parameter. | |
Matrix (const std::vector< T > &vector, const size_type size, const detail::Distribution< Matrix< T >> &distribution=detail::Distribution< Matrix< T >>()) | |
constructor with a std::vector and a matrix_size as parameter | |
template<class InputIterator > | |
Matrix (InputIterator first, InputIterator last, const typename size_type::size_type columnCount, const detail::Distribution< Matrix< T >> &distribution=detail::Distribution< Matrix< T >>()) | |
constructor with 2 iterators and the number of columns as parameter | |
template<class InputIterator > | |
Matrix (InputIterator first, InputIterator last, const size_type size, const detail::Distribution< Matrix< T >> &distribution=detail::Distribution< Matrix< T >>()) | |
constructor with 2 iterators and a matrix_size as parameter | |
Matrix (Matrix< T > &&rhs) | |
Move constructor. | |
Matrix< T > & | operator= (Matrix< T > &&rhs) |
Move assignment operator. | |
~Matrix () | |
Destructor. | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
iterator | row_begin (typename coordinate::index_type rowIndex) |
const_iterator | row_begin (typename coordinate::index_type rowIndex) const |
iterator | row_end (typename coordinate::index_type rowIndex) |
const_iterator | row_end (typename coordinate::index_type rowIndex) const |
iterator | operator[] (typename coordinate::index_type rowIndex) |
const_iterator | operator[] (typename coordinate::index_type rowIndex) const |
size_type | size () const |
size_type::size_type | rowCount () const |
size_type::size_type | columnCount () const |
size_type::size_type | max_size () const |
void | resize (const size_type &size, T c=T()) |
size_type::size_type | capacity () const |
bool | empty () const |
void | reserve (size_type::size_type bytes) |
reference | operator() (coordinate c) |
const_reference | operator() (coordinate c) const |
reference | at (coordinate c) |
const_reference | at (coordinate c) const |
reference | front () |
const_reference | front () const |
reference | back () |
const_reference | back () const |
template<class InputIterator > | |
void | assign (InputIterator first, InputIterator last) |
void | assign (size_type size, const T &v) |
template<class InputIterator > | |
void | push_back_row (InputIterator first, InputIterator last) |
void | push_back_row (std::initializer_list< T > list) |
void | pop_back_row () |
template<class InputIterator > | |
void | insert_row (typename coordinate::index_type rowIndex, InputIterator first, InputIterator last) |
void | insert_row (typename coordinate::index_type rowIndex, std::initializer_list< T > list) |
iterator | erase_row (typename coordinate::index_type rowIndex) |
void | clear () |
detail::Distribution< Matrix < T > > & | distribution () const |
template<typename U > | |
void | setDistribution (const detail::Distribution< Matrix< U >> &distribution) const |
template<typename U > | |
void | setDistribution (const std::unique_ptr< detail::Distribution< Matrix< U >>> &newDistribution) const |
void | setDistribution (std::unique_ptr< detail::Distribution< Matrix< T >>> &&newDistribution) const |
void | createDeviceBuffers () const |
void | forceCreateDeviceBuffers () const |
detail::Event | startUpload () const |
void | copyDataToDevices () const |
detail::Event | startDownload () const |
void | copyDataToHost () const |
void | dataOnDeviceModified () const |
void | dataOnHostModified () const |
const detail::DeviceBuffer & | deviceBuffer (const detail::Device &device) const |
host_buffer_type & | hostBuffer () const |
Static Public Member Functions | |
static Matrix< T > | from2DVector (const std::vector< std::vector< T >> &matrix, const detail::Distribution< Matrix< T >> &distribution=detail::Distribution< Matrix< T >>()) |
static function creating a matrix from 2 dim std::vector as parameter | |
static std::string | deviceFunctions () |
The Matrix class is a two dimensional container which makes its data accessible on the host as well as on the devices.
The interface is inspired by the std::vector class. Access to elements is possible by calling member functions or using iterators.
Like the Vector it is possible to set a Distribution, which explains how the elements should be distributed across multiple devices. In addition, there exist functions to copy the elements to and from the devices and to access the underlying OpenCL objects.
skelcl::Matrix< T >::Matrix | ( | const size_type | size, |
const value_type & | value = value_type() , |
||
const detail::Distribution< Matrix< T >> & | distribution = detail::Distribution< Matrix< T >>() |
||
) |