Skip to content

Commit 84f077b

Browse files
authored
Merge pull request #2033 from stan-dev/remove_threading_test
Remove threading test that cause false positives
2 parents 2e8f7a7 + ef89ff4 commit 84f077b

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

test/unit/math/prim/functor/reduce_sum_test.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -232,37 +232,3 @@ TEST(StanMathPrim_reduce_sum, sum) {
232232
std::vector<std::vector<double>>(2, std::vector<double>(5, 1.0)),
233233
std::vector<Eigen::VectorXd>(2, Eigen::VectorXd::Ones(5)));
234234
}
235-
236-
#ifdef STAN_THREADS
237-
std::vector<int> threading_test_global;
238-
struct threading_test_lpdf {
239-
template <typename T1>
240-
inline auto operator()(const std::vector<T1>&, std::size_t start,
241-
std::size_t end, std::ostream* msgs) const {
242-
threading_test_global[start] = tbb::this_task_arena::current_thread_index();
243-
244-
return stan::return_type_t<T1>(0);
245-
}
246-
};
247-
248-
TEST(StanMathPrim_reduce_sum, threading) {
249-
threading_test_global = std::vector<int>(10000, 0);
250-
stan::math::reduce_sum_static<threading_test_lpdf>(threading_test_global, 1,
251-
nullptr);
252-
253-
auto uniques = std::set<int>(threading_test_global.begin(),
254-
threading_test_global.end());
255-
256-
EXPECT_GT(uniques.size(), 1);
257-
258-
threading_test_global = std::vector<int>(10000, 0);
259-
260-
stan::math::reduce_sum<threading_test_lpdf>(threading_test_global, 1,
261-
nullptr);
262-
263-
uniques = std::set<int>(threading_test_global.begin(),
264-
threading_test_global.end());
265-
266-
EXPECT_GT(uniques.size(), 1);
267-
}
268-
#endif

test/unit/math/rev/functor/reduce_sum_test.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -389,38 +389,3 @@ TEST(StanMathRev_reduce_sum, slice_group_gradient) {
389389

390390
stan::math::recover_memory();
391391
}
392-
393-
#ifdef STAN_THREADS
394-
std::vector<int> threading_test_global;
395-
struct threading_test_lpdf {
396-
template <typename T1>
397-
inline auto operator()(const std::vector<T1>&, std::size_t start,
398-
std::size_t end, std::ostream* msgs) const {
399-
threading_test_global[start] = tbb::this_task_arena::current_thread_index();
400-
401-
return stan::return_type_t<T1>(0);
402-
}
403-
};
404-
405-
TEST(StanMathRev_reduce_sum, threading) {
406-
threading_test_global = std::vector<int>(10000, 0);
407-
std::vector<stan::math::var> data(threading_test_global.size(), 0);
408-
stan::math::reduce_sum_static<threading_test_lpdf>(data, 1, nullptr);
409-
410-
auto uniques = std::set<int>(threading_test_global.begin(),
411-
threading_test_global.end());
412-
413-
EXPECT_GT(uniques.size(), 1);
414-
415-
threading_test_global = std::vector<int>(10000, 0);
416-
417-
stan::math::reduce_sum<threading_test_lpdf>(data, 1, nullptr);
418-
419-
uniques = std::set<int>(threading_test_global.begin(),
420-
threading_test_global.end());
421-
422-
EXPECT_GT(uniques.size(), 1);
423-
424-
stan::math::recover_memory();
425-
}
426-
#endif

0 commit comments

Comments
 (0)