Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
abstraction for a serialized sparse matrix stored in column-sparse-row (CSR) layout More...
#include <csr.h>
Public Member Functions | |
CSR_Matrix (int64_t nnz, int nrow, int ncol, accumulatable const *sr) | |
constructor allocates all_data More... | |
CSR_Matrix (char *all_data) | |
constructor given serialized CSR matrix More... | |
CSR_Matrix () | |
CSR_Matrix (CSR_Matrix const &other) | |
CSR_Matrix (COO_Matrix const &coom, int nrow, int ncol, algstrct const *sr, char *data=NULL, bool init_data=true) | |
constructor given coordinate format (COO) matrix More... | |
int64_t | nnz () const |
retrieves number of nonzeros out of all_data More... | |
int64_t | size () const |
retrieves buffer size out of all_data More... | |
int | nrow () const |
retrieves number of rows out of all_data More... | |
int | ncol () const |
retrieves number of columns out of all_data More... | |
int | val_size () const |
retrieves matrix entry size out of all_data More... | |
char * | vals () const |
retrieves array of values out of all_data More... | |
int * | IA () const |
retrieves prefix sum of number of nonzeros for each row (of size nrow()+1) out of all_data More... | |
int * | JA () const |
retrieves column indices of each value in vals stored in sorted form by row More... | |
void | partition (int s, char **parts_buffer, CSR_Matrix **parts) |
splits CSR matrix into s submatrices (returned) corresponding to subsets of rows, all parts allocated in one contiguous buffer (passed back in parts_buffer) More... | |
CSR_Matrix (char *const *smnds, int s) | |
constructor merges parts into one CSR matrix, assuming they are split by partition() (Above) More... | |
void | print (algstrct const *sr) |
outputs matrix data to stdout, intended for debugging More... | |
Static Public Member Functions | |
static void | csrmm (char const *A, algstrct const *sr_A, int m, int n, int k, char const *alpha, char const *B, algstrct const *sr_B, char const *beta, char *C, algstrct const *sr_C, bivar_function const *func, bool do_offload) |
computes C = beta*C + func(alpha*A*B) where A is a CSR_Matrix, while B and C are dense More... | |
static void | csrmultd (char const *A, algstrct const *sr_A, int m, int n, int k, char const *alpha, char const *B, algstrct const *sr_B, char const *beta, char *C, algstrct const *sr_C, bivar_function const *func, bool do_offload) |
computes C = beta*C + func(alpha*A*B) where A and B are CSR_Matrices, while C is dense More... | |
static void | csrmultcsr (char const *A, algstrct const *sr_A, int m, int n, int k, char const *alpha, char const *B, algstrct const *sr_B, char const *beta, char *&C, algstrct const *sr_C, bivar_function const *func, bool do_offload) |
computes C = beta*C + func(alpha*A*B) where A, B, and C are CSR_Matrices, while C is dense More... | |
static void | compute_has_col (int const *JA, int const *IA, int const *JB, int const *IB, int i, int *has_col) |
static char * | csr_add (char *cA, char *cB, accumulatable const *adder) |
Data Fields | |
char * | all_data |
serialized buffer containing all info, index, and values related to matrix More... | |
abstraction for a serialized sparse matrix stored in column-sparse-row (CSR) layout
CTF_int::CSR_Matrix::CSR_Matrix | ( | int64_t | nnz, |
int | nrow, | ||
int | ncol, | ||
accumulatable const * | sr | ||
) |
constructor allocates all_data
Definition at line 20 of file csr.cxx.
References ALIGN, all_data, CTF_int::alloc(), ASSERT, CTF_int::accumulatable::el_size, CTF_int::get_csr_size(), CTF_int::accumulatable::init_shell(), ncol(), nnz(), size(), and vals().
CTF_int::CSR_Matrix::CSR_Matrix | ( | char * | all_data | ) |
|
inline |
Definition at line 33 of file csr.h.
Referenced by CSR_Matrix(), and partition().
|
inline |
Definition at line 35 of file csr.h.
References all_data, compute_has_col(), csr_add(), CSR_Matrix(), csrmm(), csrmultcsr(), csrmultd(), IA(), JA(), ncol(), nnz(), nrow(), partition(), print(), size(), val_size(), and vals().
CTF_int::CSR_Matrix::CSR_Matrix | ( | COO_Matrix const & | coom, |
int | nrow, | ||
int | ncol, | ||
algstrct const * | sr, | ||
char * | data = NULL , |
||
bool | init_data = true |
||
) |
constructor given coordinate format (COO) matrix
Definition at line 36 of file csr.cxx.
References ALIGN, all_data, CTF_int::alloc(), ASSERT, CTF_int::COO_Matrix::cols(), CTF_int::algstrct::coo_to_csr(), CTF_int::get_csr_size(), IA(), CTF_int::accumulatable::init_shell(), JA(), ncol(), CTF_int::COO_Matrix::nnz(), CTF_int::COO_Matrix::rows(), size(), CTF_int::COO_Matrix::val_size(), CTF_int::COO_Matrix::vals(), and vals().
CTF_int::CSR_Matrix::CSR_Matrix | ( | char *const * | smnds, |
int | s | ||
) |
constructor merges parts into one CSR matrix, assuming they are split by partition() (Above)
Definition at line 259 of file csr.cxx.
References all_data, CTF_int::alloc(), CSR_Matrix(), CTF_int::get_csr_size(), IA(), JA(), ncol(), nnz(), nrow(), val_size(), and vals().
|
static |
Definition at line 316 of file csr.cxx.
Referenced by CSR_Matrix(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), and CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old().
|
static |
Definition at line 332 of file csr.cxx.
References CTF_int::accumulatable::accum(), all_data, CTF_int::alloc(), ASSERT, CTF_int::cdealloc(), IA(), JA(), ncol(), nrow(), TAU_FSTART, TAU_FSTOP, val_size(), and vals().
Referenced by CTF_int::algstrct::csr_add(), CSR_Matrix(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr(), and CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old().
|
static |
computes C = beta*C + func(alpha*A*B) where A is a CSR_Matrix, while B and C are dense
Definition at line 134 of file csr.cxx.
References ASSERT, CTF_int::bivar_function::ccsrmm(), CTF_int::bivar_function::coffload_csrmm(), CTF_int::algstrct::csrmm(), CTF_int::accumulatable::el_size, CTF_int::bivar_function::has_off_gemm, IA(), CTF_int::algstrct::isequal(), JA(), CTF_int::algstrct::mulid(), nnz(), and vals().
Referenced by CSR_Matrix(), and CTF_int::seq_tsr_spctr::run().
|
static |
computes C = beta*C + func(alpha*A*B) where A, B, and C are CSR_Matrices, while C is dense
Definition at line 188 of file csr.cxx.
References ASSERT, CTF_int::bivar_function::ccsrmultcsr(), CTF_int::algstrct::csrmultcsr(), CTF_int::accumulatable::el_size, CTF_int::bivar_function::has_off_gemm, IA(), CTF_int::algstrct::isequal(), JA(), CTF_int::algstrct::mulid(), nnz(), and vals().
Referenced by CSR_Matrix(), and CTF_int::seq_tsr_spctr::run().
|
static |
computes C = beta*C + func(alpha*A*B) where A and B are CSR_Matrices, while C is dense
Definition at line 158 of file csr.cxx.
References ASSERT, CTF_int::bivar_function::ccsrmultd(), CTF_int::algstrct::csrmultd(), CTF_int::accumulatable::el_size, CTF_int::bivar_function::has_off_gemm, IA(), CTF_int::algstrct::isequal(), JA(), CTF_int::algstrct::mulid(), nnz(), and vals().
Referenced by CSR_Matrix(), and CTF_int::seq_tsr_spctr::run().
int * CTF_int::CSR_Matrix::IA | ( | ) | const |
retrieves prefix sum of number of nonzeros for each row (of size nrow()+1) out of all_data
Definition at line 107 of file csr.cxx.
References ALIGN, all_data, nnz(), and val_size().
Referenced by CTF_int::COO_Matrix::COO_Matrix(), CTF::Monoid< dtype, is_ord >::csr_add(), csr_add(), CSR_Matrix(), csrmm(), csrmultcsr(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old(), csrmultd(), CTF::Semiring< dtype, is_ord >::gen_csrmultcsr(), partition(), and print().
int * CTF_int::CSR_Matrix::JA | ( | ) | const |
retrieves column indices of each value in vals stored in sorted form by row
Definition at line 119 of file csr.cxx.
References ALIGN, all_data, nnz(), nrow(), and val_size().
Referenced by CTF_int::COO_Matrix::COO_Matrix(), CTF::Monoid< dtype, is_ord >::csr_add(), csr_add(), CSR_Matrix(), csrmm(), csrmultcsr(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old(), csrmultd(), CTF::Semiring< dtype, is_ord >::gen_csrmultcsr(), partition(), and print().
int CTF_int::CSR_Matrix::ncol | ( | ) | const |
retrieves number of columns out of all_data
Definition at line 97 of file csr.cxx.
References all_data.
Referenced by CTF::Monoid< dtype, is_ord >::csr_add(), csr_add(), CSR_Matrix(), partition(), and print().
int64_t CTF_int::CSR_Matrix::nnz | ( | ) | const |
retrieves number of nonzeros out of all_data
Definition at line 80 of file csr.cxx.
References all_data.
Referenced by CTF_int::COO_Matrix::COO_Matrix(), CSR_Matrix(), csrmm(), csrmultcsr(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old(), csrmultd(), CTF_int::tensor::despmatricize(), CTF::Semiring< dtype, is_ord >::gen_csrmultcsr(), IA(), JA(), print(), and size().
int CTF_int::CSR_Matrix::nrow | ( | ) | const |
retrieves number of rows out of all_data
Definition at line 93 of file csr.cxx.
References all_data.
Referenced by CTF_int::COO_Matrix::COO_Matrix(), CTF::Monoid< dtype, is_ord >::csr_add(), csr_add(), CSR_Matrix(), JA(), partition(), print(), and size().
void CTF_int::CSR_Matrix::partition | ( | int | s, |
char ** | parts_buffer, | ||
CSR_Matrix ** | parts | ||
) |
splits CSR matrix into s submatrices (returned) corresponding to subsets of rows, all parts allocated in one contiguous buffer (passed back in parts_buffer)
Definition at line 219 of file csr.cxx.
References CTF_int::alloc_ptr(), CSR_Matrix(), CTF_int::get_csr_size(), IA(), JA(), ncol(), nrow(), val_size(), and vals().
Referenced by CSR_Matrix(), and CTF_int::algstrct::csr_reduce().
void CTF_int::CSR_Matrix::print | ( | algstrct const * | sr | ) |
outputs matrix data to stdout, intended for debugging
[in] | sr | algebraic structure allowing print |
Definition at line 299 of file csr.cxx.
References IA(), JA(), ncol(), nnz(), nrow(), CTF_int::algstrct::print(), val_size(), and vals().
Referenced by CSR_Matrix().
int64_t CTF_int::CSR_Matrix::size | ( | ) | const |
retrieves buffer size out of all_data
Definition at line 89 of file csr.cxx.
References CTF_int::get_csr_size(), nnz(), nrow(), and val_size().
Referenced by CSR_Matrix(), and CTF_int::algstrct::csr_reduce().
int CTF_int::CSR_Matrix::val_size | ( | ) | const |
retrieves matrix entry size out of all_data
Definition at line 84 of file csr.cxx.
References all_data.
Referenced by CTF_int::COO_Matrix::COO_Matrix(), csr_add(), CSR_Matrix(), IA(), JA(), partition(), print(), and size().
char * CTF_int::CSR_Matrix::vals | ( | ) | const |
retrieves array of values out of all_data
Definition at line 101 of file csr.cxx.
References ALIGN, and all_data.
Referenced by CTF_int::COO_Matrix::COO_Matrix(), CTF::Monoid< dtype, is_ord >::csr_add(), csr_add(), CSR_Matrix(), csrmm(), csrmultcsr(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old(), csrmultd(), CTF::Semiring< dtype, is_ord >::gen_csrmultcsr(), partition(), and print().
char* CTF_int::CSR_Matrix::all_data |
serialized buffer containing all info, index, and values related to matrix
Definition at line 25 of file csr.h.
Referenced by csr_add(), CSR_Matrix(), CTF_int::algstrct::csr_reduce(), CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr(), CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >::csrmultcsr_old(), CTF::Semiring< dtype, is_ord >::gen_csrmultcsr(), IA(), JA(), ncol(), nnz(), nrow(), val_size(), and vals().