Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
677e1e20
Unverified
Commit
677e1e20
authored
Dec 05, 2022
by
YuliangLiu0306
Committed by
GitHub
Dec 05, 2022
Browse files
[device] update flatten device mesh usage (#2079)
parent
a7adad9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
colossalai/device/device_mesh.py
colossalai/device/device_mesh.py
+2
-1
No files found.
colossalai/device/device_mesh.py
View file @
677e1e20
...
...
@@ -24,6 +24,7 @@ class DeviceMesh:
during initializing the DeviceMesh instance if the init_process_group set to True.
Otherwise, users need to call create_process_groups_for_logical_mesh manually to init logical process group.
(default: False)
need_flatten(bool, optional): initialize flatten_device_mesh during initializing the DeviceMesh instance if the need_flatten set to True.
"""
def
__init__
(
self
,
...
...
@@ -50,7 +51,7 @@ class DeviceMesh:
self
.
need_flatten
=
need_flatten
if
self
.
init_process_group
:
self
.
process_groups_dict
=
self
.
create_process_groups_for_logical_mesh
()
if
self
.
need_flatten
:
if
self
.
need_flatten
and
self
.
_logical_mesh_id
.
dim
()
>
1
:
self
.
flatten_device_mesh
=
self
.
flatten
()
# Create a new member `flatten_device_meshes` to distinguish from original flatten methods (Because I'm not sure if there are functions that rely on the self.flatten())
self
.
flatten_device_meshes
=
FlattenDeviceMesh
(
self
.
physical_mesh_id
,
self
.
mesh_shape
,
self
.
mesh_alpha
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment