From 77d248676a2046d8b310b6b2dca82e3f6a72e105 Mon Sep 17 00:00:00 2001 From: Vanessa Vichi Date: Wed, 17 Apr 2024 17:46:55 +0200 Subject: [PATCH] Test of MPI_Comm_rank/size/functions --- Makefile | 6 ++++-- example2.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 example2.c 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; +}