Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
class for execution distributed contraction of tensors More...
#include <contraction.h>
Public Member Functions | |
contraction () | |
lazy constructor More... | |
~contraction () | |
destructor More... | |
contraction (contraction const &other) | |
copy constructor More... | |
contraction (tensor *A, int const *idx_A, tensor *B, int const *idx_B, char const *alpha, tensor *C, int const *idx_C, char const *beta, bivar_function const *func=NULL) | |
constructor definining contraction with C's mul and add ops More... | |
contraction (tensor *A, char const *idx_A, tensor *B, char const *idx_B, char const *alpha, tensor *C, char const *idx_C, char const *beta, bivar_function const *func=NULL) | |
void | execute () |
run contraction More... | |
double | estimate_time () |
predicts execution time in seconds using performance models More... | |
int | is_equal (contraction const &os) |
returns 1 if contractions have same tensors and index map More... | |
Data Fields | |
tensor * | A |
left operand More... | |
tensor * | B |
right operand More... | |
tensor * | C |
output More... | |
char const * | alpha |
scaling of A*B More... | |
char const * | beta |
scaling of existing C More... | |
int * | idx_A |
indices of left operand More... | |
int * | idx_B |
indices of right operand More... | |
int * | idx_C |
indices of output More... | |
bool | is_custom |
whether there is a elementwise custom function More... | |
bivar_function const * | func |
function to execute on elements More... | |
class for execution distributed contraction of tensors
Definition at line 16 of file contraction.h.
|
inline |
lazy constructor
Definition at line 42 of file contraction.h.
References A, B, C, CTF_int::ctr_2d_gen_build(), estimate_time(), execute(), is_equal(), and ~contraction().
CTF_int::contraction::~contraction | ( | ) |
destructor
Definition at line 29 of file contraction.cxx.
References CTF_int::cdealloc().
Referenced by contraction().
CTF_int::contraction::contraction | ( | contraction const & | other | ) |
copy constructor
[in] | other | object to copy |
Definition at line 35 of file contraction.cxx.
References A, CTF_int::alloc(), alpha, B, beta, C, func, idx_A, idx_B, idx_C, is_custom, and CTF_int::tensor::order.
CTF_int::contraction::contraction | ( | tensor * | A, |
int const * | idx_A, | ||
tensor * | B, | ||
int const * | idx_B, | ||
char const * | alpha, | ||
tensor * | C, | ||
int const * | idx_C, | ||
char const * | beta, | ||
bivar_function const * | func = NULL |
||
) |
constructor definining contraction with C's mul and add ops
[in] | A | left operand tensor |
[in] | idx_A | indices of left operand |
[in] | B | right operand tensor |
[in] | idx_B | indices of right operand |
[in] | alpha | scaling factor (can be NULL) alpha * A[idx_A] * B[idx_B]; |
[in] | C | ouput operand tensor |
[in] | idx_C | indices of right operand |
[in] | beta | scaling factor of output (can be NULL) C[idx_C] = beta*C[idx_C]
|
[in] | A | left operand tensor |
[in] | idx_A | indices of left operand |
[in] | B | right operand tensor |
[in] | idx_B | indices of right operand |
[in] | alpha | scaling factor (can be NULL) alpha * A[idx_A] * B[idx_B]; |
[in] | C | ouput operand tensor |
[in] | idx_C | indices of right operand |
[in] | beta | scaling factor of output (can be NULL) C[idx_C] = beta*C[idx_C]
|
[in] | func | custom elementwise function func(A[idx_A],B[idx_B],&C[idx_C]) |
Definition at line 52 of file contraction.cxx.
References CTF_int::alloc().
CTF_int::contraction::contraction | ( | tensor * | A, |
char const * | idx_A, | ||
tensor * | B, | ||
char const * | idx_B, | ||
char const * | alpha, | ||
tensor * | C, | ||
char const * | idx_C, | ||
char const * | beta, | ||
bivar_function const * | func = NULL |
||
) |
Definition at line 78 of file contraction.cxx.
References CTF_int::conv_idx().
double CTF_int::contraction::estimate_time | ( | ) |
predicts execution time in seconds using performance models
Definition at line 163 of file contraction.cxx.
Referenced by CTF_int::contract_down_terms(), contraction(), CTF_int::Bifun_Term::estimate_time(), CTF_int::Contract_Term::estimate_time(), and CTF::Tensor< dtype >::operator=().
void CTF_int::contraction::execute | ( | ) |
run contraction
Definition at line 99 of file contraction.cxx.
References CTF_int::SUCCESS.
Referenced by CTF_int::contract_down_terms(), contraction(), CTF_int::Bifun_Term::execute(), CTF_int::Contract_Term::execute(), CTF::Tensor< dtype >::fill_sp_random(), CTF_int::get_len_ordering(), and CTF_int::tensor::reduce_sumsq().
int CTF_int::contraction::is_equal | ( | contraction const & | os | ) |
returns 1 if contractions have same tensors and index map
[in] | os | contraction object to compare this with |
Definition at line 168 of file contraction.cxx.
References A, B, C, idx_A, idx_B, and idx_C.
Referenced by contraction().
tensor* CTF_int::contraction::A |
left operand
Definition at line 19 of file contraction.h.
Referenced by CTF_int::add_sym_perm(), contraction(), CTF_int::ctr::ctr(), CTF_int::ctr_replicate::ctr_replicate(), CTF_int::ctr_virt::ctr_virt(), CTF_int::get_len_ordering(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), CTF_int::seq_tsr_spctr::seq_tsr_spctr(), CTF_int::spctr::spctr(), CTF_int::spctr_pin_keys::spctr_pin_keys(), CTF_int::spctr_replicate::spctr_replicate(), and CTF_int::spctr_virt::spctr_virt().
char const* CTF_int::contraction::alpha |
scaling of A*B
Definition at line 26 of file contraction.h.
Referenced by contraction(), CTF_int::get_len_ordering(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), and CTF_int::seq_tsr_spctr::seq_tsr_spctr().
tensor* CTF_int::contraction::B |
right operand
Definition at line 21 of file contraction.h.
Referenced by CTF_int::add_sym_perm(), contraction(), CTF_int::ctr::ctr(), CTF_int::ctr_replicate::ctr_replicate(), CTF_int::ctr_virt::ctr_virt(), CTF_int::get_len_ordering(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), CTF_int::seq_tsr_spctr::seq_tsr_spctr(), CTF_int::spctr::spctr(), CTF_int::spctr_pin_keys::spctr_pin_keys(), CTF_int::spctr_replicate::spctr_replicate(), and CTF_int::spctr_virt::spctr_virt().
char const* CTF_int::contraction::beta |
scaling of existing C
Definition at line 28 of file contraction.h.
Referenced by contraction(), CTF_int::ctr::ctr(), and CTF_int::get_len_ordering().
tensor* CTF_int::contraction::C |
output
Definition at line 23 of file contraction.h.
Referenced by CTF_int::add_sym_perm(), contraction(), CTF_int::ctr::ctr(), CTF_int::ctr_replicate::ctr_replicate(), CTF_int::ctr_virt::ctr_virt(), CTF_int::get_len_ordering(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), CTF_int::seq_tsr_spctr::seq_tsr_spctr(), CTF_int::spctr::spctr(), CTF_int::spctr_pin_keys::spctr_pin_keys(), CTF_int::spctr_replicate::spctr_replicate(), and CTF_int::spctr_virt::spctr_virt().
bivar_function const* CTF_int::contraction::func |
function to execute on elements
Definition at line 39 of file contraction.h.
Referenced by contraction(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), and CTF_int::seq_tsr_spctr::seq_tsr_spctr().
int* CTF_int::contraction::idx_A |
indices of left operand
Definition at line 31 of file contraction.h.
Referenced by CTF_int::add_sym_perm(), contraction(), CTF_int::ctr_virt::ctr_virt(), CTF_int::get_len_ordering(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), CTF_int::seq_tsr_spctr::seq_tsr_spctr(), and CTF_int::spctr_virt::spctr_virt().
int* CTF_int::contraction::idx_B |
indices of right operand
Definition at line 33 of file contraction.h.
Referenced by CTF_int::add_sym_perm(), contraction(), CTF_int::ctr_virt::ctr_virt(), CTF_int::get_len_ordering(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), CTF_int::seq_tsr_spctr::seq_tsr_spctr(), and CTF_int::spctr_virt::spctr_virt().
int* CTF_int::contraction::idx_C |
indices of output
Definition at line 35 of file contraction.h.
Referenced by CTF_int::add_sym_perm(), contraction(), CTF_int::ctr_virt::ctr_virt(), CTF_int::get_len_ordering(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), CTF_int::seq_tsr_spctr::seq_tsr_spctr(), and CTF_int::spctr_virt::spctr_virt().
bool CTF_int::contraction::is_custom |
whether there is a elementwise custom function
Definition at line 37 of file contraction.h.
Referenced by contraction(), CTF_int::seq_tsr_ctr::seq_tsr_ctr(), and CTF_int::seq_tsr_spctr::seq_tsr_spctr().