user2778066
user2778066

Reputation: 41

Calling GPU functions in R

I have CUDA and rpud successfully installed. I was able to compile and run my file vecAdd.cu, but I would like to call this function in R. I used the following instruction to create vecAdd.o and vecAdd.so respectively, I got no errors.

nvcc -m64 -I/usr/local/cuda-5.5/include -I/usr/include/R - I/usr/local/include -g -O2 -c -o VecAdd.o VecAdd.cu --ptxas-options -v -Xcompiler -fPIC

g++ -m64 -std=gnu99 -shared -L/usr/local/lib64 -o VecAdd.so VecAdd.o -L/usr/lib64/R/lib -lR -L/usr/local/cuda-5.5/lib64 -lcuda -lcudart -lcurand -lm

When I tried to load it in R using:

> dyn.load("/home/CUDACodes/VecAdd.so")

Error in dyn.load("/home/CUDACodes/VecAdd.so") : unable to load shared object '/home/CUDACodes/VecAdd.so': libcudart.so.5.5: cannot open shared object file: No such file or directory

Don't know if it could be related, but when I tried to install gputools package I got this error:

Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/ac43/lib/R/gputools/libs/gputools.so': libcublas.so.5.5: cannot open shared object file: No such file or directory

Upvotes: 2

Views: 1192

Answers (1)

user2778066
user2778066

Reputation: 41

Adding the following line to the .csrc file fixed it: setenv R_INC_PATH /usr/lib64/R/include:$LD_LIBRARY_PATH

Upvotes: 2

Related Questions