Skip to content

Commit 5960a3f

Browse files
committed
upgrading to google benchmark v1.5.1; modifying benchmark_1.5.1/googletest/googletest/src/gtest_main.cc for MPI
1 parent 20ac119 commit 5960a3f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/benchmark_1.5.1/googletest/googletest/src/gtest_main.cc

+11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include <cstdio>
3131
#include "gtest/gtest.h"
32+
#include <stan/math/prim/functor/mpi_cluster.hpp>
3233

3334
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
3435
#if GTEST_OS_ESP8266
@@ -47,6 +48,16 @@ void loop() { RUN_ALL_TESTS(); }
4748
#else
4849

4950
GTEST_API_ int main(int argc, char **argv) {
51+
52+
#ifdef STAN_MPI
53+
// for MPI testing we test with all workers in listen mode.
54+
// No output is generated from the workers.
55+
stan::math::mpi_cluster cluster;
56+
cluster.listen();
57+
if (cluster.rank_ != 0)
58+
return 0;
59+
#endif
60+
5061
printf("Running main() from %s\n", __FILE__);
5162
testing::InitGoogleTest(&argc, argv);
5263
return RUN_ALL_TESTS();

0 commit comments

Comments
 (0)