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] Jenkins on Windows builds #324

Merged
merged 12 commits into from
Dec 22, 2018
Merged
Show file tree
Hide file tree
Changes from 10 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
96 changes: 89 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ def init_git_submodule() {
sh "git submodule update"
}

def init_git_submodule_win64() {
bat "git submodule init"
bat "git submodule update"
}

def setup() {
init_git_submodule()
}

def setup_win64() {
init_git_submodule_win64()
}

BarclayII marked this conversation as resolved.
Show resolved Hide resolved
def build_dgl() {
sh "if [ -d build ]; then rm -rf build; fi; mkdir build"
sh "rm -rf _download"
Expand All @@ -23,6 +32,26 @@ def build_dgl() {
}
}

def build_dgl_win64() {
/* Assuming that Windows slaves are already configured with MSBuild VS2017,
* CMake and Python/pip/setuptools etc. */
bat "DEL /S /Q build"
bat "DEL /S /Q _download"
dir ("build") {
bat """
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"
msbuild dgl.sln
COPY Release\\dgl.dll .
"""
}
dir ("python") {
bat "DEL /S /Q build *.egg-info dist"
bat "pip3 uninstall -y dgl || (call )" // ignore error
bat "python setup.py install --user"
}
}
BarclayII marked this conversation as resolved.
Show resolved Hide resolved

def pytorch_unit_test(dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) {
sh "python3 -m nose -v --with-xunit tests"
Expand All @@ -31,6 +60,14 @@ def pytorch_unit_test(dev) {
}
}

def pytorch_unit_test_win64(dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}\\build", "PYTHONPATH=${env.WORKSPACE}\\python"]) {
bat "python -m nose -v --with-xunit tests"
bat "python -m nose -v --with-xunit tests\\pytorch"
bat "python -m nose -v --with-xunit tests\\graph_index"
}
}
BarclayII marked this conversation as resolved.
Show resolved Hide resolved

def mxnet_unit_test(dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) {
sh "python3 -m nose -v --with-xunit tests/mxnet"
Expand All @@ -46,6 +83,14 @@ def example_test(dev) {
}
}

def example_test_win64(dev) {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}\\build", "PYTHONPATH=${env.WORKSPACE}\\python"]) {
dir ("tests\\scripts") {
bat "CALL task_example_test ${dev}"
}
}
}

def pytorch_tutorials() {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) {
dir ("tests/scripts") {
Expand All @@ -65,7 +110,9 @@ pipeline {
agent none
stages {
stage("Lint Check") {
agent { docker { image "dgllib/dgl-ci-lint" } }
agent {
docker { image "dgllib/dgl-ci-lint" }
}
steps {
init_git_submodule()
sh "bash tests/scripts/task_lint.sh"
Expand All @@ -74,7 +121,9 @@ pipeline {
stage("Build") {
parallel {
stage("CPU Build") {
agent { docker { image "dgllib/dgl-ci-cpu" } }
agent {
docker { image "dgllib/dgl-ci-cpu" }
}
steps {
setup()
build_dgl()
Expand All @@ -93,18 +142,31 @@ pipeline {
}
}
stage("MXNet CPU Build (temp)") {
agent { docker { image "dgllib/dgl-ci-mxnet-cpu" } }
agent {
docker { image "dgllib/dgl-ci-mxnet-cpu" }
}
steps {
setup()
build_dgl()
}
}
stage("CPU Build (Win64/PyTorch)") {
agent {
label "windows"
}
steps {
setup_win64()
build_dgl_win64()
}
}
}
}
stage("Test") {
parallel {
stage("Pytorch CPU") {
agent { docker { image "dgllib/dgl-ci-cpu" } }
agent {
docker { image "dgllib/dgl-ci-cpu" }
}
stages {
stage("TH CPU unittest") {
steps { pytorch_unit_test("CPU") }
Expand All @@ -117,6 +179,20 @@ pipeline {
always { junit "*.xml" }
}
}
stage("Pytorch CPU (Windows)") {
agent { label "windows" }
stages {
stage("TH CPU Win64 unittest") {
steps { pytorch_unit_test_win64("CPU") }
}
stage("TH CPU Win64 example test") {
steps { example_test_win64("CPU") }
}
}
BarclayII marked this conversation as resolved.
Show resolved Hide resolved
post {
always { junit "*.xml" }
}
}
stage("Pytorch GPU") {
agent {
docker {
Expand All @@ -139,7 +215,9 @@ pipeline {
//}
}
stage("MXNet CPU") {
agent { docker { image "dgllib/dgl-ci-mxnet-cpu" } }
agent {
docker { image "dgllib/dgl-ci-mxnet-cpu" }
}
stages {
stage("MX Unittest") {
steps { mxnet_unit_test("CPU") }
Expand All @@ -154,13 +232,17 @@ pipeline {
stage("Doc") {
parallel {
stage("TH Tutorial") {
agent { docker { image "dgllib/dgl-ci-cpu" } }
agent {
docker { image "dgllib/dgl-ci-cpu" }
}
steps {
pytorch_tutorials()
}
}
stage("MX Tutorial") {
agent { docker { image "dgllib/dgl-ci-mxnet-cpu" } }
agent {
docker { image "dgllib/dgl-ci-mxnet-cpu" }
}
steps {
mxnet_tutorials()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/pytorch/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_incmat():

def test_incmat_cache():
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))
g = dgl.DGLGraph(a)
# the first call should contruct the inc
Expand Down
28 changes: 28 additions & 0 deletions tests/scripts/task_example_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@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