|
ADS
Algorithms and Data Structures
|
The parallel products of matrices, beyond the book: the products by a vector of the sparse matrices CsrMatrix and SellMatrix [see CsrMatrix.h and SellMatrix.h], and the product of dense matrices of gemm() [see DenseMatrix.h], on the threads of an executor [see Executor.h], with the same results as the sequential ones, bit for bit: each entry of the output is computed by the same sequential code, with the same order of the sums, by one thread. More...
#include "ADS/Contract.h"#include "ADS/numeric/CsrMatrix.h"#include "ADS/numeric/DenseMatrix.h"#include "ADS/numeric/SellMatrix.h"#include "ADS/parallel/Executor.h"#include <algorithm>#include <cstddef>#include <vector>#include "ADS/parallel/impl/ParallelNumeric.tpp"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| template<Executor E, class T, std::integral I, std::integral P> | |
| void | ADS::multiply (E &ex, const BasicCsrMatrix< T, I, P > &A, const T *x, T *y) |
| the product \( y = A x \) of the sparse matrix \( A \) by rows on the threads of ex | |
| template<Executor E, class T, std::integral I, std::integral P> | |
| std::vector< T > | ADS::multiply (E &ex, const BasicCsrMatrix< T, I, P > &A, const std::vector< T > &x) |
| the product \( A x \) of the sparse matrix \( A \) by rows on the threads of ex, as a new vector | |
| template<Executor E, std::size_t C> | |
| void | ADS::multiply (E &ex, const SellMatrix< C > &A, const double *x, double *y) |
| the product \( y = A x \) of the sparse matrix \( A \) by chunks of \( C \) rows on the threads of ex | |
| template<Executor E, std::size_t C> | |
| std::vector< double > | ADS::multiply (E &ex, const SellMatrix< C > &A, const std::vector< double > &x) |
| the product \( A x \) of the sparse matrix \( A \) by chunks on the threads of ex, as a new vector | |
| template<Executor E, class T> | |
| void | ADS::gemm (E &ex, std::size_t m, std::size_t n, std::size_t k, T alpha, const T *A, std::size_t lda, const T *B, std::size_t ldb, T beta, T *C, std::size_t ldc) |
| \( C \gets \alpha A B + \beta C \) on the threads of ex, for \( A \) of \( m \times k \), \( B \) of \( k \times n \) and \( C \) of \( m \times n \) by rows, as gemm() | |
| template<Executor E, class T> | |
| DenseMatrix< T > | ADS::multiply (E &ex, const DenseMatrix< T > &A, const DenseMatrix< T > &B) |
| the product \( A B \) of two dense matrices on the threads of ex | |
The parallel products of matrices, beyond the book: the products by a vector of the sparse matrices CsrMatrix and SellMatrix [see CsrMatrix.h and SellMatrix.h], and the product of dense matrices of gemm() [see DenseMatrix.h], on the threads of an executor [see Executor.h], with the same results as the sequential ones, bit for bit: each entry of the output is computed by the same sequential code, with the same order of the sums, by one thread.
The products by a vector move \( 12 \mathit{nnz} + 8 ( m + n ) \) bytes and are bound by the bandwidth of the memory, so that \( p \) threads gain at most the ratio of the bandwidth of the socket to that of one core.
The contracts [see Contract.h]: those of the sequential products. The functions are defined in ParallelNumeric.tpp.