Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Split cuda image into cuda-runtime and cuda-devel #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 39 additions & 13 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,32 +10,58 @@ Please be aware that this project is currently **experimental**.
* Reproducible builds * Reproducible builds
* Ease of deployment * Ease of deployment
* Isolation of individual devices * Isolation of individual devices
* Run across heterogeneous driver/toolkit environments *(e.g. CUDA 7.0 and 7.5 on a single host machine)* * Run across heterogeneous driver/toolkit environments
* Requires only the NVIDIA driver * Requires only the NVIDIA driver


### Building images ### Building images


Images can be built on any machine running Docker, it doesn't require a NVIDIA GPU nor any driver installation. Images can be built on any machine running Docker, it doesn't require a NVIDIA GPU nor any driver installation.


Building images is done through the Docker CLI or using the ```nvidia-docker``` wrapper similarly: #### CUDA
Each CUDA image comes in two flavors:
* ```runtime```: a lightweight image containing the bare minimum to deploy a pre-built application which uses CUDA.
* ```devel```: extends the runtime image by adding the compiler toolchain, the debugging tools and the development files for the standard CUDA libraries. Use this image to compile a CUDA application from source.

The ```devel``` image must be built **after** the ```runtime``` image:
```sh ```sh
# With latest versions # Building a CUDA 7.5 development image based on Ubuntu
$ docker build -t cuda ubuntu/cuda/latest docker build -t cuda:7.5-runtime ubuntu/cuda/7.5/runtime
docker build -t cuda:7.5-devel ubuntu/cuda/7.5/devel
docker tag cuda:7.5-devel cuda
``` ```


```sh ```sh
# With specific versions # Building a CUDA 7.5 development image based on CentOS
$ docker build -t cuda:7.5 ubuntu-14.04/cuda/7.5 docker build -t cuda:7.5-runtime centos/cuda/7.5/runtime
docker build -t cuda:7.5-devel centos/cuda/7.5/devel
docker tag cuda:7.5-devel cuda
``` ```


Alternatively, one can build an image directly from this repository: Alternatively, one can build an image directly from this repository:
```sh ```sh
# With latest versions # Building a CUDA 7.5 development image based on Ubuntu
$ docker build -t cuda github.com/NVIDIA/nvidia-docker#:ubuntu/cuda/latest docker build -t cuda:7.5-runtime github.com/NVIDIA/nvidia-docker#:ubuntu/cuda/7.5/runtime
docker build -t cuda:7.5-devel github.com/NVIDIA/nvidia-docker#:ubuntu/cuda/7.5/devel
docker tag cuda:7.5-devel cuda
```

#### cuDNN

Currently, only cuDNN v2 based on CUDA 7.0 is supported, this image also comes in two flavors: ```cudnn-runtime``` and ```cudnn-devel```.
```sh
# Building a cuDNN image based on CUDA 7.0 runtime
docker build -t cuda:7.0-runtime ubuntu/cuda/7.0/runtime
docker build -t cuda:7.0-cudnn2-runtime ubuntu/cuda/7.0/runtime/cudnn2
docker tag cuda:7.0-cudnn2-runtime cuda:cudnn-runtime
``` ```

Building the development image requires the ``cuda:7.0-devel`` image:
```sh ```sh
# With specific versions # Building a cuDNN image based on CUDA 7.0 development
$ docker build -t cuda:7.5 github.com/NVIDIA/nvidia-docker#:ubuntu-14.04/cuda/7.5 docker build -t cuda:7.0-runtime ubuntu/cuda/7.0/runtime
docker build -t cuda:7.0-devel ubuntu/cuda/7.0/devel
docker build -t cuda:7.0-cudnn2-devel ubuntu/cuda/7.0/devel/cudnn2
docker tag cuda:7.0-cudnn2-devel cuda:cudnn-devel
``` ```


### NVIDIA Docker wrapper ### NVIDIA Docker wrapper
Expand All @@ -46,7 +72,7 @@ GPUs are exported through a list of comma-separated IDs using the environment va
The numbering is the same as reported by ```nvidia-smi``` or when running CUDA code with ```CUDA_DEVICE_ORDER=PCI_BUS_ID```, it is however **different** from the default CUDA ordering. The numbering is the same as reported by ```nvidia-smi``` or when running CUDA code with ```CUDA_DEVICE_ORDER=PCI_BUS_ID```, it is however **different** from the default CUDA ordering.


```sh ```sh
$ GPU=0,1 ./nvidia-docker <docker-options> <docker-command> <docker-args> GPU=0,1 ./nvidia-docker <docker-options> <docker-command> <docker-args>
``` ```


### CUDA requirements ### CUDA requirements
Expand All @@ -66,10 +92,10 @@ CUDA toolkit version | Minimum driver version | Minimum GPU architecture
### Samples ### Samples


Once you have built the required images, a few examples are provided in the folder ```samples```. Once you have built the required images, a few examples are provided in the folder ```samples```.
The following assumes that you have an image in your repository named ```cuda``` (see ```samples/deviceQuery/Dockerfile```): The following assumes that you have an Ubuntu-based CUDA image in your repository (see ```samples/ubuntu/deviceQuery/Dockerfile```):
```sh ```sh
# Run deviceQuery with one selected GPU # Run deviceQuery with one selected GPU
$ docker build -t device_query samples/deviceQuery $ docker build -t device_query samples/ubuntu/deviceQuery
$ GPU=0 ./nvidia-docker run device_query $ GPU=0 ./nvidia-docker run device_query


[ NVIDIA ] =INFO= Driver version: 352.39 [ NVIDIA ] =INFO= Driver version: 352.39
Expand Down
17 changes: 17 additions & 0 deletions centos-7/cuda/7.0/devel/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM cuda:7.0-runtime
MAINTAINER NVIDIA CORPORATION <digits@nvidia.com>

RUN yum install -y \
cuda-core-$CUDA_PKG_VERSION \
cuda-misc-headers-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-license-$CUDA_PKG_VERSION \
cuda-cublas-dev-$CUDA_PKG_VERSION \
cuda-cufft-dev-$CUDA_PKG_VERSION \
cuda-curand-dev-$CUDA_PKG_VERSION \
cuda-cusparse-dev-$CUDA_PKG_VERSION \
cuda-npp-dev-$CUDA_PKG_VERSION \
cuda-cudart-dev-$CUDA_PKG_VERSION \
cuda-driver-dev-$CUDA_PKG_VERSION \
gcc-c++ && \
rm -rf /var/cache/yum/*
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ COPY cuda.repo /etc/yum.repos.d/cuda.repo
ENV CUDA_VERSION 7.0 ENV CUDA_VERSION 7.0
LABEL com.nvidia.cuda.version="7.0" LABEL com.nvidia.cuda.version="7.0"


ENV CUDA_PKG_VERSION 7-0-7.0-28
RUN yum install -y \ RUN yum install -y \
cuda-toolkit-7-0-7.0-28 \ cuda-nvrtc-$CUDA_PKG_VERSION \
gcc-c++ && \ cuda-cusolver-$CUDA_PKG_VERSION \
cuda-cublas-$CUDA_PKG_VERSION \
cuda-cufft-$CUDA_PKG_VERSION \
cuda-curand-$CUDA_PKG_VERSION \
cuda-cusparse-$CUDA_PKG_VERSION \
cuda-npp-$CUDA_PKG_VERSION \
cuda-cudart-$CUDA_PKG_VERSION && \
ln -s cuda-$CUDA_VERSION /usr/local/cuda && \
rm -rf /var/cache/yum/* rm -rf /var/cache/yum/*


RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \ RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \
Expand Down
17 changes: 17 additions & 0 deletions centos-7/cuda/7.5/devel/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM cuda:7.5-runtime
MAINTAINER NVIDIA CORPORATION <digits@nvidia.com>

RUN yum install -y \
cuda-core-$CUDA_PKG_VERSION \
cuda-misc-headers-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-license-$CUDA_PKG_VERSION \
cuda-cublas-dev-$CUDA_PKG_VERSION \
cuda-cufft-dev-$CUDA_PKG_VERSION \
cuda-curand-dev-$CUDA_PKG_VERSION \
cuda-cusparse-dev-$CUDA_PKG_VERSION \
cuda-npp-dev-$CUDA_PKG_VERSION \
cuda-cudart-dev-$CUDA_PKG_VERSION \
cuda-driver-dev-$CUDA_PKG_VERSION \
gcc-c++ && \
rm -rf /var/cache/yum/*
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ COPY cuda.repo /etc/yum.repos.d/cuda.repo
ENV CUDA_VERSION 7.5 ENV CUDA_VERSION 7.5
LABEL com.nvidia.cuda.version="7.5" LABEL com.nvidia.cuda.version="7.5"


ENV CUDA_PKG_VERSION 7-5-7.5-18
RUN yum install -y \ RUN yum install -y \
cuda-toolkit-7-5-7.5-18 && \ cuda-nvrtc-$CUDA_PKG_VERSION \
cuda-cusolver-$CUDA_PKG_VERSION \
cuda-cublas-$CUDA_PKG_VERSION \
cuda-cufft-$CUDA_PKG_VERSION \
cuda-curand-$CUDA_PKG_VERSION \
cuda-cusparse-$CUDA_PKG_VERSION \
cuda-npp-$CUDA_PKG_VERSION \
cuda-cudart-$CUDA_PKG_VERSION && \
ln -s cuda-$CUDA_VERSION /usr/local/cuda && \
rm -rf /var/cache/yum/* rm -rf /var/cache/yum/*


RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \ RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \
Expand Down
1 change: 0 additions & 1 deletion centos-7/cuda/latest

This file was deleted.

6 changes: 0 additions & 6 deletions samples/bandwidthTest/Dockerfile

This file was deleted.

10 changes: 10 additions & 0 deletions samples/centos/bandwidthTest/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN yum install -y \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/cache/yum/*

WORKDIR /usr/local/cuda/samples/1_Utilities/bandwidthTest
RUN make

CMD ./bandwidthTest --mode=shmoo
10 changes: 10 additions & 0 deletions samples/centos/deviceQuery/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN yum install -y \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/cache/yum/*

WORKDIR /usr/local/cuda/samples/1_Utilities/deviceQuery
RUN make

CMD ./deviceQuery
10 changes: 10 additions & 0 deletions samples/centos/matrixMulCUBLAS/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN yum install -y \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/cache/yum/*

WORKDIR /usr/local/cuda/samples/0_Simple/matrixMulCUBLAS
RUN make

CMD ./matrixMulCUBLAS -sizemult=10
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM cuda:latest FROM cuda


CMD nvidia-smi -q CMD nvidia-smi -q
10 changes: 10 additions & 0 deletions samples/centos/vectorAdd/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN yum install -y \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/cache/yum/*

WORKDIR /usr/local/cuda/samples/0_Simple/vectorAdd
RUN make

CMD ./vectorAdd
6 changes: 0 additions & 6 deletions samples/deviceQuery/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions samples/matrixMulCUBLAS/Dockerfile

This file was deleted.

10 changes: 10 additions & 0 deletions samples/ubuntu/bandwidthTest/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN apt-get update && apt-get install -y --no-install-recommends \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/cuda/samples/1_Utilities/bandwidthTest
RUN make

CMD ./bandwidthTest --mode=shmoo
10 changes: 10 additions & 0 deletions samples/ubuntu/deviceQuery/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN apt-get update && apt-get install -y --no-install-recommends \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/cuda/samples/1_Utilities/deviceQuery
RUN make

CMD ./deviceQuery
10 changes: 10 additions & 0 deletions samples/ubuntu/matrixMulCUBLAS/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN apt-get update && apt-get install -y --no-install-recommends \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/cuda/samples/0_Simple/matrixMulCUBLAS
RUN make

CMD ./matrixMulCUBLAS -sizemult=10
3 changes: 3 additions & 0 deletions samples/ubuntu/nvidia-smi/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM cuda

CMD nvidia-smi -q
10 changes: 10 additions & 0 deletions samples/ubuntu/vectorAdd/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM cuda

RUN apt-get update && apt-get install -y --no-install-recommends \
cuda-samples-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/cuda/samples/0_Simple/vectorAdd
RUN make

CMD ./vectorAdd
6 changes: 0 additions & 6 deletions samples/vectorAdd/Dockerfile

This file was deleted.

16 changes: 16 additions & 0 deletions ubuntu-14.04/cuda/6.5/devel/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM cuda:6.5-runtime
MAINTAINER NVIDIA CORPORATION <digits@nvidia.com>

RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \
cuda-core-$CUDA_PKG_VERSION \
cuda-misc-headers-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-license-$CUDA_PKG_VERSION \
cuda-cublas-dev-$CUDA_PKG_VERSION \
cuda-cufft-dev-$CUDA_PKG_VERSION \
cuda-curand-dev-$CUDA_PKG_VERSION \
cuda-cusparse-dev-$CUDA_PKG_VERSION \
cuda-npp-dev-$CUDA_PKG_VERSION \
cuda-cudart-dev-$CUDA_PKG_VERSION \
cuda-driver-dev-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ RUN apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/r
ENV CUDA_VERSION 6.5 ENV CUDA_VERSION 6.5
LABEL com.nvidia.cuda.version="6.5" LABEL com.nvidia.cuda.version="6.5"


ENV CUDA_PKG_VERSION 6-5=6.5-19
RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \ RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \
cuda-toolkit-6-5=6.5-19 && \ cuda-cublas-$CUDA_PKG_VERSION \
cuda-cufft-$CUDA_PKG_VERSION \
cuda-curand-$CUDA_PKG_VERSION \
cuda-cusparse-$CUDA_PKG_VERSION \
cuda-npp-$CUDA_PKG_VERSION \
cuda-cudart-$CUDA_PKG_VERSION && \
ln -s cuda-$CUDA_VERSION /usr/local/cuda && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*


RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \ RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \
Expand Down
1 change: 0 additions & 1 deletion ubuntu-14.04/cuda/7.0/cudnn

This file was deleted.

18 changes: 18 additions & 0 deletions ubuntu-14.04/cuda/7.0/devel/Dockerfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM cuda:7.0-runtime
MAINTAINER NVIDIA CORPORATION <digits@nvidia.com>

RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \
cuda-core-$CUDA_PKG_VERSION \
cuda-misc-headers-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-license-$CUDA_PKG_VERSION \
cuda-nvrtc-dev-$CUDA_PKG_VERSION \
cuda-cusolver-dev-$CUDA_PKG_VERSION \
cuda-cublas-dev-$CUDA_PKG_VERSION \
cuda-cufft-dev-$CUDA_PKG_VERSION \
cuda-curand-dev-$CUDA_PKG_VERSION \
cuda-cusparse-dev-$CUDA_PKG_VERSION \
cuda-npp-dev-$CUDA_PKG_VERSION \
cuda-cudart-dev-$CUDA_PKG_VERSION \
cuda-driver-dev-$CUDA_PKG_VERSION && \
rm -rf /var/lib/apt/lists/*
1 change: 1 addition & 0 deletions ubuntu-14.04/cuda/7.0/devel/cudnn
Original file line number Original file line Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM cuda:7.0 FROM cuda:7.0-devel
MAINTAINER NVIDIA CORPORATION <digits@nvidia.com> MAINTAINER NVIDIA CORPORATION <digits@nvidia.com>


RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
curl && \ curl && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*


ENV CUDNN_VERSION 2
ENV CUDNN_DOWNLOAD_SUM 4b02cb6bf9dfa57f63bfff33e532f53e2c5a12f9f1a1b46e980e626a55f380aa ENV CUDNN_DOWNLOAD_SUM 4b02cb6bf9dfa57f63bfff33e532f53e2c5a12f9f1a1b46e980e626a55f380aa


RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v2/cudnn-6.5-linux-x64-v2.tgz -O && \ RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v2/cudnn-6.5-linux-x64-v2.tgz -O && \
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ RUN apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/r
ENV CUDA_VERSION 7.0 ENV CUDA_VERSION 7.0
LABEL com.nvidia.cuda.version="7.0" LABEL com.nvidia.cuda.version="7.0"


ENV CUDA_PKG_VERSION 7-0=7.0-28
RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \ RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \
cuda-toolkit-7-0=7.0-28 && \ cuda-nvrtc-$CUDA_PKG_VERSION \
cuda-cusolver-$CUDA_PKG_VERSION \
cuda-cublas-$CUDA_PKG_VERSION \
cuda-cufft-$CUDA_PKG_VERSION \
cuda-curand-$CUDA_PKG_VERSION \
cuda-cusparse-$CUDA_PKG_VERSION \
cuda-npp-$CUDA_PKG_VERSION \
cuda-cudart-$CUDA_PKG_VERSION && \
ln -s cuda-$CUDA_VERSION /usr/local/cuda && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*


RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \ RUN echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf && \
Expand Down
1 change: 1 addition & 0 deletions ubuntu-14.04/cuda/7.0/runtime/cudnn
Loading