Unverified Commit 49ea781c authored by Lingfan Yu's avatar Lingfan Yu Committed by GitHub
Browse files

Improve CI (#92)

* gcn example test code

* GPU test

* use python3

* use functions

* gpu test use functions

* remove root

* use one script to run both cpu and gpu tests
parent 3e76bcc0
#!/usr/bin/env groovy
def setup() {
sh 'easy_install nose'
sh 'git submodule init'
sh 'git submodule update'
}
def build_dgl() {
sh 'if [ -d build ]; then rm -rf build; fi; mkdir build'
dir('python') {
sh 'python3 setup.py install'
}
dir ('build') {
sh 'cmake ..'
sh 'make -j$(nproc)'
}
}
def unit_test() {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build"]) {
sh 'nosetests tests -v --with-xunit'
sh 'nosetests tests/pytorch -v --with-xunit'
sh 'nosetests tests/graph_index -v --with-xunit'
}
}
def example_test(dev) {
dir ('tests/scripts') {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build"]) {
sh "./test_examples.sh ${dev}"
}
}
}
pipeline {
agent none
stages {
......@@ -7,36 +42,27 @@ pipeline {
agent {
docker {
image 'lingfanyu/dgl-cpu'
args '-u root'
}
}
stages {
stage('SETUP') {
steps {
sh 'easy_install nose'
sh 'git submodule init'
sh 'git submodule update'
setup()
}
}
stage('BUILD') {
steps {
sh 'if [ -d build ]; then rm -rf build; fi; mkdir build'
dir('python') {
sh 'python3 setup.py install'
}
dir ('build') {
sh 'cmake ..'
sh 'make -j$(nproc)'
}
build_dgl()
}
}
stage('UNIT TEST') {
steps {
unit_test()
}
}
stage('TEST') {
stage('EXAMPLE TEST') {
steps {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build"]) {
sh 'nosetests tests -v --with-xunit'
sh 'nosetests tests/pytorch -v --with-xunit'
sh 'nosetests tests/graph_index -v --with-xunit'
}
example_test('CPU')
}
}
}
......@@ -50,36 +76,28 @@ pipeline {
agent {
docker {
image 'lingfanyu/dgl-gpu'
args '--runtime nvidia -u root'
args '--runtime nvidia'
}
}
stages {
stage('SETUP') {
steps {
sh 'easy_install nose'
sh 'git submodule init'
sh 'git submodule update'
setup()
}
}
stage('BUILD') {
steps {
sh 'if [ -d build ]; then rm -rf build; fi; mkdir build'
dir('python') {
sh 'python3 setup.py install'
}
dir ('build') {
sh 'cmake ..'
sh 'make -j$(nproc)'
}
build_dgl()
}
}
stage('UNIT TEST') {
steps {
unit_test()
}
}
stage('TEST') {
stage('EXAMPLE TEST') {
steps {
withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build"]) {
sh 'nosetests tests -v --with-xunit'
sh 'nosetests tests/pytorch -v --with-xunit'
sh 'nosetests tests/graph_index -v --with-xunit'
}
example_test('GPU')
}
}
}
......
#!/bin/bash
GCN_EXAMPLE_DIR="../../examples/pytorch/gcn"
function fail {
echo FAIL: $@
exit -1
}
function usage {
echo "Usage: $0 [CPU|GPU]"
}
# check arguments
if [ $# -ne 1 ]; then
usage
fail "Error: must specify device"
fi
if [ "$1" == "CPU" ]; then
dev=-1
elif [ "$1" == "GPU" ]; then
export CUDA_VISIBLE_DEVICES=0
dev=0
else
usage
fail "Unknown device $1"
fi
pushd $GCN_EXAMPLE_DIR> /dev/null
# test CPU
python3 gcn.py --dataset cora --gpu $dev || fail "run gcn.py on $1"
python3 gcn_spmv.py --dataset cora --gpu $dev || fail "run gcn_spmv.py on $1"
popd > /dev/null
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