Class LMatrix represents a shallow copy of class DMatrix. More...
#include <lmatrix.h>
Public Member Functions | |
LMatrix (DMatrix< T > &dm, Distribution gpu_dist=Distribution::DIST) | |
Constructor. Gathers all pointers (CPU + GPUs) pointing to a local partition of a given DMatrix. More... | |
virtual void | update () |
Updates the pointer that is accessed within the get function to point to the correct memory. More... | |
MSL_USERFUNC int | getRows () const |
Returns the number of rows. More... | |
MSL_USERFUNC int | getCols () const |
Returns the number of columns. More... | |
MSL_USERFUNC T * | operator[] (int rowIndex) const |
Returns a pointer to row with index rowIndex. Uses a local index. Note that 0 <= rowIndex < getRows() must hold (not checked for performance reasons). More... | |
MSL_USERFUNC T | get (int row, int col) const |
Returns the element at indices (row, col). Uses local indices. Note that 0 <= row < getRows() and 0 <= col < getCols() must hold (not checked for performance reasons). More... | |
![]() | |
virtual | ~ArgumentType () |
Virtual destructor. | |
Class LMatrix represents a shallow copy of class DMatrix.
Class LMatrix represents a shallow copy of class DMatrix. Instantiations of this class can be added as additional arguments to a user functor in terms of data members. It only stores pointers to the local partition (CPU and GPU partitions) but not the data itself. Therefore, copy construction comes at lower costs compared to copy constructing a DMatrix which would imply copying of (big) data. This is important because when initializing data members, the copy constructor will be called. The L in LMatrix stands for Local and indicates that the user functor only has access to the local partition of a DMatrix.
T | The element type. |
msl::LMatrix< T >::LMatrix | ( | DMatrix< T > & | dm, |
Distribution | gpu_dist = Distribution::DIST |
||
) |
Constructor. Gathers all pointers (CPU + GPUs) pointing to a local partition of a given DMatrix.
da | The distributed matrix whose local partition will be accessed. |
gpu_dist | Specifies the distribution among GPUs. Default is distributed. May also be copy distributed, in this case the local partition of a distributed matrix is copy distributed among all GPUs. |
MSL_USERFUNC T msl::LMatrix< T >::get | ( | int | row, |
int | col | ||
) | const |
MSL_USERFUNC int msl::LMatrix< T >::getCols | ( | ) | const |
Returns the number of columns.
MSL_USERFUNC int msl::LMatrix< T >::getRows | ( | ) | const |
Returns the number of rows.
MSL_USERFUNC T* msl::LMatrix< T >::operator[] | ( | int | rowIndex | ) | const |
Returns a pointer to row with index rowIndex. Uses a local index. Note that 0 <= rowIndex < getRows() must hold (not checked for performance reasons).
index | The index of the requested element. |
|
virtual |
Updates the pointer that is accessed within the get function to point to the correct memory.
Updates the pointer that is accessed within the get function to point to the correct memory. When accessed by the CPU, the pointer must point to host main memory, when accessed by GPU i, the pointer must point to device main memory of GPU i.
Implements msl::ArgumentType.