Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
iter_tsr.h
Go to the documentation of this file.
1 #ifndef __ITER_TSR_H__
2 #define __ITER_TSR_H__
3 
4 #include "util.h"
5 namespace CTF_int{
6  class algstrct;
7  //lives in contraction/sym_seq_ctr
8  void compute_syoff(int r,
9  int len,
10  algstrct const * sr,
11  int const * edge_len,
12  int const * sym,
13  uint64_t * offsets);
14 }
15 
16 #define GET_MIN_MAX(__X,nr,wd) \
17 do{ \
18  i##__X = rev_idx_map[wd*idx+nr]; \
19  if (i##__X != -1){ \
20  imax = MIN(imax, edge_len_##__X[i##__X]); \
21  /*if (sym_##__X[i##__X] > -1){ \
22  imax = MIN(imax, idx_glb[idx_map_##__X[sym_##__X[i##__X]]]+1); \
23  } \
24  if (i##__X > 0 && sym_##__X[i##__X-1] > -1){ \
25  imin = MAX(imin, idx_glb[idx_map_##__X[i##__X-1]]); \
26  }*/ \
27  } \
28 } while (0);
29 
30 #ifdef SEQ
31 #define CHECK_SYM(__X) \
32 do { \
33  sym_pass = 1; \
34  for (i=0; i<order_##__X; i++){ \
35  if (sym_##__X[i] == AS || sym_##__X[i] == SH){ \
36  if (idx_glb[idx_map_##__X[i+1]] <= \
37  idx_glb[idx_map_##__X[i]]) { \
38  sym_pass = 0; \
39  break; \
40  } \
41  } \
42  if (sym_##__X[i] == SY){ \
43  if (idx_glb[idx_map_##__X[i+1]] < \
44  idx_glb[idx_map_##__X[i]]) { \
45  sym_pass = 0; \
46  break; \
47  } \
48  } \
49  } \
50 } while(0)
51 #else
52 #define CHECK_SYM(__X) \
53 do { \
54  sym_pass = 1; \
55  for (i=0; i<order_##__X; i++){ \
56  if (sym_##__X[i] != NS){ \
57  if (idx_glb[idx_map_##__X[i+1]] < \
58  idx_glb[idx_map_##__X[i]]) { \
59  sym_pass = 0; \
60  break; \
61  } \
62  } \
63  } \
64 } while(0)
65 #endif
66 
67 #define RESET_IDX(__X) \
68 do { \
69  idx_##__X = idx_glb[idx_map_##__X[0]]; \
70  off_idx = 0, off_lda = 1; \
71  for (i=1; i<order_##__X; i++){ \
72  if (sym_##__X[i-1] == NS){ \
73  off_idx = i; \
74  off_lda = sy_packed_size(i, dlen_##__X, sym_##__X); \
75  idx_##__X += off_lda*idx_glb[idx_map_##__X[i]]; \
76  } else if (idx_glb[idx_map_##__X[i]]!=0) { \
77  k = 1; \
78  dlen_##__X[i] = idx_glb[idx_map_##__X[i]]; \
79  do { \
80  dlen_##__X[i-k] = idx_glb[idx_map_##__X[i]]; \
81  k++; \
82  } while (i>=k && sym_##__X[i-k] != NS); \
83  idx_##__X += off_lda*sy_packed_size(i+1-off_idx, \
84  dlen_##__X+off_idx,sym_##__X+off_idx); \
85  for (j=0; j<k; j++){ \
86  dlen_##__X[i-j] = edge_len_##__X[i-j]; \
87  } \
88  } \
89  } \
90 } while (0)
91 
92 #endif
void compute_syoff(int r, int len, algstrct const *sr, int const *edge_len, int const *sym, uint64_t *offsets)