diff --git a/Makefile b/Makefile index 2b69e95..eccd070 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ MPICC = mpicc #The wrapper for the compiler CFLAGS += -g #Useful for debug symbols -all: helloworld +all: helloworld hamlet helloworld: helloworld.c $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ +hamlet: hamlet.c + $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ + clean: rm -f helloworld diff --git a/hamlet.c b/hamlet.c new file mode 100644 index 0000000..5a71b06 --- /dev/null +++ b/hamlet.c @@ -0,0 +1,13 @@ +#include "mpi.h" +#include + +int main( int argc, char **argv ){ + int rank, size; + MPI_Init( &argc, &argv ); + MPI_Comm_rank( MPI_COMM_WORLD, &rank ); + MPI_Comm_size( MPI_COMM_WORLD, &size ); + printf( "Hello world! I'm process %d of %d\n",rank, size ); + MPI_Finalize(); + + return 0; +}