3 #include "../tensor/untyped_tensor.h" 4 #include "../shared/util.h" 32 for (
int j=0; j<tsr->
order; j++){
52 order = ((
int*)(buffer+buffer_ptr))[0];
53 buffer_ptr +=
sizeof(int);
63 is_cyclic = ((
int*)(buffer+buffer_ptr))[0];
64 buffer_ptr +=
sizeof(int);
65 size = ((int64_t*)(buffer+buffer_ptr))[0];
66 buffer_ptr +=
sizeof(int64_t);
67 memcpy(
phase, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
68 buffer_ptr +=
sizeof(int)*order;
69 memcpy(
virt_phase, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
70 buffer_ptr +=
sizeof(int)*order;
71 memcpy(
phys_phase, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
72 buffer_ptr +=
sizeof(int)*order;
73 memcpy(
pe_lda, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
74 buffer_ptr +=
sizeof(int)*order;
75 memcpy(
pad_edge_len, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
76 buffer_ptr +=
sizeof(int)*order;
77 memcpy(
padding, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
78 buffer_ptr +=
sizeof(int)*order;
79 memcpy(
perank, (
int*)(buffer+buffer_ptr),
sizeof(
int)*order);
80 buffer_ptr +=
sizeof(int)*order;
101 ((
int*)(buffer+buffer_ptr))[0] =
order;
102 buffer_ptr +=
sizeof(int);
103 ((
int*)(buffer+buffer_ptr))[0] =
is_cyclic;
104 buffer_ptr +=
sizeof(int);
105 ((int64_t*)(buffer+buffer_ptr))[0] =
size;
106 buffer_ptr +=
sizeof(int64_t);
107 memcpy((
int*)(buffer+buffer_ptr),
phase,
sizeof(
int)*
order);
108 buffer_ptr +=
sizeof(int)*order;
109 memcpy((
int*)(buffer+buffer_ptr),
virt_phase,
sizeof(
int)*order);
110 buffer_ptr +=
sizeof(int)*order;
111 memcpy((
int*)(buffer+buffer_ptr),
phys_phase,
sizeof(
int)*order);
112 buffer_ptr +=
sizeof(int)*order;
113 memcpy((
int*)(buffer+buffer_ptr),
pe_lda,
sizeof(
int)*order);
114 buffer_ptr +=
sizeof(int)*order;
115 memcpy((
int*)(buffer+buffer_ptr),
pad_edge_len,
sizeof(
int)*order);
116 buffer_ptr +=
sizeof(int)*order;
117 memcpy((
int*)(buffer+buffer_ptr),
padding,
sizeof(
int)*order);
118 buffer_ptr +=
sizeof(int)*order;
119 memcpy((
int*)(buffer+buffer_ptr),
perank,
sizeof(
int)*order);
120 buffer_ptr +=
sizeof(int)*order;
122 ASSERT(buffer_ptr == bufsz);
129 void distribution::free_data(){
145 int const * edge_len,
150 int64_t vsz, i, cont;
154 for (i=0; i<
order; i++){
155 if (blk_edge_len != NULL)
156 blk_edge_len[i] = edge_len[i];
157 vrt_edge_len[i] = edge_len[i];
160 if (blk_edge_len != NULL){
162 blk_edge_len[i] = blk_edge_len[i] / map->
np;
164 vrt_edge_len[i] = vrt_edge_len[i] / map->
np;
int calc_phys_rank(topology const *topo) const
compute the physical rank of a mapping
int calc_phase() const
compute the phase of a mapping
void calc_dim(int order, int64_t size, int const *edge_len, mapping const *edge_map, int64_t *vrt_sz, int *vrt_edge_len, int *blk_edge_len)
calculate the block-sizes of a tensor
int * pad_edge_len
padded tensor edge lengths
void serialize(char **buffer, int *size)
serialize object into contiguous data buffer
int calc_phys_phase() const
compute the physical phase of a mapping
int64_t size
current size of local tensor data chunk (mapping-dependent)
int order
number of tensor dimensions
bool is_cyclic
whether the tensor data is cyclically distributed (blocked if false)
int * padding
padding along each edge length (less than distribution phase)
int alloc_ptr(int64_t len, void **const ptr)
alloc abstraction
mapping * edge_map
mappings of each tensor dimension onto topology dimensions
int get_distribution_size(int order)
int cdealloc(void *ptr)
free abstraction
internal distributed tensor class
topology * topo
topology to which the tensor is mapped