{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lect06-mpi1-basics - Message Passing Interface George...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 M essage P assing I nterface George Bosilca [email protected] MPI 1 & 2 MPI 1 – MPI Datatype – Intra/Inter Communicators MPI 2 – Process management – Connect/Accept – MPI I/O
Image of page 1

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

View Full Document Right Arrow Icon
2 MPI Point-to-point communications 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)
Image of page 2
3 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
Image of page 3

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

View Full Document Right Arrow Icon
4 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
Image of page 4
5 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 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
Image of page 5

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

View Full Document Right Arrow Icon
6 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
Image of page 6
7 Datatype Conversion “Data sent = data received”
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern