100 likes | 115 Views
This paper discusses Typed MPI, a tool that automatically generates MPI data types, performs type checking and error reporting, and seamlessly integrates user-defined data types into C programs.
E N D
Typed MPI - A Data Type Tool for MPI Nitin Bahadur and Florentina Irina Popovici{ bnitin, pif } @cs.wisc.edu Typed MPI
Why a Data Type Tool for MPI? • No type message at receiver end • User has to manually construct MPI data types corresponding to user defined data types User code for constructing an MPI datatype for a C struct Nitin Bahadur, Florentina Irina Popovici, Dec 1999
Objectives of our interface: • Automatic generation of MPI datatypes • Type checking and error reporting to both sender and receiver • Seamless integration within a C program • Facility to send user-defined datatypes such as structures • Facility to send multiple data in one send call (allowing arbitrary grouping of data to be sent) Nitin Bahadur, Florentina Irina Popovici, Dec 1999
Design Overview • Code generated at compile time. It will perform: • signature generation • data and signature packaging • signature checking (receiver end) • error reporting Support for runtime Nitin Bahadur, Florentina Irina Popovici, Dec 1999
How does Typed MPI work ? • Phase 1: preprocess the user files • determine the types of the wrapper call parameters • generate signature • generate code for packaging data • generate code for sending/receiving data • generate code for error checking/reporting • Phase 2: runtime • Execute the program, make the actual MPI calls and do error checking and reporting Nitin Bahadur, Florentina Irina Popovici, Dec 1999
Receiver Sender Receive Data Send data Check Type Receive Success/Error Return Error / Success Code Code Type Checking • Rules for type checking. Two types T1 and T2 are identical if: • T1 and T2 have the same primitive type (e.g. int, char ) • T1 and T2 are arrays and they have the same base type and the same size • (int p[5] and char q[5] are different) • T1 and T2 are structures and their members have the same type • A Signature is • generated for each variable to be sent/received based on its type • sent by the sender along with the data • compared at the receiver’s end with the expected signature (an error code will be returned to the sender ) Send / Receive Protocol Nitin Bahadur, Florentina Irina Popovici, Dec 1999
Signature encompasses entire type of a variable struct example1 { int a; float b[5]; } Signature { START, VAR_START, STRUCT_START, TYPE_INT, 1 , TYPE_ARRAY, TYPE_FLOAT, 5, ST_UN_END, END } • depth first approach to signature construction • type of a variable is broken down recursively to generate the signature Recongnition of a complex C struct VAR_START STRUCT_START struct eg1 { int a; struct eg2 { int b; float b[5] } } STRUCT_START TYPE_INT 1 TYPE_INT TYPE_ARRAY TYPE_FLOAT 1 Nitin Bahadur, Florentina Irina Popovici, Dec 1999 5
Preprocessing steps Preprocessor and generator Compilation / * Initial user code */ .... MPI_Wrapper_Send (dest, tag, comm, &a, 1, &b, 2); .... MPI_Wrapper_Recv (src, tag, comm, &status, &a, 1, &b, 2); ... /* Modified user source code */ .... MPI_Wrapper_Send79205397130821 (dest, tag, comm, &a, 1, &b, 2); .... MPI_Wrapper_Recv79205397345131(src, tag, comm, &status, &a, 1, &b, 2); ... Executable /* generated file 1 */ int MPI_Wrapper_Send79205397130821 (int, int, MPI_Comm, void *, int, void * int) { /* signature and data packaging, error reporting */ } A new file is generated for every MPI_Wrapper call and it contains code for that call /* generated file 2 */ int MPI_Wrapper_Recv792053971345131 (int, int, MPI_Comm, MPI_Status *, void *, int, void *, int) { /* signature and data packaging, error reporting */ } Files resulting after preprocessing and source code generation Nitin Bahadur, Florentina Irina Popovici, Dec 1999
Performance Evaluation Type Checking overhead Preprocessing overhead • The graphs and figure show that our design is feasible for automatic type generation and type checking. • The overhead of type checking gets overshadowed by data transmission time as data size increases. Nitin Bahadur, Florentina Irina Popovici, Dec 1999
Conclusions • A simple interface for sending user defined datatypes and multiple data in one call • Strict type checking and error reporting to both sender and receiver • Low preprocessing time and runtime overhead • Error reporting to sender can be disabled to (if required) to reduce number of data transfers Future Work • Extensions for Group Communication and Vector operations • Handling of expressions in MPI_Wrapper calls • Feasibility study for use of hashing functions to reduce size of signature Nitin Bahadur, Florentina Irina Popovici, Dec 1999