File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323
2424import sys
2525from pathlib import Path
26+ from unittest .mock import MagicMock , patch
27+
28+ import pytest
2629
2730
2831SCRIPTS_PERF_PATH = Path (__file__ ).parents [3 ] / "scripts" / "performance"
2932sys .path .insert (0 , str (SCRIPTS_PERF_PATH ))
3033
3134
35+ @pytest .fixture (autouse = True )
36+ def _mock_cuda_device_properties ():
37+ """Keep recipe construction independent of the test host's GPUs."""
38+ properties = MagicMock (major = 9 , name = "NVIDIA H100" )
39+ with patch ("torch.cuda.get_device_properties" , return_value = properties ):
40+ yield
41+
42+
3243def _build_base_args (** overrides ):
3344 """Return a fully-populated argparse.Namespace using the real parser defaults.
3445
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ def test_set_determinism_env_vars_writes_three_keys():
4646 gpu = "h100" ,
4747 compute_dtype = "bf16" ,
4848 train_task = "pretrain" ,
49- num_gpus = 64 ,
5049 )
5150 executor = MagicMock ()
5251 executor .env_vars = {}
@@ -56,15 +55,3 @@ def test_set_determinism_env_vars_writes_three_keys():
5655 assert executor .env_vars ["NCCL_ALGO" ] == "Ring"
5756 assert executor .env_vars ["NVTE_ALLOW_NONDETERMINISTIC_ALGO" ] == "0"
5857 assert executor .env_vars ["CUBLAS_WORKSPACE_CONFIG" ] == ":4096:8"
59-
60-
61- def test_perf_env_plugin_num_gpus_is_optional ():
62- plugin = PerfEnvPlugin (
63- model_family_name = "llama" ,
64- model_recipe_name = "llama3_70b" ,
65- gpu = "h100" ,
66- compute_dtype = "bf16" ,
67- train_task = "pretrain" ,
68- )
69-
70- assert plugin .num_gpus is None
You can’t perform that action at this time.
0 commit comments