200 likes | 271 Views
Using Communication Patterns for Parallel Program Optimization. Robert Preissl 1,2 , Dieter Kranzlmüller 1 , Martin Schulz 2 , Bronis de Supinski 2 , Dan Quinlan 2 1 GUP , Joh. Kepler Univ. Linz, Austria 2 CASC , Lawrence Livermore Natl. Lab, US. Output. Program. Input. Output. Input.
E N D
Using Communication Patterns for Parallel Program Optimization Robert Preissl1,2, Dieter Kranzlmüller1,Martin Schulz2, Bronis de Supinski2, Dan Quinlan2 1 GUP, Joh. Kepler Univ. Linz, Austria2 CASC, Lawrence Livermore Natl. Lab, US
Output Program Input Output Input Program Analysis What is the program „really“ doing? Using Communication Patterns ...
Parallel and DistributedPrograms Output Input Using Communication Patterns ...
Parallel Program Analysis Using Communication Patterns ... VAMPIR (TU Dresden)
ParallelProgramAnalysis Using Communication Patterns ... ATEMPT (GUP Linz)
Scalability: # of Proc‘s? ParallelProgramAnalysis Using Communication Patterns ...
Scalability:Number of Processes? Using Communication Patterns ...
Scalability: Time? ParallelProgramAnalysis Using Communication Patterns ...
Loop Detection Check correctness of iterative patterns Using Communication Patterns ...
Almost Correct Patterns Using Communication Patterns ...
Pattern Detection Algorithm • Extraction of communication patterns from MPI Traces • Usually applied for error detection Can it be used for performance optimization? • Combine dynamic analysis with static source code analysis Using Communication Patterns ...
Combining Dynamic Patterns with Static Source Code Analysis • Pattern Detection Algorithm • Associate Patterns with Nodes in AST • Static Analysis • Source Code Transformation Using Communication Patterns ...
AST Traversal C++ Front-End Unoptimized C++ Source C++ AST C++ AST Transformation AST Rewrite System Rewritten C++ AST Optimized C++ AST C++ Code Generator Optimized C++ Source Data Optimized Executable Vendor C++ Compiler Uses The ROSE Compiler Framework • Open Source Infrastructure for Source-to-Source Translation • Provides Mechanisms for reading, analyzing and rewriting C/C++ codes Using Communication Patterns ...
The ROSE Abstract Syntax Tree ROSE AST Features: • AST Query mechanisms • AST Rewrite mechanisms • Semantic actions associated with grammar rules • Abstract C++ grammar is predefined • Higher level grammars automatically generated from library source • Source code generation Using Communication Patterns ...
Static Analysis: SDG(System Dependence Graph) • Directly labeled multigraph capturing control & data dependencies Using Communication Patterns ...
Inefficient communication structures: “Master-Slave Broadcast“ Unoptimized C++ Source: Identify MPI_Send, MPI_Recv in AST of source code for (nr_repeats) { if( MASTER ) { for (nr_slaves) { MPI_Send( SLAVE ) } } if( SLAVE ) { MPI_Recv(MASTER) } } Optimized C++ Source: for (nr_repeats) { MPI_Bcast() } Source Code Transformation Using Communication Patterns ...
Inefficient communication structures: “Hypercube Broadcast“ Unoptimized C++ Source: for (nr_repeats) { for (nr_levels) { if( Send( &SendID ) ) { MPI_Send( SendID ) } elseif( Recv( &RecvID ) ) { MPI_Recv( RecvID ) } } Send_Data_To_Master () } Identify MPI_Send, MPI_Recv in AST of source code Optimized C++ Source: for (nr_repeats) { MPI_Bcast () Send_Data_To_Master () } Source Code Transformation Using Communication Patterns ...
Inefficient communication structures: “Late Sender“ Optimized C++ Source: MPI_Request req Data x, y for (nr_repeats) { if( task0 ) { Do_Computation ( x ) MPI_Send ( task1 , x ) } if( task1 ) { MPI_Irecv( task0 , x, &req) } if( task1 ) { Do_Computation ( y ) } if( task1 ) { MPI_Wait ( &req ) Do_Computation ( x ) } } Unoptimized C++ Source: Data x, y for (nr_repeats) { if( task0 ) { Do_Computation ( x ) MPI_Send ( task1 , x ) } if( task1 ) { MPI_Recv( task0 , x) } if( task1 ) { Do_Computation ( y ) } if( task1 ) { Do_Computation ( x ) } } Identify MPI_Recv in AST Source Code Transformation Using Communication Patterns ...
Overview of Approach Using Communication Patterns ...
Summary • Pattern matching offers • further abstraction of event graphs to cope with large-scale traces • detection of incorrect communication structures • hints for optimization of program performance • Automatic verification of patterns relieves users during program analysis and improves comprehension of program behavior Using Communication Patterns ...