Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tvm_multilib = "build/libtvm.so, " +
"build/libvta.so, build/libtvm_topi.so, build/libnnvm_compiler.so, " + tvm_runtime

// command to start a docker container
docker_run = 'docker/build.sh'
docker_run = 'docker/bash.sh'
// timeout in minutes
max_time = 60

Expand Down Expand Up @@ -39,7 +39,7 @@ stage("Sanity Check") {
node('linux') {
ws('workspace/tvm/sanity') {
init_git()
sh "${docker_run} ci_lint ./tests/scripts/task_lint.sh"
sh "${docker_run} tvmai/ci-lint ./tests/scripts/task_lint.sh"
}
}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER g++\\) >> 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)
// compiler test
sh """
Expand All @@ -113,7 +113,7 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
"""
make('ci_gpu', 'build2', '-j2')
make('tvmai/ci-gpu', 'build2', '-j2')
}
}
},
Expand All @@ -130,11 +130,11 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER g++\\) >> 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)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} 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_cpp_unittest.sh"
sh "${docker_run} tvmai/ci-cpu ./tests/scripts/task_python_vta.sh"
}
}
}
Expand All @@ -153,7 +153,7 @@ stage('Build') {
echo set\\(CMAKE_CXX_COMPILER g++\\) >> 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)
}
}
Expand All @@ -167,7 +167,7 @@ stage('Unit Test') {
init_git()
unpack_lib('gpu', tvm_multilib)
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"
}
}
}
Expand All @@ -178,9 +178,9 @@ stage('Unit Test') {
init_git()
unpack_lib('i386', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_i386 ./tests/scripts/task_python_unittest.sh"
sh "${docker_run} 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_unittest.sh"
sh "${docker_run} tvmai/ci-i386 ./tests/scripts/task_python_integration.sh"
sh "${docker_run} tvmai/ci-i386 ./tests/scripts/task_python_vta.sh"
}
}
}
Expand All @@ -191,7 +191,7 @@ stage('Unit Test') {
init_git()
unpack_lib('gpu', tvm_multilib)
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"
}
}
}
Expand All @@ -205,10 +205,10 @@ stage('Integration Test') {
init_git()
unpack_lib('gpu', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ci_gpu ./tests/scripts/task_python_integration.sh"
sh "${docker_run} ci_gpu ./tests/scripts/task_python_topi.sh"
sh "${docker_run} 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_integration.sh"
sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_topi.sh"
sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_cpp_topi.sh"
sh "${docker_run} tvmai/ci-gpu ./tests/scripts/task_python_nnvm.sh"
}
}
}
Expand All @@ -219,7 +219,7 @@ stage('Integration Test') {
init_git()
unpack_lib('gpu', tvm_multilib)
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')
}
Expand Down
26 changes: 21 additions & 5 deletions docker/bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,28 @@
# Start a bash, mount /workspace to be current directory.
#
# 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
echo "Usage: docker/bash.sh <CONTAINER_NAME>"
echo "Usage: docker/bash.sh <CONTAINER_NAME> [COMMAND]"
exit -1
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)"
WORKSPACE="$(pwd)"
DOCKER_IMAGE_NAME=$1

# Use nvidia-docker if the container is GPU.
if [[ "${DOCKER_IMAGE_NAME}" == *"gpu"* ]]; then
Expand All @@ -22,14 +35,16 @@ fi

# Print arguments.
echo "WORKSPACE: ${WORKSPACE}"
echo "DOCKER CONTAINER NAME: ${DOCKER_IMG_NAME}"
echo "DOCKER CONTAINER NAME: ${DOCKER_IMAGE_NAME}"
echo ""

echo "Running '${COMMAND[@]}' inside ${DOCKER_IMAGE_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 -it --pid=host --net=host\
${DOCKER_BINARY} run --rm --pid=host\
-v ${WORKSPACE}:/workspace \
-v ${SCRIPT_DIR}:/docker \
-w /workspace \
Expand All @@ -38,6 +53,7 @@ ${DOCKER_BINARY} run --rm -it --pid=host --net=host\
-e "CI_BUILD_UID=$(id -u)" \
-e "CI_BUILD_GROUP=$(id -g -n)" \
-e "CI_BUILD_GID=$(id -g)" \
${CI_DOCKER_EXTRA_PARAMS[@]} \
${DOCKER_IMAGE_NAME}\
bash /docker/with_the_same_user \
bash
${COMMAND[@]}
2 changes: 1 addition & 1 deletion tests/lint/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ enable=indexing-exception,old-raise-syntax
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --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]

Expand Down