diff --git a/Jenkinsfile b/Jenkinsfile index b46632a960d6..5e5837151497 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ tvm_multilib = "build/libtvm.so, " + "build/libtvm_topi.so, build/libnnvm_compiler.so, " + tvm_runtime // command to start a docker container -docker_run = 'tests/ci_build/ci_build.sh' +docker_run = 'docker/build.sh' // timeout in minutes max_time = 60 @@ -39,7 +39,7 @@ stage("Sanity Check") { node('linux') { ws('workspace/tvm/sanity') { init_git() - sh "${docker_run} lint ./tests/scripts/task_lint.sh" + sh "${docker_run} ci_lint ./tests/scripts/task_lint.sh" } } } @@ -100,7 +100,7 @@ stage('Build') { echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake """ - make('gpu', 'build', '-j2') + make('ci_gpu', 'build', '-j2') pack_lib('gpu', tvm_multilib) // compiler test sh """ @@ -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('gpu', 'build2', '-j2') + make('ci_gpu', 'build2', '-j2') } } }, @@ -130,10 +130,10 @@ stage('Build') { echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake """ - make('cpu', 'build', '-j2') + make('ci_cpu', 'build', '-j2') pack_lib('cpu', tvm_lib) timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} cpu ./tests/scripts/task_cpp_unittest.sh" + sh "${docker_run} ci_cpu ./tests/scripts/task_cpp_unittest.sh" } } } @@ -152,7 +152,7 @@ stage('Build') { echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake """ - make('i386', 'build', '-j2') + make('ci_i386', 'build', '-j2') pack_lib('i386', tvm_multilib) } } @@ -166,7 +166,7 @@ stage('Unit Test') { init_git() unpack_lib('gpu', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} gpu ./tests/scripts/task_python_unittest.sh" + sh "${docker_run} ci_gpu ./tests/scripts/task_python_unittest.sh" } } } @@ -177,8 +177,8 @@ stage('Unit Test') { init_git() unpack_lib('i386', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} i386 ./tests/scripts/task_python_unittest.sh" - sh "${docker_run} i386 ./tests/scripts/task_python_integration.sh" + sh "${docker_run} ci_i386 ./tests/scripts/task_python_unittest.sh" + sh "${docker_run} ci_i386 ./tests/scripts/task_python_integration.sh" } } } @@ -189,7 +189,7 @@ stage('Unit Test') { init_git() unpack_lib('gpu', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} gpu ./tests/scripts/task_java_unittest.sh" + sh "${docker_run} ci_gpu ./tests/scripts/task_java_unittest.sh" } } } @@ -203,10 +203,10 @@ stage('Integration Test') { init_git() unpack_lib('gpu', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} gpu ./tests/scripts/task_python_integration.sh" - sh "${docker_run} gpu ./tests/scripts/task_python_topi.sh" - sh "${docker_run} gpu ./tests/scripts/task_cpp_topi.sh" - sh "${docker_run} gpu ./tests/scripts/task_python_nnvm.sh" + 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" } } } @@ -217,7 +217,7 @@ stage('Integration Test') { init_git() unpack_lib('gpu', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} gpu ./tests/scripts/task_python_docs.sh" + sh "${docker_run} ci_gpu ./tests/scripts/task_python_docs.sh" } pack_lib('mydocs', 'docs.tgz') } diff --git a/tests/ci_build/Dockerfile.cpu b/docker/Dockerfile.ci_cpu similarity index 100% rename from tests/ci_build/Dockerfile.cpu rename to docker/Dockerfile.ci_cpu diff --git a/tests/ci_build/Dockerfile.emscripten b/docker/Dockerfile.ci_emscripten similarity index 100% rename from tests/ci_build/Dockerfile.emscripten rename to docker/Dockerfile.ci_emscripten diff --git a/tests/ci_build/Dockerfile.gpu b/docker/Dockerfile.ci_gpu similarity index 100% rename from tests/ci_build/Dockerfile.gpu rename to docker/Dockerfile.ci_gpu diff --git a/tests/ci_build/Dockerfile.i386 b/docker/Dockerfile.ci_i386 similarity index 100% rename from tests/ci_build/Dockerfile.i386 rename to docker/Dockerfile.ci_i386 diff --git a/tests/ci_build/Dockerfile.lint b/docker/Dockerfile.ci_lint similarity index 100% rename from tests/ci_build/Dockerfile.lint rename to docker/Dockerfile.ci_lint diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000000..c39cd5bd9c60 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,58 @@ +# TVM Docker + +This directory contains the TVM's docker infrastructure. +We use docker to quickly provide environments that can be +used to build tvm in various settings. + +To run locally, we need to first install +[docker](https://docs.docker.com/engine/installation/) and +[nvidia-docker](https://github.com/NVIDIA/nvidia-docker/). + + +## Use Local Build Script + +Each dockerfile defines a different environment. +We use (`build.sh`)[./build.sh] to build and run the commands. +To use the docker images, we can run the following command +at the root of the project. + +```bash +./docker/build.sh image_name [command] +``` + +Here image_name corresponds to the docker defined in the +```Dockerfile.image_name```. + +You can also start an interactive session by typing + +```bash +./docker/build.sh image_name -it bash +``` + +The build command will map the tvm root to /workspace/ inside the container +with the same user as the user invoking the docker command. +Here are some common use examples to perform CI tasks. + +- lint the python codes + + ```bash + ./docker/build.sh ci_lint make pylint + ``` + +- build codes with CUDA support + + ```bash + ./docker/build.sh ci_gpu make -j$(nproc) + ``` + +- do the python unittest + + ```bash + ./docker/build.sh ci_gpu tests/scripts/task_python_unittest.sh' + ``` + +- build the documents. The results will be available at `docs/_build/html` + + ```bash + ./docker/ci_build.sh ci_gpu make -C docs html + ``` diff --git a/tests/ci_build/ci_build.sh b/docker/build.sh similarity index 97% rename from tests/ci_build/ci_build.sh rename to docker/build.sh index 86c138aaf3a5..ccecd0a13834 100755 --- a/tests/ci_build/ci_build.sh +++ b/docker/build.sh @@ -71,8 +71,8 @@ function upsearch () { # 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:-tvm-ci}" +WORKSPACE="${WORKSPACE:-${SCRIPT_DIR}/../}" +BUILD_TAG="${BUILD_TAG:-tvm}" # Determine the docker image name DOCKER_IMG_NAME="${BUILD_TAG}.${CONTAINER_TYPE}" @@ -122,5 +122,5 @@ ${DOCKER_BINARY} run --rm --pid=host \ -e "CI_BUILD_GID=$(id -g)" \ ${CI_DOCKER_EXTRA_PARAMS[@]} \ ${DOCKER_IMG_NAME} \ - bash tests/ci_build/with_the_same_user \ + bash docker/with_the_same_user \ ${COMMAND[@]} diff --git a/tests/ci_build/install/ubuntu_install_core.sh b/docker/install/ubuntu_install_core.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_core.sh rename to docker/install/ubuntu_install_core.sh diff --git a/tests/ci_build/install/ubuntu_install_coreml.sh b/docker/install/ubuntu_install_coreml.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_coreml.sh rename to docker/install/ubuntu_install_coreml.sh diff --git a/tests/ci_build/install/ubuntu_install_darknet.sh b/docker/install/ubuntu_install_darknet.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_darknet.sh rename to docker/install/ubuntu_install_darknet.sh diff --git a/tests/ci_build/install/ubuntu_install_emscripten.sh b/docker/install/ubuntu_install_emscripten.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_emscripten.sh rename to docker/install/ubuntu_install_emscripten.sh diff --git a/tests/ci_build/install/ubuntu_install_iverilog.sh b/docker/install/ubuntu_install_iverilog.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_iverilog.sh rename to docker/install/ubuntu_install_iverilog.sh diff --git a/tests/ci_build/install/ubuntu_install_java.sh b/docker/install/ubuntu_install_java.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_java.sh rename to docker/install/ubuntu_install_java.sh diff --git a/tests/ci_build/install/ubuntu_install_keras.sh b/docker/install/ubuntu_install_keras.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_keras.sh rename to docker/install/ubuntu_install_keras.sh diff --git a/tests/ci_build/install/ubuntu_install_llvm.sh b/docker/install/ubuntu_install_llvm.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_llvm.sh rename to docker/install/ubuntu_install_llvm.sh diff --git a/tests/ci_build/install/ubuntu_install_mxnet.sh b/docker/install/ubuntu_install_mxnet.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_mxnet.sh rename to docker/install/ubuntu_install_mxnet.sh diff --git a/tests/ci_build/install/ubuntu_install_nodejs.sh b/docker/install/ubuntu_install_nodejs.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_nodejs.sh rename to docker/install/ubuntu_install_nodejs.sh diff --git a/tests/ci_build/install/ubuntu_install_onnx.sh b/docker/install/ubuntu_install_onnx.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_onnx.sh rename to docker/install/ubuntu_install_onnx.sh diff --git a/tests/ci_build/install/ubuntu_install_opencl.sh b/docker/install/ubuntu_install_opencl.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_opencl.sh rename to docker/install/ubuntu_install_opencl.sh diff --git a/tests/ci_build/install/ubuntu_install_opengl.sh b/docker/install/ubuntu_install_opengl.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_opengl.sh rename to docker/install/ubuntu_install_opengl.sh diff --git a/tests/ci_build/install/ubuntu_install_python.sh b/docker/install/ubuntu_install_python.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_python.sh rename to docker/install/ubuntu_install_python.sh diff --git a/tests/ci_build/install/ubuntu_install_python_package.sh b/docker/install/ubuntu_install_python_package.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_python_package.sh rename to docker/install/ubuntu_install_python_package.sh diff --git a/tests/ci_build/install/ubuntu_install_redis.sh b/docker/install/ubuntu_install_redis.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_redis.sh rename to docker/install/ubuntu_install_redis.sh diff --git a/tests/ci_build/install/ubuntu_install_rocm.sh b/docker/install/ubuntu_install_rocm.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_rocm.sh rename to docker/install/ubuntu_install_rocm.sh diff --git a/tests/ci_build/install/ubuntu_install_sphinx.sh b/docker/install/ubuntu_install_sphinx.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_sphinx.sh rename to docker/install/ubuntu_install_sphinx.sh diff --git a/tests/ci_build/install/ubuntu_install_vulkan.sh b/docker/install/ubuntu_install_vulkan.sh similarity index 100% rename from tests/ci_build/install/ubuntu_install_vulkan.sh rename to docker/install/ubuntu_install_vulkan.sh diff --git a/tests/ci_build/with_the_same_user b/docker/with_the_same_user similarity index 100% rename from tests/ci_build/with_the_same_user rename to docker/with_the_same_user diff --git a/tests/ci_build/README.md b/tests/ci_build/README.md deleted file mode 100644 index cd74ff2336ff..000000000000 --- a/tests/ci_build/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# 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 make -j$(nproc) - ``` - -- do the python unittest - - ```bash - ./ci_build.sh gpu PYTHONPATH=./python/ nosetests --with-timer --verbose tests/python/unittest' - ``` - -- build the documents. The results will be available at `docs/_build/html` - - ```bash - tests/ci_build/ci_build.sh gpu make -C docs html - ```