Commit fc50e068 by Tianqi Chen Committed by GitHub

[CI] Switch to use prebuilt docker instead of build from scratch (#1442)

parent 82f78d1e
...@@ -11,7 +11,7 @@ tvm_multilib = "build/libtvm.so, " + ...@@ -11,7 +11,7 @@ tvm_multilib = "build/libtvm.so, " +
"build/libvta.so, build/libtvm_topi.so, build/libnnvm_compiler.so, " + tvm_runtime "build/libvta.so, build/libtvm_topi.so, build/libnnvm_compiler.so, " + tvm_runtime
// command to start a docker container // command to start a docker container
docker_run = 'docker/build.sh' docker_run = 'docker/bash.sh'
// timeout in minutes // timeout in minutes
max_time = 60 max_time = 60
...@@ -39,7 +39,7 @@ stage("Sanity Check") { ...@@ -39,7 +39,7 @@ stage("Sanity Check") {
node('linux') { node('linux') {
ws('workspace/tvm/sanity') { ws('workspace/tvm/sanity') {
init_git() init_git()
sh "${docker_run} ci_lint ./tests/scripts/task_lint.sh" sh "${docker_run} tvmai/ci-lint ./tests/scripts/task_lint.sh"
} }
} }
} }
...@@ -100,7 +100,7 @@ stage('Build') { ...@@ -100,7 +100,7 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('ci_gpu', 'build', '-j2') make('tvmai/ci-gpu', 'build', '-j2')
pack_lib('gpu', tvm_multilib) pack_lib('gpu', tvm_multilib)
// compiler test // compiler test
sh """ sh """
...@@ -113,7 +113,7 @@ stage('Build') { ...@@ -113,7 +113,7 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('ci_gpu', 'build2', '-j2') make('tvmai/ci-gpu', 'build2', '-j2')
} }
} }
}, },
...@@ -130,11 +130,11 @@ stage('Build') { ...@@ -130,11 +130,11 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('ci_cpu', 'build', '-j2') make('tvmai/ci-cpu', 'build', '-j2')
pack_lib('cpu', tvm_lib) pack_lib('cpu', tvm_lib)
timeout(time: max_time, unit: 'MINUTES') { timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_cpu ./tests/scripts/task_cpp_unittest.sh" sh "${docker_run} tvmai/ci-cpu ./tests/scripts/task_cpp_unittest.sh"
sh "${docker_run} ci_cpu ./tests/scripts/task_python_vta.sh" sh "${docker_run} tvmai/ci-cpu ./tests/scripts/task_python_vta.sh"
} }
} }
} }
...@@ -153,7 +153,7 @@ stage('Build') { ...@@ -153,7 +153,7 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('ci_i386', 'build', '-j2') make('tvmai/ci-i386', 'build', '-j2')
pack_lib('i386', tvm_multilib) pack_lib('i386', tvm_multilib)
} }
} }
...@@ -167,7 +167,7 @@ stage('Unit Test') { ...@@ -167,7 +167,7 @@ stage('Unit Test') {
init_git() init_git()
unpack_lib('gpu', tvm_multilib) unpack_lib('gpu', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') { timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_gpu ./tests/scripts/task_python_unittest.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_unittest.sh"
} }
} }
} }
...@@ -178,9 +178,9 @@ stage('Unit Test') { ...@@ -178,9 +178,9 @@ stage('Unit Test') {
init_git() init_git()
unpack_lib('i386', tvm_multilib) unpack_lib('i386', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') { timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_i386 ./tests/scripts/task_python_unittest.sh" sh "${docker_run} tvmai/ci-i386 ./tests/scripts/task_python_unittest.sh"
sh "${docker_run} ci_i386 ./tests/scripts/task_python_integration.sh" sh "${docker_run} tvmai/ci-i386 ./tests/scripts/task_python_integration.sh"
sh "${docker_run} ci_i386 ./tests/scripts/task_python_vta.sh" sh "${docker_run} tvmai/ci-i386 ./tests/scripts/task_python_vta.sh"
} }
} }
} }
...@@ -191,7 +191,7 @@ stage('Unit Test') { ...@@ -191,7 +191,7 @@ stage('Unit Test') {
init_git() init_git()
unpack_lib('gpu', tvm_multilib) unpack_lib('gpu', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') { timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_gpu ./tests/scripts/task_java_unittest.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_java_unittest.sh"
} }
} }
} }
...@@ -205,10 +205,10 @@ stage('Integration Test') { ...@@ -205,10 +205,10 @@ stage('Integration Test') {
init_git() init_git()
unpack_lib('gpu', tvm_multilib) unpack_lib('gpu', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') { timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_gpu ./tests/scripts/task_python_integration.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_integration.sh"
sh "${docker_run} ci_gpu ./tests/scripts/task_python_topi.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_topi.sh"
sh "${docker_run} ci_gpu ./tests/scripts/task_cpp_topi.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_cpp_topi.sh"
sh "${docker_run} ci_gpu ./tests/scripts/task_python_nnvm.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_nnvm.sh"
} }
} }
} }
...@@ -219,7 +219,7 @@ stage('Integration Test') { ...@@ -219,7 +219,7 @@ stage('Integration Test') {
init_git() init_git()
unpack_lib('gpu', tvm_multilib) unpack_lib('gpu', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') { timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_gpu ./tests/scripts/task_python_docs.sh" sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_docs.sh"
} }
pack_lib('mydocs', 'docs.tgz') pack_lib('mydocs', 'docs.tgz')
} }
......
...@@ -3,15 +3,28 @@ ...@@ -3,15 +3,28 @@
# Start a bash, mount /workspace to be current directory. # Start a bash, mount /workspace to be current directory.
# #
# Usage: docker/bash.sh <CONTAINER_NAME> # Usage: docker/bash.sh <CONTAINER_NAME>
# Starts an interactive session
#
# Usage2: docker/bash.sh <CONTAINER_NAME> [COMMAND]
# Execute command in the docker image, non-interactive
# #
if [ "$#" -lt 1 ]; then if [ "$#" -lt 1 ]; then
echo "Usage: docker/bash.sh <CONTAINER_NAME>" echo "Usage: docker/bash.sh <CONTAINER_NAME> [COMMAND]"
exit -1 exit -1
fi fi
DOCKER_IMAGE_NAME=("$1")
if [ "$#" -eq 1 ]; then
COMMAND="bash"
CI_DOCKER_EXTRA_PARAMS=("-it --net=host")
else
shift 1
COMMAND=("$@")
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE="$(pwd)" WORKSPACE="$(pwd)"
DOCKER_IMAGE_NAME=$1
# Use nvidia-docker if the container is GPU. # Use nvidia-docker if the container is GPU.
if [[ "${DOCKER_IMAGE_NAME}" == *"gpu"* ]]; then if [[ "${DOCKER_IMAGE_NAME}" == *"gpu"* ]]; then
...@@ -22,14 +35,16 @@ fi ...@@ -22,14 +35,16 @@ fi
# Print arguments. # Print arguments.
echo "WORKSPACE: ${WORKSPACE}" echo "WORKSPACE: ${WORKSPACE}"
echo "DOCKER CONTAINER NAME: ${DOCKER_IMG_NAME}" echo "DOCKER CONTAINER NAME: ${DOCKER_IMAGE_NAME}"
echo "" echo ""
echo "Running '${COMMAND[@]}' inside ${DOCKER_IMAGE_NAME}..."
# By default we cleanup - remove the container once it finish running (--rm) # 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 # 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). # pid 1 and SIGKILL is propagated to the process inside (jenkins can kill it).
echo ${DOCKER_BINARY} echo ${DOCKER_BINARY}
${DOCKER_BINARY} run --rm -it --pid=host --net=host\ ${DOCKER_BINARY} run --rm --pid=host\
-v ${WORKSPACE}:/workspace \ -v ${WORKSPACE}:/workspace \
-v ${SCRIPT_DIR}:/docker \ -v ${SCRIPT_DIR}:/docker \
-w /workspace \ -w /workspace \
...@@ -38,6 +53,7 @@ ${DOCKER_BINARY} run --rm -it --pid=host --net=host\ ...@@ -38,6 +53,7 @@ ${DOCKER_BINARY} run --rm -it --pid=host --net=host\
-e "CI_BUILD_UID=$(id -u)" \ -e "CI_BUILD_UID=$(id -u)" \
-e "CI_BUILD_GROUP=$(id -g -n)" \ -e "CI_BUILD_GROUP=$(id -g -n)" \
-e "CI_BUILD_GID=$(id -g)" \ -e "CI_BUILD_GID=$(id -g)" \
${CI_DOCKER_EXTRA_PARAMS[@]} \
${DOCKER_IMAGE_NAME}\ ${DOCKER_IMAGE_NAME}\
bash /docker/with_the_same_user \ bash /docker/with_the_same_user \
bash ${COMMAND[@]}
...@@ -65,7 +65,7 @@ enable=indexing-exception,old-raise-syntax ...@@ -65,7 +65,7 @@ enable=indexing-exception,old-raise-syntax
# --enable=similarities". If you want to run only the classes checker, but have # --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes # no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W" # --disable=W"
disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,no-member,no-name-in-module,import-error,unsubscriptable-object,unbalanced-tuple-unpacking,undefined-variable,protected-access disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,no-member,no-name-in-module,import-error,unsubscriptable-object,unbalanced-tuple-unpacking,undefined-variable,protected-access,useless-object-inheritance
[REPORTS] [REPORTS]
......
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