minimal_mpi_test.cc File Reference
#include <iostream>
#include "mpi.h"

Functions

int main (int argc, char **argv)
 Minimal mpi self test. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Minimal mpi self test.

37 {
38 
39  int myid, numprocs;
40 
41  MPI_Init(&argc,&argv);
42  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
43  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
44 
45  MPI_Finalize();
46 
47  // Check that the number of cores is two. This is required because the
48  // meshes use have been partitioned for two cores. We can't generate
49  // partitionings on the fly for regression testing because the results
50  // would change with different partitionings.
51  if(numprocs > 2)
52  {
53  std::cerr << "Too many cores! Mpi self tests must be run on two cores."
54  << std::endl;
55  return 4;
56  }
57 
58  std::cout << "This worked" << std::endl;
59 
60  return 0;
61 } //end of main