MUQ  0.4.3
RunParallelTests.cpp
Go to the documentation of this file.
1 #include <iostream>
2 
3 // include the google testing header
4 #include <gtest/gtest.h>
5 
6 #include "MUQ/config.h"
7 
8 #if MUQ_HAS_MPI==0
9 #error
10 #endif
11 
12 #include <mpi.h>
13 
14 int main(int argc, char **argv) {
15  ::testing::InitGoogleTest(&argc, argv);
16 
17  const int ierr = MPI_Init(nullptr, nullptr);
18 
19  int rank;
20  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
21 
22  // set the random number generator (important to make sure Eigen::****::Random returns different values on each processor)
23  srand((unsigned int) time(0)+rank);
24  for( unsigned int i=0; i<100; ++i ) { rand(); }
25 
26  const int res = RUN_ALL_TESTS();
27 
28  MPI_Finalize();
29 
30  return res;
31 }
int main(int argc, char **argv)