41 topology_global.regions_cnt = regions_cnt;
46 switch (topology_global.geometry) {
50 edge = sqrt(regions_cnt);
52 if (edge * edge != regions_cnt) {
53 log_log(
LOG_FATAL,
"Invalid number of regions for this topology geometry (must be a square number)\n");
63 topology_global.edge = edge;
66 __attribute__ ((pure))
lp_id_t RegionsCount(
void)
68 return topology_global.regions_cnt;
71 __attribute__ ((pure))
lp_id_t DirectionsCount(
void)
73 switch (topology_global.geometry) {
75 return topology_global.regions_cnt - 1;
95 const uint32_t edge = topology_global.edge;
96 const lp_id_t regions_cnt = topology_global.regions_cnt;
102 switch (topology_global.geometry) {
106 x = sender - y * edge;
138 x = sender - y * edge;
160 x = sender - y * edge;
190 return (sender + 1) % regions_cnt;
192 return (sender + regions_cnt - 1) % regions_cnt;
204 if((uint64_t)direction + 1 < regions_cnt)
205 return direction + 1;
213 const lp_id_t dir_cnt = DirectionsCount();
215 uint64_t rnd = RandomU64();
218 lp_id_t dir = rnd & ((UINT64_C(1) << bits) - 1);
221 const lp_id_t ret = GetReceiver(lp_id_get(), dir);
226 if (
likely((i -= bits) >= bits)) {