Skip to content
Snippets Groups Projects
Commit d38a9324 authored by Christoph Alt's avatar Christoph Alt
Browse files

using pytest skip if there is no nvcc or gpu available

parent 1e542f17
No related branches found
No related tags found
1 merge request!1Add CUDA support
Pipeline #55180 skipped
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment