Skip to content

Commit c9f17b1

Browse files
authored
Merge pull request #2693 from andrjohns/feature/cpp17-pr-1
C++17 prep - namespace qualifiers only
2 parents 662d511 + 78515b6 commit c9f17b1

96 files changed

Lines changed: 274 additions & 251 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.

Jenkinsfile

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pipeline {
8787
}
8888
environment {
8989
STAN_NUM_THREADS = 4
90-
CLANG_CXX = 'clang++-6.0'
90+
CLANG_CXX = 'clang++-7'
9191
GCC = 'g++'
9292
MPICXX = 'mpicxx.openmpi'
9393
N_TESTS = 150
@@ -116,7 +116,7 @@ pipeline {
116116
stage("Clang-format") {
117117
agent {
118118
docker {
119-
image 'stanorg/ci:gpu'
119+
image 'stanorg/ci:gpu-cpp17'
120120
label 'linux'
121121
}
122122
}
@@ -167,7 +167,7 @@ pipeline {
167167
stage('Linting & Doc checks') {
168168
agent {
169169
docker {
170-
image 'stanorg/ci:gpu'
170+
image 'stanorg/ci:gpu-cpp17'
171171
label 'linux'
172172
}
173173
}
@@ -202,7 +202,7 @@ pipeline {
202202
stage('Verify changes') {
203203
agent {
204204
docker {
205-
image 'stanorg/ci:gpu'
205+
image 'stanorg/ci:gpu-cpp17'
206206
label 'linux'
207207
}
208208
}
@@ -224,7 +224,7 @@ pipeline {
224224
stage('Headers check') {
225225
agent {
226226
docker {
227-
image 'stanorg/ci:gpu'
227+
image 'stanorg/ci:gpu-cpp17'
228228
label 'linux'
229229
}
230230
}
@@ -252,7 +252,7 @@ pipeline {
252252
stage('Rev/Fwd Unit Tests') {
253253
agent {
254254
docker {
255-
image 'stanorg/ci:gpu'
255+
image 'stanorg/ci:gpu-cpp17'
256256
label 'linux'
257257
args '--cap-add SYS_PTRACE'
258258
}
@@ -275,7 +275,7 @@ pipeline {
275275
stage('Mix Unit Tests') {
276276
agent {
277277
docker {
278-
image 'stanorg/ci:gpu'
278+
image 'stanorg/ci:gpu-cpp17'
279279
label 'linux'
280280
args '--cap-add SYS_PTRACE'
281281
}
@@ -297,7 +297,7 @@ pipeline {
297297
stage('Prim Unit Tests') {
298298
agent {
299299
docker {
300-
image 'stanorg/ci:gpu'
300+
image 'stanorg/ci:gpu-cpp17'
301301
label 'linux'
302302
args '--cap-add SYS_PTRACE'
303303
}
@@ -313,7 +313,7 @@ pipeline {
313313
script {
314314
runTests("test/unit/*_test.cpp", false)
315315
runTests("test/unit/math/*_test.cpp", false)
316-
runTests("test/unit/math/prim", false)
316+
runTests("test/unit/math/prim", false)
317317
runTests("test/unit/math/memory", false)
318318
}
319319
}
@@ -332,7 +332,7 @@ pipeline {
332332
stage('MPI tests') {
333333
agent {
334334
docker {
335-
image 'stanorg/ci:gpu'
335+
image 'stanorg/ci:gpu-cpp17'
336336
label 'linux'
337337
}
338338
}
@@ -352,7 +352,7 @@ pipeline {
352352
stage('OpenCL GPU tests') {
353353
agent {
354354
docker {
355-
image 'stanorg/ci:gpu'
355+
image 'stanorg/ci:gpu-cpp17'
356356
label 'v100'
357357
args '--gpus 1'
358358
}
@@ -375,9 +375,8 @@ pipeline {
375375
stage('Distribution tests') {
376376
agent {
377377
docker {
378-
image 'stanorg/ci:gpu'
378+
image 'stanorg/ci:gpu-cpp17'
379379
label 'linux'
380-
args '--pull always'
381380
}
382381
}
383382
steps {
@@ -409,9 +408,8 @@ pipeline {
409408
stage('Expressions test') {
410409
agent {
411410
docker {
412-
image 'stanorg/ci:gpu'
411+
image 'stanorg/ci:gpu-cpp17'
413412
label 'linux'
414-
args '--pull always'
415413
}
416414
}
417415
steps {
@@ -445,9 +443,8 @@ pipeline {
445443
stage('Threading tests') {
446444
agent {
447445
docker {
448-
image 'stanorg/ci:gpu'
446+
image 'stanorg/ci:gpu-cpp17'
449447
label 'linux'
450-
args '--pull always'
451448
}
452449
}
453450
steps {
@@ -495,7 +492,7 @@ pipeline {
495492
stage('Upload doxygen') {
496493
agent {
497494
docker {
498-
image 'stanorg/ci:gpu'
495+
image 'stanorg/ci:gpu-cpp17'
499496
label 'linux'
500497
}
501498
}

stan/math/opencl/matrix_cl.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class matrix_cl : public matrix_cl_base {
283283
matrix_cl(const int rows, const int cols,
284284
matrix_cl_view partial_view = matrix_cl_view::Entire)
285285
: rows_(rows), cols_(cols), view_(partial_view) {
286-
if (size() == 0) {
286+
if (this->size() == 0) {
287287
return;
288288
}
289289
cl::Context& ctx = opencl_context.context();
@@ -321,7 +321,7 @@ class matrix_cl : public matrix_cl_base {
321321
matrix_cl_view partial_view = matrix_cl_view::Entire)
322322
: rows_(A.rows()), cols_(A.cols()), view_(partial_view) {
323323
using Mat_type = std::decay_t<ref_type_for_opencl_t<Mat>>;
324-
if (size() == 0) {
324+
if (this->size() == 0) {
325325
return;
326326
}
327327
initialize_buffer_no_heap_if<
@@ -457,7 +457,7 @@ class matrix_cl : public matrix_cl_base {
457457
return *this;
458458
}
459459
this->wait_for_read_write_events();
460-
if (size() != a.size()) {
460+
if (this->size() != a.size()) {
461461
buffer_cl_ = cl::Buffer(opencl_context.context(), CL_MEM_READ_WRITE,
462462
sizeof(T) * a.size());
463463
}
@@ -518,7 +518,7 @@ class matrix_cl : public matrix_cl_base {
518518
template <bool in_order = false>
519519
cl::Event initialize_buffer(const T* A) {
520520
cl::Event transfer_event;
521-
if (size() == 0) {
521+
if (this->size() == 0) {
522522
return transfer_event;
523523
}
524524
cl::Context& ctx = opencl_context.context();
@@ -538,7 +538,7 @@ class matrix_cl : public matrix_cl_base {
538538
template <bool in_order = false>
539539
cl::Event initialize_buffer(T* A) {
540540
cl::Event transfer_event;
541-
if (size() == 0) {
541+
if (this->size() == 0) {
542542
return transfer_event;
543543
}
544544
cl::Context& ctx = opencl_context.context();
@@ -577,7 +577,7 @@ class matrix_cl : public matrix_cl_base {
577577
*/
578578
template <bool No_heap, typename U, std::enable_if_t<No_heap>* = nullptr>
579579
void initialize_buffer_no_heap_if(U&& obj) {
580-
if (size() == 0) {
580+
if (this->size() == 0) {
581581
return;
582582
}
583583
initialize_buffer(obj.data());
@@ -587,7 +587,7 @@ class matrix_cl : public matrix_cl_base {
587587
template <bool No_heap, typename U, std::enable_if_t<!No_heap>* = nullptr>
588588
void initialize_buffer_no_heap_if(U&& obj) {
589589
using U_val = std::decay_t<ref_type_for_opencl_t<U>>;
590-
if (size() == 0) {
590+
if (this->size() == 0) {
591591
return;
592592
}
593593
auto* obj_heap = new U_val(std::move(obj));

stan/math/opencl/prim/bernoulli_cdf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ return_type_t<T_prob_cl> bernoulli_cdf(const T_n_cl& n,
3737

3838
check_consistent_sizes(function, "Random variable", n,
3939
"Probability parameter", theta);
40-
const size_t N = is_n_vector ? size(n) : size(theta);
40+
const size_t N = is_n_vector ? math::size(n) : math::size(theta);
4141
if (N == 0) {
4242
return 1.0;
4343
}

stan/math/opencl/prim/bernoulli_lccdf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ return_type_t<T_prob_cl> bernoulli_lccdf(const T_n_cl& n,
3838

3939
check_consistent_sizes(function, "Random variable", n,
4040
"Probability parameter", theta);
41-
const size_t N = is_n_vector ? size(n) : size(theta);
41+
const size_t N = is_n_vector ? math::size(n) : math::size(theta);
4242
if (N == 0) {
4343
return 0.0;
4444
}

stan/math/opencl/prim/bernoulli_lcdf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ return_type_t<T_prob_cl> bernoulli_lcdf(const T_n_cl& n,
3838

3939
check_consistent_sizes(function, "Random variable", n,
4040
"Probability parameter", theta);
41-
const size_t N = is_n_vector ? size(n) : size(theta);
41+
const size_t N = is_n_vector ? math::size(n) : math::size(theta);
4242
if (N == 0) {
4343
return 0.0;
4444
}

stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ return_type_t<T_x_cl, T_alpha_cl, T_beta_cl> bernoulli_logit_glm_lpmf(
6666
const size_t M = x.cols();
6767

6868
if (is_y_vector) {
69-
check_size_match(function, "Rows of ", "x", N, "rows of ", "y", size(y));
69+
check_size_match(function, "Rows of ", "x", N, "rows of ", "y",
70+
math::size(y));
7071
}
7172
check_size_match(function, "Columns of ", "x_cl", M, "size of ", "beta",
72-
size(beta));
73+
math::size(beta));
7374
if (is_alpha_vector) {
7475
check_size_match(function, "Rows of ", "x", N, "size of ", "alpha",
75-
size(alpha));
76+
math::size(alpha));
7677
}
7778

7879
if (N == 0) {

stan/math/opencl/prim/bernoulli_logit_lpmf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ return_type_t<T_prob_cl> bernoulli_logit_lpmf(const T_n_cl& n,
3636

3737
check_consistent_sizes(function, "Random variable", n,
3838
"Probability parameter", theta);
39-
const size_t N = is_n_vector ? size(n) : size(theta);
39+
const size_t N = is_n_vector ? math::size(n) : math::size(theta);
4040
if (N == 0) {
4141
return 0.0;
4242
}

stan/math/opencl/prim/bernoulli_lpmf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ return_type_t<T_prob_cl> bernoulli_lpmf(const T_n_cl& n,
3838

3939
check_consistent_sizes(function, "Random variable", n,
4040
"Probability parameter", theta);
41-
const size_t N = is_n_vector ? size(n) : size(theta);
41+
const size_t N = is_n_vector ? math::size(n) : math::size(theta);
4242
if (N == 0) {
4343
return 0.0;
4444
}

stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ return_type_t<T_x, T_alpha, T_beta> categorical_logit_glm_lpmf(
6161
static const char* function = "categorical_logit_glm_lpmf";
6262
if (is_y_vector) {
6363
check_size_match(function, "Rows of ", "x", N_instances, "size of ", "y",
64-
size(y));
64+
math::size(y));
6565
}
6666
check_size_match(function, "Columns of ", "beta", N_classes, "size of ",
67-
"alpha", size(alpha));
67+
"alpha", math::size(alpha));
6868
check_size_match(function, "Columns of ", "x", N_attributes, "Rows of",
6969
"beta", beta.rows());
7070

stan/math/opencl/prim/neg_binomial_2_log_glm_lpmf.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,18 @@ neg_binomial_2_log_glm_lpmf(const T_y_cl& y, const T_x_cl& x,
8282
const size_t M = x.cols();
8383

8484
if (is_y_vector) {
85-
check_size_match(function, "Rows of ", "x", N, "rows of ", "y", size(y));
85+
check_size_match(function, "Rows of ", "x", N, "rows of ", "y",
86+
math::size(y));
8687
}
8788
check_size_match(function, "Columns of ", "x", M, "size of ", "beta",
88-
size(beta));
89+
math::size(beta));
8990
if (is_phi_vector) {
9091
check_size_match(function, "Rows of ", "x", N, "size of ", "phi",
91-
size(phi));
92+
math::size(phi));
9293
}
9394
if (is_alpha_vector) {
9495
check_size_match(function, "Rows of ", "x", N, "size of ", "alpha",
95-
size(alpha));
96+
math::size(alpha));
9697
}
9798
if (N == 0) {
9899
return 0;

0 commit comments

Comments
 (0)