Files
LBPM/tests/hello_world.cpp
T

32 lines
717 B
C++
Raw Normal View History

2013-12-05 15:00:31 -05:00
#include <iostream>
#include "common/MPI_Helpers.h"
#include "common/Utilities.h"
2013-12-05 15:00:31 -05:00
int main (int argc, char **argv)
{
MPI_Init(&argc,&argv);
int rank = MPI_WORLD_RANK();
int nprocs = MPI_WORLD_SIZE();
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);
MPI_Barrier(MPI_COMM_WORLD);
}
// 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
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
return error;
}