Skip to content

Commit bcf5368

Browse files
authored
[None][test] Enhance performance tests by adding GPU availability check in test_perf.py (NVIDIA#12535)
Signed-off-by: yufeiwu-nv <230315618+yufeiwu-nv@users.noreply.github.com>
1 parent 6803a91 commit bcf5368

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/integration/defs/perf/test_perf.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
from defs.trt_test_alternative import (is_linux, is_windows, print_info,
2727
print_warning)
2828

29-
from ..conftest import get_llm_root, llm_models_root, trt_environment
29+
from ..conftest import (get_device_count, get_llm_root, llm_models_root,
30+
trt_environment)
3031
from .pytorch_model_config import get_model_yaml_config
3132
from .sampler_options_config import get_sampler_options_config
3233
from .utils import (AbstractPerfScriptTestClass, PerfBenchScriptTestCmds,
@@ -974,6 +975,15 @@ def validate(self):
974975
[b >= 32 for b in self.batch_sizes]
975976
), f"gpt_350m and bloom_560m with small BS are very unstable! Please increase to at least 32."
976977

978+
try:
979+
available_gpus = get_device_count()
980+
except Exception:
981+
available_gpus = None
982+
if available_gpus is not None and self.num_gpus > available_gpus:
983+
pytest.skip(
984+
f"Test requires {self.num_gpus} GPUs but only {available_gpus} available"
985+
)
986+
977987
def get_model_family(self) -> str:
978988
"""
979989
Get the model family of the current model.

0 commit comments

Comments
 (0)