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

Full parallel row-distributed SpMV, based on CSB (BlockCRS + Morton curve + Cilk) and PThreads. More...

#include <RDCSB.hpp>

Inheritance diagram for RDCSB< T >:
Inheritance graph
[legend]
Collaboration diagram for RDCSB< T >:
Collaboration graph
[legend]

Public Member Functions

 RDCSB (const std::string file, T zero)
 
 RDCSB (std::vector< Triplet< T > > &input, ULI m, ULI n, T zero)
 
void wait ()
 
virtual void load (std::vector< Triplet< T > > &input, const ULI m, const ULI n, const T zero)
 Function reading in from std::vector< Triplet< T > > format. More...
 
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 unsigned long int repeat)
 
virtual void zax (const T *x, T *z)
 
virtual void zax (const T *x, T *z, const unsigned long int repeat, const clockid_t clock_id, double *elapsed_time)
 
virtual void getFirstIndexPair (ULI &i, ULI &j)
 Returns the first nonzero index, per reference. More...
 
- 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...
 
virtual size_t bytesUsed ()=0
 Function to query the amount of storage required by this sparse matrix. More...
 

Static Public Member Functions

static void end (pthread_mutex_t *mutex, pthread_cond_t *cond, unsigned long int *sync, const unsigned long int P)
 
static void synchronise (pthread_mutex_t *mutex, pthread_cond_t *cond, unsigned long int *sync, const unsigned long int P)
 
static void * thread (void *data)
 
static void collectY (RDCSB_shared_data< T > *shared)
 

Protected Attributes

pthread_t * threads
 p_threads associated to this data strcuture
 
RDCSB_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.
 
unsigned long int sync
 Used for synchronising threads.
 
unsigned long int 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 unsigned long int P = 0
 Number of threads to fire up.
 
static const T * input = NULL
 Input vector.
 
static T * output = NULL
 Output vector.
 
static clockid_t global_clock_id = 0
 Clock type used for thread-local timing.
 

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 RDCSB< T >

Full parallel row-distributed SpMV, based on CSB (BlockCRS + Morton curve + Cilk) and PThreads.

Inspired by Aydin & Gilbert's CSB, and comments by Patrick Amestoy on the BICRS Hilbert scheme. May not compile due to PThreads/Cilk clashes.

Member Function Documentation

template<typename T>
virtual void RDCSB< T >::getFirstIndexPair ( ULI &  row,
ULI &  col 
)
inlinevirtual

Returns the first nonzero index, per reference.

Implements SparseMatrix< T, ULI >.

template<typename T>
virtual void RDCSB< T >::load ( std::vector< Triplet< T > > &  input,
const ULI  m,
const ULI  n,
const T  zero 
)
inlinevirtual

Function reading in from std::vector< Triplet< T > > format.

Parameters
inputThe input matrix in triplet format.
mThe number of rows of the input matrix.
nThe number of columns of the input matrix.
zeroWhich element is to be considered zero.

Implements SparseMatrix< T, ULI >.

References RDCSB< T >::cond, MachineInfo::cores(), RDCSB< T >::end_cond, RDCSB< T >::end_mutex, RDCSB< T >::end_sync, MachineInfo::getInstance(), RDCSB< T >::input, SparseMatrix< T, ULI >::m(), RDCSB< T >::mutex, SparseMatrix< T, ULI >::n(), SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, SparseMatrix< T, ULI >::nor, RDCSB< T >::P, RDCSB< T >::sync, RDCSB< T >::thread_data, RDCSB< T >::threads, and SparseMatrix< T, ULI >::zero_element.

template<typename T>
virtual T* RDCSB< T >::mv ( const T *  x)
inlinevirtual

Overloaded mv call; allocates output vector using numa_interleaved.

Reimplemented from SparseMatrix< T, ULI >.

References SparseMatrix< T, ULI >::nor, and SparseMatrix< T, ULI >::zero_element.


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