Skip to content

Commit 1f65365

Browse files
authored
update libai dockerfile (Oneflow-Inc#276)
1 parent 8eb67dd commit 1f65365

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

docker/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04
2+
# use an older system (18.04) to avoid opencv incompatibility (issue#3524)
3+
4+
# Comment it if you are not in China
5+
RUN sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
6+
RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
7+
8+
ENV DEBIAN_FRONTEND noninteractive
9+
RUN apt-get update && apt-get install -y \
10+
python3-opencv ca-certificates python3-dev git wget sudo ninja-build
11+
RUN ln -sv /usr/bin/python3 /usr/bin/python
12+
13+
# create a non-root user
14+
ARG USER_ID=1000
15+
RUN useradd -m --no-log-init --system --uid ${USER_ID} appuser -g sudo
16+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
17+
USER appuser
18+
WORKDIR /home/appuser
19+
20+
ENV PATH="/home/appuser/.local/bin:${PATH}"
21+
RUN wget https://bootstrap.pypa.io/pip/3.6/get-pip.py && \
22+
python3 get-pip.py --user && \
23+
rm get-pip.py
24+
25+
# install dependencies
26+
# See https://pytorch.org/ for other options if you use a different version of CUDA
27+
RUN pip install --user pybind11 cmake # cmake from apt-get is too old
28+
RUN python3 -m pip install --user --pre oneflow -f https://staging.oneflow.info/branch/master/cu112
29+
30+
# install libai
31+
RUN git clone https://github.com/Oneflow-Inc/libai.git libai_repo
32+
33+
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --user -e libai_repo
34+
35+
WORKDIR /home/appuser/libai_repo

docker/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Use the container (with docker >= 19.03)
2+
3+
```shell
4+
cd docker/
5+
# Build:
6+
docker build --build-arg USER_ID=$UID -t libai:v0 .
7+
# Launch (require GPUs):
8+
docker run --gpus all -it --name libai -v /home/user/:/workspace/ --ipc host --net host libai:v0 /bin/bash
9+
```
10+
11+
You can also use the pre-built LiBai containers (the latest compatible version at time of publication can be pulled with `docker pull l1aoxingyu/libai:v0`).
12+
13+
> NOTE: If your nvidia-driver cannot support `cuda111`, you can build the base image from `cuda102`.
14+
15+
## Install new dependencies
16+
17+
Add the following to `Dockerfile` to make persistent changes.
18+
19+
```shell
20+
RUN sudo apt-get update && sudo apt-get install -y vim
21+
```
22+
23+
Or run them in the container to make temporary changes.

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def get_libai_configs() -> List[str]:
132132
"isort==5.10.1",
133133
"black==21.4b ",
134134
"autoflake",
135+
"tensorboardX",
135136
],
136137
packages=find_packages(),
137138
package_data={"libai.config": get_libai_configs()},

0 commit comments

Comments
 (0)