Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tests/unit_tests/transformer/test_vision_cuda_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
get_gpt_layer_with_transformer_engine_submodules,
)
from megatron.core.models.vision.vit_layer_specs import get_vit_layer_with_transformer_engine_spec
from megatron.core.num_microbatches_calculator import (
destroy_num_microbatches_calculator,
init_num_microbatches_calculator,
)
from megatron.core.tensor_parallel.random import (
HAVE_TE,
initialize_rng_tracker,
Expand Down Expand Up @@ -536,6 +540,7 @@ def setup_method(self, method):
self.micro_batch_size = 2

def teardown_method(self, method):
destroy_num_microbatches_calculator()
Utils.destroy_model_parallel()
gc.collect()

Expand Down Expand Up @@ -588,8 +593,6 @@ def test_pp2_num_microbatches_preserved(self):
not (HAVE_TE_GRAPHS and is_te_min_version("2.7.0")),
reason="TE CUDA graph capture requires TransformerEngine >= 2.7.0",
)
@pytest.mark.flaky
@pytest.mark.flaky_in_dev
def test_pp2_create_cudagraphs_first_stage(self):
"""On stage 0, CUDA graphs should be captured with the full pipeline order."""
if not self.is_first_stage:
Expand All @@ -599,6 +602,14 @@ def test_pp2_create_cudagraphs_first_stage(self):
num_mb = 4
helper = self._make_helper(num_microbatches=num_mb)

init_num_microbatches_calculator(
rank=0,
global_batch_size=self.micro_batch_size * num_mb,
micro_batch_size=self.micro_batch_size,
data_parallel_size=1,
decrease_batch_size_if_needed=False,
)

assert not helper.graphs_created()

helper.create_cudagraphs()
Expand Down
Loading