forked from hpcaitech/ColossalAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[autoparallel] add shard option (hpcaitech#2696)
* [autoparallel] add shard option * polish
- Loading branch information
1 parent
5b24987
commit 21d6a48
Showing
15 changed files
with
176 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
colossalai/auto_parallel/tensor_shard/node_handler/option.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from dataclasses import dataclass | ||
from enum import Enum | ||
|
||
__all__ = ['SolverOptions', 'SolverPerference', 'DataloaderOption', 'ShardOption'] | ||
|
||
|
||
class SolverPerference(Enum): | ||
""" | ||
This enum class is to define the solver preference. | ||
""" | ||
STANDARD = 0 | ||
DP = 1 | ||
TP = 2 | ||
|
||
|
||
class ShardOption(Enum): | ||
""" | ||
This enum class is to define the shard level required in node strategies. | ||
Notes: | ||
STANDARD: We do not add any extra shard requirements. | ||
SHARD: We require the node to be shard using at least one device mesh axis. | ||
SHARD_ONE_AXIS: We require the node to be shard using the last device mesh axis. | ||
FULL_SHARD: We require the node to be shard using all device mesh axes. | ||
TP_SHARD: We require the node to be shard using tensor parallel strategies on last device mesh axis. | ||
TP_FULL_SHARD: We require the node to be shard using tensor parallel strategies on all device mesh axes. | ||
""" | ||
STANDARD = 0 | ||
SHARD = 1 | ||
SHARD_LAST_AXIS = 2 | ||
FULL_SHARD = 3 | ||
|
||
|
||
class DataloaderOption(Enum): | ||
""" | ||
This enum class is to define the dataloader option. | ||
""" | ||
REPLICATED = 0 | ||
DISTRIBUTED = 1 | ||
|
||
|
||
@dataclass | ||
class SolverOptions: | ||
""" | ||
SolverOptions is a dataclass used to configure the preferences for the parallel execution plan search. | ||
""" | ||
solver_perference: SolverPerference = SolverPerference.STANDARD | ||
dataloader_option: DataloaderOption = DataloaderOption.REPLICATED | ||
shard_option: ShardOption = ShardOption.STANDARD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from .cost_graph import CostGraph | ||
from .graph_analysis import GraphAnalyser | ||
from .options import SolverOptions | ||
from .solver import Solver | ||
from .strategies_constructor import StrategiesConstructor | ||
|
||
__all__ = ['GraphAnalyser', 'Solver', 'StrategiesConstructor', 'CostGraph', 'SolverOptions'] | ||
__all__ = ['GraphAnalyser', 'Solver', 'StrategiesConstructor', 'CostGraph'] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.