There is one real and one practical reason.
First, MPI was developed at a time when machines had exactly one processor core and when we wanted to couple different machines. It is today used on clusters of tens of thousands of machines, each of which happens to have many cores but the point is that it's still separate machines. Now, a processor core on ...
Wolfgang Bangerth's answer is totally correct, and I only want to add one practical aspect.
Portability across hardware
Let's say you write a research code from scratch. You have a powerful multi-core shared memory machine at your department which can do the job. If you start out with a thread-based implementation, you can reach good performance on this ...
The problem with output from parallel processes is that they all go through ssh tunnels, and there is no guarantee in what order they will arrive. Even if you use Send/Recv to sequentialize them.
You could do the following:
mpirun -np 8 program_script
your_program > program.out$PMPI_RANK
for i in `seq 1 8` ;...
If you're looking for an example, take a look at the MatrixBase class here:
MPI solves a different problem than multithreading, whether it's done via pthreads or OpenMP:
Multithreading is designed to take advantage of a single, big machine, but is restricted to that one machine. If you server only has 64 processor cores, that's the max. amount of threads that can be run (if you care for performance, that is).
MPI is designed to ...
It's possible to use VTK library and its parallel IO built-in mechanism to write the files from each rank to different file and ParaView could combine them again to show you the visualization. Also, I should say I don't have a FORTRAN example and unfortunately VTK doesn't support FORTRAN officially. So, I'll show you a C++ example, which I'm not sure how ...
You're doing the right thing by first doing a local reduction and then reducing that single scalar.
You're using Reduce followed by Bcast: you should really be using Allreduce.
Your code otherwise looks correct, but you're obscuring one crucial detail: how is your "v" array allocated? Are you using explicit lower bounds for that?
You specify "real" has the ...
The whole point of the guru interface is to do complicated FFTs without copying the data into contiguous arrays.
This advantage is not very important if data needs to be communicated through MPI anyway.
Taking advantage of a guru like interface would be complicated and ineffective in an MPI setting.
In other words, if your data is not in the expected MPIFFTW ...