R CMD check warning with CUDA *.cu files

433 views Asked by At

I'm building a tiny R package that uses Rcpp and CUDA. It's a learning exercise to help me build a bigger package to submit to Bioconductor. The package installs and runs just fine on the Linux machine I describe in this post. However, when I run R CMD check on the tarball, I get a warning.

$ R CMD check rcppcuda_0.0.tar.gz 
* using log directory ‘/home/landau/rcppcuda.Rcheck’
* using R version 3.2.0 (2015-04-16)
* using platform: x86_64-unknown-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘rcppcuda/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘rcppcuda’ version ‘0.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... WARNING
Subdirectory ‘src’ contains:
  someCUDAcode.cu
These are unlikely file names for src files.
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘rcppcuda’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... OK
* checking examples ... NONE
* checking PDF version of manual ... OK
* DONE

Status: 1 WARNING
See
  ‘/home/landau/rcppcuda.Rcheck/00check.log’
for details.

$

This warning, also present in the bigger package I'm building, prevents me from submitting to Bioconductor. Warnings in R CMD check automatically disqualify me. Sadly, nvcc requires a .cu extension on each CUDA file, so I can't rename *.cu to *.c or *.cpp. Does anyone know how to tell R that *.cu files are legitimate source files?

1

There are 1 answers

0
talonmies On BEST ANSWER

While the default behaviour of nvcc is to automatically deduce language from filename extension (so that CUDA code is expected to be contained in a .cu extension file), this is not a fixed requirement. nvcc supports the -x flag to manually set language for a given compilation unit, so you could use pass -x cu to a source file containing CUDA code with a .cpp extension and the compilation will work correctly.

Whether this is advisable from a maintainability perspective is a decision you will have to make. But it should solve your immediate problem.