| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <tuple> | ||
| 4 | #include <utility> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "task/include/task.hpp" | ||
| 8 | |||
| 9 | namespace potashnik_m_star_topol { | ||
| 10 | |||
| 11 | using InType = std::vector<int>; | ||
| 12 | using OutType = std::tuple<int, int>; // Second int = 0 if number of processes = 1 (or sequential version) | ||
| 13 | using TestType = int; | ||
| 14 | using BaseTask = ppc::task::Task<InType, OutType>; | ||
| 15 | |||
| 16 | // Function to generate next (source -> destination) call. Cyclicly goes through number of non-center processes | ||
| 17 | inline std::pair<int, int> GetCyclicSrcDst(int world_size, int iter) { | ||
| 18 | 272 | int num_other_processes = world_size - 1; | |
| 19 | 272 | int src = (iter % num_other_processes) + 1; | |
| 20 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 136 times.
|
272 | int dst = ((iter + 1) % num_other_processes) + 1; |
| 21 | return {src, dst}; | ||
| 22 | } | ||
| 23 | |||
| 24 | } // namespace potashnik_m_star_topol | ||
| 25 |