Muesli
 All Classes Namespaces Files Functions Typedefs Enumerations
Public Member Functions | List of all members
msl::LMatrix< T > Class Template Reference

Class LMatrix represents a shallow copy of class DMatrix. More...

#include <lmatrix.h>

Inheritance diagram for msl::LMatrix< T >:
msl::ArgumentType

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...
 
- Public Member Functions inherited from msl::ArgumentType
virtual ~ArgumentType ()
 Virtual destructor.
 

Detailed Description

template<typename T>
class msl::LMatrix< T >

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.

Template Parameters
TThe element type.

Constructor & Destructor Documentation

template<typename T>
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.

Parameters
daThe distributed matrix whose local partition will be accessed.
gpu_distSpecifies 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.

Member Function Documentation

template<typename T>
MSL_USERFUNC T msl::LMatrix< 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).

Parameters
rowThe row index of the requested element.
colThe column index of the requested element.
Returns
The requested element.
template<typename T>
MSL_USERFUNC int msl::LMatrix< T >::getCols ( ) const

Returns the number of columns.

Returns
The number of columns.
template<typename T>
MSL_USERFUNC int msl::LMatrix< T >::getRows ( ) const

Returns the number of rows.

Returns
The number of rows.
template<typename T>
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).

Parameters
indexThe index of the requested element.
Returns
A pointer to the requested row of the local partition.
template<typename T>
virtual void msl::LMatrix< T >::update ( )
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.


The documentation for this class was generated from the following file: