SparseLibrary  Version 1.6.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
RDBHilbert< T, MatrixType > Class Template Reference

The Beta Hilbert triplet scheme. More...

#include <RDBHilbert.hpp>

Inheritance diagram for RDBHilbert< T, MatrixType >:
Inheritance graph
[legend]
Collaboration diagram for RDBHilbert< T, MatrixType >:
Collaboration graph
[legend]

Public Member Functions

 RDBHilbert (const std::string file, T zero=0, std::vector< size_t > *_p_translate=NULL)
 Default file-based constructor. More...
 
 RDBHilbert (std::vector< Triplet< T > > &input, ULI m, ULI n, T zero=0, std::vector< size_t > *_p_translate=NULL)
 Default triplet-based constructor. More...
 
virtual ~RDBHilbert ()
 Base deconstructor. More...
 
void wait ()
 
virtual void load (std::vector< Triplet< T > > &input, const ULI m, const ULI n, const T zero)
 
virtual T * mv (const T *x)
 Overloaded mv call; allocates output vector using numa_interleaved. More...
 
virtual void zxa (const T *x, T *z)
 
virtual void zxa (const T *x, T *z, const size_t repeat)
 
void reset ()
 
virtual void zax (const T *x, T *z)
 
virtual void zax (const T *x, T *z, const size_t repeat, const clockid_t clock_id, double *elapsed_time)
 
virtual void getFirstIndexPair (ULI &i, ULI &j)
 
virtual size_t bytesUsed ()
 
- Public Member Functions inherited from SparseMatrix< T, ULI >
 SparseMatrix ()
 Base constructor. More...
 
 SparseMatrix (const ULInzs, const ULInr, const ULInc, const T zero)
 Base constructor. More...
 
virtual ~SparseMatrix ()
 Base deconstructor. More...
 
void loadFromFile (const std::string file, const T zero=0)
 Function which loads a matrix from a matrix market file. More...
 
virtual unsigned long int m ()
 Queries the number of rows this matrix contains. More...
 
virtual unsigned long int n ()
 Queries the number of columns this matrix contains. More...
 
virtual unsigned long int nzs ()
 Queries the number of nonzeroes stored in this matrix. More...
 
virtual void zax (const T *__restrict__ x, T *__restrict__ z)=0
 In-place z=Ax function. More...
 
virtual void zxa (const T *__restrict__ x, T *__restrict__ z)=0
 In-place z=xA function. More...
 
- Public Member Functions inherited from Matrix< T >
 Matrix ()
 Base constructor. More...
 
virtual ~Matrix ()
 Base deconstructor. More...
 
virtual void zax (const T *__restrict__ x, T *__restrict__ z, const size_t k, const clockid_t clock_id=0, double *elapsed_time=NULL)
 Wrapper function to call the zax kernel multiple times successively, while timing the duration of the operation. More...
 
template<size_t k>
void ZaX (const T *__restrict__ const *__restrict__ const X, T *__restrict__ const *__restrict__ const Z)
 In-place Z=AX function, where A is m x n, Z = m x k, and X is n x k. More...
 
template<size_t k>
void ZXa (const T *__restrict__ const *__restrict__ const X, T *__restrict__ const *__restrict__ const Z)
 In-place Z=XA function, where A is m x n, Z = k x n, and X is k x m. More...
 
virtual void zxa (const T *__restrict__ x, T *__restrict__ z, const unsigned long int repeat, const clockid_t clock_id=0, double *elapsed_time=NULL)
 Wrapper function to call the zxa kernel multiple times successively, while timing the operation duration. More...
 

Static Public Member Functions

static void end (pthread_mutex_t *mutex, pthread_cond_t *cond, size_t *sync, const size_t P)
 
static void synchronise (pthread_mutex_t *mutex, pthread_cond_t *cond, size_t *sync, const size_t P)
 
static void * thread (void *data)
 
static void collectY (RDB_shared_data< T > *shared)
 

Protected Member Functions

void set_p_translate (std::vector< size_t > *_p_translate)
 Sets p_translate to 0..P-1 by default, or equal to the optionally supplied vector. More...
 

Protected Attributes

std::vector< size_t > p_translate
 Which processors to pin threads to.
 
const T * input
 Input vector.
 
T * output
 Output vector.
 
pthread_t * threads
 Input vectors for multiple-RHS operations. More...
 
RDB_shared_data< T > * thread_data
 array of initial thread data
 
pthread_mutex_t mutex
 Stop/continue mechanism: mutex.
 
pthread_cond_t cond
 Stop/continue mechanism: condition.
 
pthread_mutex_t end_mutex
 Wait for end mechanism: mutex.
 
pthread_cond_t end_cond
 Wait for end mechanism: condition.
 
size_t sync
 Used for synchronising threads.
 
size_t end_sync
 Used for construction end signal.
 
- Protected Attributes inherited from SparseMatrix< T, ULI >
ULI nor
 Number of rows. More...
 
ULI noc
 Number of columns.
 
ULI nnz
 Number of non-zeros. More...
 

Static Protected Attributes

static size_t P = 0
 Number of threads to fire up.
 
static clockid_t global_clock_id = 0
 Clock type used for thread-local timing.
 
static const ULI max_n = FBICRS< T >::beta_n
 Given FBICRS, the maximum value for columnwise matrix size.
 
static const ULI max_m = FBICRS< T >::beta_m
 Given FBICRS, the maximum value for the rowwise matrix size, assuming short ints on ICRS at the lower level.
 

Additional Inherited Members

- Public Attributes inherited from SparseMatrix< T, ULI >
zero_element
 The element considered to be zero. More...
 

Detailed Description

template<typename T, class MatrixType = FBICRS< T >>
class RDBHilbert< T, MatrixType >

The Beta Hilbert triplet scheme.

Full parallel SpMV, based on Blocked Hilbert and PThreads. Inspired by Aydin & Gilbert's CSB and comments by Patrick Amestoy on the BICRS Hilbert scheme (both pointed towards sparse blocking, for different reasons that this scheme combines).

Constructor & Destructor Documentation

template<typename T, class MatrixType = FBICRS< T >>
RDBHilbert< T, MatrixType >::RDBHilbert ( const std::string  file,
zero = 0,
std::vector< size_t > *  _p_translate = NULL 
)
inline
template<typename T, class MatrixType = FBICRS< T >>
RDBHilbert< T, MatrixType >::RDBHilbert ( std::vector< Triplet< T > > &  input,
ULI  m,
ULI  n,
zero = 0,
std::vector< size_t > *  _p_translate = NULL 
)
inline
template<typename T, class MatrixType = FBICRS< T >>
virtual RDBHilbert< T, MatrixType >::~RDBHilbert ( )
inlinevirtual

Member Function Documentation

template<typename T, class MatrixType = FBICRS< T >>
virtual size_t RDBHilbert< T, MatrixType >::bytesUsed ( )
inlinevirtual
template<typename T, class MatrixType = FBICRS< T >>
static void RDBHilbert< T, MatrixType >::collectY ( RDB_shared_data< T > *  shared)
inlinestatic
template<typename T, class MatrixType = FBICRS< T >>
static void RDBHilbert< T, MatrixType >::end ( pthread_mutex_t *  mutex,
pthread_cond_t *  cond,
size_t *  sync,
const size_t  P 
)
inlinestatic
template<typename T, class MatrixType = FBICRS< T >>
virtual void RDBHilbert< T, MatrixType >::getFirstIndexPair ( ULI &  i,
ULI &  j 
)
inlinevirtual
template<typename T, class MatrixType = FBICRS< T >>
virtual void RDBHilbert< T, MatrixType >::load ( std::vector< Triplet< T > > &  input,
const ULI  m,
const ULI  n,
const T  zero 
)
inlinevirtual
template<typename T, class MatrixType = FBICRS< T >>
virtual T* RDBHilbert< T, MatrixType >::mv ( const T *  x)
inlinevirtual

Overloaded mv call; allocates output vector using numa_interleaved.

Reimplemented from SparseMatrix< T, ULI >.

References SparseMatrix< T, ULI >::nor, RDBHilbert< T, MatrixType >::reset(), RDBHilbert< T, MatrixType >::zax(), and SparseMatrix< T, ULI >::zero_element.

template<typename T, class MatrixType = FBICRS< T >>
void RDBHilbert< T, MatrixType >::reset ( )
inline
template<typename T, class MatrixType = FBICRS< T >>
void RDBHilbert< T, MatrixType >::set_p_translate ( std::vector< size_t > *  _p_translate)
inlineprotected

Sets p_translate to 0..P-1 by default, or equal to the optionally supplied vector.

References MachineInfo::cores(), MachineInfo::getInstance(), RDBHilbert< T, MatrixType >::P, and RDBHilbert< T, MatrixType >::p_translate.

Referenced by RDBHilbert< T, MatrixType >::RDBHilbert().

template<typename T, class MatrixType = FBICRS< T >>
static void RDBHilbert< T, MatrixType >::synchronise ( pthread_mutex_t *  mutex,
pthread_cond_t *  cond,
size_t *  sync,
const size_t  P 
)
inlinestatic
template<typename T, class MatrixType = FBICRS< T >>
static void* RDBHilbert< T, MatrixType >::thread ( void *  data)
inlinestatic
template<typename T, class MatrixType = FBICRS< T >>
void RDBHilbert< T, MatrixType >::wait ( )
inline
template<typename T, class MatrixType = FBICRS< T >>
virtual void RDBHilbert< T, MatrixType >::zax ( const T *  x,
T *  z 
)
inlinevirtual
template<typename T, class MatrixType = FBICRS< T >>
virtual void RDBHilbert< T, MatrixType >::zax ( const T *  x,
T *  z,
const size_t  repeat,
const clockid_t  clock_id,
double *  elapsed_time 
)
inlinevirtual
template<typename T, class MatrixType = FBICRS< T >>
virtual void RDBHilbert< T, MatrixType >::zxa ( const T *  x,
T *  z 
)
inlinevirtual
See also
Matrix::zxa
template<typename T, class MatrixType = FBICRS< T >>
virtual void RDBHilbert< T, MatrixType >::zxa ( const T *  x,
T *  z,
const size_t  repeat 
)
inlinevirtual

Member Data Documentation

template<typename T, class MatrixType = FBICRS< T >>
pthread_t* RDBHilbert< T, MatrixType >::threads
protected

Input vectors for multiple-RHS operations.

Output vectors for multiple-RHS operations. p_threads associated to this data strcuture

Referenced by RDBHilbert< T, MatrixType >::load(), and RDBHilbert< T, MatrixType >::~RDBHilbert().


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