Search code examples
mpirounding-error

mpi_send mpi_recv rounding error


I would like to ask if the functions mpi_send and mpi_recv have any rounding error similar to mpi_reduce ? I thought it should not be since the rounding error of the mpr_reduce function comes from the difference in the order of processor executing but the functions mpi_send and mpr_recv do not have a similar procedure.

Then I would like to ask if it is logical to verify the calculation of a parallel code with only mpi_send and mpi_recv functions by compare its results with a serial code ?

Thank you for your time.


Solution

  • MPI_Send and MPI_Recv do not perform rounding per se. But there could still be differences between the results from the serial code and the parallel one on systems, where higher internal precision is used. A typical example is x86 when the x87 FPU is used (mostly in 32-bit code). x87 operates on a small stack of 80-bit values and all operations, even those involving values of lesser precision, are performed with 80-bit internal precision. Whenever an intermediate value has to be transferred to another MPI rank, it first gets rounded to either float or double, unless the non-standard extended precision type is used, which removes significant bits that would otherwise be there if the value were to remain in the x87 stack. This is not an MPI-specific problem as it might also manifest itself in serial code as different results depending on the level of register optimisation performed by the compiler.