Skip to content

Commit 7b3f7b7

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/parameter-pack-odes
2 parents c719ec5 + e672c90 commit 7b3f7b7

File tree

4 files changed

+71
-34
lines changed

4 files changed

+71
-34
lines changed

Jenkinsfile

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,29 @@ pipeline {
175175
}
176176
post { always { deleteDir() } }
177177
}
178-
stage('Linux Unit with MPI') {
179-
agent { label 'linux && mpi' }
178+
stage('Full Unit Tests') {
179+
agent any
180+
when {
181+
expression {
182+
!skipRemainingStages
183+
}
184+
}
180185
steps {
181-
deleteDir()
182-
unstash 'MathSetup'
183-
sh "echo CXX=${MPICXX} >> make/local"
184-
sh "echo CXX_TYPE=gcc >> make/local"
185-
sh "echo STAN_MPI=true >> make/local"
186-
runTests("test/unit")
186+
script {
187+
if (isUnix()) {
188+
deleteDir()
189+
unstash 'MathSetup'
190+
runTests("test/unit/math/prim")
191+
runTests("test/unit/math/rev")
192+
runTests("test/unit")
193+
} else {
194+
deleteDirWin()
195+
unstash 'MathSetup'
196+
runTestsWin("test/unit/math/prim")
197+
runTestsWin("test/unit/math/rev")
198+
runTestsWin("test/unit")
199+
}
200+
}
187201
}
188202
post { always { retry(3) { deleteDir() } } }
189203
}
@@ -194,7 +208,20 @@ pipeline {
194208
}
195209
}
196210
parallel {
197-
stage('Full unit with GPU') {
211+
stage('MPI tests') {
212+
agent { label 'linux && mpi' }
213+
steps {
214+
deleteDir()
215+
unstash 'MathSetup'
216+
sh "echo CXX=${MPICXX} >> make/local"
217+
sh "echo CXX_TYPE=gcc >> make/local"
218+
sh "echo STAN_MPI=true >> make/local"
219+
runTests("test/unit/math/prim/functor")
220+
runTests("test/unit/math/rev/functor")
221+
}
222+
post { always { retry(3) { deleteDir() } } }
223+
}
224+
stage('OpenCL tests') {
198225
agent { label "gpu" }
199226
steps {
200227
deleteDir()
@@ -204,7 +231,13 @@ pipeline {
204231
sh "echo OPENCL_PLATFORM_ID=0>> make/local"
205232
sh "echo OPENCL_DEVICE_ID=${OPENCL_DEVICE_ID}>> make/local"
206233
sh "make -j${env.PARALLEL} test-headers"
207-
runTests("test/unit")
234+
runTests("test/unit/math/opencl")
235+
runTests("test/unit/math/prim/fun/gp_exp_quad_cov_test")
236+
runTests("test/unit/math/prim/fun/mdivide_left_tri_test")
237+
runTests("test/unit/math/prim/fun/mdivide_right_tri_test")
238+
runTests("test/unit/math/prim/fun/multiply_test")
239+
runTests("test/unit/math/rev/fun/mdivide_left_tri_test")
240+
runTests("test/unit/math/rev/fun/multiply_test")
208241
}
209242
post { always { retry(3) { deleteDir() } } }
210243
}
@@ -238,14 +271,28 @@ pipeline {
238271
stage('Threading tests') {
239272
agent any
240273
steps {
241-
deleteDir()
242-
unstash 'MathSetup'
243-
sh "echo CXX=${env.CXX} -Werror > make/local"
244-
sh "echo CPPFLAGS+=-DSTAN_THREADS >> make/local"
245-
sh "export STAN_NUM_THREADS=4"
246-
runTests("test/unit -f thread")
247-
sh "find . -name *_test.xml | xargs rm"
248-
runTests("test/unit -f map_rect")
274+
script {
275+
if (isUnix()) {
276+
deleteDir()
277+
unstash 'MathSetup'
278+
sh "echo CXX=${env.CXX} -Werror > make/local"
279+
sh "echo CPPFLAGS+=-DSTAN_THREADS >> make/local"
280+
sh "export STAN_NUM_THREADS=4"
281+
runTests("test/unit -f thread")
282+
sh "find . -name *_test.xml | xargs rm"
283+
runTests("test/unit -f map_rect")
284+
sh "find . -name *_test.xml | xargs rm"
285+
runTests("test/unit -f reduce_sum")
286+
} else {
287+
deleteDirWin()
288+
unstash 'MathSetup'
289+
bat "echo CXX=${env.CXX} -Werror > make/local"
290+
bat "echo CXXFLAGS+=-DSTAN_THREADS >> make/local"
291+
runTestsWin("test/unit -f thread", false)
292+
runTestsWin("test/unit -f map_rect", false)
293+
runTestsWin("test/unit -f reduce_sum", false)
294+
}
295+
}
249296
}
250297
post { always { retry(3) { deleteDir() } } }
251298
}
@@ -259,17 +306,6 @@ pipeline {
259306
runTestsWin("test/unit", false)
260307
}
261308
}
262-
stage('Windows Threading') {
263-
agent { label 'windows' }
264-
steps {
265-
deleteDirWin()
266-
unstash 'MathSetup'
267-
bat "echo CXX=${env.CXX} -Werror > make/local"
268-
bat "echo CXXFLAGS+=-DSTAN_THREADS >> make/local"
269-
runTestsWin("test/unit -f thread")
270-
runTestsWin("test/unit -f map_rect")
271-
}
272-
}
273309
}
274310
}
275311
stage('Additional merge tests') {

stan/math/prim/fun/inv_cloglog.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,16 @@ namespace math {
2626
\textrm{NaN} & \mbox{if } y = \textrm{NaN}
2727
\end{cases}
2828
\f]
29-
3029
\f[
3130
\frac{\partial\, \mbox{inv\_cloglog}(y)}{\partial y} =
3231
\begin{cases}
3332
\frac{\partial\, \mbox{cloglog}^{-1}(y)}{\partial y} & \mbox{if }
3433
-\infty\leq y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN}
3534
\end{cases}
3635
\f]
37-
3836
\f[
3937
\mbox{cloglog}^{-1}(y) = 1 - \exp \left( - \exp(y) \right)
4038
\f]
41-
4239
\f[
4340
\frac{\partial \, \mbox{cloglog}^{-1}(y)}{\partial y} = \exp(y-\exp(y))
4441
\f]

stan/math/prim/prob/lognormal_lpdf.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <stan/math/prim/meta.hpp>
55
#include <stan/math/prim/err.hpp>
66
#include <stan/math/prim/fun/constants.hpp>
7+
#include <stan/math/prim/fun/inv.hpp>
78
#include <stan/math/prim/fun/log.hpp>
89
#include <stan/math/prim/fun/max_size.hpp>
910
#include <stan/math/prim/fun/size.hpp>
@@ -63,7 +64,7 @@ return_type_t<T_y, T_loc, T_scale> lognormal_lpdf(const T_y& y, const T_loc& mu,
6364
inv_sigma_sq(size(sigma));
6465
if (include_summand<propto, T_y, T_loc, T_scale>::value) {
6566
for (size_t n = 0; n < stan::math::size(sigma); n++) {
66-
inv_sigma[n] = 1 / value_of(sigma_vec[n]);
67+
inv_sigma[n] = inv(value_of(sigma_vec[n]));
6768
}
6869
}
6970
if (include_summand<propto, T_y, T_loc, T_scale>::value) {
@@ -85,7 +86,7 @@ return_type_t<T_y, T_loc, T_scale> lognormal_lpdf(const T_y& y, const T_loc& mu,
8586
stan::math::size(y));
8687
if (!is_constant_all<T_y>::value) {
8788
for (size_t n = 0; n < stan::math::size(y); n++) {
88-
inv_y[n] = 1 / value_of(y_vec[n]);
89+
inv_y[n] = inv(value_of(y_vec[n]));
8990
}
9091
}
9192

test/unit/math/prim/prob/lognormal_log_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ TEST(ProbLognormal, log_matches_lpdf) {
2121
EXPECT_FLOAT_EQ(
2222
(stan::math::lognormal_lpdf<double, double, double>(y, mu, sigma)),
2323
(stan::math::lognormal_log<double, double, double>(y, mu, sigma)));
24+
25+
EXPECT_FLOAT_EQ((stan::math::lognormal_lpdf(0.8, 2.0, 2.0)),
26+
(stan::math::lognormal_log(0.8, 2, 2)));
2427
}

0 commit comments

Comments
 (0)