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

Update dependencies for docker image #153

Open
wants to merge 1 commit into
base: main
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
88 changes: 88 additions & 0 deletions dockerfiles/runtime_ubt22/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Please build this dockerfile with nvidia-container-runtime
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

# Install apt packages
RUN apt-get update && \
apt-get install -y \
wget git vim \
make \
libblas-dev liblapack-dev libatlas-base-dev\
&& \
apt-get autoclean

# Install miniconda
RUN wget -q \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda \
&& rm -f Miniconda3-latest-Linux-x86_64.sh

# Update in bashrc
RUN echo "source /opt/miniconda/etc/profile.d/conda.sh" >> /root/.bashrc && \
echo "conda deactivate" >> /root/.bashrc

# Prepare python env
ARG PY_VER
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda create -n openxrlab python=$PY_VER -y && \
conda activate openxrlab && \
conda install ffmpeg -y && \
conda clean -y --all

# Prepare pytorch env
ARG CUDA_VER
ARG TORCH_VER
ARG TORCHV_VER
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
conda install pytorch==$TORCH_VER torchvision==$TORCHV_VER pytorch-cuda=$CUDA_VER cudatoolkit=$CUDA_VER -c pytorch -c nvidia -y && \
conda clean -y --all

# Prepare pytorch3d env
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
conda install -c fvcore -c iopath -c conda-forge fvcore iopath && \
conda install -c bottler nvidiacub && \
conda install pytorch3d -c pytorch3d && \
conda clean -y --all

# Prepare pip env
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
pip install pre-commit interrogate coverage pytest && \
pip install xrprimer && \
pip cache purge

# Install build requirements
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
pip install -r https://raw.githubusercontent.com/openxrlab/xrmocap/main/requirements/build.txt && \
pip cache purge

# Install test requirements
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
pip install -r https://raw.githubusercontent.com/openxrlab/xrmocap/main/requirements/test.txt && \
pip cache purge

# Install mmhuman3d
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
cd /opt && \
git clone https://github.com/open-mmlab/mmhuman3d.git && \
cd mmhuman3d && pip install -e . && \
pip cache purge

# Re-install numpy+scipy for mm-repos and smplx
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
pip uninstall scipy numpy -y && \
pip install numpy==1.23.5 scipy==1.10.0 && \
pip cache purge

# Re-install opencv for headless system
# For cudagl base image, please remove both and re-install opencv-python
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
pip uninstall opencv-python opencv-python-headless -y && \
pip install opencv-python-headless && \
pip cache purge
30 changes: 30 additions & 0 deletions dockerfiles/runtime_ubt22/build_runtime_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
CUDA_VER=11.8
PY_VER=3.10
MMCV_VER=1.7.0
TORCH_VER=2.0.1
TORCHV_VER=0.15.2
CUDA_VER_DIGIT=${CUDA_VER//./}
PY_VER_DIGIT=${PY_VER//./}
MMCV_VER_DIGIT=${MMCV_VER//./}
TORCH_VER_DIGIT=${TORCH_VER//./}
FINAL_TAG="openxrlab/xrmocap_runtime:ubuntu2204_x64_cuda${CUDA_VER_DIGIT}_py${PY_VER_DIGIT}_torch${TORCH_VER_DIGIT}_mmcv${MMCV_VER_DIGIT}"
echo "tag to build: $FINAL_TAG"
BUILD_ARGS="--build-arg CUDA_VER=${CUDA_VER} --build-arg PY_VER=${PY_VER} --build-arg MMCV_VER=${MMCV_VER} --build-arg TORCH_VER=${TORCH_VER} --build-arg TORCHV_VER=${TORCHV_VER}"
# build according to Dockerfile
TAG=${FINAL_TAG}_not_compatible
docker build -t $TAG -f dockerfiles/runtime_ubt18/Dockerfile $BUILD_ARGS --progress=plain .
# Install mpr and mmcv-full with GPU
CONTAINER_ID=$(docker run -it --gpus all -d $TAG)
docker exec -ti $CONTAINER_ID sh -c "
. /opt/miniconda/etc/profile.d/conda.sh && \
conda activate openxrlab && \
pip install -U openmim && \
mim install mmcv-full==${MMCV_VER} && \
pip install git+https://github.com/rmbashirov/minimal_pytorch_rasterizer.git && \
pip cache purge
"
docker commit $CONTAINER_ID $FINAL_TAG
docker rm -f $CONTAINER_ID
docker rmi $TAG
echo "Successfully tagged $FINAL_TAG"
2 changes: 1 addition & 1 deletion docs/en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ We provide a Dockerfile to build a runtime image. Ensure that you are using [doc
Or pull a built image from docker hub.

```shell
docker pull openxrlab/xrmocap_runtime:ubuntu1804_x64_cuda116_py38_torch1121_mmcv161
docker pull openxrlab/xrmocap_runtime:ubuntu2204_x64_cuda118_py310_torch201_mmcv170
```

Run it with:
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
TAG="openxrlab/xrmocap_runtime:ubuntu1804_x64_cuda116_py38_torch1121_mmcv161"
TAG="openxrlab/xrmocap_runtime:ubuntu2204_x64_cuda118_py310_torch201_mmcv170"
# modify data mount below
VOLUMES="-v $PWD:/workspace/xrmocap -v /data:/workspace/xrmocap/data"
WORKDIR="-w /workspace/xrmocap"
Expand Down