We are going to mess around with some of the R gpu packages using our eGPU Rig. Look here for how to set up RStudio and then use the gpuR, gputools and keras/tensorflow packages against an eGPU.
Setup your eGPU as described at NUC with eGPU – a Big Little ML Rig. Smoketest your rig to verify basic CUDA functionality by issuing commands such as.
$ nvidia-smi $ nvcc -V $ gcc -V $ cd ~/MLOps/NVIDIA_CUDA-9.0_Samples/bin/x86_64/linux/release $ ./deviceQuery $ ~/MLOps/cudnn_samples_v7/mnistCUDNN $ ./mnistCUDNN $ env | grep LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/lib/nvidia-384: $ env | grep PATH PATH=/usr/local/cuda-9.0/bin:/usr/lib/nvidia-384/bin:/usr/lib/nvidia-384:...
1. RStudio Desktop
Let’s try out some R GPU libraries, but we are going to need RStudio first. Locate then download your RStudio distribution at https://www.rstudio.com/products/rstudio/download/#download . For Ubuntu 17.04, I also needed to download some additional packages and then proceed as follows.
- Download “libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb” from https://packages.debian.org/jessie/amd64/libgstreamer-plugins-base0.10-0/download
- Download “libgstreamer0.10-0_0.10.36-1.5_amd64.deb” from https://packages.debian.org/jessie/amd64/libgstreamer0.10-0/download
$ sudo dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb $ sudo dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb $ sudo apt install libjpeg62 libedit2 $ sudo gdebi -n rstudio-1.1.383-amd64.deb
2. R gpuR Package
Launch RStudio and install the gpuR package. Copy/paste in the sample sample at https://raw.githubusercontent.com/StefanoPicozzi/MLOps/master/gpu/gpuR.R and verify it works. Install any other R packages as required, e.g. ggplot2. Looking good?
2. R gputools Package
Next we take the gputools R package for a spin. Follow the instructions at https://goatoftheplague.com/2016/12/08/installing-r-package-gputools-and-cuda-8-0-on-ubuntu-16-04/ to install this package (e.g. to overcome the R.h include file issue). Install the source modified package as follows:
> install.packages("~/Downloads/gputools_1.1_new.tar.gz", repos = NULL, type = "source")
Once installed try out the sample gputools R script at https://raw.githubusercontent.com/StefanoPicozzi/MLOps/master/gpu/gputools.R
3. R Keras Package using Tensorsoft
First we need to setup tensorflow and python as described towards the end of NUC with eGPU – a Big Little ML Rig . Now from RStudio use the Console window to install Keras as follows:
> install.packages('Rcpp') > install.packages('devtools') > devtools::install_github("rstudio/keras") > devtools::install_github("rstudio/reticulate") > library("keras") > install_keras(tensorflow = "gpu")
You are now ready to test drive a few sample scripts:
Other gpu R Packages Attempted
- install fails with -lRmath related issue
- install fails with gcc version related issue
- install fails with Biobase availability related issue
- R CMD INSTALL fails with packaging issue
- Requires license file