MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / Construct

Method Construct

src/network/linker_topo.cpp:29–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29BruckMap BruckMap::Construct(int rank, int num_machines) {
30 // distance at k-th communication, distance[k] = 2^k
31 std::vector<int> distance;
32 int k = 0;
33 for (k = 0; (1 << k) < num_machines; ++k) {
34 distance.push_back(1 << k);
35 }
36 BruckMap bruckMap(k);
37 for (int j = 0; j < k; ++j) {
38 // set incoming rank at k-th commuication
39 const int in_rank = (rank + distance[j]) % num_machines;
40 bruckMap.in_ranks[j] = in_rank;
41 // set outgoing rank at k-th commuication
42 const int out_rank = (rank - distance[j] + num_machines) % num_machines;
43 bruckMap.out_ranks[j] = out_rank;
44 }
45 return bruckMap;
46}
47
48RecursiveHalvingMap::RecursiveHalvingMap() {
49 k = 0;

Callers

nothing calls this directly

Calls 1

push_backMethod · 0.80

Tested by

no test coverage detected