Skip to content

Commit 53ce103

Browse files
committed
Merge branch 'develop' into issue-2783-bernoulli-cdf-stable
2 parents 6103b16 + 38289cd commit 53ce103

2,444 files changed

Lines changed: 125776 additions & 44407 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.git-blame-ignore-revs

Lines changed: 2161 additions & 0 deletions
Large diffs are not rendered by default.

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ If this is a **feature request**, show what you expect to happen if the feature
2525

2626

2727
#### Current Version:
28-
v4.5.0
28+
v4.6.2

.github/workflows/header_checks.yml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@ on:
1616
permissions:
1717
contents: read
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
1923
jobs:
2024
windows:
21-
permissions:
22-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
23-
contents: read # for actions/checkout to fetch code
2425
name: Windows
2526
runs-on: windows-latest
2627

2728
steps:
28-
- uses: n1hility/cancel-previous-runs@v2
29-
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
31-
workflow: c-cpp.yml
32-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
33-
3429
- uses: actions/checkout@v3
3530
- uses: actions/setup-python@v4
3631
with:
@@ -53,39 +48,21 @@ jobs:
5348
run: make -j2 test-headers
5449

5550
opencl:
56-
permissions:
57-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
58-
contents: read # for actions/checkout to fetch code
5951
name: OpenCL
6052
runs-on: ubuntu-latest
6153

6254
steps:
63-
- uses: n1hility/cancel-previous-runs@v2
64-
with:
65-
token: ${{ secrets.GITHUB_TOKEN }}
66-
workflow: c-cpp.yml
67-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
68-
6955
- uses: actions/checkout@v3
7056

7157
- name: Run header tests
7258
run: |
7359
echo "STAN_OPENCL=true" > make/local
7460
make -j2 test-headers
7561
no_range_checks:
76-
permissions:
77-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
78-
contents: read # for actions/checkout to fetch code
7962
name: NoRange
8063
runs-on: ubuntu-latest
8164

8265
steps:
83-
- uses: n1hility/cancel-previous-runs@v2
84-
with:
85-
token: ${{ secrets.GITHUB_TOKEN }}
86-
workflow: c-cpp.yml
87-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
88-
8966
- uses: actions/checkout@v3
9067

9168
- name: Run header tests

.github/workflows/main.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,16 @@ on:
1414
- 'RELEASE-NOTES.txt'
1515
permissions:
1616
contents: read
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
1720

1821
jobs:
1922
prim-rev:
20-
permissions:
21-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
22-
contents: read # for actions/checkout to fetch code
2323
name: prim and rev tests
2424
runs-on: windows-latest
2525

2626
steps:
27-
- uses: n1hility/cancel-previous-runs@v2
28-
with:
29-
token: ${{ secrets.GITHUB_TOKEN }}
30-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
31-
3227
- uses: actions/checkout@v3
3328
- uses: actions/setup-python@v4
3429
with:
@@ -73,6 +68,7 @@ jobs:
7368
with:
7469
name: gtest_outputs_xml
7570
path: '**/*_test.xml'
71+
7672
fwd-non-fun-mix:
7773
name: fwd tests and non-fun mix tests
7874
runs-on: windows-latest
@@ -126,6 +122,7 @@ jobs:
126122
with:
127123
name: gtest_outputs_xml
128124
path: '**/*_test.xml'
125+
129126
mix-fun-1:
130127
name: mix/fun tests 1
131128
runs-on: windows-latest
@@ -174,6 +171,7 @@ jobs:
174171
with:
175172
name: gtest_outputs_xml
176173
path: '**/*_test.xml'
174+
177175
mix-fun-2:
178176
name: mix/fun tests 2
179177
runs-on: windows-latest

Jenkinsfile

Lines changed: 106 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def runTests(String testPath, boolean jumbo = false) {
1414
}
1515

1616
def skipRemainingStages = false
17-
17+
def changedDistributionTests = []
1818
def utils = new org.stan.Utils()
1919

2020
def isBranch(String b) { env.BRANCH_NAME == b }
@@ -38,11 +38,12 @@ pipeline {
3838
booleanParam(defaultValue: false, name: 'withRowVector', description: 'Run additional distribution tests on RowVectors (takes 5x as long)')
3939
booleanParam(defaultValue: false, name: 'disableJumbo', description: 'Disable Jumbo tests. This takes longer and should only be used for debugging if it is believed that the jumbo tests are causing failures.')
4040
booleanParam(defaultValue: false, name: 'optimizeUnitTests', description: 'Use O=3 for unit tests (takex ~3x as long)')
41+
booleanParam(defaultValue: false, name: 'runAllDistributions', description: 'Run all distribution tests, even ones which are unchanged compared to develop')
4142
}
4243
options {
4344
skipDefaultCheckout()
4445
preserveStashes(buildCount: 7)
45-
parallelsAlwaysFailFast()
46+
parallelsAlwaysFailFast()
4647
}
4748
environment {
4849
STAN_NUM_THREADS = 4
@@ -57,6 +58,10 @@ pipeline {
5758
OPENCL_PLATFORM_ID_CPU = 0
5859
OPENCL_PLATFORM_ID_GPU = 0
5960
PARALLEL = 4
61+
GIT_AUTHOR_NAME = 'Stan Jenkins'
62+
GIT_AUTHOR_EMAIL = 'mc.stanislaw@gmail.com'
63+
GIT_COMMITTER_NAME = 'Stan Jenkins'
64+
GIT_COMMITTER_EMAIL = 'mc.stanislaw@gmail.com'
6065
}
6166
stages {
6267

@@ -85,14 +90,12 @@ pipeline {
8590
usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
8691
sh """#!/bin/bash
8792
set -x
88-
git config user.email "mc.stanislaw@gmail.com"
89-
git config user.name "Stan Jenkins"
9093
git checkout -b ${branchName()}
9194
clang-format --version
9295
find stan test -name '*.hpp' -o -name '*.cpp' | xargs -n20 -P${PARALLEL} clang-format -i
9396
if [[ `git diff` != "" ]]; then
9497
git add stan test
95-
git commit --author='Stan BuildBot <mc.stanislaw@gmail.com>' -m "[Jenkins] auto-formatting by `clang-format --version`"
98+
git commit -m "[Jenkins] auto-formatting by `clang-format --version`"
9699
git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${fork()}/math.git ${branchName()}
97100
echo "Exiting build because clang-format found changes."
98101
echo "Those changes are now found on stan-dev/math under branch ${branchName()}"
@@ -121,7 +124,7 @@ pipeline {
121124
}
122125
}
123126
}
124-
}
127+
}
125128

126129
stage('Linting & Doc checks') {
127130
agent {
@@ -175,27 +178,65 @@ pipeline {
175178

176179
}
177180
}
181+
post { always { retry(3) { deleteDir() } } }
178182
}
179183

180-
stage('Headers check') {
181-
agent {
182-
docker {
183-
image 'stanorg/ci:gpu-cpp17'
184-
label 'linux'
185-
}
186-
}
184+
stage('Quick tests') {
187185
when {
188186
expression {
189187
!skipRemainingStages
190188
}
191189
}
192-
steps {
193-
unstash 'MathSetup'
194-
sh "echo CXX=${CLANG_CXX} -Werror > make/local"
195-
sh "echo O=0 >> make/local"
196-
sh "make -j${PARALLEL} test-headers"
190+
failFast true
191+
parallel {
192+
stage('Headers check') {
193+
when {
194+
expression {
195+
!skipRemainingStages
196+
}
197+
}
198+
agent {
199+
docker {
200+
image 'stanorg/ci:gpu-cpp17'
201+
label 'linux'
202+
}
203+
}
204+
205+
steps {
206+
unstash 'MathSetup'
207+
sh "echo CXX=${CLANG_CXX} -Werror > make/local"
208+
sh "make -j${PARALLEL} test-headers"
209+
}
210+
post { always { deleteDir() } }
211+
}
212+
stage('Run changed unit tests') {
213+
agent {
214+
docker {
215+
image 'stanorg/ci:gpu-cpp17'
216+
label 'linux'
217+
args '--cap-add SYS_PTRACE'
218+
}
219+
}
220+
when {
221+
allOf {
222+
expression {
223+
env.BRANCH_NAME ==~ /PR-\d+/
224+
}
225+
expression {
226+
!skipRemainingStages
227+
}
228+
}
229+
}
230+
steps {
231+
retry(3) { checkout scm }
232+
233+
sh "echo CXXFLAGS += -fsanitize=address >> make/local"
234+
sh "./runTests.py -j${PARALLEL} --changed --debug"
235+
236+
}
237+
post { always { retry(3) { deleteDir() } } }
238+
}
197239
}
198-
post { always { deleteDir() } }
199240
}
200241

201242
stage('Full Unit Tests') {
@@ -406,35 +447,66 @@ pipeline {
406447
}
407448
}
408449

409-
stage ('Distribution tests') {
450+
stage ('Discover changed distribution tests') {
410451
when {
411452
expression {
412453
!skipRemainingStages
413454
}
414455
}
456+
agent {
457+
docker {
458+
image 'stanorg/ci:gpu-cpp17'
459+
label 'linux'
460+
}
461+
}
462+
steps {
463+
script {
464+
retry(3) { checkout scm }
465+
if (params.runAllDistributions || isBranch('develop') || isBranch('master')) {
466+
changedDistributionTests = sh(script:"python3 test/prob/getDependencies.py --pretend-all", returnStdout:true).trim().readLines()
467+
} else {
468+
changedDistributionTests = sh(script:"python3 test/prob/getDependencies.py", returnStdout:true).trim().readLines()
469+
}
470+
}
471+
}
472+
}
473+
474+
stage ('Distribution tests') {
475+
when {
476+
allOf {
477+
expression {
478+
!skipRemainingStages
479+
}
480+
expression {
481+
!changedDistributionTests.isEmpty()
482+
}
483+
}
484+
}
415485
agent { label 'linux && docker' }
416486
steps {
417487
script {
418-
unstash 'MathSetup'
419488
def tests = [:]
420-
def files = sh(script:"find test/prob/* -type d", returnStdout:true).trim().split('\n')
421-
for (f in files.toList().collate(8)) {
489+
for (f in changedDistributionTests.collate(24)) {
422490
def names = f.join(" ")
423491
tests["Distribution Tests: ${names}"] = { node ("linux && docker") {
492+
deleteDir()
424493
docker.image('stanorg/ci:gpu-cpp17').inside {
425-
unstash 'MathSetup'
426-
sh """
427-
echo CXX=${CLANG_CXX} > make/local
428-
echo O=0 >> make/local
429-
echo N_TESTS=${N_TESTS} >> make/local
430-
"""
431-
script {
432-
if (params.withRowVector || isBranch('develop') || isBranch('master')) {
433-
sh "echo CXXFLAGS+=-DSTAN_TEST_ROW_VECTORS >> make/local"
434-
sh "echo CXXFLAGS+=-DSTAN_PROB_TEST_ALL >> make/local"
494+
catchError {
495+
unstash 'MathSetup'
496+
sh """
497+
echo CXX=${CLANG_CXX} > make/local
498+
echo O=0 >> make/local
499+
echo N_TESTS=${N_TESTS} >> make/local
500+
"""
501+
script {
502+
if (params.withRowVector || isBranch('develop') || isBranch('master')) {
503+
sh "echo CXXFLAGS+=-DSTAN_TEST_ROW_VECTORS >> make/local"
504+
sh "echo CXXFLAGS+=-DSTAN_PROB_TEST_ALL >> make/local"
505+
}
435506
}
507+
sh "./runTests.py -j${PARALLEL} ${names}"
436508
}
437-
sh "./runTests.py -j${PARALLEL} ${names}"
509+
deleteDir()
438510
}
439511
} }
440512
}

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
<div><a href="https://zenodo.org/badge/latestdoi/38388440"><img src="https://zenodo.org/badge/38388440.svg"/></a></div>
2-
3-
The <b>Stan Math Library</b> is a C++, reverse-mode automatic
4-
differentiation library designed to be usable, extensive and
5-
extensible, efficient, scalable, stable, portable, and redistributable
6-
in order to facilitate the construction and utilization of algorithms
7-
that utilize derivatives.
8-
9-
10-
Documentation, Installation, and Examples
11-
--------------
12-
13-
All of Stan math's documentation is hosted on our website below. Please do not
14-
reference articles in the wiki as they are outdated and not maintained.
15-
16-
[mc-stan.org/math](https://mc-stan.org/math/)
17-
18-
19-
Licensing
20-
---------
21-
The Stan Math Library is licensed under the [new BSD
22-
license](https://github.com/stan-dev/math/blob/develop/LICENSE%2Emd).
23-
24-
The Stan Math Library depends on the Intel TBB library which is
25-
licensed under the Apache 2.0 license. This dependency implies an
26-
additional restriction as compared to the new BSD license alone. The
27-
Apache 2.0 license is incompatible with GPL-2 licensed code if
28-
distributed as a unitary binary. You may refer to the Licensing page on the [Stan wiki](https://github.com/stan-dev/stan/wiki/Stan-Licensing).
1+
<div><a href="https://zenodo.org/badge/latestdoi/38388440"><img src="https://zenodo.org/badge/38388440.svg"/></a></div>
2+
3+
The <b>Stan Math Library</b> is a C++, reverse-mode automatic
4+
differentiation library designed to be usable, extensive and
5+
extensible, efficient, scalable, stable, portable, and redistributable
6+
in order to facilitate the construction and utilization of algorithms
7+
that utilize derivatives.
8+
9+
10+
Documentation, Installation, and Examples
11+
--------------
12+
13+
All of Stan math's documentation is hosted on our website below. Please do not
14+
reference articles in the wiki as they are outdated and not maintained.
15+
16+
[mc-stan.org/math](https://mc-stan.org/math/)
17+
18+
19+
Licensing
20+
---------
21+
The Stan Math Library is licensed under the [new BSD
22+
license](https://github.com/stan-dev/math/blob/develop/LICENSE%2Emd).
23+
24+
The Stan Math Library depends on the Intel TBB library which is
25+
licensed under the Apache 2.0 license. This dependency implies an
26+
additional restriction as compared to the new BSD license alone. The
27+
Apache 2.0 license is incompatible with GPL-2 licensed code if
28+
distributed as a unitary binary. You may refer to the Licensing page on the [Stan wiki](https://github.com/stan-dev/stan/wiki/Stan-Licensing).

0 commit comments

Comments
 (0)