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
Megatron-LM
Commits
3ce6a1c2
Commit
3ce6a1c2
authored
Apr 07, 2023
by
Abhinav Khattar
Browse files
add needed helper functions
Signed-off-by:
Abhinav Khattar
<
aklife97@gmail.com
>
parent
035cae2e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
megatron/core/parallel_state.py
megatron/core/parallel_state.py
+11
-0
No files found.
megatron/core/parallel_state.py
View file @
3ce6a1c2
...
...
@@ -233,6 +233,11 @@ def initialize_model_parallel(
_set_global_memory_buffer
()
def
is_unitialized
():
"""Useful for code segments that may be accessed with or without mpu initialization"""
return
_DATA_PARALLEL_GROUP
is
None
def
model_parallel_is_initialized
():
"""Check if model and data parallel groups are initialized."""
if
_TENSOR_MODEL_PARALLEL_GROUP
is
None
or
\
...
...
@@ -454,6 +459,12 @@ def get_virtual_pipeline_model_parallel_world_size():
return
_VIRTUAL_PIPELINE_MODEL_PARALLEL_WORLD_SIZE
def
set_virtual_pipeline_model_parallel_world_size
(
world_size
):
"""Set the virtual pipeline-parallel world size"""
global
_VIRTUAL_PIPELINE_MODEL_PARALLEL_WORLD_SIZE
_VIRTUAL_PIPELINE_MODEL_PARALLEL_WORLD_SIZE
=
world_size
def
get_tensor_model_parallel_src_rank
():
"""Calculate the global rank corresponding to the first local rank
in the tensor model parallel group."""
...
...
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