Test of MPI_Comm_rank/size/functions

main
Vanessa Vichi 1 month ago
parent ff4397cc05
commit 77d248676a

@ -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

@ -0,0 +1,12 @@
#include"mpi.h"
#include<stdio.h>
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;
}
Loading…
Cancel
Save