From e632a816276f8263530fac661025eb4b7da35ef3 Mon Sep 17 00:00:00 2001 From: Olexa Bilaniuk Date: Sun, 24 Feb 2019 08:56:42 -0500 Subject: Rework CUDA sanity check. PArtially addresses #4961. Also make the sanity check do double duty as a GPU architecture detection test. --- mesonbuild/compilers/cuda.py | 150 +++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 69 deletions(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 66dcf33..8f34864 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -47,35 +47,97 @@ class CudaCompiler(Compiler): return [] def sanity_check(self, work_dir, environment): - source_name = os.path.join(work_dir, 'sanitycheckcuda.cu') - binary_name = os.path.join(work_dir, 'sanitycheckcuda') - extra_flags = self.get_cross_extra_flags(environment, link=False) - if self.is_cross: - extra_flags += self.get_compile_only_args() - - code = ''' -__global__ void kernel (void) { - -} + mlog.debug('Sanity testing ' + self.get_display_language() + ' compiler:', ' '.join(self.exelist)) + mlog.debug('Is cross compiler: %s.' % str(self.is_cross)) - int main(int argc,char** argv){ + sname = 'sanitycheckcuda.cu' + code = r''' + #include + #include + + __global__ void kernel (void) {} + + int main(void){ + struct cudaDeviceProp prop; + int count, i; + cudaError_t ret = cudaGetDeviceCount(&count); + if(ret != cudaSuccess){ + fprintf(stderr, "%d\n", (int)ret); + }else{ + for(i=0;i Date: Sun, 24 Feb 2019 08:58:56 -0500 Subject: Solve NVCC -Werror problem. Partially addresses #4961. --- mesonbuild/compilers/cuda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 8f34864..d1964fd 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -188,7 +188,7 @@ class CudaCompiler(Compiler): return cuda_debug_args[is_debug] def get_werror_args(self): - return ['-Werror'] + return ['-Werror=cross-execution-space-call,deprecated-declarations,reorder'] def get_linker_exelist(self): return self.exelist[:] -- cgit v1.1