Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seabbs/tidyverse-gpu
Adding in support for GPU acceleration via CUDA to rocker/tidyverse
https://github.com/seabbs/tidyverse-gpu
Last synced: 18 days ago
JSON representation
Adding in support for GPU acceleration via CUDA to rocker/tidyverse
- Host: GitHub
- URL: https://github.com/seabbs/tidyverse-gpu
- Owner: seabbs
- Created: 2019-01-25T17:23:18.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-29T10:00:57.000Z (almost 6 years ago)
- Last Synced: 2024-08-01T00:41:49.478Z (3 months ago)
- Language: Dockerfile
- Size: 19.5 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```# tidyverse-gpu
A Docker image based on [rocker/tidyverse](https://github.com/rocker-org/rocker-versioned) including GPU support via CUDA. Based on [work](zhttps://github.com/ecohealthalliance/reservoir/blob/master/Dockerfile.gpu) done by [Noam Ross](https://github.com/noamross). The Docker image contains `xgboost` built for GPU's in both R and Python as well as the latest stable release of `h2o`. If you wanted to use a different version of CUDA to the one currently installed then change the relevant environment variables in the `Dockerfile` and rebuild the image.
## Usage
Use as [rocker/tidyverse](https://github.com/rocker-org/rocker-versioned) but replace all `docker` commands with [`nvidia-docker`](https://github.com/NVIDIA/nvidia-docker) commands (must have installed [`nvidia-docker`](https://github.com/NVIDIA/nvidia-docker) on the host system).
* Pull/Build
```{bash, eval = FALSE}
docker pull seabbs/tidyverse-gpu
## Or build
## Clone repo and navigate into the repo in the terminal
docker build . -t tidyverse-gpu
```* Run
```{bash, eval = FALSE}
nvidia-docker run -d -p 8787:8787 -e USER=tidyverse-gpu -e PASSWORD=tidyverse-gpu --name tidyverse-gpu seabbs/tidyverse-gpu
## Or build
nvidia-docker run -d -p 8787:8787 -e USER=tidyverse-gpu -e PASSWORD=tidyverse-gpu --name tidyverse-gpu tidyverse-gpu
```* Login: Go to `localhost:8787` and sign in using the password and username given with the `docker run` command
## Nvidia Test
Run `nvidia-smi` in a bash shell. If GPU support is working correctly it should return GPU usage and temperature information.
```{bash, eval = FALSE}
nvidia-smi
```
## Xgboost GPU TestIf the following runs without errors `xgboost` is installed and using the GPU.
```{r, eval = FALSE}
library(xgboost)
# load data
data(agaricus.train, package = 'xgboost')
data(agaricus.test, package = 'xgboost')
train <- agaricus.train
test <- agaricus.test
# fit model
bst <- xgboost(data = train$data, label = train$label, max_depth = 5, eta = 0.001, nrounds = 100,
nthread = 2, objective = "binary:logistic", tree_method = "gpu_hist")
# predict
pred <- predict(bst, test$data)
```## Xgboost via H2O Test
`h2o` provides a nice interface to `xgboost`, along with some great tools for hyper-parameter tuning. (*Note: This is not an install of `h2o4gpu` so only `h2o.xgboost` supports GPU acceleration.*)
```{r, eval = FALSE}
# Init h2o
library(h2o)
h2o.init()# Load test data
australia_path <- system.file("extdata", "australia.csv", package = "h2o")
australia <- h2o.uploadFile(path = australia_path)
independent <- c("premax", "salmax","minairtemp", "maxairtemp", "maxsst",
"maxsoilmoist", "Max_czcs")
dependent <- "runoffnew"# Run xgboost without GPU
h2o.xgboost(y = dependent, x = independent, training_frame = australia,
ntrees = 1000, backend = "cpu")# Run xgboost with GPU
h2o.xgboost(y = dependent, x = independent, training_frame = australia,
ntrees = 1000, backend = "gpu")
```