| 22 | namespace { |
| 23 | |
| 24 | Maybe<std::vector<std::string>> FindOrCreateNdSbpString(Symbol<NdSbp> nd_sbp) { |
| 25 | static thread_local auto* nd_sbp2nd_sbp_str = |
| 26 | new HashMap<Symbol<NdSbp>, std::shared_ptr<std::vector<std::string>>>(); |
| 27 | auto iter = nd_sbp2nd_sbp_str->find(nd_sbp); |
| 28 | if (iter == nd_sbp2nd_sbp_str->end()) { |
| 29 | std::shared_ptr<std::vector<std::string>> nd_sbp_str = |
| 30 | std::make_shared<std::vector<std::string>>(nd_sbp->sbp_parallel_size()); |
| 31 | for (int64_t i = 0; i < nd_sbp_str->size(); ++i) { |
| 32 | nd_sbp_str->at(i) = SbpParallelToString(nd_sbp->sbp_parallel(i)); |
| 33 | } |
| 34 | iter = nd_sbp2nd_sbp_str->emplace(nd_sbp, nd_sbp_str).first; |
| 35 | } |
| 36 | return iter->second; |
| 37 | } |
| 38 | |
| 39 | Maybe<void> GetDualSbpParallel(const SbpParallel& sbp_parallel, SbpParallel* dual_sbp_parallel) { |
| 40 | if (sbp_parallel.has_split_parallel()) { |
no test coverage detected