Lect03-a - Message Passing Interface George Bosilca...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 M essage P assing I nterface George Bosilca bosilca@eecs.utk.edu MPI 1 & 2 • MPI 1 – MPI Datatype – Intra/Inter Communicators • MPI 2 – Process management – Connect/Accept – MPI I/O MPI Point-to-point communications
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Send & Receive Explicit communications Move data from one process to another (possibly local) process – The data is described by a data-type, a count and a memory location – The destination process by a rank in a communicator – The matching is tag based int MPI_Send( void* buf , int count , MPI_Datatype datatype , int dest , int tag , MPI_Comm comm ) int MPI_Recv( void* buf , int count , MPI_Datatype datatype , int source , int tag , MPI_Comm comm , MPI_Status* status) MPI Derived Datatypes MPI Datatypes • Abstract representation of underlying data – Handle type: MPI_Datatype • Pre-defined handles for intrinsic types – E.g., C: MPI_INT, MPI_FLOAT, MPI_DOUBLE – E.g., Fortran: MPI_INTEGER, MPI_REAL – E.g., C++: MPI::BOOL • User-defined datatypes – E.g., arbitrary / user-defined C structs
Background image of page 2
3 MPI Data Representation • Multi platform interoperability • Multi languages interoperability – Is MPI_INT the same as MPI_INTEGER? – How about MPI_INTEGER[1,2,4,8]? • Handling datatypes in Fortran with MPI_SIZEOF and MPI_TYPE_MATCH_SIZE Multi-Platform Interoperability • Different data representations – Length 32 vs. 64 bits – Endianness conflict • Problems – No standard about the data length in the programming languages (C/C++) – No standard floating point data representation • IEEE Standard 754 Floating Point Numbers – Subnormals, infinities, NANs … • Same representation but different lengths How About Performance? • Old way – Manually copy the data in a user pre-allocated buffer, or – Manually use MPI_PACK and MPI_UNPACK • New way – Trust the [modern] MPI library – High performance MPI datatypes
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 MPI Datatypes • MPI uses “datatypes” to: – Efficiently represent and transfer data – Minimize memory usage • Even between heterogeneous systems – Used in most communication functions (MPI_SEND, MPI_RECV, etc.) – And file operations • MPI contains a large number of pre- defined datatypes Some of MPI’s Pre-Defined Datatypes MPI_Datatype C datatype Fortran datatype MPI_CHAR signed char CHARACTER MPI_SHORT signed short int INTEGER*2 MPI_INT signed int INTEGER MPI_LONG signed long int MPI_UNSIGNED_CHAR unsigned char MPI_UNSIGNED_SHORT unsigned short MPI_UNSIGNED unsigned int MPI_UNSIGNED_LONG unsigned long int MPI_FLOAT float REAL MPI_DOUBLE double DOUBLE PRECISION MPI_LONG_DOUBLE long double DOUBLE PRECISION*8 Datatype Matching • Two requirements for correctness: – Type of each data in the send / recv buffer matches the corresponding type specified in the sending / receiving operation – Type specified by the sending operation has to match the type specified for receiving operation • Issues: – Matching of type of the host language – Match of types at sender and receiver
Background image of page 4
5 Datatype Conversion • “Data sent = data received”
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2010 for the course COMPUTER S cs202 taught by Professor Jiuhui during the Spring '08 term at 東京国際大学.

Page1 / 25

Lect03-a - Message Passing Interface George Bosilca...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online