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
f792507f
Unverified
Commit
f792507f
authored
Jul 29, 2022
by
Jiarui Fang
Committed by
GitHub
Jul 29, 2022
Browse files
[chunk] add PG check for tensor appending (#1383)
parent
8dced41a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
colossalai/gemini/chunk_mgr.py
colossalai/gemini/chunk_mgr.py
+5
-1
No files found.
colossalai/gemini/chunk_mgr.py
View file @
f792507f
...
...
@@ -3,7 +3,7 @@ from typing import Optional, Dict, Deque, Set, List, Tuple, Iterable
from
collections
import
deque
from
colossalai.utils
import
get_current_device
from
colossalai.tensor
import
ProcessGroup
as
ColoProcessGroup
from
colossalai.tensor
import
ProcessGroup
as
ColoProcessGroup
,
ColoTensor
from
.chunk
import
Chunk
,
ChunkFullError
,
TensorState
...
...
@@ -13,6 +13,7 @@ class ChunkManager:
Args:
chunk_size (int): the size of a chunk.
process_group (ColoProcessGroup): process group of the chunk.
enable_distributed_storage (bool): optional, allow for distributed storage of a chunk. The default is false.
init_device (torch.device): optional, the device on which the chunk is initialized. The default is None.
"""
...
...
@@ -57,6 +58,9 @@ class ChunkManager:
group_name (str): the name of the chunk group.
"""
assert
tensor
not
in
self
.
tensor_chunk_map
if
isinstance
(
tensor
,
ColoTensor
):
assert
tensor
.
get_process_group
().
dp_process_group
()
==
self
.
process_group
.
dp_process_group
(
),
f
"Chunk Manager can only manage ColoTensor with the same DP process group"
if
self
.
chunk_size
is
not
None
and
tensor
.
numel
()
>
self
.
chunk_size
:
raise
ValueError
(
f
'Cannot create chunk, got tensor numel (
{
tensor
.
numel
()
}
) > chunk size (
{
self
.
chunk_size
}
)'
)
...
...
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