【问题标题】:R CMD check warning with CUDA *.cu filesCUDA *.cu 文件的 R CMD 检查警告
【发布时间】:2015-06-10 03:18:59
【问题描述】:

我正在构建一个使用 Rcpp 和 CUDA 的 tiny R package。这是一个学习练习,可以帮助我构建一个更大的包以提交给 Bioconductor。该软件包在我在this post 中描述的 Linux 机器上安装并运行良好。但是,当我在 tarball 上运行 R CMD check 时,会收到警告。

$ 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.

$

这个警告,也出现在我正在构建的更大的包中,阻止我提交给 Bioconductor。 R CMD check 中的警告会自动取消我的资格。可悲的是,nvcc 在每个 CUDA 文件上都需要一个 .cu 扩展名,所以我无法将 *.cu 重命名为 *.c*.cpp。有谁知道如何告诉 R *.cu 文件是合法的源文件?

【问题讨论】:

  • 您应该与 Bioconductor 的人员交谈(例如,通过页面底部描述包裹提交的contact information);他们不太可能拒绝带有不合理警告的包。在当前情况下,您可能想明确说明使用 CUDA 进行包构建和可移植性的后果(最终用户是否需要安装 CUDA 头文件和编译器?这个额外的要求是否会带来有价值的收益?)跨度>
  • 页面here 表示“顶级”级别只允许specified files and directories,但如果需要安装文件,您可以将文件移动到inst...查看Checking top-level files 的部分。如果可行,请随时自己回答问题!
  • nvcc 不需要 需要 .cu 扩展来编译 CUDA 代码。这是默认行为,但是有一个特定的命令行选项可以手动设置语言而不是从文件扩展名中推断
  • 那个选项是什么?我查看了nvcc 手册,但一直找不到。
  • 另外,@Martin_Morgan,是的,我一直想知道 CUDA 和 Bioconductor。用户需要安装 CUDA,以及将支持 CUDA 的 NVIDIA GPU 连接到他们的机器上,而这种特殊的软件和硬件并不常见。该软件包无法使用常规 gcc/g++ 工具进行编译。然而,这是设计的一部分。 CUDA 增加了一个主要的加速,没有它,这个包可能不实用。到时候,我会就这个便携性问题联系 Bioconductor。

标签: c++ c r bioconductor


【解决方案1】:

虽然 nvcc 的默认行为是从文件扩展名中自动推断语言(因此 CUDA 代码应该包含在 .cu 扩展名文件中),但这不是一个固定的要求。 nvcc 支持-x 标志为给定的编译单元手动设置语言,因此您可以使用将-x cu 传递给包含扩展名为.cpp 的CUDA 代码的源文件,并且编译将正常工作。

从可维护性的角度来看,这是否可取是您必须做出的决定。但它应该可以解决您当前的问题。

【讨论】:

    猜你喜欢
    • 2013-02-08
    • 2017-05-28
    • 1970-01-01
    • 2018-11-12
    • 1970-01-01
    • 1970-01-01
    • 2013-05-09
    • 2018-06-19
    • 2011-07-14
    相关资源
    最近更新 更多