Distribute edges to the sample pool. This function can be parallelized. */
| 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) { |
| 1111 | auto &offsets = solver->pool_offsets[id]; |
| 1112 | auto array = solver->array->unchecked(); |
| 1113 | |
| 1114 | for (size_t i = start; i < end; i++) { |
| 1115 | Index head_global_id = array(i, 0); |
| 1116 | Index tail_global_id = array(i, 1); |
| 1117 | std::pair<int, Index> head = solver->head_locations[head_global_id]; |
| 1118 | std::pair<int, Index> tail = solver->tail_locations[tail_global_id]; |
| 1119 | int head_partition_id = head.first; |
| 1120 | int tail_partition_id = tail.first; |
| 1121 | Index head_local_id = head.second; |
| 1122 | Index tail_local_id = tail.second; |
| 1123 | |
| 1124 | auto &pool = solver->predict_pool[head_partition_id][tail_partition_id]; |
| 1125 | auto &indexes = solver->sample_indexes[head_partition_id][tail_partition_id]; |
| 1126 | size_t &offset = offsets[head_partition_id][tail_partition_id]; |
| 1127 | EdgeSample sample; |
| 1128 | Index *_sample = reinterpret_cast<Index *>(&sample); |
| 1129 | for (int j = 0; j < kSampleSize; j++) |
| 1130 | _sample[j] = array(i, kSampleSize - j - 1); |
| 1131 | std::get<0>(sample) = head_local_id; |
| 1132 | std::get<1>(sample) = tail_local_id; |
| 1133 | |
| 1134 | pool[offset] = sample; |
| 1135 | indexes[offset] = i; |
| 1136 | offset++; |
| 1137 | } |
| 1138 | } |
| 1139 | |
| 1140 | /** @return GPU memory cost */ |
| 1141 | static size_t gpu_memory_demand() { |
nothing calls this directly
no outgoing calls
no test coverage detected