提交测试

This commit is contained in:
2024-01-16 17:22:21 +08:00
parent 92862c0372
commit 73635fda01
654 changed files with 178015 additions and 2 deletions

View File

@@ -0,0 +1,68 @@
ARG CUDA_VERSION=11.6.1
ARG CUDNN_VERSION=8
FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu20.04
ARG PYTHON_VERSION=3.8
ENV PYTHON_VERSION=${PYTHON_VERSION}
ARG PYTORCH_VERSION=1.13.1
ENV PYTORCH_VERSION=${PYTORCH_VERSION}
RUN echo "Acquire { https::Verify-Peer false }" > /etc/apt/apt.conf.d/99verify-peer.conf \
&& if [ -f /etc/apt/sources.list.d/cuda.list ]; then \
rm /etc/apt/sources.list.d/cuda.list; \
fi \
&& if [ -f /etc/apt/sources.list.d/nvidia-ml.list ]; then \
rm /etc/apt/sources.list.d/nvidia-ml.list; \
fi \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ca-certificates \
&& rm /etc/apt/apt.conf.d/99verify-peer.conf \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
unzip \
gfortran \
libopenblas-dev \
liblapack-dev \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} && \
/opt/conda/bin/conda clean -ya
ENV PATH /opt/conda/bin:$PATH
RUN CUDA_MAJOR="$(echo ${CUDA_VERSION} | cut -d'.' -f1)" && \
CUDA_MINOR="$(echo ${CUDA_VERSION} | cut -d'.' -f2)" && \
CUDA_TAG="$(echo ${CUDA_MAJOR}${CUDA_MINOR})" && \
pip install --no-cache-dir torch==${PYTORCH_VERSION}+cu${CUDA_TAG} \
-f https://download.pytorch.org/whl/cu${CUDA_TAG} \
-f https://download.pytorch.org/whl/torch_stable.html
WORKDIR /tmp
RUN curl -fsSL https://deb.nodesource.com/setup_16.x --insecure | bash - \
&& apt-get install -y nodejs
RUN conda list > conda_build.txt
### Install Dash3D Requirements ###
RUN npm install -g npm@8.5.4
COPY package.json package-lock.json ./
RUN npm install

View File

@@ -0,0 +1,57 @@
FROM ubuntu:18.04
# used for cross-compilation in docker build
#
ARG PYTHON_VERSION=3.9
ENV PYTHON_VERSION=${PYTHON_VERSION}
ARG PYTORCH_VERSION=1.10.2
ENV PYTORCH_VERSION=${PYTORCH_VERSION}
RUN echo "Acquire { https::Verify-Peer false }" > /etc/apt/apt.conf.d/99verify-peer.conf \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ca-certificates \
&& rm /etc/apt/apt.conf.d/99verify-peer.conf \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
unzip \
gfortran \
libopenblas-dev \
liblapack-dev \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} && \
/opt/conda/bin/conda clean -ya
ENV PATH /opt/conda/bin:$PATH
RUN pip install --no-cache-dir torch==${PYTORCH_VERSION}+cpu \
-f https://download.pytorch.org/whl/torch_stable.html
WORKDIR /tmp
RUN curl -fsSL https://deb.nodesource.com/setup_16.x --insecure | bash -
RUN apt-get install -y nodejs
RUN conda list > conda_build.txt
### Install Dash3D Requirements ###
RUN npm install -g npm@8.5.4
COPY package.json package-lock.json ./
RUN chown -R root package.json package-lock.json
RUN npm install

View File

@@ -0,0 +1,82 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# used for cross-compilation in docker build
ARG FORCE_CUDA=1
ENV FORCE_CUDA=${FORCE_CUDA}
RUN if [ -f /etc/apt/sources.list.d/cuda.list ]; then \
rm /etc/apt/sources.list.d/cuda.list; \
fi \
&& if [ -f /etc/apt/sources.list.d/nvidia-ml.list ]; then \
rm /etc/apt/sources.list.d/nvidia-ml.list; \
fi
WORKDIR /kaolin
COPY . .
RUN echo "Acquire { https::Verify-Peer false }" > /etc/apt/apt.conf.d/99verify-peer.conf \
&& apt-get -y update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ca-certificates \
&& rm /etc/apt/apt.conf.d/99verify-peer.conf \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libgl1-mesa-dev \
libgles2-mesa-dev \
libegl1-mesa-dev \
git \
pkg-config \
libatk1.0-0 \
libatk-bridge2.0-0 \
libasound2 \
libgtk2.0-0 \
libgtk-3-0 \
libnss3 \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libgles2 \
libglvnd-dev \
curl \
cmake \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# fix for a weird pytorch bug (see: https://discuss.pytorch.org/t/not-able-to-include-cusolverdn-h/169122/5)
ENV PATH /usr/local/cuda/bin:$PATH
# for GLEW
ENV LD_LIBRARY_PATH /usr/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib:${LD_LIBRARY_PATH}
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics
## Install Dash3D Requirements ###
RUN curl -fsSL https://deb.nodesource.com/setup_16.x --insecure | bash - \
&& apt-get install -y nodejs
RUN npm install -g npm@8.5.4
RUN npm install
RUN pip install --upgrade pip && \
pip install --no-cache-dir setuptools==58.0.0 ninja \
imageio imageio-ffmpeg && \
pip install --no-cache-dir \
-r tools/viz_requirements.txt \
-r tools/requirements.txt \
-r tools/build_requirements.txt
RUN cd /tmp && \
git clone https://github.com/NVlabs/nvdiffrast && \
cd nvdiffrast && \
cp ./docker/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json && \
pip install .
RUN python setup.py develop

View File

@@ -0,0 +1,74 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN if [ -f /etc/apt/sources.list.d/cuda.list ]; then \
rm /etc/apt/sources.list.d/cuda.list; \
fi \
&& if [ -f /etc/apt/sources.list.d/nvidia-ml.list ]; then \
rm /etc/apt/sources.list.d/nvidia-ml.list; \
fi
WORKDIR /kaolin
ARG WHEEL_NAME
COPY ./package.json ./package-lock.json ./${WHEEL_NAME} ./
COPY ./examples ./examples
COPY ./sample_data ./sample_data
COPY ./tests ./tests
COPY ./tools ./tools
RUN apt-get -y update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libgl1-mesa-dev \
libgles2-mesa-dev \
libegl1-mesa-dev \
git \
pkg-config \
libatk1.0-0 \
libatk-bridge2.0-0 \
libasound2 \
libgtk2.0-0 \
libgtk-3-0 \
libnss3 \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libgles2 \
libglvnd-dev \
curl \
cmake \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# for GLEW
ENV LD_LIBRARY_PATH /usr/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib:${LD_LIBRARY_PATH}
# nvidia-container-runtime
#ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics
# Default pyopengl to EGL for good headless rendering support
ENV PYOPENGL_PLATFORM egl
## Install Dash3D Requirements ###
RUN curl -fsSL https://deb.nodesource.com/setup_16.x --insecure | bash - \
&& apt-get install -y nodejs
RUN npm install -g npm@8.5.4
RUN npm install
RUN pip install --upgrade pip && pip install ninja
RUN cd /tmp && \
git clone https://github.com/NVlabs/nvdiffrast && \
cd nvdiffrast && \
cp ./docker/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json && \
pip install .
RUN pip install ./${WHEEL_NAME}

175
tools/linux/run_tests.sh Executable file
View File

@@ -0,0 +1,175 @@
#!/bin/bash
set -o nounset
USAGE="$0 <type of test(optional)>
Run some or all Kaolin tests, saving logs to file. Summary
will be printed at the end.
To ensure everything passes, export variables such as:
export KAOLIN_TEST_SHAPENETV2_PATH=/path/to/local/shapenet
To run all tests:
bash $0 all
To run only pytest tests:
bash $0 pytest
To run only notebooks:
bash $0 notebook
To run only recipes:
bash $0 recipes
To build the docs:
bash $0 docs
"
if [ $# -ne 1 ]; then
echo -e "$USAGE"
exit 1
fi
export CLI_COLOR=1
RED='\033[1;31m'
GREEN='\033[1;32m'
NOCOLOR='\033[0m'
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
KAOLIN_ROOT=$SCRIPT_DIR/../..
cd $KAOLIN_ROOT
KAOLIN_ROOT=`pwd`
LOG_DIR=$KAOLIN_ROOT/.test_logs
mkdir -p $LOG_DIR
RUN_PYTEST=0
RUN_NOTEBOOK=0
RUN_RECIPES=0
BUILD_DOCS=0
if [ $1 == "all" ]; then
RUN_PYTEST=1
RUN_NOTEBOOK=1
RUN_RECIPES=1
BUILD_DOCS=1
elif [ $1 == "pytest" ]; then
RUN_PYTEST=1
elif [ $1 == "notebook" ]; then
RUN_NOTEBOOK=1
elif [ $1 == "recipes" ]; then
RUN_RECIPES=1
elif [ $1 == "docs" ]; then
BUILD_DOCS=1
else
echo "$RED Unknown argument type $1 $NOCOLOR"
echo -e "$USAGE"
exit 1
fi
start_test_info() {
echo "***********************************************"
echo " Running $1 Tests "
echo "***********************************************"
echo
echo " ...running, see log: $LOG_DIR/log_$1.txt"
}
STATUS=0
end_test_info() {
if [ $1 -ne 0 ]; then
STATUS=1
echo -e "$RED FAILED: $NOCOLOR $2"
else
echo -e "$GREEN SUCCESS: $NOCOLOR $2"
fi
echo
}
maybe_open_url() {
which xdg-open
if [ $? -eq 0 ]; then
xdg-open $1
fi
}
PYTEST_LOG=$LOG_DIR/log_pytest.txt
if [ $RUN_PYTEST -eq "1" ]; then
echo "" > $PYTEST_LOG
start_test_info "pytest"
CMDLINE="pytest --import-mode=importlib --cov=kaolin -s --cov-report=html --cov-report term-missing tests/python/"
$CMDLINE >> $PYTEST_LOG 2>&1
RES=$?
COV_URL=".test_coverage/index.html"
echo " HTML line-by-line test coverage available in $COV_URL"
end_test_info $RES "$CMDLINE"
maybe_open_url $COV_URL >> $PYTEST_LOG 2>&1
fi
NOTEBOOK_LOG=$LOG_DIR/log_notebook.txt
if [ $RUN_NOTEBOOK -eq "1" ]; then
echo "" > $NOTEBOOK_LOG
start_test_info "notebook"
CMDLINE="pytest --nbmake --nbmake-timeout=3000 examples/**/*.ipynb"
$CMDLINE >> $NOTEBOOK_LOG 2>&1
end_test_info $? "$CMDLINE"
fi
RECIPES_LOG=$LOG_DIR/log_recipes.txt
if [ $RUN_RECIPES -eq "1" ]; then
echo "" > $RECIPES_LOG
start_test_info "recipes"
NFAIL=0
NPASS=0
cd $KAOLIN_ROOT/examples/recipes
for F in $(find . -name "*.py" | grep -v "ipynb_checkpoints"); do
echo "Executing python $F" >> $RECIPES_LOG
python $F >> $RECIPES_LOG 2>&1
RES=$?
if [ $RES -ne 0 ]; then
echo -e "$RED failed : $NOCOLOR python $F"
NFAIL=$((NFAIL+1))
else
echo -e "$GREEN success: $NOCOLOR python $F"
NPASS=$((NPASS+1))
fi
done
end_test_info $NFAIL "python examples/recipes/**/*.py"
fi
DOCS_LOG=$LOG_DIR/log_docs.txt
if [ $BUILD_DOCS -eq "1" ]; then
echo "" > $DOCS_LOG
start_test_info "docs"
cd $KAOLIN_ROOT
rm -rf $KAOLIN_ROOT/docs/_build
echo " ...copying docs/ to build_docs/ to avoid git confusion" >> $DOCS_LOG 2>&1
mkdir -p build_docs
cp -r docs/* build_docs/.
cd build_docs
echo " ...replacing DOCS_MODULE_PATH in build_docs/kaolin_ext.py" >> $DOCS_LOG 2>&1
sed -i 's/"docs"/"build_docs"/g' kaolin_ext.py >> $DOCS_LOG 2>&1
echo " ...building docs in build_docs dir" >> $DOCS_LOG 2>&1
CMDLINE="python -m sphinx -T -E -W --keep-going -b html -d _build/doctrees -D language=en . _build/html"
$CMDLINE >> $DOCS_LOG 2>&1
RES=$?
cd $KAOLIN_ROOT
DOCS_URL="build_docs/_build/html/index.html"
echo " HTML written to $DOCS_URL"
end_test_info $RES "$CMDLINE"
maybe_open_url $DOCS_URL >> $DOCS_LOG 2>&1
fi