PKGBUILDs/extra/meson/0002-cuda-avoid-test-failure-without-GPU-available.patch

34 lines
1.5 KiB
Diff
Raw Normal View History

2024-05-31 02:18:18 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Fri, 31 May 2024 00:21:43 +0200
Subject: [PATCH] cuda: avoid test failure without GPU available
Fixes #13269
---
.../cuda/17 separate compilation linking/meson.build | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/test cases/cuda/17 separate compilation linking/meson.build b/test cases/cuda/17 separate compilation linking/meson.build
index 8e90ddd7f6fd..7ba7e220870d 100644
--- a/test cases/cuda/17 separate compilation linking/meson.build
+++ b/test cases/cuda/17 separate compilation linking/meson.build
@@ -11,12 +11,16 @@ add_languages('cuda')
nvcc = meson.get_compiler('cuda')
cuda = import('unstable-cuda')
-arch_flags = cuda.nvcc_arch_flags(nvcc.version(), 'Auto', detected : ['8.0'])
+arch_flags = cuda.nvcc_arch_flags(nvcc.version(), 'Common')
message('NVCC version: ' + nvcc.version())
message('NVCC flags: ' + ' '.join(arch_flags))
# test device linking with -dc (which is equivalent to `--relocatable-device-code true`)
lib = static_library('devicefuncs', ['b.cu'], cuda_args : ['-dc'] + arch_flags)
exe = executable('app', 'main.cu', cuda_args : ['-dc'] + arch_flags, link_with : lib, link_args : arch_flags)
-test('cudatest', exe)
+
+# if we don't have a CUDA-capable GPU available, avoid creating the test
+if run_command('__nvcc_device_query', check : false).returncode() == 0
+ test('cudatest', exe)
+endif