[CI] Remove VLLM_TEST_CLEAN_GPU_MEMORY to avoid environment variable pollution that causes unnecessary GPU detection, thereby slowing down test case execution. (#3446)

Signed-off-by: wangyu <410167048@qq.com>
Signed-off-by: [Your Name] <your.email@example.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
wangyuandHongsheng Liu authored and GitHub committed 2026-05-10 07:00:29 +08:00
1 parent 77480215f5
commit 26d481fc84
54 files changed
+54 -156

No files matched your search

+2 -21
View File
@@ -16,11 +16,6 @@ from contextlib import contextmanager
import torch
def run_forced_gpu_cleanup_round() -> None:
run_pre_test_cleanup(enable_force=True)
run_post_test_cleanup(enable_force=True)
def get_physical_device_indices(devices):
visible_devices = os.environ.get("CUDA_VISIBLE_DEVICES")
if visible_devices is None:
@@ -232,16 +227,7 @@ def _print_gpu_processes() -> None:
print("=" * 80)
_SKIPPED_GPU_CLEANUP_MSG = (
"\nSkipping GPU memory cleanup check (typically: instance already up; no check needed between tests)\n"
)
def run_pre_test_cleanup(enable_force: bool = False) -> None:
if os.getenv("VLLM_TEST_CLEAN_GPU_MEMORY", "0") != "1" and not enable_force:
print(_SKIPPED_GPU_CLEANUP_MSG)
return
def run_pre_test_cleanup() -> None:
print("Pre-test GPU status:")
num_gpus = torch.accelerator.device_count()
@@ -255,11 +241,7 @@ def run_pre_test_cleanup(enable_force: bool = False) -> None:
print(f"Pre-test cleanup note: {e}")
def run_post_test_cleanup(enable_force: bool = False) -> None:
if os.getenv("VLLM_TEST_CLEAN_GPU_MEMORY", "0") != "1" and not enable_force:
print(_SKIPPED_GPU_CLEANUP_MSG)
return
def run_post_test_cleanup() -> None:
if torch.cuda.is_available():
gc.collect()
torch.accelerator.empty_cache()
@@ -318,6 +300,5 @@ __all__ = [
"get_physical_device_indices",
"run_post_test_cleanup",
"run_pre_test_cleanup",
"run_forced_gpu_cleanup_round",
"wait_for_gpu_memory_to_clear",
]
+5 -3
View File
@@ -27,10 +27,12 @@ def model_prefix() -> str:
return f"{prefix.rstrip('/')}/" if prefix else ""
@pytest.fixture(autouse=True)
@pytest.fixture
def clean_gpu_memory_between_tests():
# Import here so ``tests.helpers.env`` (and vLLM platform modules) load only
# after session autouse fixtures like ``default_env`` have run (RFC #2299).
"""Opt-in GPU pre/post hooks for a test (no environment-variable gate).
Use as a test parameter or ``@pytest.mark.usefixtures("clean_gpu_memory_between_tests")``.
"""
from tests.helpers.env import run_post_test_cleanup, run_pre_test_cleanup
print("\n=== PRE-TEST GPU CLEANUP ===")
+11 -7
View File
@@ -35,7 +35,7 @@ from tests.helpers.assertions import (
assert_diffusion_response,
assert_omni_response,
)
from tests.helpers.env import run_forced_gpu_cleanup_round
from tests.helpers.env import run_post_test_cleanup, run_pre_test_cleanup
from tests.helpers.media import (
_merge_base64_audio_to_segment,
convert_audio_bytes_to_text,
@@ -201,7 +201,8 @@ class OmniServer:
env_dict: dict[str, str] | None = None,
use_omni: bool = True,
) -> None:
run_forced_gpu_cleanup_round()
run_pre_test_cleanup()
run_post_test_cleanup()
cleanup_dist_env_and_memory()
self.model = model
self.serve_args = serve_args
@@ -306,7 +307,8 @@ class OmniServer:
def __exit__(self, exc_type, exc_val, exc_tb):
if self.proc:
self._kill_process_tree(self.proc.pid)
run_forced_gpu_cleanup_round()
run_pre_test_cleanup()
run_post_test_cleanup()
cleanup_dist_env_and_memory()
@@ -593,7 +595,8 @@ class OmniServerStageCli(OmniServer):
proc = self.stage_procs[stage_key]
if proc.poll() is None:
self._kill_process_tree(proc.pid)
run_forced_gpu_cleanup_round()
run_pre_test_cleanup()
run_post_test_cleanup()
cleanup_dist_env_and_memory()
@@ -1272,7 +1275,8 @@ class OmniRunner:
**kwargs,
) -> None:
cleanup_dist_env_and_memory()
run_forced_gpu_cleanup_round()
run_pre_test_cleanup()
run_post_test_cleanup()
self.model_name = model_name
self.seed = seed
self._prompt_len_estimate_cache: dict[str, Any] = {}
@@ -1538,7 +1542,8 @@ class OmniRunner:
if hasattr(self.omni, "close"):
self.omni.close()
self._cleanup_process()
run_forced_gpu_cleanup_round()
run_pre_test_cleanup()
run_post_test_cleanup()
cleanup_dist_env_and_memory()
@@ -1876,6 +1881,5 @@ __all__ = [
"OmniServerStageCli",
"OpenAIClientHandler",
"get_open_port",
"run_forced_gpu_cleanup_round",
"dummy_messages_from_mix_data",
]