Welcome to gpuRcuda! This package is designed to be an extension upon the more general gpuR package. Essentially, this package creates a secondary level of child classes that inherit from gpuR classes. As such, any functions defined in gpuR (i.e. OpenCL counterpart) will also work on any of the objects defined herein. The key aspect of this package is to allow the user to use a CUDA backend where the NVIDIA specific language will improve overall performance.
The syntax is designed to be identical to gpuR
ORDER <- 1024
A <- matrix(rnorm(ORDER^2), nrow=ORDER)
B <- matrix(rnorm(ORDER^2), nrow=ORDER)
gpuA <- cudaMatrix(A, type="double")
gpuB <- cudaMatrix(B, type="double")
C <- A %*% B
gpuC <- gpuA %*% gpuB
all(C == gpuC)
[1] TRUE
- opencl-headers (shared library)
- NVIDIA Drivers & SDK
If you are fortunate enough to have a very recent card that you can use the most recent drivers. THis install is much more simple
# Install Boost & OpenCL headers
sudo apt-get install opencl-headers
# Install NVIDIA Drivers and CUDA
sudo add-apt-repository -y ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install nvidia-346 nvidia-settings
sudo apt-get install cuda
If you have an older card that doesn't support the newest drivers:
- Purge any existing nvidia and cuda implementations
(
sudo apt-get purge cuda* nvidia-*
) - Download appropriate CUDA toolkit for the specific card. You can figure this out by first checking which NVIDIA driver is compatible with your card by searching for it in NVIDIA's Driver Downloads. Then check which cuda toolkit is compatible with the driver from this Backward Compatibility Table Let's say the cuda-6.5 toolkit was appropriate, which you can download from the CUDA toolkit archive. Once downloaded, run the .run file.
- Reboot computer
- Switch to ttyl (Ctrl-Alt-F1)
- Stop the X server (sudo stop lightdm)
- Run the cuda run file (
sh cuda_6.5.14_linux_64.run
) - Select 'yes' and accept all defaults
- Required reboot
- Switch to ttyl, stop X server and run the cuda run file again and select 'yes' and default for everything (including the driver again)
- Update
PATH
to include/usr/local/cuda-6.5/bin
andLD_LIBRARY_PATH
to include/usr/local/cuda-6.5/lib64
- Reboot again