cuda: avoid test failure without GPU available

Fixes #13269
pull/13273/head
David Seifert 6 months ago committed by Eli Schwartz
parent 6f3841e986
commit f4577911b4
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 8
      test cases/cuda/17 separate compilation linking/meson.build

@ -11,7 +11,7 @@ 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))
@ -19,4 +19,8 @@ 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

Loading…
Cancel
Save