You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

step_auto_parallel.h 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Copyright 2019 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef PARALLEL_STEP_AUTO_PARALLEL_H_
  17. #define PARALLEL_STEP_AUTO_PARALLEL_H_
  18. #include <map>
  19. #include <memory>
  20. #include <string>
  21. #include <vector>
  22. #include "ir/anf.h"
  23. #include "optimizer/opt.h"
  24. #include "parallel/status.h"
  25. #include "pipeline/pipeline.h"
  26. namespace mindspore {
  27. namespace parallel {
  28. bool IsSplittableOperator(const std::string &);
  29. bool IsAutoParallelCareNode(const CNodePtr &);
  30. // main step of Auto-parallel
  31. bool StepAutoParallel(const FuncGraphPtr &func_graph, const opt::OptimizerPtr &optimizer);
  32. size_t GetLengthOfDataType(const TypePtr &type);
  33. std::vector<bool> ExtractInputParameterByNode(const CNodePtr &node);
  34. std::vector<size_t> ExtractInputTypeLengthByNode(const CNodePtr &node);
  35. std::vector<TypePtr> ExtractOutputTypeByNode(const CNodePtr &node);
  36. Status ConstructCostGraphNodesByUniqueId(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
  37. Status ConstructCostGraphNodesByUniqueIdTC(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
  38. void ConstructCostGraphEdges(const std::vector<AnfNodePtr> &all_nodes);
  39. void AugmentCostGraph(const std::vector<AnfNodePtr> &all_nodes);
  40. Status ParallelStrategySearch(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
  41. Status ParallelStrategyRecSearch(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
  42. std::vector<std::vector<std::string>> RecInputTensorNames(const std::map<std::string, std::string>::iterator &it,
  43. std::vector<std::vector<std::string>> input_tensor_names);
  44. } // namespace parallel
  45. } // namespace mindspore
  46. #endif // PARALLEL_STEP_AUTO_PARALLEL_H_