I'm studying a bit of MPI, and decided to do a test by making a program that calls objects, eg main.c -> main program, function.c -> any function
function.c that will only use the MPI. compiling I as follows:
gcc-c main.c to create main.o, mpicc-c to create function.c function.o, of course I create the file function.h too.
I compile with mpicc-o program main.o function.o
Here is main.c
#include <stdio.h> #include "function.h" void main(int argc, char *argv[]) { printf("Hello\n"); function(); printf("Bye\n"); } just function has the MPI code, but when I'm running the program mpiexe -np 2 I get
Hello Hello ----- function job here ----- Bye Bye But I wanted it to be
Hello ------ function job ----- Bye What can I do?