SparseLibrary
Version 1.6.0
|
The Beta Hilbert triplet scheme. More...
#include <RDBHilbert.hpp>
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 > | |
T | zero_element |
The element considered to be zero. More... | |
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).
|
inline |
Default file-based constructor.
References SparseMatrix< T, ULI >::loadFromFile(), and RDBHilbert< T, MatrixType >::set_p_translate().
|
inline |
Default triplet-based constructor.
References RDBHilbert< T, MatrixType >::input, RDBHilbert< T, MatrixType >::load(), and RDBHilbert< T, MatrixType >::set_p_translate().
|
inlinevirtual |
Base deconstructor.
References RDBHilbert< T, MatrixType >::cond, RDBHilbert< T, MatrixType >::mutex, RDBHilbert< T, MatrixType >::P, RDBHilbert< T, MatrixType >::thread_data, and RDBHilbert< T, MatrixType >::threads.
|
inlinevirtual |
Implements Matrix< T >.
References RDBHilbert< T, MatrixType >::P, and RDBHilbert< T, MatrixType >::thread_data.
|
inlinestatic |
|
inlinestatic |
Referenced by RDBHilbert< T, MatrixType >::thread().
|
inlinevirtual |
Implements SparseMatrix< T, ULI >.
|
inlinevirtual |
Implements SparseMatrix< T, ULI >.
References RDBHilbert< T, MatrixType >::cond, RDBHilbert< T, MatrixType >::end_cond, RDBHilbert< T, MatrixType >::end_mutex, RDBHilbert< T, MatrixType >::end_sync, RDBHilbert< T, MatrixType >::input, SparseMatrix< T, ULI >::m(), RDBHilbert< T, MatrixType >::mutex, SparseMatrix< T, ULI >::n(), SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, SparseMatrix< T, ULI >::nor, RDBHilbert< T, MatrixType >::output, RDBHilbert< T, MatrixType >::P, RDBHilbert< T, MatrixType >::p_translate, RDBHilbert< T, MatrixType >::sync, RDBHilbert< T, MatrixType >::thread(), RDBHilbert< T, MatrixType >::thread_data, RDBHilbert< T, MatrixType >::threads, RDBHilbert< T, MatrixType >::wait(), and SparseMatrix< T, ULI >::zero_element.
Referenced by RDBHilbert< T, MatrixType >::RDBHilbert().
|
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.
|
inline |
References RDBHilbert< T, MatrixType >::cond, RDBHilbert< T, MatrixType >::end_mutex, RDBHilbert< T, MatrixType >::mutex, RDBHilbert< T, MatrixType >::P, RDBHilbert< T, MatrixType >::thread_data, and RDBHilbert< T, MatrixType >::wait().
Referenced by RDBHilbert< T, MatrixType >::mv().
|
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().
|
inlinestatic |
Referenced by RDBHilbert< T, MatrixType >::thread().
|
inlinestatic |
References RDB_shared_data< T >::bytes, RDBHilbert< T, MatrixType >::collectY(), RDB_shared_data< T >::cond, RDBHilbert< T, MatrixType >::cond, RDBHilbert< T, MatrixType >::end(), RDB_shared_data< T >::end_cond, RDB_shared_data< T >::end_mutex, RDB_shared_data< T >::end_sync, RDB_shared_data< T >::fillIn, RDBHilbert< T, MatrixType >::global_clock_id, RDB_shared_data< T >::id, RDB_shared_data< T >::input, Matrix2HilbertCoordinates::IntegerToHilbert(), RDB_shared_data< T >::local_y, SparseMatrix< T, ULI >::m(), RDBHilbert< T, MatrixType >::max_m, RDBHilbert< T, MatrixType >::max_n, RDB_shared_data< T >::mode, RDB_shared_data< T >::mutex, RDBHilbert< T, MatrixType >::mutex, SparseMatrix< T, ULI >::n(), SparseMatrix< T, ULI >::nnz, RDB_shared_data< T >::nzb, RDB_shared_data< T >::original, RDB_shared_data< T >::output, RDB_shared_data< T >::output_vector_offset, RDB_shared_data< T >::output_vector_size, RDB_shared_data< T >::P, RDBHilbert< T, MatrixType >::P, RDB_shared_data< T >::repeat, RDB_shared_data< T >::sync, RDBHilbert< T, MatrixType >::synchronise(), and RDB_shared_data< T >::time.
Referenced by RDBHilbert< T, MatrixType >::load().
|
inline |
|
inlinevirtual |
Referenced by RDBHilbert< T, MatrixType >::mv().
|
inlinevirtual |
References RDBHilbert< T, MatrixType >::cond, RDBHilbert< T, MatrixType >::end_mutex, RDBHilbert< T, MatrixType >::global_clock_id, RDBHilbert< T, MatrixType >::input, RDBHilbert< T, MatrixType >::mutex, RDBHilbert< T, MatrixType >::output, RDBHilbert< T, MatrixType >::P, RDBHilbert< T, MatrixType >::thread_data, and RDBHilbert< T, MatrixType >::wait().
|
inlinevirtual |
|
inlinevirtual |
References RDBHilbert< T, MatrixType >::cond, RDBHilbert< T, MatrixType >::end_mutex, RDBHilbert< T, MatrixType >::input, RDBHilbert< T, MatrixType >::mutex, RDBHilbert< T, MatrixType >::output, RDBHilbert< T, MatrixType >::P, RDBHilbert< T, MatrixType >::thread_data, and RDBHilbert< T, MatrixType >::wait().
|
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().