如何在 R 中安装“gputools”

5 cuda r

我在 CentOS 6.4 上使用了自编译的 R 2.15

所有CUDA环境都正确(我写过CUDA C程序)

我已经安装了 R-devel

我仍然无法为 R 安装 gputools

为什么?

* 
config.status: creating src/Makefile
config.status: creating R/gpuSvm.R
config.status: creating R/gpuFastICA.R
config.status: creating R/gpuSvd.R
** libs
** arch - 
/usr/local/cuda-5.0/bin/nvcc -gencode arch=compute_10,code=sm_10 -gencode arch=compute_11,code=sm_11 -gencode arch=compute_12,code=sm_12 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -c -I. -I/usr/local/cuda-5.0/include  -Xcompiler -fpic kendall.cu -o kendall.o
ptxas /tmp/tmpxft_00002846_00000000-17_kendall.compute_10.ptx, line 285; warning : Double is not supported. Demoting to float
ptxas /tmp/tmpxft_00002846_00000000-14_kendall.compute_11.ptx, line 285; warning : Double is not supported. Demoting to float
ptxas /tmp/tmpxft_00002846_00000000-11_kendall.compute_12.ptx, line 285; warning : Double is not supported. Demoting to float
/usr/local/cuda-5.0/bin/nvcc -gencode arch=compute_10,code=sm_10 -gencode arch=compute_11,code=sm_11 -gencode arch=compute_12,code=sm_12 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -c -I. -I/usr/local/cuda-5.0/include  -Xcompiler -fpic classification.cu -o classification.o
classification.cu:24:14: error: R.h: No such file or directory
make: *** [classification.o] Error 1
ERROR: compilation failed for package ‘gputools’
* removing ‘/usr/local/lib64/R/library/gputools’

The downloaded source packages are in
    ‘/tmp/RtmpD9AnXS/downloaded_packages’
Updating HTML index of packages in '.Library'
Making packages.html  ... done
Warning message:
In install.packages("gputools") :
  installation of package ‘gputools’ had non-zero exit status
Run Code Online (Sandbox Code Playgroud)

qed*_*qed 4

我开始为这个问题悬赏,但过了一会儿我想出了如何解决它,所以我不妨将其发布在这里作为答案。

看起来 nvcc 要求 /usr/lib/R/include,它在 ubuntu 12.04 上不存在。这是解决方案(在ubuntu 12.04上测试)

sudo aptitude install r-base-dev
cd /usr/lib/R
sudo ln -s /usr/share/R/include .
Run Code Online (Sandbox Code Playgroud)

现在启动 R 并像往常一样安装 gputools。它应该有效。你应该能够在 centOS 上做出类似的事情。