forked from jolibrain/deepdetect
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile.unittests
118 lines (118 loc) · 3.44 KB
/
Jenkinsfile.unittests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
pipeline {
agent { node { label 'gpu' } }
stages {
stage('Init') {
steps {
script {
def common = load("ci/Jenkinsfile.common")
common.cancelPreviousBuilds()
}
sh 'printenv | sort'
}
}
stage('Installing prebuilt cache') {
when {
expression { !env.CHANGE_ID || pullRequest.labels.findAll { it == "ci:full-build" }.size() == 0 }
}
steps {
script {
try {
copyArtifacts(projectName: 'deepdetect-prebuilt-cache/master')
} catch (err) {
echo "artefact copy fail, skipping it"
echo err.getMessage();
}
}
}
}
stage('Configure') {
steps {
sh '''
export PATH="/usr/lib/ccache/:$PATH"
mkdir -p build
cd build
cmake .. -DBUILD_TESTS=ON -DUSE_CUDNN=ON -DUSE_FAISS=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_XGBOOST=ON -DUSE_TORCH=ON -DUSE_NCNN=ON -DUSE_TENSORRT=ON -DUSE_TENSORRT_OSS=ON -DCUDA_ARCH="-gencode arch=compute_61,code=sm_61"
'''
}
}
stage('Check codestyle') {
steps {
sh 'cd build && make clang-format-check'
}
}
stage('Check python client') {
steps {
sh 'cd clients/python/ && tox -e pep8,py36,py27'
}
}
stage('Build GPU') {
steps {
sh '''
export PATH="/usr/lib/ccache/:$PATH"
cd build
schedtool -B -n 1 -e ionice -n 1 make -j24 protobuf pytorch caffe_dd Multicore-TSNE faisslib ncnn xgboost cpp-netlib tensorrt-oss
# TODO(sileht): we should create the prebuilt artefacts here after each successful master branch build
schedtool -B -n 1 -e ionice -n 1 make -j 6
ccache -s
'''
}
}
stage('Tests GPU') {
steps {
lock(resource: null, label: "${NODE_NAME}-gpu", variable: 'LOCKED_GPU', quantity: 1) {
sh '''
export CUDA_VISIBLE_DEVICES=${LOCKED_GPU##*GPU }
echo "****************************"
echo
python3 -c 'import torch, sys; c=torch.cuda.device_count() ; print(f"CUDA VISIBLE GPU: {c}"); sys.exit(bool(c == 0 ))'
echo
echo "****************************"
cd build && ctest -V -E "http|multigpu"
'''
}
}
}
/*
stage('Tests multi-GPU') {
steps {
lock(resource: null, label: 'gpu', variable: 'LOCKED_GPU', quantity: 2) {
sh '''
export CUDA_VISIBLE_DEVICES=$(echo ${LOCKED_GPU} | sed "s/GPU //g")
echo "****************************"
echo
python3 -c 'import torch, sys; c=torch.cuda.device_count() ; print(f"CUDA VISIBLE GPU: {c}"); sys.exit(bool(c < 2))'
echo
echo "****************************"
cd build && ctest -V -E "http" -R "multigpu"
'''
}
}
}
*/
}
post {
always {
cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, cleanupMatrixParent: true, deleteDirs: true)
}
success {
catchError {
rocketSend(channel: 'build', message: 'Build succeed' ,color: 'green' )
}
}
aborted {
catchError {
rocketSend(channel: 'build', message: 'Build superseded or aborted')
}
}
unstable {
catchError {
rocketSend(channel: 'build', message: 'Build failed', color: 'red')
}
}
failure {
catchError {
rocketSend(channel: 'build', message: 'Build failed', color: 'red')
}
}
}
}