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
1 merge request!1Add CUDA support
Pipeline #55144 skipped with stage
...@@ -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% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment