forked from taichi-dev/taichi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Add Dockerfile to support minimum CPU (taichi-dev#3277)
* Add Dockerfile to support minimum cpu * Add image for 18.04
- Loading branch information
Showing
3 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Taichi Dockerfile for development | ||
FROM ubuntu:18.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
LABEL maintainer="https://github.com/taichi-dev" | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y software-properties-common \ | ||
python3-pip \ | ||
libtinfo-dev \ | ||
clang-10 \ | ||
wget \ | ||
git \ | ||
unzip \ | ||
zlib1g-dev \ | ||
libx11-xcb-dev | ||
|
||
# Install the latest version of CMAKE v3.20.5 from source | ||
WORKDIR / | ||
RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.tar.gz | ||
RUN tar xf cmake-3.20.5-linux-x86_64.tar.gz && \ | ||
rm cmake-3.20.5-linux-x86_64.tar.gz | ||
ENV PATH="/cmake-3.20.5-linux-x86_64/bin:$PATH" | ||
|
||
# Intall LLVM 10 | ||
WORKDIR / | ||
# Make sure this URL gets updated each time there is a new prebuilt bin release | ||
RUN wget https://github.com/taichi-dev/taichi_assets/releases/download/llvm10_linux_patch2/taichi-llvm-10.0.0-linux.zip | ||
RUN unzip taichi-llvm-10.0.0-linux.zip && \ | ||
rm taichi-llvm-10.0.0-linux.zip | ||
ENV PATH="/taichi-llvm-10.0.0-linux/bin:$PATH" | ||
# Use Clang as the default compiler | ||
ENV CC="clang-10" | ||
ENV CXX="clang++-10" | ||
|
||
# Create non-root user for running the container | ||
RUN useradd -ms /bin/bash dev | ||
WORKDIR /home/dev | ||
USER dev | ||
|
||
# Install miniconda | ||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ | ||
bash Miniconda3-latest-Linux-x86_64.sh -p /home/dev/miniconda -b | ||
ENV PATH="/home/dev/miniconda/bin:$PATH" | ||
|
||
# Set up multi-python environment | ||
RUN conda init bash | ||
RUN conda create -n py36 python=3.6 -y | ||
RUN conda create -n py37 python=3.7 -y | ||
RUN conda create -n py38 python=3.8 -y | ||
RUN conda create -n py39 python=3.9 -y | ||
|
||
# Load scripts for build and test | ||
WORKDIR /home/dev/scripts | ||
COPY ci/scripts/ubuntu_build_test_cpu.sh ubuntu_build_test_cpu.sh | ||
|
||
WORKDIR /home/dev | ||
ENV LANG="C.UTF-8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Taichi Dockerfile for development | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
LABEL maintainer="https://github.com/taichi-dev" | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y software-properties-common \ | ||
python3-pip \ | ||
libtinfo-dev \ | ||
clang-10 \ | ||
wget \ | ||
git \ | ||
unzip \ | ||
libx11-xcb-dev | ||
|
||
# Install the latest version of CMAKE v3.20.5 from source | ||
WORKDIR / | ||
RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.tar.gz | ||
RUN tar xf cmake-3.20.5-linux-x86_64.tar.gz && \ | ||
rm cmake-3.20.5-linux-x86_64.tar.gz | ||
ENV PATH="/cmake-3.20.5-linux-x86_64/bin:$PATH" | ||
|
||
# Intall LLVM 10 | ||
WORKDIR / | ||
# Make sure this URL gets updated each time there is a new prebuilt bin release | ||
RUN wget https://github.com/taichi-dev/taichi_assets/releases/download/llvm10_linux_patch2/taichi-llvm-10.0.0-linux.zip | ||
RUN unzip taichi-llvm-10.0.0-linux.zip && \ | ||
rm taichi-llvm-10.0.0-linux.zip | ||
ENV PATH="/taichi-llvm-10.0.0-linux/bin:$PATH" | ||
# Use Clang as the default compiler | ||
ENV CC="clang-10" | ||
ENV CXX="clang++-10" | ||
|
||
# Create non-root user for running the container | ||
RUN useradd -ms /bin/bash dev | ||
WORKDIR /home/dev | ||
USER dev | ||
|
||
# Install miniconda | ||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ | ||
bash Miniconda3-latest-Linux-x86_64.sh -p /home/dev/miniconda -b | ||
ENV PATH="/home/dev/miniconda/bin:$PATH" | ||
|
||
# Set up multi-python environment | ||
RUN conda init bash | ||
RUN conda create -n py36 python=3.6 -y | ||
RUN conda create -n py37 python=3.7 -y | ||
RUN conda create -n py38 python=3.8 -y | ||
RUN conda create -n py39 python=3.9 -y | ||
|
||
# Load scripts for build and test | ||
WORKDIR /home/dev/scripts | ||
COPY ci/scripts/ubuntu_build_test_cpu.sh ubuntu_build_test_cpu.sh | ||
|
||
WORKDIR /home/dev | ||
ENV LANG="C.UTF-8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# Parse ARGs | ||
for ARGUMENT in "$@" | ||
do | ||
KEY=$(echo $ARGUMENT | cut -f1 -d=) | ||
VALUE=$(echo $ARGUMENT | cut -f2 -d=) | ||
case "$KEY" in | ||
SHA) SHA=${VALUE} ;; | ||
PY) PY=${VALUE} ;; | ||
*) | ||
esac | ||
done | ||
|
||
source /home/dev/miniconda/etc/profile.d/conda.sh | ||
conda activate $PY | ||
|
||
# Build Taichi from source | ||
git clone --recursive https://github.com/taichi-dev/taichi --branch=master | ||
cd taichi | ||
git checkout $SHA | ||
python3 -m pip install -r requirements_dev.txt -i http://repo.taichigraphics.com/repository/pypi/simple --trusted-host repo.taichigraphics.com | ||
TAICHI_CMAKE_ARGS="-DTI_WITH_VULKAN:BOOL=OFF -DTI_WITH_CUDA:BOOL=OFF -DTI_WITH_OPENGL:BOOL=OFF" python3 setup.py install | ||
|
||
# Add Docker specific ENV | ||
export TI_IN_DOCKER=true | ||
|
||
# Run tests | ||
ti diagnose | ||
ti test -vr2 -t2 -k "not ndarray and not torch" | ||
ti test -vr2 -t1 -k "ndarray or torch" |