diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index a45fcdd6d93e7ce8fc59169658f1b40bdbf55ae6..b47f9c5970086bcca151e58899a15ccdc434968d 100755 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -19,11 +19,17 @@ config_kwargs = ({}, def nvidia_gpu_available(): - return subprocess.call(['nvidia-smi']) == 0 + try: + return subprocess.call(['nvidia-smi']) == 0 + except (FileNotFoundError,): + return False def nvcc_available(): - return subprocess.call(['nvcc', '--version']) == 0 + try: + return subprocess.call(['nvcc', '--version']) == 0 + except (FileNotFoundError,): + return False @pytest.mark.parametrize('compiler', compilers) @@ -72,8 +78,8 @@ def test_generate_gpu(kwargs): temp_dir = Path(temp_dir) pb.gpu.generate_benchmark([kernel_vadd, kernel_daxpy], temp_dir, compiler=compiler, **kwargs) if not nvcc_available(): - return + pytest.skip("nvcc is not available!") subprocess.run(['make', '-C', f'{temp_dir}'], check=True) if not nvidia_gpu_available(): - return + pytest.skip("There is no GPU available!") subprocess.run([f'{temp_dir}/benchmark-{compiler.name}', '10'], check=True)