4.15.2. Signed Characters and Reductions
Up: New Predefined Datatypes Next: Unsigned long long Type Previous: Wide Characters
MPI-1 doesn't allow reductions on signed or unsigned chars. Since this restriction (formally) prevents a C programmer from performing reduction operations on such types (which could be useful, particularly in an image processing application where pixel values are often represented as ``unsigned char''), we now specify a way for such reductions to be carried out.
MPI-1.2 already has the C types MPI_CHAR and MPI_UNSIGNED_CHAR. However there is a problem here in that MPI_CHAR is intended to represent a character, not a small integer, and therefore will be translated between machines with different character representations.
To overcome this, a new MPI predefined datatype, MPI_SIGNED_CHAR, is added to the predefined datatypes of MPI-2, which corresponds to the ANSI C and ANSI C++ datatype signed char.
[] Advice to users.
The types MPI_CHAR and MPI_CHARACTER are intended for characters, and so will be translated to preserve the printable representation, rather than the bit value, if sent between machines with different character codes. The types MPI_SIGNED_CHAR and MPI_UNSIGNED_CHAR should be used in C if the integer value should be preserved.
( End of advice to users.)
The types MPI_SIGNED_CHAR and MPI_UNSIGNED_CHAR can be
used in reduction operations. MPI_CHAR (which represents printable
characters) cannot be used in reduction operations. This is an extension to
MPI-1.2, since MPI-1.2 does not allow the use of
MPI_UNSIGNED_CHAR in reduction operations (and does not have the
MPI_SIGNED_CHAR type).
In a heterogeneous environment, MPI_CHAR and MPI_WCHAR will be translated so as to preserve the printable charater, whereas MPI_SIGNED_CHAR and MPI_UNSIGNED_CHAR will be translated so as to preserve the integer value.
Up: New Predefined Datatypes Next: Unsigned long long Type Previous: Wide Characters
Return to MPI-2 Standard Index
MPI-2.0 of July 18, 1997
HTML Generated on August 11, 1997