diff --git a/Makefile b/Makefile index 3856935..8946058 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ MPICC = mpicc CFLAGS += -g -all: example +all: example example2 example: example.c $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ +example2: example2.c + $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ clean: - rm -f example + rm -f example example2 diff --git a/example2.c b/example2.c new file mode 100644 index 0000000..0fb0e79 --- /dev/null +++ b/example2.c @@ -0,0 +1,12 @@ +#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; +}