Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
A Monoid is a Set equipped with a binary addition operator '+' or a custom function addition must have an identity and be associative, does not need to be commutative special case (parent) of a semiring, group, and ring. More...
#include <monoid.h>
Public Member Functions | |
Monoid (Monoid const &other) | |
virtual CTF_int::algstrct * | clone () const |
''copy constructor'' More... | |
Monoid () | |
Monoid (dtype taddid_) | |
Monoid (dtype taddid_, dtype(*fadd_)(dtype a, dtype b), MPI_Op addmop_) | |
void | add (char const *a, char const *b, char *c) const |
c = a+b More... | |
char const * | addid () const |
MPI datatype for pairs. More... | |
MPI_Op | addmop () const |
MPI addition operation for reductions. More... | |
void | init (int64_t n, char *arr) const |
initialize n objects to zero More... | |
void | axpy (int n, char const *alpha, char const *X, int incX, char *Y, int incY) const |
Y["i"]+=alpha*X["i"];. More... | |
char * | csr_add (char *cA, char *cB) const |
adds CSR matrices A (stored in cA) and B (stored in cB) to create matric C (pointer to all_data returned), C data allocated internally More... | |
template<> | |
char * | csr_add (char *cA, char *cB) const |
adds CSR matrices A (stored in cA) and B (stored in cB) to create matric C (pointer to all_data returned), C data allocated internally More... | |
template<> | |
char * | csr_add (char *, char *) const |
adds CSR matrices A (stored in cA) and B (stored in cB) to create matric C (pointer to all_data returned), C data allocated internally More... | |
Public Member Functions inherited from CTF::Set< dtype, is_ord > | |
~Set () | |
Set (Set const &other) | |
int | pair_size () const |
gets pair size el_size plus the key size More... | |
int64_t | get_key (char const *a) const |
gets key from pair More... | |
char * | get_value (char *a) const |
gets pair to value from pair More... | |
char const * | get_const_value (char const *a) const |
bool | is_ordered () const |
Set () | |
void | set_abs_to_default () |
MPI_Datatype | mdtype () const |
MPI datatype. More... | |
void | min (char const *a, char const *b, char *c) const |
c = min(a,b) More... | |
void | max (char const *a, char const *b, char *c) const |
c = max(a,b) More... | |
void | min (char *c) const |
c = minimum possible value More... | |
void | max (char *c) const |
c = maximum possible value More... | |
void | cast_double (double d, char *c) const |
c = &d More... | |
void | cast_int (int64_t i, char *c) const |
c = &i More... | |
double | cast_to_double (char const *c) const |
return (double)*c More... | |
int64_t | cast_to_int (char const *c) const |
return (int64_t)*c More... | |
void | print (char const *a, FILE *fp=stdout) const |
prints the value More... | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
void | coo_to_csr (int64_t nz, int nrow, char *csr_vs, int *csr_ja, int *csr_ia, char const *coo_vs, int const *coo_rs, int const *coo_cs) const |
converts coordinate sparse matrix layout to CSR layout More... | |
void | csr_to_coo (int64_t nz, int nrow, char const *csr_vs, int const *csr_ja, int const *csr_ia, char *coo_vs, int *coo_rs, int *coo_cs) const |
converts CSR sparse matrix layout to coordinate (COO) layout More... | |
char * | pair_alloc (int64_t n) const |
allocate space for n (int64_t,dtype) pairs, necessary for object types More... | |
char * | alloc (int64_t n) const |
allocate space for n items, necessary for object types More... | |
void | dealloc (char *ptr) const |
deallocate given pointer containing contiguous array of values More... | |
void | pair_dealloc (char *ptr) const |
deallocate given pointer containing contiguous array of pairs More... | |
void | sort (int64_t n, char *pairs) const |
sorts n sets of pairs using std::sort More... | |
void | copy (char *a, char const *b) const |
copies element b to element a More... | |
void | copy (char *a, char const *b, int64_t n) const |
copies n elements from array b to array a More... | |
void | copy_pair (char *a, char const *b) const |
copies pair b to element a More... | |
void | copy_pairs (char *a, char const *b, int64_t n) const |
copies n pair from array b to array a More... | |
void | set (char *a, char const *b, int64_t n) const |
sets n elements of array a to value b More... | |
void | set_pair (char *a, int64_t key, char const *b) const |
sets 1 elements of pair a to value and key More... | |
void | set_pairs (char *a, char const *b, int64_t n) const |
sets n elements of array of pairs a to value b More... | |
void | copy (int64_t n, char const *a, int inc_a, char *b, int inc_b) const |
copies n elements TO array b with increment inc_a FROM array a with increment inc_b More... | |
void | copy (int64_t m, int64_t n, char const *a, int64_t lda_a, char *b, int64_t lda_b) const |
copies m-by-n submatrix from a with lda_a to b with lda_b More... | |
void | init (int64_t n, char *arr) const |
initialize n objects to zero More... | |
virtual void | init_shell (int64_t n, char *arr) const |
initialize n objects to zero More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *p, FILE *fp) const |
prints the value More... | |
template<> | |
void | copy (int64_t nn, char const *a, int inc_a, char *b, int inc_b) const |
copies n elements TO array b with increment inc_a FROM array a with increment inc_b More... | |
template<> | |
void | copy (int64_t nn, char const *a, int inc_a, char *b, int inc_b) const |
copies n elements TO array b with increment inc_a FROM array a with increment inc_b More... | |
template<> | |
void | copy (int64_t nn, char const *a, int inc_a, char *b, int inc_b) const |
copies n elements TO array b with increment inc_a FROM array a with increment inc_b More... | |
template<> | |
void | copy (int64_t nn, char const *a, int inc_a, char *b, int inc_b) const |
copies n elements TO array b with increment inc_a FROM array a with increment inc_b More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_double (double d, char *c) const |
c = &d More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
void | cast_int (int64_t d, char *c) const |
c = &i More... | |
template<> | |
double | cast_to_double (char const *c) const |
return (double)*c More... | |
template<> | |
double | cast_to_double (char const *c) const |
return (double)*c More... | |
template<> | |
double | cast_to_double (char const *c) const |
return (double)*c More... | |
template<> | |
double | cast_to_double (char const *c) const |
return (double)*c More... | |
template<> | |
double | cast_to_double (char const *c) const |
return (double)*c More... | |
template<> | |
int64_t | cast_to_int (char const *c) const |
return (int64_t)*c More... | |
template<> | |
int64_t | cast_to_int (char const *c) const |
return (int64_t)*c More... | |
template<> | |
int64_t | cast_to_int (char const *c) const |
return (int64_t)*c More... | |
template<> | |
int64_t | cast_to_int (char const *c) const |
return (int64_t)*c More... | |
template<> | |
int64_t | cast_to_int (char const *c) const |
return (int64_t)*c More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
void | print (char const *a, FILE *fp) const |
prints the value More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
template<> | |
bool | isequal (char const *a, char const *b) const |
returns true if algstrct elements a and b are equal More... | |
Public Member Functions inherited from CTF_int::algstrct | |
algstrct () | |
default constructor More... | |
algstrct (int el_size) | |
constructor creates algstrct with all parameters More... | |
virtual | ~algstrct ()=0 |
destructor More... | |
virtual char const * | mulid () const |
identity element for multiplication i.e. 1 More... | |
virtual void | addinv (char const *a, char *b) const |
b = -a More... | |
virtual void | safeaddinv (char const *a, char *&b) const |
b = -a, with checks for NULL and alloc as necessary More... | |
virtual void | accum (char const *a, char *b) const |
b+=a More... | |
virtual bool | has_mul () const |
virtual void | mul (char const *a, char const *b, char *c) const |
c = a*b More... | |
virtual void | safemul (char const *a, char const *b, char *&c) const |
c = a*b, with NULL treated as mulid More... | |
virtual void | scal (int n, char const *alpha, char *X, int incX) const |
X["i"]=alpha*X["i"];. More... | |
virtual void | gemm (char tA, char tB, int m, int n, int k, char const *alpha, char const *A, char const *B, char const *beta, char *C) const |
beta*C["ij"]=alpha*A^tA["ik"]*B^tB["kj"]; More... | |
virtual void | gemm_batch (char tA, char tB, int l, int m, int n, int k, char const *alpha, char const *A, char const *B, char const *beta, char *C) const |
beta*C["ijl"]=alpha*A^tA["ikl"]*B^tB["kjl"]; More... | |
virtual void | offload_gemm (char tA, char tB, int m, int n, int k, char const *alpha, char const *A, char const *B, char const *beta, char *C) const |
virtual bool | is_offloadable () const |
virtual void | coomm (int m, int n, int k, char const *alpha, char const *A, int const *rows_A, int const *cols_A, int64_t nnz_A, char const *B, char const *beta, char *C, bivar_function const *func) const |
sparse version of gemm using coordinate format for A More... | |
virtual void | csrmm (int m, int n, int k, char const *alpha, char const *A, int const *JA, int const *IA, int64_t nnz_A, char const *B, char const *beta, char *C, bivar_function const *func) const |
sparse version of gemm using CSR format for A More... | |
virtual void | csrmultd (int m, int n, int k, char const *alpha, char const *A, int const *JA, int const *IA, int64_t nnz_A, char const *B, int const *JB, int const *IB, int64_t nnz_B, char const *beta, char *C) const |
sparse version of gemm using CSR format for A and B More... | |
virtual void | csrmultcsr (int m, int n, int k, char const *alpha, char const *A, int const *JA, int const *IA, int64_t nnz_A, char const *B, int const *JB, int const *IB, int64_t nnz_B, char const *beta, char *&C_CSR) const |
virtual char * | csr_reduce (char *cA, int root, MPI_Comm cm) const |
reduces CSR matrices stored in cA on each processor in cm and returns result on processor root More... | |
double | estimate_csr_red_time (int64_t msg_sz, CommData const *cdt) const |
void | acc (char *b, char const *beta, char const *a, char const *alpha) const |
compute b=beta*b + alpha*a More... | |
void | accmul (char *c, char const *a, char const *b, char const *alpha) const |
compute c=c + alpha*a*b More... | |
void | safecopy (char *&a, char const *b) const |
copies element b to element a, , with checks for NULL and alloc as necessary More... | |
virtual void | copy (int64_t m, int64_t n, char const *a, int64_t lda_a, char const *alpha, char *b, int64_t lda_b, char const *beta) const |
copies m-by-n submatrix from a with lda_a and scaling alpha to b with lda_b and scaling by 1 More... | |
Data Fields | |
dtype | taddid |
dtype(* | fadd )(dtype a, dtype b) |
MPI_Op | taddmop |
Data Fields inherited from CTF::Set< dtype, is_ord > | |
int | pair_sz |
bool | is_custom_mdtype |
MPI_Datatype | tmdtype |
Data Fields inherited from CTF_int::algstrct | |
bool | has_coo_ker |
whether there was a custom COO CSRMM kernel provided for this algebraic structure More... | |
void(* | abs )(char const *a, char *b) |
b = max(a,addinv(a)) More... | |
Data Fields inherited from CTF_int::accumulatable | |
int | el_size |
size of each element of algstrct in bytes More... | |
A Monoid is a Set equipped with a binary addition operator '+' or a custom function addition must have an identity and be associative, does not need to be commutative special case (parent) of a semiring, group, and ring.
|
inline |
|
inline |
Definition at line 81 of file monoid.h.
References CTF::Monoid< dtype, is_ord >::fadd.
|
inline |
Definition at line 86 of file monoid.h.
References CTF::Monoid< dtype, is_ord >::fadd.
|
inline |
Definition at line 93 of file monoid.h.
References CTF::Monoid< dtype, is_ord >::fadd.
|
inlinevirtual |
c = a+b
Reimplemented from CTF_int::algstrct.
Definition at line 101 of file monoid.h.
References ctf.core::dtype, and CTF::Monoid< dtype, is_ord >::fadd.
Referenced by CTF::Monoid< dtype, is_ord >::axpy().
|
inlinevirtual |
MPI datatype for pairs.
identity element for addition i.e. 0
Reimplemented from CTF_int::algstrct.
Definition at line 107 of file monoid.h.
References CTF::Monoid< dtype, is_ord >::taddid.
|
inlinevirtual |
MPI addition operation for reductions.
Reimplemented from CTF_int::algstrct.
Definition at line 111 of file monoid.h.
References CTF::Monoid< dtype, is_ord >::taddmop.
|
inlinevirtual |
Y["i"]+=alpha*X["i"];.
Reimplemented from CTF_int::algstrct.
Reimplemented in CTF::Semiring< dtype, is_ord >.
Definition at line 119 of file monoid.h.
References CTF::Monoid< dtype, is_ord >::add(), and ctf.core::dtype.
|
inlinevirtual |
''copy constructor''
Reimplemented from CTF::Set< dtype, is_ord >.
Reimplemented in CTF::Semiring< dtype, is_ord >, CTF::Ring< dtype, is_ord >, and CTF::Group< dtype, is_ord >.
|
virtual |
adds CSR matrices A (stored in cA) and B (stored in cB) to create matric C (pointer to all_data returned), C data allocated internally
Reimplemented from CTF_int::algstrct.
Definition at line 29 of file monoid.cxx.
References CTF_int::alloc_ptr(), CTF_int::cdealloc(), CTF_int::algstrct::csr_add(), CTF_int::CSR_Matrix::IA(), CTF_int::CSR_Matrix::JA(), CTF_BLAS::MKL_DCSRADD(), CTF_int::CSR_Matrix::ncol(), CTF_int::CSR_Matrix::nrow(), TAU_FSTART, TAU_FSTOP, and CTF_int::CSR_Matrix::vals().
|
inlinevirtual |
adds CSR matrices A (stored in cA) and B (stored in cB) to create matric C (pointer to all_data returned), C data allocated internally
Reimplemented from CTF_int::algstrct.
Definition at line 132 of file monoid.h.
References CTF_int::algstrct::csr_add().
|
virtual |
adds CSR matrices A (stored in cA) and B (stored in cB) to create matric C (pointer to all_data returned), C data allocated internally
Reimplemented from CTF_int::algstrct.
|
inlinevirtual |
initialize n objects to zero
[in] | n | number of items |
[in] | arr | array containing n items, to be set to zero |
Reimplemented from CTF_int::algstrct.
Definition at line 115 of file monoid.h.
References ctf.core::dtype.
dtype(* CTF::Monoid< dtype, is_ord >::fadd) (dtype a, dtype b) |
Definition at line 72 of file monoid.h.
Referenced by CTF::Monoid< dtype, is_ord >::add(), and CTF::Monoid< dtype, is_ord >::Monoid().
dtype CTF::Monoid< dtype, is_ord >::taddid |
Definition at line 71 of file monoid.h.
Referenced by CTF::Monoid< dtype, is_ord >::addid().
MPI_Op CTF::Monoid< dtype, is_ord >::taddmop |
Definition at line 73 of file monoid.h.
Referenced by CTF::Monoid< dtype, is_ord >::addmop().