Some useful links from
MPI Documents
giving examples of MPI code
MPI_Gather
MPI_Scatter