Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dockerfile, add auto-launch script #1513

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 0 additions & 25 deletions docker/README.md

This file was deleted.

23 changes: 23 additions & 0 deletions script/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM nvidia/cuda:11.6.2-devel-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive

# Get all dependencies
RUN apt-get update && apt-get install -y \
git zip build-essential cmake libssl-dev python3-dev python3-pip python3-pip cmake ninja-build git wget ca-certificates ffmpeg libsm6 libxext6 &&\
rm -rf /var/lib/apt/lists/*

RUN ln -sv /usr/bin/python3 /usr/bin/python
ENV PATH="/root/.local/bin:${PATH}"
RUN wget -O /root/get-pip.py https://bootstrap.pypa.io/get-pip.py && python3 /root/get-pip.py --user

# PyTorch for CUDA 11.6
RUN pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
ENV TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX;Kepler;Kepler+Tesla;Maxwell;Maxwell+Tegra;Pascal;Volta;Turing;8.6"

RUN pip install numpy==1.23.0 llvmlite numba opencv-python tensorboardX easydict pyyaml scikit-image tqdm SharedArray open3d mayavi av2 pyquaternion kornia==0.6.8 nuscenes-devkit==1.0.5 spconv-cu116
RUN python -m pip install --user jupyter
RUN git clone https://github.com/open-mmlab/OpenPCDet.git
WORKDIR OpenPCDet
RUN python setup.py develop
RUN pip install torch-scatter==2.0.9 -f https://data.pyg.org/whl/torch-1.13.1+cu116.html

44 changes: 22 additions & 22 deletions docker/Dockerfile → script/docker/cu102.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,52 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio

# Install basics
RUN apt-get update -y \
&& apt-get install build-essential \
&& apt-get install -y apt-utils git curl ca-certificates bzip2 tree htop wget \
&& apt-get install -y libglib2.0-0 libsm6 libxext6 libxrender-dev bmon iotop g++ python3.7 python3.7-dev python3.7-distutils
&& apt-get install build-essential \
&& apt-get install -y apt-utils git curl ca-certificates bzip2 tree htop wget \
&& apt-get install -y libglib2.0-0 libsm6 libxext6 libxrender-dev bmon iotop g++ python3.7 python3.7-dev python3.7-distutils

# Install cmake v3.13.2
RUN apt-get purge -y cmake && \
mkdir /root/temp && \
cd /root/temp && \
wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz && \
tar -xzvf cmake-3.13.2.tar.gz && \
cd cmake-3.13.2 && \
bash ./bootstrap && \
make && \
make install && \
cmake --version && \
rm -rf /root/temp
mkdir /root/temp && \
cd /root/temp && \
wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz && \
tar -xzvf cmake-3.13.2.tar.gz && \
cd cmake-3.13.2 && \
bash ./bootstrap && \
make && \
make install && \
cmake --version && \
rm -rf /root/temp

# Install python
RUN ln -sv /usr/bin/python3.7 /usr/bin/python
RUN wget https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
python get-pip.py && \
rm get-pip.py

# Install python packages
RUN PIP_INSTALL="python -m pip --no-cache-dir install" && \
$PIP_INSTALL numpy==1.19.3 llvmlite numba
$PIP_INSTALL numpy==1.19.3 llvmlite numba

# Install torch and torchvision
# See https://pytorch.org/ for other options if you use a different version of CUDA
RUN pip install --user torch==1.6 torchvision==0.7.0 -f https://download.pytorch.org/whl/cu102/torch_stable.html

# Install python packages
RUN PIP_INSTALL="python -m pip --no-cache-dir install" && \
$PIP_INSTALL tensorboardX easydict pyyaml scikit-image tqdm SharedArray six
$PIP_INSTALL tensorboardX easydict pyyaml scikit-image tqdm SharedArray six

WORKDIR /root

# Install Boost geometry
RUN wget https://jaist.dl.sourceforge.net/project/boost/boost/1.68.0/boost_1_68_0.tar.gz && \
tar xzvf boost_1_68_0.tar.gz && \
cp -r ./boost_1_68_0/boost /usr/include && \
rm -rf ./boost_1_68_0 && \
rm -rf ./boost_1_68_0.tar.gz
tar xzvf boost_1_68_0.tar.gz && \
cp -r ./boost_1_68_0/boost /usr/include && \
rm -rf ./boost_1_68_0 && \
rm -rf ./boost_1_68_0.tar.gz

# A weired problem that hasn't been solved yet
RUN pip uninstall -y SharedArray && \
pip install SharedArray
pip install SharedArray

RUN pip install spconv-cu102
File renamed without changes.
24 changes: 24 additions & 0 deletions script/make_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

while [[ "$#" -gt 0 ]]; do
case $1 in
--nocache) NOCACHE="true" ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done

# Get directory of this script
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DOCKER_DIR=${SOURCE_DIR}/docker

IMAGE_NAME=openpcdet



if [[ ${NOCACHE} == 'true' ]]
then
DOCKER_BUILDKIT=1 docker build --build-arg CACHEBUST=$(date +%s) --no-cache -t ${IMAGE_NAME} ${DOCKER_DIR}
else
DOCKER_BUILDKIT=1 docker build --build-arg CACHEBUST=$(date +%s) -t ${IMAGE_NAME} ${DOCKER_DIR}
fi
27 changes: 27 additions & 0 deletions script/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

## Installation
- This Docker Image is based on cuda 11.6 and torch 1.13.1. If your nvidia-drive is able to support this version, just follow the below guidance

```bash
git clone https://github.com/open-mmlab/OpenPCDet.git
cd OpenPCDet

# For Making Docker Image
./scripts/make_image.sh

# For Making Docker Image without cache
./scripts/make_image.sh --nocache

```

## Usage

- You can launch docker image after finishing the Installation

```bash
# For Launching Docker Image temporarily
./scripts/run_image.sh

# For MakLaunchinging Docker Image permanently
./scripts/run_image.sh --keep-alive
```
36 changes: 36 additions & 0 deletions script/run_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Default arguments
PORT=$(( ${RANDOM} % 9000 + 1000 ))
IMAGE_NAME=openpcdet
COMMAND=bash
IMAGE_NAME_=${IMAGE_NAME//\//_}
IMAGE_NAME_=${IMAGE_NAME_//:/_}
GPUS_ARGS="--gpus all"

while [[ "$#" -gt 0 ]]; do
case $1 in
--keep-alive) KEEP_ALIVE="true" ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done

if [[ ${KEEP_ALIVE} == 'true' ]]
then
DOCKER_ARGS="-tid --restart always"
else
DOCKER_ARGS="-ti --rm"
fi

docker run --ipc=host --shm-size=8gb --pid=host \
${DOCKER_ARGS} \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v ${HOME}:${HOME} \
${GPUS_ARGS} \
-p 2${PORT}:8080 \
-p 3${PORT}:8097 \
-p 4${PORT}:8888 \
-p 5${PORT}:6006 \
--name ${USER}.${IMAGE_NAME_}.${PORT} \
${IMAGE_NAME} ${COMMAND}