I have a code that calculates heat transfer in some number of conductors. What happens in one conductor doesn't impact others in the model. So I'm trying to make the solution of these conductors run in parallel, with each processor taking on a different set of conductors. Now, I thought that the code would work by running on one core until it got to this loop where I put the command:
MPI_INIT
Then run this section of code on however many cores I requested and then go back to running on one core after the command:
MPI_FINALIZE
is encountered. But what I'm seeing is that the input file is read in by both cores (if I use 2 cores), and all the outputs are printed twice also. Does MPI not work as I thought? If not, then how can I achieve the behavior I want? I only want the code running on multiple cores for that one segment of the code and not in any other subroutines or parts of the code outside of MPI_INIT and MPI_FINALIZE.