Bryce Wehan
Bryce Wehan

Reputation: 31

Getting gputools and gmatrix in R to run smoothly on Linux

I am having trouble getting R to recognize gmatrix for R, running through Rstudio. My details are below.

*I had to edit the host_config.h file because cuda is not supported for the gcc compiler that Tumbleweed ships with. I basically broke the evaluation that checks for version and set it to 5.9 instead of 4.9. Was this a supremely naive thing to do?

-I wasn't able to install gmatrix properly. I got R to install by manually adding the LD & PATH directories using the Sys.setenv()

> Sys.setenv("LD_LIBRARY_PATH"="/usr/lib64/R/lib:/lib:/usr/local/lib64:/usr/local/cuda/lib64")

> Sys.setenv("PATH"="/home/eamergent/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/cuda/bin")

However, I am unable to load the gmatrix package, yet gputools works fine:

> library(gputools) "no issues"

> library(gmatrix)

> Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/eamergent/R/x86_64-suse-linux-gnu-library/3.2/gmatrix/libs/gmatrix.so':libcudart.so.7.5: cannot open shared object file: No such file or directory Error: package or namespace load failed for ‘gmatrix’

*The Error makes it seem that libcudart.so.7.5 is to blame However, /usr/local/cuda/lib64/libcudart.so.7.5 does in fact exist:

> eamergent@linux-pnx7: ls /usr/local/cuda/lib64/libcuda

libcudadevrt.a       libcudart.so         libcudart.so.7.5     libcudart.so.7.5.18  libcudart_static.a 

*I used tab to get a shorter list. there are many more in lib64

Any ideas on how to get R to recognize the already installed gmatrix package? Or how to properly reinstall without using the R environment path fix that I used above?

Upvotes: 0

Views: 282

Answers (1)

jelias
jelias

Reputation: 11

I had the same issue on Ubuntu 14.04 where the system and R (Sys.setenv()) shared library paths were set properly, but R failed to load the CUDA shared library. What worked was to set the CUDA shared library path using ldconfig.

as root or prefix commands with sudo:

# echo "/usr/local/cuda/lib64/libcuda" > /etc/ld.so.conf.d/cuda.conf
# ldconfig

then

# R
> install.packages("gmatrix")

or if gmatrix is already installed

# R
> library(gmatrix)
> gtest()

Upvotes: 1

Related Questions