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.

parallel_utils.py 1.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """Parallel utils"""
  16. __all__ = ["ParallelMode"]
  17. class ParallelMode:
  18. """
  19. Parallel mode options.
  20. There are five kinds of parallel modes, "STAND_ALONE", "DATA_PARALLEL",
  21. "HYBRID_PARALLEL", "SEMI_AUTO_PARALLEL" and "AUTO_PARALLEL". Default: "STAND_ALONE".
  22. - STAND_ALONE: Only one processor working.
  23. - DATA_PARALLEL: Distributing the data across different processors.
  24. - HYBRID_PARALLEL: Achieving data parallelism and model parallelism manually.
  25. - SEMI_AUTO_PARALLEL: Achieving data parallelism and model parallelism by setting parallel strategies.
  26. - AUTO_PARALLEL: Achieving parallelism automatically.
  27. MODE_LIST: The list for all supported parallel modes.
  28. """
  29. STAND_ALONE = "stand_alone"
  30. DATA_PARALLEL = "data_parallel"
  31. HYBRID_PARALLEL = "hybrid_parallel"
  32. SEMI_AUTO_PARALLEL = "semi_auto_parallel"
  33. AUTO_PARALLEL = "auto_parallel"
  34. MODE_LIST = [STAND_ALONE, DATA_PARALLEL, HYBRID_PARALLEL, SEMI_AUTO_PARALLEL, AUTO_PARALLEL]