12 #include <gtest/gtest.h>
16 TEST(Threading, openmp) {
18 omp_set_num_threads(10);
20 EXPECT_EQ(omp_get_max_threads(), 10);
22 std::vector<int> nt_per_thread(10);
24 #pragma omp parallel reduction(+: sum)
26 int nt = omp_get_num_threads ();
27 int rank = omp_get_thread_num ();
29 nt_per_thread[rank] = nt;
31 for(
int i = 0; i < 1000 * 1000 * 10; i++) {
37 EXPECT_EQ (nt_per_thread[0], 10);