Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
mapping.h
Go to the documentation of this file.
1 /*Copyright (c) 2011, Edgar Solomonik, all rights reserved.*/
2 
3 #ifndef __INT_MAPPING_H__
4 #define __INT_MAPPING_H__
5 
6 #include "topology.h"
7 
8 namespace CTF_int {
9 
10  class CommData;
11  class tensor;
12 
13  enum map_type {
17  };
18 
19  // \brief object keeping track of a mapping of a tensor dimension onto a torus dimension
20  class mapping {
21  public:
23  int np;
24  int cdt;
25  int has_child;
27 
29  mapping();
30 
32  ~mapping();
33 
35  mapping(mapping const & other);
36  mapping & operator=(mapping const & other);
37 
43  int calc_phase() const;
44 
50  int calc_phys_phase() const;
51 
58  int calc_phys_rank(topology const * topo) const;
59 
61  void clear();
62 
68  void aug_phys(topology const * topo, int idim);
69 
74  void aug_virt(int tot_phase);
75  };
76 
82  int comp_dim_map(mapping const * map_A,
83  mapping const * map_B);
84 
91  void copy_mapping(int order,
92  mapping const * mapping_A,
93  mapping * mapping_B);
94 
105  int copy_mapping(int order_A,
106  int order_B,
107  int const * idx_A,
108  mapping const * mapping_A,
109  int const * idx_B,
110  mapping * mapping_B,
111  int make_virt = 1);
112 
113 
128  int map_tensor(int num_phys_dims,
129  int tsr_order,
130  int const * tsr_edge_len,
131  int const * tsr_sym_table,
132  int * restricted,
133  CommData * phys_comm,
134  int const * comm_idx,
135  int fill,
136  mapping * tsr_edge_map);
137 
144  int check_self_mapping(tensor const * tsr,
145  int const * idx_map);
146 
152  int map_self_indices(tensor const * tsr,
153  int const * idx_map);
154 
155 
164  int map_symtsr(int tsr_order,
165  int const * tsr_sym_table,
166  mapping * tsr_edge_map);
167 
168 
175  int stretch_virt(int order,
176  int stretch_factor,
177  mapping * maps);
178 
179 
180 }
181 
182 #endif
int calc_phys_rank(topology const *topo) const
compute the physical rank of a mapping
Definition: mapping.cxx:74
int map_tensor(int num_phys_dims, int tsr_order, int const *tsr_edge_len, int const *tsr_sym_table, int *restricted, CommData *phys_comm, int const *comm_idx, int fill, mapping *tsr_edge_map)
map a tensor
Definition: mapping.cxx:244
map_type type
Definition: mapping.h:22
int calc_phase() const
compute the phase of a mapping
Definition: mapping.cxx:39
void aug_phys(topology const *topo, int idim)
adds a physical mapping to this mapping
Definition: mapping.cxx:104
int calc_phys_phase() const
compute the physical phase of a mapping
Definition: mapping.cxx:57
void copy_mapping(int order, mapping const *mapping_A, mapping *mapping_B)
copies mapping A to B
Definition: mapping.cxx:190
map_type
Definition: mapping.h:13
int comp_dim_map(mapping const *map_A, mapping const *map_B)
compares two mappings
Definition: mapping.cxx:143
~mapping()
destructor
Definition: mapping.cxx:17
mapping * child
Definition: mapping.h:26
int map_symtsr(int tsr_order, int const *tsr_sym_table, mapping *tsr_edge_map)
adjust a mapping to maintan symmetry
Definition: mapping.cxx:470
int check_self_mapping(tensor const *tsr, int const *idx_map)
checks mapping in preparation for tensors scale, summ or contract
Definition: mapping.cxx:332
internal distributed tensor class
mapping()
constructor
Definition: mapping.cxx:11
mapping & operator=(mapping const &other)
Definition: mapping.cxx:29
int map_self_indices(tensor const *tsr, int const *idx_map)
create virtual mapping for idx_maps that have repeating indices
Definition: mapping.cxx:423
void aug_virt(int tot_phase)
augments mapping to have sufficient virtualization so that the total phas is exactly tot_phase (assum...
Definition: mapping.cxx:117
int stretch_virt(int order, int stretch_factor, mapping *maps)
stretch virtualization by a factor
Definition: mapping.cxx:542
void clear()
resets mapping to NOT_MAPPED
Definition: mapping.cxx:94