I'm studying a bit of MPI, and decided to do a test by making a program that calls objects, eg main.c main.c -> main program, function.cfunction.c -> any function
function.c that will only use the MPI. compiling I as follows. gcc-c main.c:
gcc-c main.c to create main.o mpicc-cmain.o, mpicc-c to create function.c function.ofunction.c function.o, of course I create the file function.hfunction.h too.
I compile with mpicc-ompicc-o program main.o function.omain.o function.o
here main.cHere 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'mI'm running the program mpiexe -np 2 program impiexe -np 2 I get
Hello Hello ----- function job here ----- Bye Bye butBut I wanted it to be
Hello ------ function job ----- Bye whatWhat can iI do?
sorry my bad english :)