The MPI basic data types correspond to the data types of the host language, except MPI_BYTE and MPI_PACKED. My question is what's the benefit of using those MPI basic data type? Or equivalently, why it is bad to just use the host language data types?
I read a tutorial by William Gropp etc. In slide 31 "Why Datatypes", it says:
- Since all data is labeled by type, an MPI implementation can support communication between processes on machines with very different memory representations and lengths of elementary datatypes (heterogeneous communication).
- Specifying application-oriented layout of data in memory
- reduces memory-to-memory copies in the implementation
- allows the use of special hardware (scatter/gather) when available
(http://www.mcs.anl.gov/research/projects/mpi/tutorial/mpiintro/ppframe.htm)
I don't grasp the explanation. First, if elementary datatypes are different, I don't see why using MPI datatypes can resolve the difference since the basic MPI datatypes correspond to basic datatype of host language (elementary datatypes). Second, why this application-oriented layout of data in memory has the two benefits mentioned?
Any answers that address my original questions will be accepted. Any answer resolves my questions to William Gropp's explanation will also be accepted.
d
is variable that will be sent out from one process to another process. When we defined
, we certainly useMPI_DOUBLE d
, notdouble d
, right? – Rivulet