This repository contains images for machine learning and GPU-based computation in R. EDIT Dockerfiles are now built in modular build system at https://github.com/rocker-org/rocker-versioned2 . This repo remains for documentation around the ML part of the stack.
The dependency stack looks like so:
-| rocker/cuda
-| rocker/ml
-| rocker/ml-verse
All three are CUDA compatible and will optionally take R version tags (rocker/ml:4.0.5
) with the option of additional trailing CUDA version tag (e.g. rocker/ml:4.0.5-cuda10.1
).
Note: GPU use requires nvidia-docker runtime to run!
Run a bash shell or R command line:
# CPU-only
docker run --rm -ti rocker/ml R
# Machines with nvidia-docker and GPU support
docker run --gpus all --rm -ti rocker/ml R
Or run in RStudio instance:
docker run --gpus all -e PASSWORD=mu -p 8787:8787 rocker/ml
See current ml
tags
See current ml-verse
tags
The ML images configure a default python virtualenv using the Ubuntu system python (3.8.5 for current Ubuntu 20.04 LTS), see install_python.sh. This virtualenv is user-writable and the default detected by reticulate
(using WORKON_HOME
and PYTHON_VENV_PATH
variables).
Images also configure pipenv with pyenv by default. This makes it very easy to manage projects that require specific versions of Python as well as specific python modules. For instance, a project using the popular [greta](https://greta-stats.org/)
package for GPU-accelerated Bayesian inference needs Tensorflow 1.x, which requires Python <= 3.7, might do:
pipenv --python 3.7
In the bash terminal to set up a pipenv-managed virtualenv in the working directory using Python 3.7. Then in R we can activate this virtualenv
venv <- system("pipenv --venv", inter = TRUE)
reticulate::use_virtualenv(venv, required = TRUE)
We can now install tensorflow version needed, e.g.
install.packages("tensorflow")
tensorflow::install_tensorflow(version="1.14.0-gpu", extra_packages="tensorflow-probability==0.7.0")
All images are based on the current Ubuntu LTS (ubuntu 20.04) and based on the official NVIDIA CUDA docker build recipes
PLEASE NOTE: older images, rocker/ml-gpu
, rocker/tensorflow
and rocker/tensorflow-gpu
, built with cuda 9.0, are deprecated and no longer supported.