Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
spctr_tsr.h
Go to the documentation of this file.
1 /*Copyright (c) 2011, Edgar Solomonik, all rights reserved.*/
2 
3 #ifndef __SPCTR_TSR_H__
4 #define __SPCTR_TSR_H__
5 
6 #include "ctr_tsr.h"
7 
8 namespace CTF_int{
9 
10  class spctr : public ctr {
11  public:
15  char * new_C;
16 
17  ~spctr();
18  spctr(spctr * other);
19  virtual spctr * clone() { return NULL; }
20 
29  virtual double est_time_fp(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C){ return 0.0; }
30  double est_time_fp(int nlyr){ return est_time_fp(nlyr, 1.0, 1.0, 1.0); }
39  virtual double est_time_rec(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C){ return 0.0; }
40  double est_time_rec(int nlyr){ return est_time_rec(nlyr, 1.0, 1.0, 1.0); }
45  virtual int64_t spmem_rec(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C){ return 0; };
46 
47 
48  void run(char * A, char * B, char * C) { printf("CTF ERROR: PROVIDE SPARSITY ARGS TO RUN\n"); assert(0); };
49  virtual void run(char * A, int nblk_A, int64_t const * size_blk_A,
50  char * B, int nblk_B, int64_t const * size_blk_B,
51  char * C, int nblk_C, int64_t * size_blk_C,
52  char *& new_C) { IASSERT(0); }
53  spctr(contraction const * c);
54  };
55 
56  class seq_tsr_spctr : public spctr {
57  public:
58  char const * alpha;
59  int order_A;
60  int * edge_len_A;
61  int const * idx_map_A;
62  int * sym_A;
63 
64  int order_B;
65  int * edge_len_B;
66  int const * idx_map_B;
67  int * sym_B;
68 
69  int order_C;
70  int * edge_len_C;
71  int const * idx_map_C;
72  int * sym_C;
73 
74  int krnl_type;
76 
77  int is_custom;
78  bivar_function const * func; // custom_params;
79 
80 
84  void run(char * A, int nblk_A, int64_t const * size_blk_A,
85  char * B, int nblk_B, int64_t const * size_blk_B,
86  char * C, int nblk_C, int64_t * size_blk_C,
87  char *& new_C);
88  void print();
89  int64_t spmem_fp();
90  spctr * clone();
91  double est_fp(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
92  int64_t est_spmem_rec(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
93  uint64_t est_membw(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
94  double est_time_fp(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
95  double est_time_rec(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
96 
101  seq_tsr_spctr(spctr * other);
103  CTF_int::cdealloc(edge_len_A), CTF_int::cdealloc(edge_len_B), CTF_int::cdealloc(edge_len_C),
104  CTF_int::cdealloc(sym_A), CTF_int::cdealloc(sym_B), CTF_int::cdealloc(sym_C);
105  }
106 
107  seq_tsr_spctr(contraction const * s,
108  int krnl_type,
109  iparam const * inner_params,
110  int * virt_blk_len_A,
111  int * virt_blk_len_B,
112  int * virt_blk_len_C,
113  int64_t vrt_sz_C);
114 
115  };
116 
117  class spctr_virt : public spctr {
118  public:
120  int num_dim;
121  int * virt_dim;
122  int order_A;
123  int64_t blk_sz_A;
124  int const * idx_map_A;
125  int order_B;
126  int64_t blk_sz_B;
127  int const * idx_map_B;
128  int order_C;
129  int64_t blk_sz_C;
130  int const * idx_map_C;
131 
132  void print();
133 
137  void run(char * A, int nblk_A, int64_t const * size_blk_A,
138  char * B, int nblk_B, int64_t const * size_blk_B,
139  char * C, int nblk_C, int64_t * size_blk_C,
140  char *& new_C);
141  int64_t spmem_fp();
142  int64_t spmem_rec(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
143 
144  double est_time_rec(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
145  spctr * clone();
146 
150  ~spctr_virt();
151 
155  spctr_virt(spctr *other);
156  spctr_virt(contraction const * c,
157  int num_tot,
158  int * virt_dim,
159  int64_t vrt_sz_A,
160  int64_t vrt_sz_B,
161  int64_t vrt_sz_C);
162  };
163 
164  class spctr_pin_keys : public spctr {
165  public:
167  int AxBxC;
168  int order;
169  int const * lens;
170  int * divisor;
171  int * virt_dim;
172  int * phys_rank;
173  int64_t dns_blk_sz;
174 
175  void run(char * A, int nblk_A, int64_t const * size_blk_A,
176  char * B, int nblk_B, int64_t const * size_blk_B,
177  char * C, int nblk_C, int64_t * size_blk_C,
178  char *& new_C);
179  void print();
180  int64_t spmem_fp(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
181  int64_t spmem_rec(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
182  spctr * clone();
183 
184  double est_time_fp(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
185  double est_time_rec(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C);
186  spctr_pin_keys(spctr * other);
187  ~spctr_pin_keys();
188  spctr_pin_keys(contraction const * s, int AxBxC);
189 
190  };
191 }
192 
193 #endif
bivar_function const * func
Definition: spctr_tsr.h:78
virtual int64_t spmem_rec(double nnz_frac_A, double nnz_frac_B, double nnz_frac_C)
returns the number of bytes need by each processor in this kernel and its recursive calls ...
Definition: spctr_tsr.h:45
virtual void run(char *A, int nblk_A, int64_t const *size_blk_A, char *B, int nblk_B, int64_t const *size_blk_B, char *C, int nblk_C, int64_t *size_blk_C, char *&new_C)
Definition: spctr_tsr.h:49
virtual double est_time_rec(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C)
returns the execution time this kernel and its recursive calls are estimated to take ...
Definition: spctr_tsr.h:39
int const * idx_map_A
Definition: spctr_tsr.h:124
bool is_sparse_C
Definition: spctr_tsr.h:14
untyped internal class for triply-typed bivariate function
Definition: ctr_comm.h:16
#define IASSERT(...)
Definition: common.h:74
bool is_sparse_A
Definition: spctr_tsr.h:12
double est_time_fp(int nlyr)
Definition: spctr_tsr.h:30
class for execution distributed contraction of tensors
Definition: contraction.h:16
virtual void print()
Definition: ctr_comm.h:175
char const * alpha
Definition: spctr_tsr.h:58
char * new_C
Definition: spctr_tsr.h:15
int const * idx_map_B
Definition: spctr_tsr.h:127
int const * idx_map_A
Definition: spctr_tsr.h:61
int const * idx_map_C
Definition: spctr_tsr.h:130
int const * idx_map_B
Definition: spctr_tsr.h:66
int cdealloc(void *ptr)
free abstraction
Definition: memcontrol.cxx:480
int const * idx_map_C
Definition: spctr_tsr.h:71
virtual spctr * clone()
Definition: spctr_tsr.h:19
virtual double est_time_fp(int nlyr, double nnz_frac_A, double nnz_frac_B, double nnz_frac_C)
returns the execution time the local part this kernel is estimated to take
Definition: spctr_tsr.h:29
double est_time_rec(int nlyr)
Definition: spctr_tsr.h:40
void run(char *A, char *B, char *C)
Definition: spctr_tsr.h:48
bool is_sparse_B
Definition: spctr_tsr.h:13
spctr(spctr *other)
Definition: spctr_tsr.cxx:20