Docsity

Parallel Computing Laboratory 2 - Data Conversion and Buffer Size in MPI - Prof. Adrian Sa, Lab Reports of Computer Science

Toggle sidebar
bg1
Parallel Computing
Fall 2005
Laboratory #2
1 DATA CONVERSION
During communication data is:
1. copied from send buffer to mesage
2. message is transferred from sender to receiver
3. data is copied from message and disassembled into
the receive buffer
Rule: type specified by send
= type specified by recv
= type of variables in the send buffer
= type of variables in the recv buffer
A code not observing these rules is considered erroneous
by MPI. In this case the program behavior is undefined.
Note:
MPI defines the following types:
MPI_BYTE - transfers a byte of data unchanged
MPI_PACK - data has been packed explicitly
No conversion is needed on a homogeneous system. Sending MPI_BYTE-s is
correct in MPI, but if the undelying data is typed, and the system is
heterogeneous, the meaning (value) of the data is changed.
Typed communication is strongly preffered.
Note:
MPI never performs type conversion of data (e.g., round a real to an
integer). MPI does perform binary representation conversion of a value in
heterogeneopus environments, where different cpus use different
representations of this value (e.g., changes byte ordering for little/big
endian representations, changes 32-bit fp to 64 bit fp, or changes internal
representation of a character, etc.).
Overflow, underflow exceptions may appear during conversion. This results
in failed communication and send (or recv) operations return error codes.
Run mpi_TypeConvert.c and assess the incorrect program behavior.
pf2

Partial preview of the text

Download Parallel Computing Laboratory 2 - Data Conversion and Buffer Size in MPI - Prof. Adrian Sa and more Lab Reports Computer Science in PDF only on Docsity!

Parallel Computing

Fall 2005

Laboratory

1 DATA CONVERSION

During communication data is:

  1. copied from send buffer to mesage
  2. message is transferred from sender to receiver
  3. data is copied from message and disassembled into the receive buffer

Rule: type specified by send = type specified by recv = type of variables in the send buffer = type of variables in the recv buffer A code not observing these rules is considered erroneous by MPI. In this case the program behavior is undefined.

Note:

MPI defines the following types: MPI_BYTE - transfers a byte of data unchanged MPI_PACK - data has been packed explicitly No conversion is needed on a homogeneous system. Sending MPI_BYTE-s is correct in MPI, but if the undelying data is typed, and the system is heterogeneous, the meaning (value) of the data is changed. Typed communication is strongly preffered.

Note:

MPI never performs type conversion of data (e.g., round a real to an integer). MPI does perform binary representation conversion of a value in heterogeneopus environments, where different cpus use different representations of this value (e.g., changes byte ordering for little/big endian representations, changes 32-bit fp to 64 bit fp, or changes internal representation of a character, etc.).

Overflow, underflow exceptions may appear during conversion. This results in failed communication and send (or recv) operations return error codes.

Run mpi_TypeConvert.c and assess the incorrect program behavior.

2 BUFFER SIZE

Run mpi_BufferSize.c to estimate how large can the messages be.

3 UNSAFE PROGRAMS

Run mpi_BufferUnsafe.c; progressively increase BUFSIZE and different number of processors until the program deadlocks.

4 BEFORE MPI_INIT

The MPI standard does not specify what happens before MPI_Init. In LAM/MPI, a new process is exec/fork-ed for every MPI process (by mpirun), and they all therefore enter via their own main().

Other MPI implementations may differ - it is permissable, for example, to simply fork threads during MPI_Init. In this case, there would likely be only one entry via main, but several "MPI processes" after MPI_Init.