Added other example

This commit is contained in:
Fabio Durastante
2024-04-23 17:31:10 +02:00
parent 83363cdb49
commit a5f3ed981f
2 changed files with 17 additions and 1 deletions
+4 -1
View File
@@ -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
+13
View File
@@ -0,0 +1,13 @@
#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;
}