Skip to content

Commit 05ac92f

Browse files
Split compile tests into smaller chunks to improve CI times (#1123)
Split compile tests into smaller chunks to improve CI times
1 parent 6a39f77 commit 05ac92f

2 files changed

Lines changed: 59 additions & 24 deletions

File tree

Jenkinsfile

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@Library('StanUtils')
22
import org.stan.Utils
33

4-
def utils = new org.stan.Utils()
4+
utils = new org.stan.Utils()
55

66
def skipExpressionTests = false
77
def skipRemainingStages = false
@@ -24,6 +24,30 @@ def tagName() {
2424
}
2525
}
2626

27+
def runPerformanceTests(String testsPath){
28+
unstash 'ubuntu-exe'
29+
30+
sh """
31+
git clone --recursive --depth 50 https://github.com/stan-dev/performance-tests-cmdstan
32+
"""
33+
34+
writeFile(file:"performance-tests-cmdstan/cmdstan/make/local", text:"CXX=${CXX}")
35+
36+
utils.checkout_pr("cmdstan", "performance-tests-cmdstan/cmdstan", params.cmdstan_pr)
37+
utils.checkout_pr("stan", "performance-tests-cmdstan/cmdstan/stan", params.stan_pr)
38+
utils.checkout_pr("math", "performance-tests-cmdstan/cmdstan/stan/lib/stan_math", params.math_pr)
39+
40+
sh """
41+
cd performance-tests-cmdstan
42+
mkdir cmdstan/bin
43+
cp ../bin/stanc cmdstan/bin/linux-stanc
44+
cd cmdstan; make clean-all;
45+
echo 'O=0' >> make/local
46+
make -j${env.PARALLEL} build; cd ..
47+
./runPerformanceTests.py -j${env.PARALLEL} --runs=0 ${testsPath}
48+
"""
49+
}
50+
2751
pipeline {
2852
agent none
2953
parameters {
@@ -38,7 +62,7 @@ pipeline {
3862
options {parallelsAlwaysFailFast()}
3963
environment {
4064
CXX = 'clang++-6.0'
41-
PARALLEL = 8
65+
PARALLEL = 4
4266
}
4367
stages {
4468
stage('Kill previous builds') {
@@ -176,7 +200,8 @@ pipeline {
176200
}
177201
stage("CmdStan & Math tests") {
178202
parallel {
179-
stage("Compile tests") {
203+
204+
stage("Compile tests - good") {
180205
when {
181206
beforeAgent true
182207
expression {
@@ -191,26 +216,36 @@ pipeline {
191216
}
192217
steps {
193218
script {
194-
unstash 'ubuntu-exe'
195-
sh """
196-
git clone --recursive --depth 50 https://github.com/stan-dev/performance-tests-cmdstan
197-
"""
198-
199-
writeFile(file:"performance-tests-cmdstan/cmdstan/make/local",
200-
text:"O=0\nCXX=${CXX}")
219+
runPerformanceTests("../test/integration/good")
220+
}
201221

202-
utils.checkout_pr("cmdstan", "performance-tests-cmdstan/cmdstan", params.cmdstan_pr)
203-
utils.checkout_pr("stan", "performance-tests-cmdstan/cmdstan/stan", params.stan_pr)
204-
utils.checkout_pr("math", "performance-tests-cmdstan/cmdstan/stan/lib/stan_math", params.math_pr)
222+
xunit([GoogleTest(
223+
deleteOutputFiles: false,
224+
failIfNotNew: true,
225+
pattern: 'performance-tests-cmdstan/performance.xml',
226+
skipNoTestFiles: false,
227+
stopProcessingIfError: false)
228+
])
229+
}
230+
post { always { runShell("rm -rf ./*") }}
231+
}
205232

206-
sh """
207-
cd performance-tests-cmdstan
208-
mkdir cmdstan/bin
209-
cp ../bin/stanc cmdstan/bin/linux-stanc
210-
cd cmdstan; make clean-all; make -j${env.PARALLEL} build; cd ..
211-
./runPerformanceTests.py -j${env.PARALLEL} --runs=0 ../test/integration/good
212-
./runPerformanceTests.py -j${env.PARALLEL} --runs=0 example-models
213-
"""
233+
stage("Compile tests - example-models") {
234+
when {
235+
beforeAgent true
236+
expression {
237+
!skipCompileTests
238+
}
239+
}
240+
agent {
241+
docker {
242+
image 'stanorg/ci:gpu'
243+
label 'linux'
244+
}
245+
}
246+
steps {
247+
script {
248+
runPerformanceTests("example-models")
214249
}
215250

216251
xunit([GoogleTest(
@@ -223,6 +258,7 @@ pipeline {
223258
}
224259
post { always { runShell("rm -rf ./*") }}
225260
}
261+
226262
stage("Model end-to-end tests") {
227263
when {
228264
beforeAgent true

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ This repo contains a new compiler for Stan, stanc3, written in OCaml.
33
Since version 2.26, this has been the default compiler for Stan. See [this wiki](https://github.com/stan-dev/stanc3/wiki/changes-from-stanc2) for a list of minor differences between this compiler and the previous Stan compiler.
44

55
To read more about why we built this, see this [introductory blog post](https://statmodeling.stat.columbia.edu/2019/03/13/stanc3-rewriting-the-stan-compiler/). For some discussion as to how we chose OCaml, see [this accidental flamewar](https://discourse.mc-stan.org/t/choosing-the-new-stan-compilers-implementation-language/6203).
6-
We're testing [these models](https://jenkins.mc-stan.org/job/stanc3/job/master/) (listed under Test Results) on every pull request.
7-
8-
[![Build Status](https://jenkins.mc-stan.org/buildStatus/icon?job=stanc3%2Fmaster&style=flat-square)](https://jenkins.mc-stan.org/job/stanc3/job/master/)
6+
We're testing [these models](https://jenkins.flatironinstitute.org/job/Stan/job/Stanc3/job/master/) (listed under Test Results) on every pull request.
97

8+
[![Build Status](https://jenkins.flatironinstitute.org/job/Stan/job/Stanc3/job/master/badge/icon?style=flat-square)](https://jenkins.flatironinstitute.org/job/Stan/job/Stanc3/job/master/)
109

1110
## Documentation
1211

0 commit comments

Comments
 (0)