| 60 | } |
| 61 | |
| 62 | Maybe<std::pair<std::string, int>> SbpGetState(const Symbol<SbpParallel>& sbp) { |
| 63 | if (sbp->has_broadcast_parallel()) { |
| 64 | return std::make_shared<std::pair<std::string, int>>("B", -1); |
| 65 | } else if (sbp->has_partial_sum_parallel()) { |
| 66 | return std::make_shared<std::pair<std::string, int>>("P", -1); |
| 67 | } else if (sbp->has_split_parallel()) { |
| 68 | return std::make_shared<std::pair<std::string, int>>("S", sbp->split_parallel().axis()); |
| 69 | } else { |
| 70 | return Error::RuntimeError() << "Invalid sbp signature: " << sbp->DebugString(); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | Maybe<Symbol<SbpParallel>> GetSbpFromState(const std::pair<std::string, int>& state) { |
| 75 | if (state.first == "B") { |
no test coverage detected