Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / auto_parallel / sapp_ppb / __init__.py: 67%
12 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-07-06 05:41 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-07-06 05:41 +0800
1# Copyright 2026 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"""SAPP-PPB: Symbolic Automatic Parallel Planner - Pipeline Parallelism Balancing.
17Offline ILP planner for automatically generating layer distribution and
18recomputation policies across pipeline parallel stages.
19"""
20# pylint: disable=invalid-name,undefined-all-variable
22from importlib import import_module as _import_module
23import sys as _sys
25_sys.modules.setdefault("sapp_ppb", _sys.modules[__name__])
27__all__ = [
28 "SappPipeline",
29 "choose_interleave",
30 "flatten",
31 "SappSolver",
32 "PipelineMemoryConstraint",
33 "Layer",
34 "generate_layers_list",
35 "compute_memories",
36 "initialize_layer_json",
37 "build_arg_parser",
38 "run",
39 "main",
40]
42_EXPORTS = {
43 "SappPipeline": ".sapp.sapp_pipeline",
44 "choose_interleave": ".sapp.sapp_pipeline",
45 "flatten": ".sapp.sapp_pipeline",
46 "SappSolver": ".sapp.sapp_solver",
47 "PipelineMemoryConstraint": ".sapp.sapp_solver",
48 "Layer": ".utils.layer",
49 "generate_layers_list": ".utils.layer",
50 "compute_memories": ".utils.compute_memory",
51 "initialize_layer_json": ".utils.config",
52 "build_arg_parser": ".run_pipeline_balance",
53 "run": ".run_pipeline_balance",
54 "main": ".run_pipeline_balance",
55}
58def __getattr__(name):
59 """Lazily import public SAPP-PPB interfaces."""
60 if name not in _EXPORTS:
61 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
63 module = _import_module(_EXPORTS[name], __name__)
64 value = getattr(module, name)
65 globals()[name] = value
66 return value