forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TEST] CI infrastructure (apache#30)
- Loading branch information
Showing
23 changed files
with
483 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!groovy | ||
// -*- mode: groovy -*- | ||
// Jenkins pipeline | ||
// See documents at https://jenkins.io/doc/book/pipeline/jenkinsfile/ | ||
|
||
// nnvm libraries | ||
vta_lib += "lib/libvta.so, lib/libvta.so.json" | ||
vta_lib += ", nnvm/tvm/lib/libtvm.so, nnvm/tvm/lib/libtopi.so, nnvm/lib/libnnvm_compiler.so" | ||
|
||
|
||
// 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/vta/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') { | ||
sh "${docker_run} ${docker_type} cp make/sim_sample.json config.json" | ||
try { | ||
sh "${docker_run} ${docker_type} ./tests/scripts/task_build.sh ${make_flag}" | ||
} catch (exc) { | ||
echo 'Incremental compilation failed. Fall back to build from scratch' | ||
sh "${docker_run} ${docker_type} ./tests/scripts/task_clean.sh" | ||
sh "${docker_run} ${docker_type} ./tests/scripts/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('linux') { | ||
ws('workspace/vta/build') { | ||
init_git() | ||
make('cpu', '-j2') | ||
pack_lib('cpu', vta_lib) | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Tests') { | ||
parallel 'python': { | ||
node('linux') { | ||
ws('workspace/vta/it-python') { | ||
init_git() | ||
unpack_lib('cpu', vta_lib) | ||
timeout(time: max_time, unit: 'MINUTES') { | ||
sh "${docker_run} cpu ./tests/scripts/task_python_test.sh" | ||
} | ||
} | ||
} | ||
}, | ||
'docs': { | ||
node('linux') { | ||
ws('workspace/vta/docs-python') { | ||
init_git() | ||
unpack_lib('cpu', vta_lib) | ||
timeout(time: max_time, unit: 'MINUTES') { | ||
sh "${docker_run} cpu ./tests/scripts/task_python_docs.sh" | ||
} | ||
pack_lib('mydocs', 'docs.tgz') | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Deploy') { | ||
node('docker' && 'doc') { | ||
ws('workspace/vta/deploy-docs') { | ||
if (env.BRANCH_NAME == "master") { | ||
unpack_lib('mydocs', 'docs.tgz') | ||
sh "tar xf docs.tgz -C /var/vta-docs" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"TARGET" : "sim", | ||
"LOG_INP_WIDTH" : 3, | ||
"LOG_WGT_WIDTH" : 3, | ||
"LOG_ACC_WIDTH" : 5, | ||
"LOG_OUT_WIDTH" : 3, | ||
"LOG_BATCH" : 0, | ||
"LOG_BLOCK_IN" : 4, | ||
"LOG_BLOCK_OUT" : 4, | ||
"LOG_UOP_BUFF_SIZE" : 15, | ||
"LOG_INP_BUFF_SIZE" : 15, | ||
"LOG_WGT_BUFF_SIZE" : 15, | ||
"LOG_ACC_BUFF_SIZE" : 17 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# For CPU | ||
FROM ubuntu:16.04 | ||
|
||
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_llvm.sh /install/ubuntu_install_llvm.sh | ||
RUN bash /install/ubuntu_install_llvm.sh | ||
|
||
COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh | ||
RUN bash /install/ubuntu_install_python.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 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/) | ||
|
||
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 | ||
``` |
Oops, something went wrong.