Add global option to set cuda arch.

Cuda programs may produce different errors depending on the architecture of the
target hardware. The canonical example and reason for writing this patch, is the
lack of support for double precision numbers on older hardware. By default, nvcc
and thus syntastic, defaults to the most basic architecture. This can produce
false errors if the developer intends to compile for newer hardware and use
newer features.

Not defining g:syntastic_cuda_arch preserves this behavior. Otherwise the user
is expected to set it a valid arch flag, as listed by `nvcc --help`.

Example:

    let g:syntastic_cuda_arch = "sm_20"
This commit is contained in:
John Tyree 2012-06-22 16:07:50 +02:00
parent 1e94b98705
commit 3951845dc8

View File

@ -21,7 +21,12 @@ if !executable('nvcc')
endif
function! SyntaxCheckers_cuda_GetLocList()
let makeprg = 'nvcc --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
if exists('g:syntastic_cuda_arch')
let arch_flag = '-arch='.g:syntastic_cuda_arch
else
let arch_flag = ''
endif
let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
"let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
let errorformat = '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f'',%X%*\a[%*\d]: Leaving directory `%f'',%D%*\a: Entering directory `%f'',%X%*\a: Leaving directory `%f'',%DMaking %*\a in %f,%f|%l| %m'