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
846406a0
Unverified
Commit
846406a0
authored
Apr 16, 2022
by
ver217
Committed by
GitHub
Apr 16, 2022
Browse files
[gemini] fix auto tensor placement policy (#775)
parent
38102cf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
colossalai/gemini/tensor_placement_policy.py
colossalai/gemini/tensor_placement_policy.py
+3
-0
No files found.
colossalai/gemini/tensor_placement_policy.py
View file @
846406a0
...
...
@@ -46,7 +46,9 @@ class AutoTensorPlacementPolicy(TensorPlacementPolicy):
def
__init__
(
self
,
mem_stats_collector
:
Optional
[
MemStatsCollector
]
=
None
)
->
None
:
super
().
__init__
(
None
,
mem_stats_collector
=
mem_stats_collector
)
# model data will use 1-self._warmup_non_model_data_ratio CUDA memory in warmup phase
# TODO(ver217): make these args configurable
self
.
_warmup_non_model_data_ratio
:
float
=
0.8
self
.
_steady_cuda_cap_ratio
:
float
=
0.8
def
evict_tensors
(
self
,
hold_cuda_tensor_list
:
List
[
StatefulTensor
],
...
...
@@ -63,6 +65,7 @@ class AutoTensorPlacementPolicy(TensorPlacementPolicy):
else
:
# max non-model-data cuda memory consumption of this sampling moment and the next sampling moment.
max_cuda_non_model_data_per_period
=
self
.
mem_stats_collector
.
next_period_non_model_data_usage
(
'cuda'
)
cuda_capacity
*=
self
.
_steady_cuda_cap_ratio
total_cuda_model_data
=
cuda_capacity
-
max_cuda_non_model_data_per_period
avail_cuda_model_data
=
total_cuda_model_data
-
used_cuda_model_data
if
avail_cuda_model_data
<
cuda_demand
:
...
...
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