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

Skipping compiling and running cuda kernels if cuda or gpu is not

available
parent 82ce1d7d
No related branches found
No related tags found
1 merge request!1Add CUDA support
Pipeline #55144 skipped
...@@ -18,6 +18,14 @@ config_kwargs = ({}, ...@@ -18,6 +18,14 @@ config_kwargs = ({},
'assume_aligned': True}}) 'assume_aligned': True}})
def nvidia_gpu_available():
return subprocess.call(['nvidia-smi']) == 0
def nvcc_available():
return subprocess.call(['nvcc', '--version']) == 0
@pytest.mark.parametrize('compiler', compilers) @pytest.mark.parametrize('compiler', compilers)
@pytest.mark.parametrize('config_kwarg', config_kwargs) @pytest.mark.parametrize('config_kwarg', config_kwargs)
def test_generate(compiler, config_kwarg): def test_generate(compiler, config_kwarg):
...@@ -63,5 +71,9 @@ def test_generate_gpu(kwargs): ...@@ -63,5 +71,9 @@ def test_generate_gpu(kwargs):
with tempfile.TemporaryDirectory(dir=Path.cwd()) as temp_dir: with tempfile.TemporaryDirectory(dir=Path.cwd()) as temp_dir:
temp_dir = Path(temp_dir) temp_dir = Path(temp_dir)
pb.gpu.generate_benchmark([kernel_vadd, kernel_daxpy], temp_dir, compiler=compiler, **kwargs) pb.gpu.generate_benchmark([kernel_vadd, kernel_daxpy], temp_dir, compiler=compiler, **kwargs)
if not nvcc_available():
return
subprocess.run(['make', '-C', f'{temp_dir}'], check=True) subprocess.run(['make', '-C', f'{temp_dir}'], check=True)
if not nvidia_gpu_available():
return
subprocess.run([f'{temp_dir}/benchmark-{compiler.name}', '10'], check=True) 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