Skip to content

Commit

Permalink
Merge pull request #178 from ufo-kit/docker
Browse files Browse the repository at this point in the history
Add NVIDIA docker for Ubuntu 20.04
  • Loading branch information
tfarago committed Feb 28, 2022
2 parents 6554665 + cba9171 commit 8c8f533
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 2 deletions.
71 changes: 71 additions & 0 deletions docker/Dockerfile.intel.ubuntu-20.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get -y upgrade && apt-get install -y \
apt-utils \
wget \
build-essential \
meson \
ninja-build \
git \
gcc \
g++ \
gobject-introspection \
make \
ca-certificates \
cmake \
liblapack-dev \
libjpeg-dev \
libtiff5-dev \
libglib2.0-dev \
libjson-glib-dev \
libopenmpi-dev \
libhdf5-dev \
libclfft-dev \
libgsl-dev \
libgirepository1.0-dev \
qt5-default \
python3 \
python3-dev \
python3-gi \
python-gi-dev \
python3-sphinx \
python3-pip \
python3-numpy \
python3-cairo \
python3-gi-cairo \
python3-sphinx \
python3-pyqt5 \
python3-pyqtgraph \
pkg-config \
fftw3-dev \
opencl-headers \
clinfo \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

ENV LD_LIBRARY_PATH /usr/local/lib/:${LD_LIBRARY_PATH}
ENV GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0:$GI_TYPELIB_PATH
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

RUN mkdir /intel && cd /intel
RUN wget https://github.com/intel/compute-runtime/releases/download/21.35.20826/intel-gmmlib_21.2.1_amd64.deb
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.8517/intel-igc-core_1.0.8517_amd64.deb
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.8517/intel-igc-opencl_1.0.8517_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/21.35.20826/intel-opencl_21.35.20826_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/21.35.20826/intel-ocloc_21.35.20826_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/21.35.20826/intel-level-zero-gpu_1.2.20826_amd64.deb
RUN dpkg -i *.deb

RUN git clone https://github.com/ufo-kit/ufo-core.git && \
git clone https://github.com/ufo-kit/ufo-filters.git && \
git clone https://github.com/ufo-kit/tofu

RUN pip3 install --upgrade pip && pip3 install setuptools
RUN pip3 install tifffile

RUN cd /ufo-core && meson build --libdir=lib -Dbashcompletiondir=$HOME/.local/share/bash-completion/completions && cd build && ninja install
RUN cd /ufo-core/python && python3 setup.py install
RUN cd /ufo-filters && meson build --libdir=lib -Dcontrib_filters=True && cd build && ninja install
RUN cd /tofu && pip3 install -r requirements-flow.txt && pip3 install -r requirements-flow.txt && python3 setup.py install
RUN rm -rf /ufo-core /ufo-filters /tofu /intel
68 changes: 68 additions & 0 deletions docker/Dockerfile.nvidia.ubuntu-20.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get -y upgrade && apt-get install -y \
apt-utils \
build-essential \
meson \
ninja-build \
git \
gcc \
g++ \
gobject-introspection \
make \
ca-certificates \
cmake \
liblapack-dev \
libjpeg-dev \
libtiff5-dev \
libglib2.0-dev \
libjson-glib-dev \
libopenmpi-dev \
libhdf5-dev \
libclfft-dev \
libgsl-dev \
libgirepository1.0-dev \
qt5-default \
python3 \
python3-dev \
python3-gi \
python-gi-dev \
python3-sphinx \
python3-pip \
python3-numpy \
python3-cairo \
python3-gi-cairo \
python3-sphinx \
python3-pyqt5 \
python3-pyqtgraph \
pkg-config \
ocl-icd-libopencl1 \
ocl-icd-opencl-dev \
fftw3-dev \
opencl-headers \
clinfo \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

ENV LD_LIBRARY_PATH /usr/local/lib/:${LD_LIBRARY_PATH}
ENV GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0:$GI_TYPELIB_PATH
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

RUN mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility

RUN git clone https://github.com/ufo-kit/ufo-core.git && \
git clone https://github.com/ufo-kit/ufo-filters.git && \
git clone https://github.com/ufo-kit/tofu

RUN pip3 install --upgrade pip && pip3 install setuptools
RUN pip3 install tifffile

RUN cd /ufo-core && meson build --libdir=lib -Dbashcompletiondir=$HOME/.local/share/bash-completion/completions && cd build && ninja install
RUN cd /ufo-core/python && python3 setup.py install
RUN cd /ufo-filters && meson build --libdir=lib -Dcontrib_filters=True && cd build && ninja install
RUN cd /tofu && pip3 install -r requirements-flow.txt && pip3 install -r requirements-flow.txt && python3 setup.py install
RUN rm -rf /ufo-core /ufo-filters /tofu
49 changes: 47 additions & 2 deletions docs/manual/install/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Before, proceeding have a look at the `Docker documentation
<https://docs.docker.com/engine/installation>`_ and install Docker on your
system.


==================
Rady-to-use Images
==================

You can pull the following images from the `ufo-kit
<https://hub.docker.com/r/tfarago/ufo-kit/>`_ repository on dockerhub without
the need of `Build`_\ing them::

docker pull tfarago/ufo-kit:ufo-nvidia-ubuntu-20.04
docker pull tfarago/ufo-kit:ufo-intel-ubuntu-20.04

=====
Build
=====
Expand Down Expand Up @@ -37,6 +49,39 @@ Run the image in a new Docker container using::
Usage on NVIDIA
===============

Install nvidia-docker and run::
Install `nvidia-container-runtime
<https://nvidia.github.io/nvidia-container-runtime/>`_ and then pull the image::

$ docker pull tfarago/ufo-kit:ufo-nvidia-ubuntu-20.04

and run::

$ docker run --rm -it --gpus all tfarago/ufo-kit:ufo-nvidia-ubuntu-20.04

If you want to use the graphical user interfaces (GUIs) run::

$ sudo xhost +local:username
$ docker run --rm -it --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY tfarago/ufo-kit:ufo-nvidia-ubuntu-20.04


===============
Usage on Intel
===============

First install the OpenCL runtime (Ubuntu-specific but it should be similar for
other distributions)::

$ sudo apt-get install intel-opencl-icd

then pull the image::

$ docker pull tfarago/ufo-kit:ufo-intel-ubuntu-20.04

and run the following::

$ docker run --rm -it --device /dev/dri:/dev/dri tfarago/ufo-kit:ufo-intel-ubuntu-20.04

or this for GUI support::

$ nvidia-docker run -it ufo
$ sudo xhost +local:username
$ docker run --rm -it --device /dev/dri:/dev/dri -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY tfarago/ufo-kit:ufo-intel-ubuntu-20.04
1 change: 1 addition & 0 deletions docs/manual/install/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ accompanying filter suite is described.
linux.rst
mac.rst
docker.rst
windows.rst
2 changes: 2 additions & 0 deletions docs/manual/install/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ vendors. However, our CMake build facility is in most cases intelligent enough
to find header files and libraries for NVIDIA CUDA and AMD APP SDKs.


.. _ubuntu20.04:

Ubuntu/Debian (Tested on Ubuntu 20.04.3 LTS)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
17 changes: 17 additions & 0 deletions docs/manual/install/windows.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. _installation-windows:

#################################
Installation on Windows with WSL2
#################################

With Windows 11 and WSL2 it is possible to use Intel OpenCL GPU support. Please
follow `Intel's documentation`_ for detailed installation procedure. Long story
short, you need to install WSL2 and Ubuntu 20.04 from Microsoft Store, then the
Intel `driver`_ *inside Windows* and then `OpenCL runtime`_ *inside Ubuntu 20.04
running in the WSL*. After that, follow the normal installation procedure
(without the nvidia packages) described in :ref:`ubuntu20.04`.


.. _Intel's documentation: https://www.intel.com/content/www/us/en/artificial-intelligence/harness-the-power-of-intel-igpu-on-your-machine.html
.. _driver: https://www.intel.com/content/www/us/en/download/19344/30579/intel-graphics-windows-dch-drivers.html?
.. _OpenCL runtime: https://github.com/intel/compute-runtime/releases/tag/21.35.20826
1 change: 1 addition & 0 deletions docs/manual/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sources = [
'install/index.rst',
'install/linux.rst',
'install/mac.rst',
'install/windows.rst',
'using/api.rst',
'using/env.rst',
'using/execution.rst',
Expand Down

0 comments on commit 8c8f533

Please sign in to comment.