MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / distribute

Method distribute

include/core/solver.h:1083–1107  ·  view source on GitHub ↗

Distribute edges to the sample pool. This function can be parallelized. */

Source from the content-addressed store, hash-verified

1081
1082 /** Distribute edges to the sample pool. This function can be parallelized. */
1083 void distribute(size_t start, size_t end, int id) {
1084 auto &offsets = solver->pool_offsets[id];
1085
1086 for (size_t i = start; i < end; i++) {
1087 Index head_global_id = std::get<0>((*solver->samples)[i]);
1088 Index tail_global_id = std::get<1>((*solver->samples)[i]);
1089 std::pair<int, Index> head = solver->head_locations[head_global_id];
1090 std::pair<int, Index> tail = solver->tail_locations[tail_global_id];
1091 int head_partition_id = head.first;
1092 int tail_partition_id = tail.first;
1093 Index head_local_id = head.second;
1094 Index tail_local_id = tail.second;
1095
1096 auto &pool = solver->predict_pool[head_partition_id][tail_partition_id];
1097 auto &indexes = solver->sample_indexes[head_partition_id][tail_partition_id];
1098 size_t &offset = offsets[head_partition_id][tail_partition_id];
1099 EdgeSample sample = (*solver->samples)[i];
1100 std::get<0>(sample) = head_local_id;
1101 std::get<1>(sample) = tail_local_id;
1102
1103 pool[offset] = sample;
1104 indexes[offset] = i;
1105 offset++;
1106 }
1107 }
1108
1109 /** Distribute edges to the sample pool. This function can be parallelized. */
1110 void distribute_numpy(size_t start, size_t end, int id) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected