2013-12-05 15:00:31 -05:00
|
|
|
#include <iostream>
|
2021-01-05 18:43:44 -05:00
|
|
|
#include "common/MPI.h"
|
2015-03-06 09:40:05 -05:00
|
|
|
#include "common/Utilities.h"
|
2013-12-05 15:00:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
int main (int argc, char **argv)
|
|
|
|
|
{
|
2020-10-08 11:03:42 -04:00
|
|
|
Utilities::startup( argc, argv );
|
2020-01-28 08:51:32 -05:00
|
|
|
Utilities::MPI comm( MPI_COMM_WORLD );
|
|
|
|
|
int rank = comm.getRank();
|
|
|
|
|
int nprocs = comm.getSize();
|
2013-12-05 15:00:31 -05:00
|
|
|
|
|
|
|
|
for (int i=0; i<nprocs; i++) {
|
|
|
|
|
if ( rank==i )
|
|
|
|
|
printf("%i of %i: Hello world\n",rank,nprocs);
|
2021-01-05 18:43:44 -05:00
|
|
|
comm.barrier();
|
2013-12-05 15:00:31 -05:00
|
|
|
}
|
|
|
|
|
|
2015-03-06 09:40:05 -05:00
|
|
|
// Create a memory leak for valgrind to find
|
|
|
|
|
if ( nprocs==1 ) {
|
|
|
|
|
double *x = new double[1];
|
|
|
|
|
ASSERT(x!=NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-05 15:00:31 -05:00
|
|
|
// set the error code
|
|
|
|
|
// Note: the error code should be consistent across all processors
|
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
|
|
// Finished
|
2020-10-08 11:03:42 -04:00
|
|
|
Utilities::shutdown();
|
2013-12-05 15:00:31 -05:00
|
|
|
return error;
|
|
|
|
|
}
|