Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
sparse_rw.h
Go to the documentation of this file.
1 /*Copyright (c) 2011, Edgar Solomonik, all rights reserved.*/
2 
3 #ifndef __INT_SORT_H__
4 #define __INT_SORT_H__
5 
6 #include "../tensor/algstrct.h"
7 #include <functional>
8 
9 namespace CTF_int {
10 
22  void permute_keys(int order,
23  int num_pair,
24  int const * edge_len,
25  int const * new_edge_len,
26  int * const * permutation,
27  char * pairs,
28  int64_t * new_num_pair,
29  algstrct const * sr);
30 
41  void depermute_keys(int order,
42  int num_pair,
43  int const * edge_len,
44  int const * new_edge_len,
45  int * const * permutation,
46  char * pairs,
47  algstrct const * sr);
48 
64  void assign_keys(int order,
65  int64_t size,
66  int nvirt,
67  int const * edge_len,
68  int const * sym,
69  int const * phase,
70  int const * phys_phase,
71  int const * virt_dim,
72  int * phase_rank,
73  char const * vdata,
74  char * vpairs,
75  algstrct const * sr);
76 
95  void spsfy_tsr(int order,
96  int64_t size,
97  int nvirt,
98  int const * edge_len,
99  int const * sym,
100  int const * phase,
101  int const * phys_phase,
102  int const * virt_dim,
103  int * phase_rank,
104  char const * vdata,
105  char *& vpairs,
106  int64_t * nnz_blk,
107  algstrct const * sr,
108  int64_t const * edge_lda,
109  std::function<bool(char const*)> f);
110 
126  void bucket_by_pe(int order,
127  int64_t num_pair,
128  int64_t np,
129  int const * phys_phase,
130  int const * virt_phase,
131  int const * bucket_lda,
132  int const * edge_len,
133  ConstPairIterator mapped_data,
134  int64_t * bucket_counts,
135  int64_t * bucket_off,
136  PairIterator bucket_data,
137  algstrct const * sr);
138 
151  int64_t * bucket_by_virt(int order,
152  int num_virt,
153  int64_t num_pair,
154  int const * phys_phase,
155  int const * virt_phase,
156  int const * edge_len,
157  ConstPairIterator mapped_data,
158  PairIterator bucket_data,
159  algstrct const * sr);
160 
179  void readwrite(int order,
180  int64_t size,
181  char const * alpha,
182  char const * beta,
183  int nvirt,
184  int const * edge_len,
185  int const * sym,
186  int const * phase,
187  int const * phys_phase,
188  int const * virt_dim,
189  int * phase_rank,
190  char * vdata,
191  char *pairs,
192  char rw,
193  algstrct const * sr);
194 
195 
223  void wr_pairs_layout(int order,
224  int np,
225  int64_t inwrite,
226  char const * alpha,
227  char const * beta,
228  char rw,
229  int num_virt,
230  int const * sym,
231  int const * edge_len,
232  int const * padding,
233  int const * phase,
234  int const * phys_phase,
235  int const * virt_phase,
236  int * virt_phys_rank,
237  int const * bucket_lda,
238  char * wr_pairs_buf,
239  char * rw_data,
240  CommData glb_comm,
241  algstrct const * sr,
242  bool is_sparse,
243  int64_t nnz_loc,
244  int64_t * nnz_blk,
245  char *& pprs_new,
246  int64_t & nnz_loc_new);
247 
248 
266  void read_loc_pairs(int order,
267  int64_t nval,
268  int num_virt,
269  int const * sym,
270  int const * edge_len,
271  int const * padding,
272  int const * phase,
273  int const * phys_phase,
274  int const * virt_phase,
275  int * phase_rank,
276  int64_t * nread,
277  char const * data,
278  char ** pairs,
279  algstrct const * sr);
280 
281 
293  void sp_read(algstrct const * sr,
294  int64_t ntsr,
295  ConstPairIterator prs_tsr,
296  char const * alpha,
297  int64_t nread,
298  PairIterator prs_read,
299  char const * beta);
300 
301 
317  void sp_write(int num_virt,
318  algstrct const * sr,
319  int64_t * vntsr,
320  ConstPairIterator vprs_tsr,
321  char const * beta,
322  int64_t * vnwrite,
323  ConstPairIterator vprs_write,
324  char const * alpha,
325  int64_t * vnnew,
326  char *& pprs_new);
327 }
328 #endif
void read_loc_pairs(int order, int64_t nval, int num_virt, int const *sym, int const *edge_len, int const *padding, int const *phase, int const *phys_phase, int const *virt_phase, int *phase_rank, int64_t *nread, char const *data, char **pairs, algstrct const *sr)
read tensor pairs local to processor
Definition: sparse_rw.cxx:1235
void sp_write(int num_virt, algstrct const *sr, int64_t *vntsr, ConstPairIterator vprs_tsr, char const *beta, int64_t *vnwrite, ConstPairIterator vprs_write, char const *alpha, int64_t *vnnew, char *&pprs_new)
writes pairs in a sparse write set to the sparse set of elements defining the tensor, resulting in a set of size between ntsr and ntsr+nwrite
Definition: sparse_rw.cxx:1362
void sp_read(algstrct const *sr, int64_t ntsr, ConstPairIterator prs_tsr, char const *alpha, int64_t nread, PairIterator prs_read, char const *beta)
reads elements of a sparse set defining the tensor, into a sparse read set with potentially repeating...
Definition: sparse_rw.cxx:1311
void assign_keys(int order, int64_t size, int nvirt, int const *edge_len, int const *sym, int const *phase, int const *phys_phase, int const *virt_dim, int *phase_rank, char const *vdata, char *vpairs, algstrct const *sr)
assigns keys to an array of values
Definition: sparse_rw.cxx:180
void bucket_by_pe(int order, int64_t num_pair, int64_t np, int const *phys_phase, int const *virt_phase, int const *bucket_lda, int const *edge_len, ConstPairIterator mapped_data, int64_t *bucket_counts, int64_t *bucket_off, PairIterator bucket_data, algstrct const *sr)
buckets key-value pairs by processor according to distribution
Definition: sparse_rw.cxx:432
void depermute_keys(int order, int num_pair, int const *edge_len, int const *new_edge_len, int *const *permutation, char *pairs_buf, algstrct const *sr)
depermutes keys (apply P^T)
Definition: sparse_rw.cxx:99
void permute_keys(int order, int num_pair, int const *edge_len, int const *new_edge_len, int *const *permutation, char *pairs_buf, int64_t *new_num_pair, algstrct const *sr)
permutes keys
Definition: sparse_rw.cxx:10
int64_t * bucket_by_virt(int order, int num_virt, int64_t num_pair, int const *phys_phase, int const *virt_phase, int const *edge_len, ConstPairIterator mapped_data, PairIterator bucket_data, algstrct const *sr)
buckets key value pairs by block/virtual-processor
Definition: sparse_rw.cxx:539
void wr_pairs_layout(int order, int np, int64_t inwrite, char const *alpha, char const *beta, char rw, int num_virt, int const *sym, int const *edge_len, int const *padding, int const *phase, int const *phys_phase, int const *virt_phase, int *virt_phys_rank, int const *bucket_lda, char *wr_pairs_buf, char *rw_data, CommData glb_comm, algstrct const *sr, bool is_sparse, int64_t nnz_loc, int64_t *nnz_blk, char *&pprs_new, int64_t &nnz_loc_new)
read or write pairs from / to tensor
Definition: sparse_rw.cxx:872
void spsfy_tsr(int order, int64_t size, int nvirt, int const *edge_len, int const *sym, int const *phase, int const *phys_phase, int const *virt_dim, int *phase_rank, char const *vdata, char *&vpairs, int64_t *nnz_blk, algstrct const *sr, int64_t const *edge_lda, std::function< bool(char const *)> f)
extracts all tensor values (in pair format) that pass a sparsifier function (including padded zeros i...
Definition: sparse_rw.cxx:276
void readwrite(int order, int64_t size, char const *alpha, char const *beta, int nvirt, int const *edge_len, int const *sym, int const *phase, int const *phys_phase, int const *virt_dim, int *phase_rank, char *vdata, char *pairs_buf, char rw, algstrct const *sr)
read or write pairs from / to tensor
Definition: sparse_rw.cxx:685
def np(self)
Definition: core.pyx:315