Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
ctr_tsr.h
Go to the documentation of this file.
1 /*Copyright (c) 2011, Edgar Solomonik, all rights reserved.*/
2 
3 #ifndef __CTR_TSR_H__
4 #define __CTR_TSR_H__
5 
6 #include "ctr_comm.h"
7 namespace CTF_int {
8 
9  class ctr_virt : public ctr {
10  public:
12  int num_dim;
13  int * virt_dim;
14  int order_A;
15  int64_t blk_sz_A;
16  int const * idx_map_A;
17  int order_B;
18  int64_t blk_sz_B;
19  int const * idx_map_B;
20  int order_C;
21  int64_t blk_sz_C;
22  int const * idx_map_C;
23 
24  void print();
25 
29  void run(char * A, char * B, char * C);
30  int64_t mem_fp();
31  int64_t mem_rec();
32 
33  double est_time_rec(int nlyr);
34  ctr * clone();
35 
39  ~ctr_virt();
40 
44  ctr_virt(ctr *other);
45  ctr_virt(contraction const * c,
46  int num_tot,
47  int * virt_dim,
48  int64_t vrt_sz_A,
49  int64_t vrt_sz_B,
50  int64_t vrt_sz_C);
51  };
52 
53  /* Assume LDA equal to dim */
54 /* class ctr_dgemm : public ctr {
55  public:
56  char transp_A;
57  char transp_B;
58  char const * alpha;
59  int n;
60  int m;
61  int k;
62 
63  void print() {};
64  void run();
65  int64_t mem_fp();
66  double est_time_fp(int nlyr);
67  double est_time_rec(int nlyr);
68  ctr * clone();
69 
70  ctr_dgemm(ctr * other);
71  ~ctr_dgemm();
72  ctr_dgemm(){}
73  };*/
74 
75  struct iparam {
76  int64_t l;
77  int64_t n;
78  int64_t m;
79  int64_t k;
80  int64_t sz_C;
81  char tA;
82  char tB;
83  char tC;
84  bool offload;
85  };
86 
87  class seq_tsr_ctr : public ctr {
88  public:
89  char const * alpha;
90  int order_A;
91  int * edge_len_A;
92  int const * idx_map_A;
93  int * sym_A;
94  int order_B;
95  int * edge_len_B;
96  int const * idx_map_B;
97  int * sym_B;
98  int order_C;
99  int * edge_len_C;
100  int const * idx_map_C;
101  int * sym_C;
102  //fseq_tsr_ctr func_ptr;
103 
104  int is_inner;
106 
108  bivar_function const * func; // custom_params;
109 
113  void run(char * A, char * B, char * C);
114  void print();
115  int64_t mem_fp();
116  double est_fp();
117  uint64_t est_membw();
118  double est_time_rec(int nlyr);
119  double est_time_fp(int nlyr);
120  ctr * clone();
121 
126  seq_tsr_ctr(ctr * other);
127  ~seq_tsr_ctr(){ CTF_int::cdealloc(edge_len_A), CTF_int::cdealloc(edge_len_B), CTF_int::cdealloc(edge_len_C),
128  CTF_int::cdealloc(sym_A), CTF_int::cdealloc(sym_B), CTF_int::cdealloc(sym_C); }
129  seq_tsr_ctr(contraction const * c,
130  bool is_inner,
131  iparam const * inner_params,
132  int * virt_blk_len_A,
133  int * virt_blk_len_B,
134  int * virt_blk_len_C,
135  int64_t vrt_sz_C);
136  };
137 
149  void inv_idx(int order_A,
150  int const * idx_A,
151  int order_B,
152  int const * idx_B,
153  int order_C,
154  int const * idx_C,
155  int * order_tot,
156  int ** idx_arr);
157 
158 
159 }
160 
161 #endif // __CTR_TSR_H__
int64_t blk_sz_B
Definition: ctr_tsr.h:18
int const * idx_map_B
Definition: ctr_tsr.h:96
virtual double est_time_fp(int nlyr)
Definition: ctr_comm.h:178
bool offload
Definition: ctr_tsr.h:84
int64_t k
Definition: ctr_tsr.h:79
void inv_idx(int order_A, int const *idx_A, int order_B, int const *idx_B, int order_C, int const *idx_C, int *order_tot, int **idx_arr)
invert index map
Definition: ctr_tsr.cxx:592
int const * idx_map_C
Definition: ctr_tsr.h:100
int64_t mem_fp()
Definition: ctr_tsr.cxx:92
int64_t m
Definition: ctr_tsr.h:78
~ctr_virt()
deallocates ctr_virt object
Definition: ctr_tsr.cxx:41
untyped internal class for triply-typed bivariate function
Definition: ctr_comm.h:16
int const * idx_map_C
Definition: ctr_tsr.h:22
int64_t blk_sz_C
Definition: ctr_tsr.h:21
ctr_virt(ctr *other)
copies ctr_virt object
Definition: ctr_tsr.cxx:46
class for execution distributed contraction of tensors
Definition: contraction.h:16
int const * idx_map_B
Definition: ctr_tsr.h:19
int64_t n
Definition: ctr_tsr.h:77
int64_t sz_C
Definition: ctr_tsr.h:80
void run(char *A, char *B, char *C)
iterates over the dense virtualization block grid and contracts
Definition: ctr_tsr.cxx:101
int const * idx_map_A
Definition: ctr_tsr.h:92
int64_t l
Definition: ctr_tsr.h:76
double est_time_rec(int nlyr)
Definition: ctr_tsr.cxx:82
bivar_function const * func
Definition: ctr_tsr.h:108
int * virt_dim
Definition: ctr_tsr.h:13
int cdealloc(void *ptr)
free abstraction
Definition: memcontrol.cxx:480
char const * alpha
Definition: ctr_tsr.h:89
int64_t blk_sz_A
Definition: ctr_tsr.h:15
int64_t mem_rec()
Definition: ctr_tsr.cxx:96
int const * idx_map_A
Definition: ctr_tsr.h:16