Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
class for execution distributed summation of tensors More...
#include <summation.h>
Public Member Functions | |
~summation () | |
lazy constructor More... | |
summation (summation const &other) | |
copy constructor More... | |
summation (tensor *A, int const *idx_A, char const *alpha, tensor *B, int const *idx_B, char const *beta) | |
constructor definining summation with C's mul and add ops More... | |
summation (tensor *A, char const *idx_A, char const *alpha, tensor *B, char const *idx_B, char const *beta) | |
summation (tensor *A, int const *idx_A, char const *alpha, tensor *B, int const *idx_B, char const *beta, univar_function const *func) | |
constructor definining summation with custom function More... | |
summation (tensor *A, char const *idx_A, char const *alpha, tensor *B, char const *idx_B, char const *beta, univar_function const *func) | |
void | execute (bool run_diag=false) |
run summation More... | |
double | estimate_time () |
predicts execution time in seconds using performance models More... | |
int | is_equal (summation const &os) |
returns 1 if summations have same tensors and index map More... | |
int | sum_tensors (bool run_diag) |
PDAXPY: a*idx_map_A(A) + b*idx_map_B(B) -> idx_map_B(B). Treats symmetric as lower triangular. More... | |
void | print () |
print contraction details More... | |
Data Fields | |
tensor * | A |
left operand More... | |
tensor * | B |
output More... | |
char const * | alpha |
scaling of A More... | |
char const * | beta |
scaling of existing B More... | |
int * | idx_A |
indices of left operand More... | |
int * | idx_B |
indices of output More... | |
bool | is_custom |
whether there is a elementwise custom function More... | |
univar_function const * | func |
function to execute on elements More... | |
class for execution distributed summation of tensors
Definition at line 15 of file summation.h.
CTF_int::summation::~summation | ( | ) |
lazy constructor
destructor
Definition at line 19 of file summation.cxx.
References CTF_int::cdealloc().
CTF_int::summation::summation | ( | summation const & | other | ) |
copy constructor
[in] | other | object to copy |
Definition at line 24 of file summation.cxx.
References A, CTF_int::alloc(), alpha, B, beta, func, idx_A, idx_B, is_custom, and CTF_int::tensor::order.
CTF_int::summation::summation | ( | tensor * | A, |
int const * | idx_A, | ||
char const * | alpha, | ||
tensor * | B, | ||
int const * | idx_B, | ||
char const * | beta | ||
) |
constructor definining summation with C's mul and add ops
[in] | A | left operand tensor |
[in] | idx_A | indices of left operand |
[in] | alpha | scaling factor alpha * A[idx_A]; (can be NULL) |
[in] | B | ouput operand tensor |
[in] | idx_B | indices of right operand |
[in] | beta | scaling factor of ouput (can be NULL) C[idx_B] = beta*B[idx_B] + alpha * A[idx_A] |
Definition at line 37 of file summation.cxx.
References CTF_int::alloc().
CTF_int::summation::summation | ( | tensor * | A, |
char const * | idx_A, | ||
char const * | alpha, | ||
tensor * | B, | ||
char const * | idx_B, | ||
char const * | beta | ||
) |
Definition at line 57 of file summation.cxx.
References CTF_int::conv_idx().
CTF_int::summation::summation | ( | tensor * | A, |
int const * | idx_A, | ||
char const * | alpha, | ||
tensor * | B, | ||
int const * | idx_B, | ||
char const * | beta, | ||
univar_function const * | func | ||
) |
constructor definining summation with custom function
[in] | A | left operand tensor |
[in] | idx_A | indices of left operand |
[in] | alpha | scaling factor alpha * A[idx_A]; (can be NULL) |
[in] | B | ouput operand tensor |
[in] | idx_B | indices of right operand |
[in] | func | custom elementwise function func(A[idx_A],&B[idx_B]) |
[in] | beta | scaling factor of ouput (can be NULL) C[idx_B] = beta*B[idx_B] + alpha * A[idx_A] |
Definition at line 74 of file summation.cxx.
References CTF_int::alloc().
CTF_int::summation::summation | ( | tensor * | A, |
char const * | idx_A, | ||
char const * | alpha, | ||
tensor * | B, | ||
char const * | idx_B, | ||
char const * | beta, | ||
univar_function const * | func | ||
) |
Definition at line 99 of file summation.cxx.
References CTF_int::conv_idx().
double CTF_int::summation::estimate_time | ( | ) |
predicts execution time in seconds using performance models
Definition at line 132 of file summation.cxx.
References A, ABORT, CTF_int::algstrct::add(), CTF_int::algstrct::addid(), CTF_int::tensor::addinv(), align_symmetric_indices(), CTF_int::alloc(), CTF_int::alloc_ptr(), alpha, ASSERT, B, beta, CTF_int::tspsum_virt::blk_sz_A, CTF_int::tsum_virt::blk_sz_A, CTF_int::tspsum_virt::blk_sz_B, CTF_int::tsum_virt::blk_sz_B, CTF_int::calc_dim(), CTF_int::tensor::calc_nvirt(), CTF_int::cdealloc(), CTF_int::mapping::cdt, CTF_int::mapping::child, CTF_int::contract_mst(), CTF_int::conv_idx< int >(), CTF_int::copy_mapping(), CTF_int::tensor::data, CTF_int::desymmetrize(), DPRINTF, CTF_int::seq_tsr_spsum::edge_len_A, CTF_int::seq_tsr_sum::edge_len_A, CTF_int::seq_tsr_spsum::edge_len_B, CTF_int::seq_tsr_sum::edge_len_B, CTF_int::tensor::edge_map, CTF_int::accumulatable::el_size, CTF_int::ERROR, CTF_int::est_time_transp(), CTF_int::scaling::execute(), execute(), CTF_int::tensor::extract_diag(), CTF_int::seq_tsr_spsum::func, CTF_int::seq_tsr_sum::func, CTF_int::get_sym_perms(), CTF_int::mapping::has_child, CTF_int::tensor::has_home, CTF_int::tensor::home_buffer, CTF_int::tensor::home_size, idx_A, idx_B, CTF_int::seq_tsr_sum::inr_stride, CTF_int::inv_idx(), CTF_int::seq_tsr_spsum::is_custom, CTF_int::seq_tsr_sum::is_custom, CTF_int::tensor::is_data_aliased, CTF_int::tensor::is_home, CTF_int::seq_tsr_spsum::is_inner, CTF_int::seq_tsr_sum::is_inner, CTF_int::tensor::is_mapped, CTF_int::algstrct::isequal(), CTF_int::algstrct::mulid(), CTF_int::tensor::name, CTF_int::tensor::nnz_blk, CTF_int::tensor::nnz_loc, CTF_int::tensor::nnz_tot, CTF_int::nosym_transpose(), CTF_int::mapping::np, NS, CTF_int::tspsum_virt::num_dim, CTF_int::tsum_virt::num_dim, CTF_int::tensor::order, overcounting_factor(), CTF_int::tensor::pad_edge_len, CTF_int::algstrct::pair_dealloc(), CTF_int::permute_target(), CTF_int::PHYSICAL_MAP, print(), CTF_int::tensor::pull_alias(), CTF_int::strp_sum::rec_strp_A, CTF_int::strp_sum::rec_strp_B, CTF_int::tensor::rec_tsr, CTF_int::tspsum_virt::rec_tsum, CTF_int::tspsum_replicate::rec_tsum, CTF_int::strp_sum::rec_tsum, CTF_int::tsum_virt::rec_tsum, CTF_int::tsum_replicate::rec_tsum, CTF_int::tspsum_permute::rec_tsum, CTF_int::tspsum_pin_keys::rec_tsum, CTF_int::algstrct::safeaddinv(), CTF_int::algstrct::safecopy(), CTF_int::tensor::self_reduce(), CTF_int::tensor::set_new_nnz_glb(), CTF_int::tensor::set_padding(), sign(), CTF_int::tensor::sr, CTF_int::tsum::sr_A, CTF_int::tsum::sr_B, CTF_int::strp_sum::strip_A, CTF_int::strp_sum::strip_B, CTF_int::strip_diag(), CTF_int::strp_tsr::strip_dim, CTF_int::SUCCESS, sum_tensors(), SY, CTF_int::tensor::sym, CTF_int::seq_tsr_spsum::sym_A, CTF_int::seq_tsr_sum::sym_A, CTF_int::seq_tsr_spsum::sym_B, CTF_int::seq_tsr_sum::sym_B, CTF_int::symmetrize(), TAU_FSTART, TAU_FSTOP, CTF_int::tensor::topo, CTF_int::mapping::type, CTF_int::tensor::unfold(), CTF_int::tspsum_virt::virt_dim, CTF_int::tsum_virt::virt_dim, and CTF_int::VIRTUAL_MAP.
Referenced by CTF_int::Unifun_Term::estimate_time(), CTF::Idx_Tensor::estimate_time(), CTF_int::Sum_Term::estimate_time(), CTF_int::Contract_Term::estimate_time(), and CTF::Tensor< dtype >::operator=().
void CTF_int::summation::execute | ( | bool | run_diag = false | ) |
run summation
[in] | run_diag | if true runs diagonal iterators (otherwise calls itself with run_diag=true later |
Definition at line 119 of file summation.cxx.
References CTF_int::SUCCESS.
Referenced by CTF_int::desymmetrize(), estimate_time(), CTF_int::Unifun_Term::execute(), CTF::Idx_Tensor::execute(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), CTF_int::tensor::extract_diag(), CTF::Tensor< dtype >::fill_sp_random(), CTF_int::get_len_ordering(), CTF_int::tensor::read_local(), CTF_int::tensor::reduce_sum(), CTF_int::tensor::reduce_sumabs(), CTF_int::tensor::self_reduce(), and CTF_int::symmetrize().
int CTF_int::summation::is_equal | ( | summation const & | os | ) |
returns 1 if summations have same tensors and index map
[in] | os | summation object to compare this with |
Definition at line 1821 of file summation.cxx.
References A, CTF_int::alloc_ptr(), ASSERT, B, CTF_int::can_block_reshuffle(), CTF_int::cdealloc(), CTF_int::mapping::cdt, CTF::World::cdt, CTF_int::check_self_mapping(), CTF_int::mapping::child, CTF_int::mapping::clear(), CTF_int::comp_dim_map(), CTF_int::copy_mapping(), CTF_int::topology::dim_comm, DPRINTF, CTF_int::ERROR, CTF_int::get_best_topo(), CTF_int::mapping::has_child, idx_A, idx_B, CTF_int::inv_idx(), CTF_int::map_self_indices(), CTF_int::map_tensor(), CTF_int::NEGATIVE, CTF_int::NOT_MAPPED, CTF_int::mapping::np, CTF_int::CommData::np, NS, CTF_int::topology::order, CTF_int::distribution::phase, CTF_int::PHYSICAL_MAP, CTF::World::rank, CTF_int::CommData::rank, CTF_int::SUCCESS, TAU_FSTART, TAU_FSTOP, CTF::World::topovec, and CTF_int::mapping::type.
void CTF_int::summation::print | ( | ) |
print contraction details
Definition at line 2362 of file summation.cxx.
References CTF_int::alloc_ptr(), CTF_int::cdealloc(), CTF_int::CommData::cm, CTF_int::PairIterator::k(), CTF_int::algstrct::pair_size(), CTF_int::CommData::rank, CTF_int::PairIterator::sort(), and CTF_int::PairIterator::sr.
Referenced by estimate_time(), and sum_tensors().
int CTF_int::summation::sum_tensors | ( | bool | run_diag | ) |
PDAXPY: a*idx_map_A(A) + b*idx_map_B(B) -> idx_map_B(B). Treats symmetric as lower triangular.
PDAXPY: a*idx_map_A(A) + b*idx_map_B(B) -> idx_map_B(B).
[in] | run_diag | if 1 run diagonal sum |
Definition at line 1384 of file summation.cxx.
References A, ABORT, CTF_int::topology::activate(), align_symmetric_indices(), CTF_int::alloc_ptr(), AS, ASSERT, B, CTF_int::cdealloc(), CTF::World::comm, COST_MEMBW, CTF_int::tensor::data, CTF_int::topology::deactivate(), DEBUG_PRINTF, ctf.core::dtype, CTF_int::ERROR, CTF_int::scaling::execute(), CTF_int::tensor::extract_diag(), idx_A, idx_B, CTF_int::inv_idx(), CTF_int::tensor::is_sparse, CTF_int::tspsum::new_B, CTF_int::tspsum::new_nnz_B, CTF_int::tensor::nnz_blk, CTF_int::tensor::nnz_loc, NS, CTF_int::tensor::order, CTF_int::algstrct::pair_dealloc(), CTF_int::tsum::print(), print(), CTF_int::tensor::print_map(), CTF::World::rank, CTF_int::tsum::run(), CTF_int::tensor::set_new_nnz_glb(), CTF_int::tensor::set_sym(), sign(), CTF_int::tensor::sparsify(), CTF_int::tensor::sr, CTF_int::SUCCESS, SY, CTF_int::tensor::sym, TAU_FSTART, TAU_FSTOP, CTF_int::tensor::topo, CTF_int::tensor::unfold(), CTF_int::tensor::wrld, and CTF_int::tensor::zero_out_padding().
Referenced by CTF_int::desymmetrize(), estimate_time(), CTF_int::tensor::read_dense_from_file(), CTF_int::symmetrize(), and CTF_int::tensor::tensor().
tensor* CTF_int::summation::A |
left operand
Definition at line 18 of file summation.h.
Referenced by CTF_int::add_sym_perm(), estimate_time(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_spsum::seq_tsr_spsum(), CTF_int::seq_tsr_sum::seq_tsr_sum(), sum_tensors(), summation(), CTF_int::tspsum::tspsum(), CTF_int::tspsum_map::tspsum_map(), CTF_int::tspsum_permute::tspsum_permute(), CTF_int::tspsum_pin_keys::tspsum_pin_keys(), CTF_int::tspsum_replicate::tspsum_replicate(), CTF_int::tspsum_virt::tspsum_virt(), CTF_int::tsum::tsum(), CTF_int::tsum_replicate::tsum_replicate(), and CTF_int::tsum_virt::tsum_virt().
char const* CTF_int::summation::alpha |
scaling of A
Definition at line 23 of file summation.h.
Referenced by estimate_time(), summation(), and CTF_int::tsum::tsum().
tensor* CTF_int::summation::B |
output
Definition at line 20 of file summation.h.
Referenced by CTF_int::add_sym_perm(), estimate_time(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_spsum::seq_tsr_spsum(), CTF_int::seq_tsr_sum::seq_tsr_sum(), sum_tensors(), summation(), CTF_int::tspsum::tspsum(), CTF_int::tspsum_map::tspsum_map(), CTF_int::tspsum_permute::tspsum_permute(), CTF_int::tspsum_pin_keys::tspsum_pin_keys(), CTF_int::tspsum_replicate::tspsum_replicate(), CTF_int::tspsum_virt::tspsum_virt(), CTF_int::tsum::tsum(), CTF_int::tsum_replicate::tsum_replicate(), and CTF_int::tsum_virt::tsum_virt().
char const* CTF_int::summation::beta |
scaling of existing B
Definition at line 25 of file summation.h.
Referenced by estimate_time(), summation(), and CTF_int::tsum::tsum().
univar_function const* CTF_int::summation::func |
function to execute on elements
Definition at line 34 of file summation.h.
Referenced by summation().
int* CTF_int::summation::idx_A |
indices of left operand
Definition at line 28 of file summation.h.
Referenced by CTF_int::add_sym_perm(), estimate_time(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_spsum::seq_tsr_spsum(), CTF_int::seq_tsr_sum::seq_tsr_sum(), sum_tensors(), summation(), CTF_int::tspsum_map::tspsum_map(), CTF_int::tspsum_permute::tspsum_permute(), CTF_int::tspsum_virt::tspsum_virt(), and CTF_int::tsum_virt::tsum_virt().
int* CTF_int::summation::idx_B |
indices of output
Definition at line 30 of file summation.h.
Referenced by CTF_int::add_sym_perm(), estimate_time(), CTF_int::get_sym_perms(), is_equal(), CTF_int::seq_tsr_spsum::seq_tsr_spsum(), CTF_int::seq_tsr_sum::seq_tsr_sum(), sum_tensors(), summation(), CTF_int::tspsum_map::tspsum_map(), CTF_int::tspsum_permute::tspsum_permute(), CTF_int::tspsum_virt::tspsum_virt(), and CTF_int::tsum_virt::tsum_virt().
bool CTF_int::summation::is_custom |
whether there is a elementwise custom function
Definition at line 32 of file summation.h.
Referenced by CTF_int::seq_tsr_spsum::seq_tsr_spsum(), CTF_int::seq_tsr_sum::seq_tsr_sum(), and summation().