-Modified Dockerfile.base to cudagl
-Changed demo to take in input from demoConfig.yaml file -Readme changes for demo.md
This commit is contained in:
+121
-38
@@ -1,57 +1,140 @@
|
||||
FROM nvidia/cuda:11.3.1-devel-ubuntu20.04
|
||||
LABEL maintainer "Francesco Gatti"
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install libcudnn8-dev=8.2.1.32-1+cuda11.3 libcudnn8=8.2.1.32-1+cuda11.3 libnvinfer-dev=8.0.3-1+cuda11.3 libnvinfer8=8.0.3-1+cuda11.3
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt install -y git wget libeigen3-dev libyaml-cpp-dev gcc-9 g++-9 libopengl-dev libgl-dev
|
||||
RUN cd /tmp && \
|
||||
wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-Linux-x86_64.sh && \
|
||||
chmod +x cmake-3.21.4-Linux-x86_64.sh && \
|
||||
./cmake-3.21.4-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license && \
|
||||
rm ./cmake-3.21.4-Linux-x86_64.sh
|
||||
FROM nvidia/cudagl:11.3.1-devel-ubuntu20.04
|
||||
|
||||
LABEL maintainer "TKDNN AUTHORS"
|
||||
LABEL Description="tkDNN+cudagl"
|
||||
LABEL com.tkdnn.nvidia.version="11.3.1"
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV CC gcc
|
||||
ENV CXX g++
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libblkid-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libcudnn8-dev=8.2.1.32-1+cuda11.3 \
|
||||
libcudnn8=8.2.1.32-1+cuda11.3 \
|
||||
libnvinfer-dev=8.0.3-1+cuda11.3 \
|
||||
libnvinfer8=8.0.3-1+cuda11.3 && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libblkid-dev \
|
||||
locales \
|
||||
lsb-release \
|
||||
mesa-utils \
|
||||
git \
|
||||
nano \
|
||||
terminator \
|
||||
wget \
|
||||
curl \
|
||||
libssl-dev \
|
||||
htop \
|
||||
dbus-x11 \
|
||||
libqt5opengl5-dev \
|
||||
libgtk-3-dev \
|
||||
libvtk7-dev \
|
||||
libv4l-dev \
|
||||
tar \
|
||||
libgoogle-glog-dev \
|
||||
libgflags-dev \
|
||||
gfortran-9 \
|
||||
libtbb-dev \
|
||||
libgstreamer1.0-dev \
|
||||
libgstreamer-plugins-base1.0-dev \
|
||||
libdc1394-22-dev \
|
||||
libavresample-dev \
|
||||
libatlas-cpp-0.6-dev \
|
||||
python3-dev \
|
||||
gdb \
|
||||
python3-pip \
|
||||
unzip libtbb-dev && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
software-properties-common && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-add-repository universe
|
||||
RUN apt-get update && apt-get install -y python3-pip python3 openssh-server ssh pyqt5-dev sip-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install --upgrade virtualenv
|
||||
RUN pip3 install --upgrade paramiko
|
||||
RUN pip3 install --ignore-installed --upgrade numpy protobuf
|
||||
|
||||
|
||||
RUN cd ~ && mkdir build
|
||||
RUN cd ~/build && wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4.tar.gz && \
|
||||
tar -xvf cmake-3.21.4.tar.gz && cd cmake-3.21.4 && ./configure --prefix=/usr/local --qt-gui --parallel=12 && \
|
||||
make -j8 && make install
|
||||
|
||||
RUN apt-get update && apt-get install -y automake autoconf pkg-config libevent-dev libncurses5-dev bison && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
RUN git clone https://github.com/tmux/tmux.git && \
|
||||
cd tmux && git checkout tags/3.2 && ls -la && sh autogen.sh && ./configure && make -j8 && make install
|
||||
|
||||
RUN apt-get update && apt-get install -y zsh && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
|
||||
RUN chsh -s /usr/bin/zsh root
|
||||
RUN git clone https://github.com/sindresorhus/pure /root/.oh-my-zsh/custom/pure
|
||||
RUN ln -s /root/.oh-my-zsh/custom/pure/pure.zsh-theme /root/.oh-my-zsh/custom/
|
||||
RUN ln -s /root/.oh-my-zsh/custom/pure/async.zsh /root/.oh-my-zsh/custom/
|
||||
RUN sed -i -e 's/robbyrussell/refined/g' /root/.zshrc
|
||||
RUN sed -i '/plugins=(/c\plugins=(git git-flow adb pyenv tmux)' /root/.zshrc
|
||||
|
||||
RUN mkdir -p /root/.config/terminator/
|
||||
COPY assets/terminator_config /root/.config/terminator/config
|
||||
|
||||
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
|
||||
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \
|
||||
echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf.d/nvidia.conf
|
||||
|
||||
|
||||
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
|
||||
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/lib:/usr/lib/x86_64-linux-gnu:/usr/local/lib:${LD_LIBRARY_PATH}
|
||||
ENV NVIDIA_VISIBLE_DEVICES all
|
||||
RUN echo "INSTALL OPENCV"
|
||||
RUN apt-get install -y build-essential \
|
||||
unzip \
|
||||
pkg-config \
|
||||
libjpeg-dev \
|
||||
libpng-dev \
|
||||
libtiff-dev \
|
||||
libavcodec-dev \
|
||||
libavformat-dev \
|
||||
libswscale-dev \
|
||||
libv4l-dev \
|
||||
libxvidcore-dev \
|
||||
libx264-dev \
|
||||
libgtk-3-dev \
|
||||
libatlas-base-dev \
|
||||
gfortran-9 \
|
||||
libtbb-dev \
|
||||
libgstreamer1.0-dev \
|
||||
libgstreamer-plugins-base1.0-dev \
|
||||
libdc1394-22-dev \
|
||||
libavresample-dev
|
||||
RUN cd && wget https://github.com/opencv/opencv/archive/4.5.4.tar.gz && tar -xf 4.5.4.tar.gz && rm *.tar.gz
|
||||
RUN cd && wget https://github.com/opencv/opencv_contrib/archive/4.5.4.tar.gz && tar -xf 4.5.4.tar.gz && rm *.tar.gz
|
||||
RUN cd && \
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics
|
||||
|
||||
|
||||
|
||||
RUN cd ~/build && wget https://github.com/opencv/opencv/archive/4.5.4.tar.gz && tar -xf 4.5.4.tar.gz && rm 4.5.4.tar.gz
|
||||
RUN cd ~/build && wget https://github.com/opencv/opencv_contrib/archive/4.5.4.tar.gz && tar -xf 4.5.4.tar.gz && rm 4.5.4.tar.gz
|
||||
RUN cd ~/build && \
|
||||
cd opencv-4.5.4 && mkdir build && cd build && \
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
||||
-D CMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-D INSTALL_PYTHON_EXAMPLES=OFF \
|
||||
-D INSTALL_C_EXAMPLES=OFF \
|
||||
-D OPENCV_EXTRA_MODULES_PATH='~/opencv_contrib-4.5.4/modules' \
|
||||
-D OPENCV_EXTRA_MODULES_PATH='~/build/opencv_contrib-4.5.4/modules' \
|
||||
-D BUILD_EXAMPLES=OFF \
|
||||
-D BUILD_TESTS=OFF \
|
||||
-D BUILD_PERF_TESTS=OFF \
|
||||
-D BUILD_DOCS=OFF \
|
||||
-D WITH_CUDA=ON \
|
||||
-D WITH_OPENGL=ON \
|
||||
-D WITH_NVCUVID=ON \
|
||||
-D CUDA_ARCH_BIN=7.2 \
|
||||
-D CUDA_ARCH_PTX="" \
|
||||
-D CUDA_ARCH_PTX=7.2 \
|
||||
-D ENABLE_FAST_MATH=ON \
|
||||
-D CUDA_FAST_MATH=ON \
|
||||
-D WITH_CUBLAS=ON \
|
||||
-D WITH_CUDNN=ON \
|
||||
-D WITH_OPENMP=ON \
|
||||
-D WITH_NONFREE=ON \
|
||||
-D WITH_LIBV4L=ON \
|
||||
-D WITH_GSTREAMER=ON \
|
||||
-D WITH_GSTREAMER_0_10=OFF \
|
||||
-D WITH_TBB=ON \
|
||||
../ && make -j12 && make install
|
||||
RUN apt clean
|
||||
../ && make -j12 && make install && ldconfig
|
||||
|
||||
RUN cd ~ && rm -rf build
|
||||
|
||||
RUN cd ~ && mkdir Development && cd Development && \
|
||||
git clone https://github.com/ceccocats/tkDNN.git && cd tkDNN && \
|
||||
mkdir build && cd build && \
|
||||
cmake -DCMAKE_BUILD_TYPE=Release .. && \
|
||||
make -j6
|
||||
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
COPY assets/entrypoint_setup.sh /
|
||||
ENTRYPOINT ["/entrypoint_setup.sh"]
|
||||
CMD ["terminator"]
|
||||
+1
-4
@@ -9,13 +9,10 @@ docker build -t tkdnn:build -f Dockerfile .
|
||||
# make nvidia docker working
|
||||
# follow this guide: https://github.com/NVIDIA/nvidia-docker
|
||||
|
||||
# dowload tensorrt
|
||||
# from: https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/7.0/7.0.0.11/local_repo/nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.0.0.11-ga-20191216_1-1_amd64.deb
|
||||
|
||||
# build image
|
||||
docker build -t ceccocats/tkdnn:latest -f Dockerfile.base .
|
||||
|
||||
# run image
|
||||
docker run -ti --gpus all --rm ceccocats/tkdnn:latest bash
|
||||
./docker_launch.sh
|
||||
```
|
||||
|
||||
|
||||
Executable
+123
@@ -0,0 +1,123 @@
|
||||
#! /bin/bash
|
||||
|
||||
CMD=
|
||||
|
||||
# Functions
|
||||
# TOOD: Check if we can use: getent passwd $USER to extract all variables
|
||||
# TODO: Check for valid inputs, cause now it will go through even with bad inputs
|
||||
check_envs () {
|
||||
DOCKER_CUSTOM_USER_OK=true;
|
||||
if [ -z ${DOCKER_USER_NAME+x} ]; then
|
||||
DOCKER_CUSTOM_USER_OK=false;
|
||||
return;
|
||||
fi
|
||||
|
||||
if [ -z ${DOCKER_USER_ID+x} ]; then
|
||||
DOCKER_CUSTOM_USER_OK=false;
|
||||
return;
|
||||
else
|
||||
if ! [ -z "${DOCKER_USER_ID##[0-9]*}" ]; then
|
||||
echo -e "\033[1;33mWarning: User-ID should be a number. Falling back to defaults.\033[0m"
|
||||
DOCKER_CUSTOM_USER_OK=false;
|
||||
return;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z ${DOCKER_USER_GROUP_NAME+x} ]; then
|
||||
DOCKER_CUSTOM_USER_OK=false;
|
||||
return;
|
||||
fi
|
||||
|
||||
if [ -z ${DOCKER_USER_GROUP_ID+x} ]; then
|
||||
DOCKER_CUSTOM_USER_OK=false;
|
||||
return;
|
||||
else
|
||||
if ! [ -z "${DOCKER_USER_GROUP_ID##[0-9]*}" ]; then
|
||||
echo -e "\033[1;33mWarning: Group-ID should be a number. Falling back to defaults.\033[0m"
|
||||
DOCKER_CUSTOM_USER_OK=false;
|
||||
return;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_env_user () {
|
||||
USER=$1
|
||||
USER_ID=$2
|
||||
GROUP=$3
|
||||
GROUP_ID=$4
|
||||
|
||||
## Create user
|
||||
useradd -m $USER
|
||||
|
||||
## Copy zsh/sh configs
|
||||
cp /root/.profile /home/$USER/
|
||||
cp /root/.bashrc /home/$USER/
|
||||
cp /root/.zshrc /home/$USER/
|
||||
## Copy terminator configs
|
||||
mkdir -p /home/$USER/.config/terminator
|
||||
cp /root/.config/terminator/config /home/$USER/.config/terminator/config
|
||||
cp /root/.config/terminator/background.png /home/$USER/.config/terminator/background.png
|
||||
cp -rf /root/.oh-my-zsh /home/$USER/
|
||||
cp -rf /root/tkDNN /home/$USER/
|
||||
rm -rf /home/$USER/.oh-my-zsh/custom/pure.zsh-theme /home/$USER/.oh-my-zsh/custom/async.zsh
|
||||
ln -s /home/$USER/.oh-my-zsh/custom/pure/pure.zsh-theme /home/$USER/.oh-my-zsh/custom/
|
||||
ln -s /home/$USER/.oh-my-zsh/custom/pure/async.zsh /home/$USER/.oh-my-zsh/custom/
|
||||
sed -i -e 's@ZSH=\"/root@ZSH=\"/home/$USER@g' /home/$USER/.zshrc
|
||||
# Copy SSH keys & fix owner
|
||||
if [ -d "/root/.ssh" ]; then
|
||||
cp -rf /root/.ssh /home/$USER/
|
||||
chown -R $USER:$GROUP /home/$USER/.ssh
|
||||
fi
|
||||
|
||||
## Fix owner
|
||||
chown $USER:$GROUP /home/$USER
|
||||
chown -R $USER:$GROUP /home/$USER/.config
|
||||
chown $USER:$GROUP /home/$USER/.profile
|
||||
chown $USER:$GROUP /home/$USER/.bashrc
|
||||
chown $USER:$GROUP /home/$USER/.zshrc
|
||||
chown -R $USER:$GROUP /home/$USER/.oh-my-zsh
|
||||
chown -R $USER:$GROUP /home/$USER/tkDNN
|
||||
|
||||
## This a trick to keep the evnironmental variables of root which is important!
|
||||
echo "if ! [ \"$DOCKER_USER_NAME\" = \"$(id -un)\" ]; then" >> /root/.bashrc
|
||||
echo " cd /home/$DOCKER_USER_NAME" >> /root/.bashrc
|
||||
echo " su $DOCKER_USER_NAME" >> /root/.bashrc
|
||||
echo "fi" >> /root/.bashrc
|
||||
|
||||
echo "if ! [ \"$DOCKER_USER_NAME\" = \"$(id -un)\" ]; then" >> /root/.zshrc
|
||||
echo " cd /home/$DOCKER_USER_NAME" >> /root/.zshrc
|
||||
echo " su $DOCKER_USER_NAME" >> /root/.zshrc
|
||||
echo "fi" >> /root/.zshrc
|
||||
|
||||
## Setup Password-file
|
||||
PASSWDCONTENTS=$(grep -v "^${USER}:" /etc/passwd)
|
||||
GROUPCONTENTS=$(grep -v -e "^${GROUP}:" -e "^docker:" /etc/group)
|
||||
|
||||
(echo "${PASSWDCONTENTS}" && echo "${USER}:x:$USER_ID:$GROUP_ID::/home/$USER:/bin/bash") > /etc/passwd
|
||||
(echo "${GROUPCONTENTS}" && echo "${GROUP}:x:${GROUP_ID}:") > /etc/group
|
||||
(if test -f /etc/sudoers ; then echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers ; fi)
|
||||
}
|
||||
|
||||
|
||||
# ---Main---
|
||||
|
||||
# Create new user
|
||||
## Check Inputs
|
||||
check_envs
|
||||
|
||||
## Determine user & Setup Environment
|
||||
if [ $DOCKER_CUSTOM_USER_OK == true ]; then
|
||||
echo " -->DOCKER_USER Input is set to '$DOCKER_USER_NAME:$DOCKER_USER_ID:$DOCKER_USER_GROUP_NAME:$DOCKER_USER_GROUP_ID'";
|
||||
echo -e "\033[0;32mSetting up environment for user=$DOCKER_USER_NAME\033[0m"
|
||||
setup_env_user $DOCKER_USER_NAME $DOCKER_USER_ID $DOCKER_USER_GROUP_NAME $DOCKER_USER_GROUP_ID
|
||||
else
|
||||
echo " -->DOCKER_USER* variables not set. Using 'root'.";
|
||||
echo -e "\033[0;32mSetting up environment for user=root\033[0m"
|
||||
DOCKER_USER_NAME="root"
|
||||
fi
|
||||
|
||||
# Change shell to zsh
|
||||
chsh -s /usr/bin/zsh $DOCKER_USER_NAME
|
||||
|
||||
# Run CMD from Docker
|
||||
"$@"
|
||||
@@ -0,0 +1,18 @@
|
||||
[global_config]
|
||||
title_transmit_bg_color = "#2e3436"
|
||||
[keybindings]
|
||||
[layouts]
|
||||
[[default]]
|
||||
[[[child1]]]
|
||||
parent = window0
|
||||
type = Terminal
|
||||
[[[window0]]]
|
||||
parent = ""
|
||||
type = Window
|
||||
[plugins]
|
||||
[profiles]
|
||||
[[default]]
|
||||
background_color = "#282828"
|
||||
cursor_color = "#aaaaaa"
|
||||
foreground_color = "#f3f3f3"
|
||||
palette = "#000000:#aa0000:#00aa00:#c4a000:#3465a4:#75507b:#06989a:#d3d7cf:#88807c:#f15d22:#73c48f:#ffce51:#48b9c7:#ad7fa8:#34e2e2:#eeeeec"
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
xhost local:root
|
||||
docker run --rm -it --runtime=nvidia --privileged --net=host --cap-add sys_ptrace -d --ipc=host \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY \
|
||||
-v $HOME/.Xauthority:/home/$(id -un)/.Xauthority -e XAUTHORITY=/home/$(id -un)/.Xauthority \
|
||||
-e DOCKER_USER_NAME=$(id -un) \
|
||||
-e DOCKER_USER_ID=$(id -u) \
|
||||
-e DOCKER_USER_GROUP_NAME=$(id -gn) \
|
||||
-e DOCKER_USER_GROUP_ID=$(id -g) \
|
||||
-v $HOME/.ssh:/home/$(id -un)/.ssh ceccocats/tkdnn
|
||||
Reference in New Issue
Block a user