Skip to content

Commit

Permalink
cuda: avoid test failure without GPU available
Browse files Browse the repository at this point in the history
  • Loading branch information
SoapGentoo committed May 30, 2024
1 parent 6f3841e commit c34bde6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test cases/cuda/17 separate compilation linking/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c34bde6

Please sign in to comment.