Commit b65c2212 by Tianqi Chen

[TEST] Checkin test docker and scripts (#48)

parent 950aa1a0
#!groovy
// -*- mode: groovy -*-
// Jenkins pipeline
// See documents at https://jenkins.io/doc/book/pipeline/jenkinsfile/
// nnvm libraries
nnvm_lib = "tvm/lib/libtvm.so, tvm/lib/libtvm_runtime.so, lib/libnnvm_top.so, config.mk"
// command to start a docker container
docker_run = 'tests/ci_build/ci_build.sh'
// timeout in minutes
max_time = 60
// initialize source codes
def init_git() {
checkout scm
retry(5) {
timeout(time: 2, unit: 'MINUTES') {
sh 'git submodule update --init --recursive'
}
}
}
def init_git_win() {
checkout scm
retry(5) {
timeout(time: 2, unit: 'MINUTES') {
bat 'git submodule update --init --recursive'
}
}
}
stage("Sanity Check") {
timeout(time: max_time, unit: 'MINUTES') {
node('linux') {
ws('workspace/tvm/sanity') {
init_git()
sh "${docker_run} lint ./tests/scripts/task_lint.sh"
}
}
}
}
// Run make. First try to do an incremental make from a previous workspace in hope to
// accelerate the compilation. If something wrong, clean the workspace and then
// build from scratch.
def make(docker_type, make_flag) {
timeout(time: max_time, unit: 'MINUTES') {
try {
sh "${docker_run} ${docker_type} ./tests/script/task_build.sh ${make_flag}"
} catch (exc) {
echo 'Incremental compilation failed. Fall back to build from scratch'
sh "${docker_run} ${docker_type} ./tests/script/task_clean.sh"
sh "${docker_run} ${docker_type} ./tests/script/task_build.sh ${make_flag}"
}
}
}
// pack libraries for later use
def pack_lib(name, libs) {
sh """
echo "Packing ${libs} into ${name}"
echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
"""
stash includes: libs, name: name
}
// unpack libraries saved before
def unpack_lib(name, libs) {
unstash name
sh """
echo "Unpacked ${libs} from ${name}"
echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
"""
}
stage('Build') {
timeout(time: max_time, unit: 'MINUTES') {
node('GPU' && 'linux') {
ws('workspace/nnvm/build-gpu') {
init_git()
make('gpu', '-j2')
pack_lib('gpu', nnvm_lib)
}
}
}
}
stage('Tests') {
parallel 'python': {
node('GPU' && 'linux') {
ws('workspace/nnvm/it-python-gpu') {
init_git()
unpack_lib('gpu', nnvm_lib)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} gpu ./tests/scripts/task_python_test.sh"
sh "${docker_run} gpu ./tests/scripts/task_frontend_test.sh"
}
}
}
},
'docs': {
node('GPU' && 'linux') {
ws('workspace/nnvm/docs-python-gpu') {
init_git()
unpack_lib('gpu', nnvm_lib)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} gpu ./tests/scripts/task_python_docs.sh"
}
pack_lib('mydocs', 'docs.tgz')
}
}
}
}
stage('Deploy') {
node('docker' && 'doc') {
ws('workspace/nnvm/deploy-docs') {
if (env.BRANCH_NAME == "master") {
unpack_lib('mydocs', 'docs.tgz')
sh "tar xf docs.tgz -C /var/docs"
}
}
}
}
...@@ -38,7 +38,7 @@ PLUGIN_OBJ = ...@@ -38,7 +38,7 @@ PLUGIN_OBJ =
include $(NNVM_PLUGINS) include $(NNVM_PLUGINS)
# specify tensor path # specify tensor path
.PHONY: clean all test lint pylint doc cython cython3 cyclean .PHONY: clean all test lint cpplint pylint doc cython cython3 cyclean
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
...@@ -87,7 +87,9 @@ cython3: ...@@ -87,7 +87,9 @@ cython3:
cyclean: cyclean:
rm -rf python/nnvm/*/*.so python/nnvm/*/*.dylib python/nnvm/*/*.cpp rm -rf python/nnvm/*/*.so python/nnvm/*/*.dylib python/nnvm/*/*.cpp
lint: pylint lint: pylint cpplint
cpplint:
python dmlc-core/scripts/lint.py nnvm cpp include src python dmlc-core/scripts/lint.py nnvm cpp include src
pylint: pylint:
......
/*! /*!
* Copyright (c) 2017 by Contributors * Copyright (c) 2017 by Contributors
* \file op_attr_types.h * \file nnvm/compiler/op_attr_types.h
* \brief The Expr and related elements in DataFlow construction. * \brief The Expr and related elements in DataFlow construction.
*/ */
#ifndef NNVM_COMPILER_OP_ATTR_TYPES_H_ #ifndef NNVM_COMPILER_OP_ATTR_TYPES_H_
......
/*! /*!
* Copyright (c) 2016 by Contributors * Copyright (c) 2016 by Contributors
* \file op_attr_types.h * \file nnvm/op_attr_types.h
* \brief Data structures that can appear in operator attributes. * \brief Data structures that can appear in operator attributes.
*/ */
#ifndef NNVM_OP_ATTR_TYPES_H_ #ifndef NNVM_OP_ATTR_TYPES_H_
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
""" ctypes library of nnvm and helper functions """ """ ctypes library of nnvm and helper functions """
from __future__ import absolute_import from __future__ import absolute_import
import os
import sys import sys
import ctypes import ctypes
import numpy as np import numpy as np
...@@ -44,7 +45,8 @@ def _load_lib(): ...@@ -44,7 +45,8 @@ def _load_lib():
__version__ = libinfo.__version__ __version__ = libinfo.__version__
# library instance of nnvm # library instance of nnvm
_LIB = _load_lib() _LIB = _load_lib()
# The FFI mode of TVM
_FFI_MODE = os.environ.get("TVM_FFI", "auto")
# type definitions # type definitions
nn_uint = ctypes.c_uint nn_uint = ctypes.c_uint
......
...@@ -11,21 +11,24 @@ import ctypes as _ctypes ...@@ -11,21 +11,24 @@ import ctypes as _ctypes
from numbers import Number as _Number from numbers import Number as _Number
from . import _base from . import _base
from ._base import _LIB, check_call as _check_call from ._base import _LIB, check_call as _check_call, _FFI_MODE
from .attribute import AttrScope from .attribute import AttrScope
from . import _symbol_internal as _internal from . import _symbol_internal as _internal
# Use different verison of SymbolBase # Use different verison of SymbolBase
# When possible, use cython to speedup part of computation. # When possible, use cython to speedup part of computation.
IMPORT_EXCEPT = RuntimeError if _FFI_MODE == "cython" else ImportError
try: try:
if int(_os.environ.get("MXNET_ENABLE_CYTHON", True)) == 0: if _FFI_MODE == "ctypes":
from ._ctypes.symbol import SymbolBase, _init_symbol_module raise ImportError()
elif _sys.version_info >= (3, 0): if _sys.version_info >= (3, 0):
from ._cy3.symbol import SymbolBase, _init_symbol_module from ._cy3.symbol import SymbolBase, _init_symbol_module
else: else:
from ._cy2.symbol import SymbolBase, _init_symbol_module from ._cy2.symbol import SymbolBase, _init_symbol_module
except ImportError: except IMPORT_EXCEPT:
# pylint: disable=wrong-import-position
from ._ctypes.symbol import SymbolBase, _init_symbol_module from ._ctypes.symbol import SymbolBase, _init_symbol_module
......
...@@ -3,6 +3,9 @@ import sys ...@@ -3,6 +3,9 @@ import sys
from distutils.core import setup from distutils.core import setup
def config_cython(): def config_cython():
# temporary disable cython for now
# as NNVM uses local DLL build
return []
try: try:
from Cython.Build import cythonize from Cython.Build import cythonize
from distutils.extension import Extension from distutils.extension import Extension
......
FROM nvidia/cuda:8.0-cudnn7-devel
# Base scripts
RUN apt-get update --fix-missing
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
RUN bash /install/ubuntu_install_core.sh
COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
RUN bash /install/ubuntu_install_python.sh
COPY install/ubuntu_install_llvm.sh /install/ubuntu_install_llvm.sh
RUN bash /install/ubuntu_install_llvm.sh
COPY install/ubuntu_install_opencl.sh /install/ubuntu_install_opencl.sh
RUN bash /install/ubuntu_install_opencl.sh
COPY install/ubuntu_install_python_package.sh /install/ubuntu_install_python_package.sh
RUN bash /install/ubuntu_install_python_package.sh
COPY install/ubuntu_install_sphinx.sh /install/ubuntu_install_sphinx.sh
RUN bash /install/ubuntu_install_sphinx.sh
# Fix recommonmark to latest version
RUN git clone https://github.com/rtfd/recommonmark
RUN cd recommonmark; python setup.py install
# Enable doxygen for c++ doc build
RUN apt-get update && apt-get install -y doxygen graphviz libprotobuf-dev protobuf-compiler
# DL Frameworks
COPY install/ubuntu_install_mxnet.sh /install/ubuntu_install_mxnet.sh
RUN bash /install/ubuntu_install_mxnet.sh
COPY install/ubuntu_install_onnx.sh /install/ubuntu_install_onnx.sh
RUN bash /install/ubuntu_install_onnx.sh
# Environment variables
ENV PATH=/usr/local/nvidia/bin:${PATH}
ENV PATH=/usr/local/cuda/bin:${PATH}
ENV CPLUS_INCLUDE_PATH=/usr/local/cuda/include:${CPLUS_INCLUDE_PATH}
ENV C_INCLUDE_PATH=/usr/local/cuda/include:${C_INCLUDE_PATH}
ENV LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/nvidia/lib64:${LIBRARY_PATH}
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
# For lint test
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y python-pip sudo
RUN apt-get install -y doxygen graphviz
RUN pip install cpplint pylint
# CI Build Scripts
This directory contains the files and setup instructions to run all tests.
## Run locally
To run locally, we need to first install
[docker](https://docs.docker.com/engine/installation/) and
[nvidia-docker](https://github.com/NVIDIA/nvidia-docker/wiki).
Then we can run the tasks defined in the [Jenkinsfile](../../Jenkinsfile) by
using (`ci_build.sh`)[./ci_build.sh]. For example
- lint the python codes
```bash
./ci_build.sh lint make pylint
```
- build codes with CUDA supports
```bash
./ci_build.sh gpu tests/scripts/task_build.sh
```
- do the python unittest
```bash
./ci_build.sh gpu tests/scripts/task_python_test.sh
```
- build the documents. The results will be available at `docs/_build/html`
```bash
tests/ci_build/ci_build.sh gpu tests/scripts/task_python_docs.sh
```
#!/usr/bin/env bash
#
# Execute command within a docker container
#
# Usage: ci_build.sh <CONTAINER_TYPE> [--dockerfile <DOCKERFILE_PATH>] [-it]
# <COMMAND>
#
# CONTAINER_TYPE: Type of the docker container used the run the build: e.g.,
# (cpu | gpu)
#
# DOCKERFILE_PATH: (Optional) Path to the Dockerfile used for docker build. If
# this optional value is not supplied (via the --dockerfile
# flag), will use Dockerfile.CONTAINER_TYPE in default
#
# COMMAND: Command to be executed in the docker container
#
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Get the command line arguments.
CONTAINER_TYPE=$( echo "$1" | tr '[:upper:]' '[:lower:]' )
shift 1
# Dockerfile to be used in docker build
DOCKERFILE_PATH="${SCRIPT_DIR}/Dockerfile.${CONTAINER_TYPE}"
DOCKER_CONTEXT_PATH="${SCRIPT_DIR}"
if [[ "$1" == "--dockerfile" ]]; then
DOCKERFILE_PATH="$2"
DOCKER_CONTEXT_PATH=$(dirname "${DOCKERFILE_PATH}")
echo "Using custom Dockerfile path: ${DOCKERFILE_PATH}"
echo "Using custom docker build context path: ${DOCKER_CONTEXT_PATH}"
shift 2
fi
if [[ "$1" == "-it" ]]; then
CI_DOCKER_EXTRA_PARAMS+=('-it')
shift 1
fi
if [[ ! -f "${DOCKERFILE_PATH}" ]]; then
echo "Invalid Dockerfile path: \"${DOCKERFILE_PATH}\""
exit 1
fi
COMMAND=("$@")
# Validate command line arguments.
if [ "$#" -lt 1 ] || [ ! -e "${SCRIPT_DIR}/Dockerfile.${CONTAINER_TYPE}" ]; then
supported_container_types=$( ls -1 ${SCRIPT_DIR}/Dockerfile.* | \
sed -n 's/.*Dockerfile\.\([^\/]*\)/\1/p' | tr '\n' ' ' )
echo "Usage: $(basename $0) CONTAINER_TYPE COMMAND"
echo " CONTAINER_TYPE can be one of [${supported_container_types}]"
echo " COMMAND is a command (with arguments) to run inside"
echo " the container."
exit 1
fi
# Use nvidia-docker if the container is GPU.
if [[ "${CONTAINER_TYPE}" == *"gpu"* ]]; then
DOCKER_BINARY="nvidia-docker"
else
DOCKER_BINARY="docker"
fi
# Helper function to traverse directories up until given file is found.
function upsearch () {
test / == "$PWD" && return || \
test -e "$1" && echo "$PWD" && return || \
cd .. && upsearch "$1"
}
# Set up WORKSPACE and BUILD_TAG. Jenkins will set them for you or we pick
# reasonable defaults if you run it outside of Jenkins.
WORKSPACE="${WORKSPACE:-${SCRIPT_DIR}/../../}"
BUILD_TAG="${BUILD_TAG:-nnvm-ci}"
# Determine the docker image name
DOCKER_IMG_NAME="${BUILD_TAG}.${CONTAINER_TYPE}"
# Under Jenkins matrix build, the build tag may contain characters such as
# commas (,) and equal signs (=), which are not valid inside docker image names.
DOCKER_IMG_NAME=$(echo "${DOCKER_IMG_NAME}" | sed -e 's/=/_/g' -e 's/,/-/g')
# Convert to all lower-case, as per requirement of Docker image names
DOCKER_IMG_NAME=$(echo "${DOCKER_IMG_NAME}" | tr '[:upper:]' '[:lower:]')
# Print arguments.
echo "WORKSPACE: ${WORKSPACE}"
echo "CI_DOCKER_EXTRA_PARAMS: ${CI_DOCKER_EXTRA_PARAMS[@]}"
echo "COMMAND: ${COMMAND[@]}"
echo "CONTAINER_TYPE: ${CONTAINER_TYPE}"
echo "BUILD_TAG: ${BUILD_TAG}"
echo "DOCKER CONTAINER NAME: ${DOCKER_IMG_NAME}"
echo ""
# Build the docker container.
echo "Building container (${DOCKER_IMG_NAME})..."
docker build -t ${DOCKER_IMG_NAME} \
-f "${DOCKERFILE_PATH}" "${DOCKER_CONTEXT_PATH}"
# Check docker build status
if [[ $? != "0" ]]; then
echo "ERROR: docker build failed."
exit 1
fi
# Run the command inside the container.
echo "Running '${COMMAND[@]}' inside ${DOCKER_IMG_NAME}..."
# By default we cleanup - remove the container once it finish running (--rm)
# and share the PID namespace (--pid=host) so the process inside does not have
# pid 1 and SIGKILL is propagated to the process inside (jenkins can kill it).
echo ${DOCKER_BINARY}
${DOCKER_BINARY} run --rm --pid=host \
-v ${WORKSPACE}:/workspace \
-w /workspace \
-e "CI_BUILD_HOME=/workspace" \
-e "CI_BUILD_USER=$(id -u -n)" \
-e "CI_BUILD_UID=$(id -u)" \
-e "CI_BUILD_GROUP=$(id -g -n)" \
-e "CI_BUILD_GID=$(id -g)" \
${CI_DOCKER_EXTRA_PARAMS[@]} \
${DOCKER_IMG_NAME} \
bash tests/ci_build/with_the_same_user \
${COMMAND[@]}
# install libraries for building c++ core on ubuntu
apt-get install -y --no-install-recommends --force-yes \
git make libgtest-dev cmake wget unzip libtinfo-dev libz-dev\
libcurl4-openssl-dev libopenblas-dev g++ sudo
cd /usr/src/gtest && cmake CMakeLists.txt && make && cp *.a /usr/lib
echo deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main\
>> /etc/apt/sources.list.d/llvm.list
echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main\
>> /etc/apt/sources.list.d/llvm.list
echo deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main\
>> /etc/apt/sources.list.d/llvm.list
echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main\
>> /etc/apt/sources.list.d/llvm.list
echo deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\
>> /etc/apt/sources.list.d/llvm.list
echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\
>> /etc/apt/sources.list.d/llvm.list
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0
pip2 install mxnet
pip3 install mxnet
pip2 install onnx
pip3 install onnx
pip2 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
pip2 install torchvision
pip3 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl
pip3 install torchvision
# Install OpenCL runtime in nvidia docker.
apt-get install -y --no-install-recommends --force-yes \
ocl-icd-libopencl1 \
clinfo && \
rm -rf /var/lib/apt/lists/*
mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
# install python and pip, don't modify this, modify install_python_package.sh
apt-get update && apt-get install -y python-pip python-dev python3-dev
# the version of the pip shipped with ubuntu may be too lower, install a recent version here
cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && python2 get-pip.py
# install libraries for python package on ubuntu
pip2 install nose pylint numpy nose-timer cython decorator scipy tornado
pip3 install nose pylint numpy nose-timer cython decorator scipy tornado
pip install sphinx==1.6.2 sphinx-gallery sphinx_rtd_theme matplotlib Image commonmark>=0.7.3 docutils>=0.11
#!/usr/bin/env bash
# This script is a wrapper creating the same user inside container as the one
# running the ci_build.sh outside the container. It also set the home directory
# for the user inside container to match the same absolute path as the workspace
# outside of container. Do not run this manually. It does not make sense. It is
# intended to be called by ci_build.sh only.
set -e
COMMAND=("$@")
if ! touch /this_is_writable_file_system; then
echo "You can't write to your filesystem!"
echo "If you are in Docker you should check you do not have too many images" \
"with too many files in them. Docker has some issue with it."
exit 1
else
rm /this_is_writable_file_system
fi
getent group "${CI_BUILD_GID}" || addgroup --gid "${CI_BUILD_GID}" "${CI_BUILD_GROUP}"
getent passwd "${CI_BUILD_UID}" || adduser --gid "${CI_BUILD_GID}" --uid "${CI_BUILD_UID}" \
--gecos "${CI_BUILD_USER} (generated by with_the_same_user script)" \
--disabled-password --home "${CI_BUILD_HOME}" --quiet "${CI_BUILD_USER}"
usermod -a -G sudo "${CI_BUILD_USER}"
echo "${CI_BUILD_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-nopasswd-sudo
HOME=${CI_BUILD_HOME}\
sudo -u "#${CI_BUILD_UID}" --preserve-env\
PATH=${PATH}\
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}\
HOME=${CI_BUILD_HOME}\
${COMMAND[@]}
...@@ -11,7 +11,8 @@ import mxnet as mx ...@@ -11,7 +11,8 @@ import mxnet as mx
import model_zoo import model_zoo
def test_mxnet_frontend_impl(mx_symbol, data_shape=(1, 3, 224, 224), out_shape=(1, 1000)): def verify_mxnet_frontend_impl(mx_symbol, data_shape=(1, 3, 224, 224), out_shape=(1, 1000)):
"""Use name different from test to avoid let nose pick it up"""
def get_mxnet_output(symbol, x, dtype='float32'): def get_mxnet_output(symbol, x, dtype='float32'):
from collections import namedtuple from collections import namedtuple
Batch = namedtuple('Batch', ['data']) Batch = namedtuple('Batch', ['data'])
...@@ -48,17 +49,17 @@ def test_mxnet_frontend_impl(mx_symbol, data_shape=(1, 3, 224, 224), out_shape=( ...@@ -48,17 +49,17 @@ def test_mxnet_frontend_impl(mx_symbol, data_shape=(1, 3, 224, 224), out_shape=(
def test_forward_mlp(): def test_forward_mlp():
mlp = model_zoo.mx_mlp mlp = model_zoo.mx_mlp
test_mxnet_frontend_impl(mlp) verify_mxnet_frontend_impl(mlp)
def test_forward_vgg(): def test_forward_vgg():
for n in [11]: for n in [11]:
mx_sym = model_zoo.mx_vgg[n] mx_sym = model_zoo.mx_vgg[n]
test_mxnet_frontend_impl(mx_sym) verify_mxnet_frontend_impl(mx_sym)
def test_forward_resnet(): def test_forward_resnet():
for n in [18]: for n in [18]:
mx_sym = model_zoo.mx_resnet[n] mx_sym = model_zoo.mx_resnet[n]
test_mxnet_frontend_impl(mx_sym) verify_mxnet_frontend_impl(mx_sym)
if __name__ == '__main__': if __name__ == '__main__':
test_forward_mlp() test_forward_mlp()
......
...@@ -4,10 +4,10 @@ import tvm ...@@ -4,10 +4,10 @@ import tvm
from tvm.contrib import graph_runtime from tvm.contrib import graph_runtime
from nnvm.testing.config import ctx_list from nnvm.testing.config import ctx_list
import onnx import onnx
import onnx_caffe2.backend
from model_zoo import super_resolution from model_zoo import super_resolution
def test_onnx_forward_impl(graph_file, data_shape, out_shape): def verify_onnx_forward_impl(graph_file, data_shape, out_shape):
import onnx_caffe2.backend
def get_caffe2_output(graph, x, dtype='float32'): def get_caffe2_output(graph, x, dtype='float32'):
prepared_backend = onnx_caffe2.backend.prepare(graph) prepared_backend = onnx_caffe2.backend.prepare(graph)
W = {graph.input[-1]: x.astype(dtype)} W = {graph.input[-1]: x.astype(dtype)}
...@@ -35,8 +35,8 @@ def test_onnx_forward_impl(graph_file, data_shape, out_shape): ...@@ -35,8 +35,8 @@ def test_onnx_forward_impl(graph_file, data_shape, out_shape):
tvm_out = get_tvm_output(graph, x, target, ctx, dtype) tvm_out = get_tvm_output(graph, x, target, ctx, dtype)
np.testing.assert_allclose(c2_out, tvm_out, rtol=1e-5, atol=1e-5) np.testing.assert_allclose(c2_out, tvm_out, rtol=1e-5, atol=1e-5)
def test_super_resolution_example(): def verify_super_resolution_example():
test_onnx_forward_impl(super_resolution[0], (1, 1, 224, 224), (1, 1, 672, 672)) verify_onnx_forward_impl(super_resolution[0], (1, 1, 224, 224), (1, 1, 672, 672))
if __name__ == '__main__': if __name__ == '__main__':
test_super_resolution_example() verify_super_resolution_example()
#!/bin/bash
echo "Build TVM..."
cd tvm
cp make/config.mk .
echo USE_CUDNN=1 >> config.mk
echo USE_CUDA=1 >> config.mk
echo USE_OPENCL=1 >> config.mk
echo LLVM_CONFIG=llvm-config-4.0 >> config.mk
echo USE_RPC=1 >> config.mk
echo USE_BLAS=openblas >> config.mk
echo USE_GRAPH_RUNTIME=1 >> config.mk
make "$@"
cd ..
echo "Build NNVM..."
make "$@"
#!/bin/bash
echo "Cleanup data..."
cd tvm
make clean
cd ..
make clean
#!/bin/bash
export PYTHONPATH=python:tvm/python:tvm/topi/python
echo "Running ONNX frontend test..."
python -m nose -v tests/python/frontend/onnx || exit -1
echo "Running MXNet frontend test..."
python -m nose -v tests/python/frontend/mxnet || exit -1
#!/bin/bash
echo "Check codestyle of c++ code..."
make cpplint || exit -1
echo "Check codestyle of python code..."
make pylint || exit -1
echo "Check documentations of c++ code..."
make doc 2>log.txt
(cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag") > logclean.txt
echo "---------Error Log----------"
cat logclean.txt
echo "----------------------------"
(cat logclean.txt|grep warning) && exit -1
(cat logclean.txt|grep error) && exit -1
rm logclean.txt
rm log.txt
#!/bin/bash
mkdir -p docs/_build/html
# C++ doc
make doc
rm -rf python/nnvm/*.pyc python/nnvm/*/*.pyc
cd docs
PYTHONPATH=../python:../tvm/python:../tvm/topi/python make html || exit -1
cd _build/html
tar czf docs.tgz *
mv docs.tgz ../../../
#!/bin/bash
export PYTHONPATH=python:tvm/python:tvm/topi/python
echo "Running unittest..."
python -m nose -v tests/python/unittest || exit -1
python3 -m nose -v tests/python/unittest || exit -1
echo "Running compiler test..."
python -m nose -v tests/python/compiler || exit -1
python3 -m nose -v tests/python/compiler || exit -1
...@@ -39,7 +39,7 @@ def tvm_callback_cuda_compile(code): ...@@ -39,7 +39,7 @@ def tvm_callback_cuda_compile(code):
# .. note:: # .. note::
# #
# In a typical workflow, we can get this pair from :any:`nnvm.frontend` # In a typical workflow, we can get this pair from :any:`nnvm.frontend`
# Example: /nnvm-top/tests/python/frontend/mxnet/test_forward.py #
target = "cuda" target = "cuda"
ctx = tvm.gpu(0) ctx = tvm.gpu(0)
batch_size = 1 batch_size = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment