49 #define __CL_ENABLE_EXCEPTIONS
51 #undef __CL_ENABLE_EXCEPTIONS
55 #include "detail/Device.h"
56 #include "detail/DeviceBuffer.h"
57 #include "detail/Distribution.h"
58 #include "detail/Padding.h"
59 #include "detail/skelclDll.h"
69 typedef size_t size_type;
76 MatrixSize(size_type rowCount, size_type columnCount);
82 size_type elemCount()
const;
87 size_type rowCount()
const;
92 size_type columnCount()
const;
157 size_type _columnCount;
163 template <
typename T>
164 class RegisterMatrixDeviceFunctions {
166 RegisterMatrixDeviceFunctions();
189 template <
typename T>
200 typedef typename host_buffer_type::pointer
pointer;
212 typedef typename host_buffer_type::iterator
iterator;
254 const detail::Distribution<
Matrix<T>>& distribution =
261 Matrix(
const std::vector<T>& vector,
262 const typename size_type::size_type columnCount,
263 const detail::Distribution<
Matrix<T>>& distribution =
270 const detail::Distribution<
Matrix<T>>& distribution =
279 const detail::Distribution<
Matrix<T>>& distribution =
285 template <
class InputIterator>
286 Matrix(InputIterator first, InputIterator last,
287 const typename size_type::size_type columnCount,
288 const detail::Distribution<
Matrix<T>>& distribution =
294 template <
class InputIterator>
296 const detail::Distribution<
Matrix<T>>& distribution =
333 typename size_type::size_type rowCount()
const;
334 typename size_type::size_type columnCount()
const;
338 size_type::size_type max_size()
const;
339 void resize(
const size_type& size, T c = T());
340 size_type::size_type capacity()
const;
342 void reserve(size_type::size_type bytes);
358 template <
class InputIterator>
359 void assign(InputIterator first, InputIterator last);
363 template <
class InputIterator>
364 void push_back_row(InputIterator first, InputIterator last);
366 void push_back_row(std::initializer_list<T> list);
369 template <
class InputIterator>
371 InputIterator first, InputIterator last);
373 std::initializer_list<T> list);
380 detail::Distribution<Matrix<T>>& distribution()
const;
382 template <
typename U>
383 void setDistribution(
const detail::Distribution<
Matrix<U>>&
386 template <
typename U>
387 void setDistribution(
const std::unique_ptr<detail::Distribution<
Matrix<U>>>&
388 newDistribution)
const;
390 void setDistribution(std::unique_ptr<detail::Distribution<
Matrix<T>>>&&
391 newDistribution)
const;
393 void createDeviceBuffers()
const;
395 void forceCreateDeviceBuffers()
const;
397 detail::Event startUpload()
const;
399 void copyDataToDevices()
const;
401 detail::Event startDownload()
const;
403 void copyDataToHost()
const;
405 void dataOnDeviceModified()
const;
407 void dataOnHostModified()
const;
409 const detail::DeviceBuffer& deviceBuffer(
const detail::Device&
device)
const;
413 static std::string deviceFunctions();
426 std::string getInfo()
const;
427 std::string getDebugInfo()
const;
430 static RegisterMatrixDeviceFunctions<T> registerMatrixDeviceFunctions;
434 std::unique_ptr<detail::Distribution<Matrix<T>>> _distribution;
435 mutable bool _hostBufferUpToDate;
436 mutable bool _deviceBuffersUpToDate;
439 mutable std::map< detail::Device::id_type,
440 detail::DeviceBuffer > _deviceBuffers;
443 template <
typename T>
448 #include "detail/MatrixDef.h"
host_buffer_type::allocator_type allocator_type
The type of the allocator used on the host.
The Matrix class is a two dimensional container which makes its data accessible on the host as well a...
host_buffer_type::difference_type difference_type
The integral type used to define differences of two size_type values.
std::vector< T > host_buffer_type
The type used to store the elements on the host.
host_buffer_type::reference reference
The type of a reference to an element.
skelcl::MatrixSize size_type
The integral type used to define the number of the rows and columns in the Matrix.
This struct represents two dimensional coordinates.
SKELCL_DLL detail::DeviceID device(size_t dID)
Creates an OpenCL device ID to be used as parameter of the init(detail::PlatformID, detail::DeviceID) function.
host_buffer_type::const_iterator const_iterator
The type of an const iterator.
Matrix()
Creates a new empty Matrix.
This class defines a two dimensional size for a Matrix.
index_type rowIndex
The index for the row.
host_buffer_type::iterator iterator
The type of an iterator.
size_type::size_type index_type
The type used to define the numbers in a row or in a column of the Matrix.
Matrix< T > & operator=(Matrix< T > &&rhs)
Move assignment operator.
host_buffer_type::pointer pointer
The type of a pointer to an element.
host_buffer_type::value_type value_type
The type of the elements.
index_type columnIndex
The index for the column.
host_buffer_type::const_reference const_reference
The type of a const reference to an element.
host_buffer_type::const_pointer const_pointer
The type of a const pointer to an element.
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