Commit 75e2af79 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by Minjie Wang
Browse files

[CI] Jenkins on Windows builds (#324)

* Jenkins build & test on Windows

* oops

* still running nohup on Windows slaves

* ooops again

* squishing vcvars and cmake

* another try

* reverting back

* --user

* switching to msbuild

* made the graph size in cache testing bigger

* put commands into script files

* oooops
parent 01e8794f
...@@ -5,47 +5,49 @@ def init_git_submodule() { ...@@ -5,47 +5,49 @@ def init_git_submodule() {
sh "git submodule update" sh "git submodule update"
} }
def setup() { def init_git_submodule_win64() {
init_git_submodule() bat "git submodule init"
bat "git submodule update"
} }
def build_dgl() { def build_dgl() {
sh "if [ -d build ]; then rm -rf build; fi; mkdir build" sh "bash tests/scripts/build_dgl.sh"
sh "rm -rf _download"
dir ("build") {
sh "cmake .."
sh "make -j4"
}
dir("python") {
sh "rm -rf build *.egg-info dist"
sh "pip3 uninstall -y dgl"
sh "python3 setup.py install"
}
} }
def pytorch_unit_test(dev) { def build_dgl_win64() {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) { /* Assuming that Windows slaves are already configured with MSBuild VS2017,
sh "python3 -m nose -v --with-xunit tests" * CMake and Python/pip/setuptools etc. */
sh "python3 -m nose -v --with-xunit tests/pytorch" bat "CALL tests\\scripts\\build_dgl.bat"
sh "python3 -m nose -v --with-xunit tests/graph_index" }
def unit_test(backend, dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python", "DGLBACKEND=${backend}"]) {
sh "bash tests/scripts/task_unit_test.sh ${backend}"
} }
} }
def mxnet_unit_test(dev) { def unit_test_win64(backend, dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) { withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}\\build", "PYTHONPATH=${env.WORKSPACE}\\python", "DGLBACKEND=${backend}"]) {
sh "python3 -m nose -v --with-xunit tests/mxnet" bat "CALL tests\\scripts\\task_unit_test.bat ${backend}"
sh "python3 -m nose -v --with-xunit tests/graph_index"
} }
} }
def example_test(dev) { def example_test(backend, dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) { withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python", "DGLBACKEND=${backend}"]) {
dir ("tests/scripts") { dir ("tests/scripts") {
sh "bash task_example_test.sh ${dev}" sh "bash task_example_test.sh ${dev}"
} }
} }
} }
def example_test_win64(backend, dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}\\build", "PYTHONPATH=${env.WORKSPACE}\\python", "DGLBACKEND=${backend}"]) {
dir ("tests\\scripts") {
bat "CALL task_example_test ${dev}"
}
}
}
def pytorch_tutorials() { def pytorch_tutorials() {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) { withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) {
dir ("tests/scripts") { dir ("tests/scripts") {
...@@ -65,7 +67,9 @@ pipeline { ...@@ -65,7 +67,9 @@ pipeline {
agent none agent none
stages { stages {
stage("Lint Check") { stage("Lint Check") {
agent { docker { image "dgllib/dgl-ci-lint" } } agent {
docker { image "dgllib/dgl-ci-lint" }
}
steps { steps {
init_git_submodule() init_git_submodule()
sh "bash tests/scripts/task_lint.sh" sh "bash tests/scripts/task_lint.sh"
...@@ -74,9 +78,11 @@ pipeline { ...@@ -74,9 +78,11 @@ pipeline {
stage("Build") { stage("Build") {
parallel { parallel {
stage("CPU Build") { stage("CPU Build") {
agent { docker { image "dgllib/dgl-ci-cpu" } } agent {
docker { image "dgllib/dgl-ci-cpu" }
}
steps { steps {
setup() init_git_submodule()
build_dgl() build_dgl()
} }
} }
...@@ -88,29 +94,56 @@ pipeline { ...@@ -88,29 +94,56 @@ pipeline {
} }
} }
steps { steps {
setup() init_git_submodule()
build_dgl() build_dgl()
} }
} }
stage("MXNet CPU Build (temp)") { stage("MXNet CPU Build (temp)") {
agent { docker { image "dgllib/dgl-ci-mxnet-cpu" } } agent {
docker { image "dgllib/dgl-ci-mxnet-cpu" }
}
steps { steps {
setup() init_git_submodule()
build_dgl() build_dgl()
} }
} }
stage("CPU Build (Win64/PyTorch)") {
agent {
label "windows"
}
steps {
init_git_submodule_win64()
build_dgl_win64()
}
}
} }
} }
stage("Test") { stage("Test") {
parallel { parallel {
stage("Pytorch CPU") { stage("Pytorch CPU") {
agent { docker { image "dgllib/dgl-ci-cpu" } } agent {
docker { image "dgllib/dgl-ci-cpu" }
}
stages { stages {
stage("TH CPU unittest") { stage("TH CPU unittest") {
steps { pytorch_unit_test("CPU") } steps { unit_test("pytorch", "CPU") }
} }
stage("TH CPU example test") { stage("TH CPU example test") {
steps { example_test("CPU") } steps { example_test("pytorch", "CPU") }
}
}
post {
always { junit "*.xml" }
}
}
stage("Pytorch CPU (Windows)") {
agent { label "windows" }
stages {
stage("TH CPU Win64 unittest") {
steps { unit_test_win64("pytorch", "CPU") }
}
stage("TH CPU Win64 example test") {
steps { example_test_win64("pytorch", "CPU") }
} }
} }
post { post {
...@@ -130,7 +163,7 @@ pipeline { ...@@ -130,7 +163,7 @@ pipeline {
// steps { pytorch_unit_test("GPU") } // steps { pytorch_unit_test("GPU") }
//} //}
stage("TH GPU example test") { stage("TH GPU example test") {
steps { example_test("GPU") } steps { example_test("pytorch", "GPU") }
} }
} }
// TODO: have GPU unittest // TODO: have GPU unittest
...@@ -139,10 +172,12 @@ pipeline { ...@@ -139,10 +172,12 @@ pipeline {
//} //}
} }
stage("MXNet CPU") { stage("MXNet CPU") {
agent { docker { image "dgllib/dgl-ci-mxnet-cpu" } } agent {
docker { image "dgllib/dgl-ci-mxnet-cpu" }
}
stages { stages {
stage("MX Unittest") { stage("MX Unittest") {
steps { mxnet_unit_test("CPU") } steps { unit_test("mxnet", "CPU") }
} }
} }
post { post {
...@@ -154,13 +189,17 @@ pipeline { ...@@ -154,13 +189,17 @@ pipeline {
stage("Doc") { stage("Doc") {
parallel { parallel {
stage("TH Tutorial") { stage("TH Tutorial") {
agent { docker { image "dgllib/dgl-ci-cpu" } } agent {
docker { image "dgllib/dgl-ci-cpu" }
}
steps { steps {
pytorch_tutorials() pytorch_tutorials()
} }
} }
stage("MX Tutorial") { stage("MX Tutorial") {
agent { docker { image "dgllib/dgl-ci-mxnet-cpu" } } agent {
docker { image "dgllib/dgl-ci-mxnet-cpu" }
}
steps { steps {
mxnet_tutorials() mxnet_tutorials()
} }
......
...@@ -94,7 +94,7 @@ def test_incmat(): ...@@ -94,7 +94,7 @@ def test_incmat():
def test_incmat_cache(): def test_incmat_cache():
n = 1000 n = 1000
p = 2 * math.log(n) / n p = 10 * math.log(n) / n
a = sp.random(n, n, p, data_rvs=lambda n: np.ones(n)) a = sp.random(n, n, p, data_rvs=lambda n: np.ones(n))
g = dgl.DGLGraph(a) g = dgl.DGLGraph(a)
# the first call should contruct the inc # the first call should contruct the inc
......
@ECHO OFF
SETLOCAL EnableDelayedExpansion
DEL /S /Q build
DEL /S /Q _download
MD build
PUSHD build
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
cmake -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -DCMAKE_CONFIGURATION_TYPES="Release" .. -G "Visual Studio 15 2017 Win64" || EXIT /B 1
msbuild dgl.sln || EXIT /B 1
COPY Release\dgl.dll .
POPD
PUSHD python
DEL /S /Q build *.egg-info dist
pip install -e . --force-reinstall --user || EXIT /B 1
POPD
ENDLOCAL
EXIT /B
#!/bin/bash
if [ -d build ]; then
rm -rf build
fi
mkdir build
rm -rf _download
pushd build
cmake ..
make -j4
popd
pushd python
rm -rf build *.egg-info dist
pip3 uninstall -y dgl
python3 setup.py install
popd
@ECHO OFF
SETLOCAL EnableDelayedExpansion
IF x%1x==xx (
ECHO Must supply CPU or GPU
GOTO :FAIL
) ELSE IF x%1x==xCPUx (
SET DEV=-1
) ELSE IF x%1x==xGPUx (
SET DEV=0
SET CUDA_VISIBLE_DEVICES=0
) ELSE (
ECHO Must supply CPU or GPU
GOTO :FAIL
)
PUSHD ..\..\examples\pytorch
python pagerank.py || GOTO :FAIL
python gcn\gcn.py --dataset cora --gpu !dev! || GOTO :FAIL
python gcn\gcn_spmv.py --dataset cora --gpu !dev! || GOTO :FAIL
POPD
ENDLOCAL
EXIT /B
:FAIL
ECHO Example test failed
ENDLOCAL
EXIT /B 1
@ECHO OFF
SETLOCAL EnableDelayedExpansion
IF x%1x==xx (
ECHO Specify backend
EXIT /B 1
) ELSE (
SET BACKEND=%1
)
python -m nose -v --with-xunit tests || EXIT /B 1
python -m nose -v --with-xunit tests\!BACKEND! || EXIT /B 1
python -m nose -v --with-xunit tests\graph_index || EXIT /B 1
EXIT /B
#!/bin/bash
function fail {
echo FAIL: $@
exit -1
}
function usage {
echo "Usage: $0 backend"
}
if [ $# -ne 1 ]; then
usage
fail "Error: must specify backend"
fi
BACKEND=$1
python3 -m nose -v --with-xunit tests || fail "tests"
python3 -m nose -v --with-xunit tests/$BACKEND || fail "backend"
python3 -m nose -v --with-xunit tests/graph_index || fail "graph_index"
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