mpi checker static analysis for mpi
play

MPI-Checker Static Analysis for MPI Alexander Droste, Michael Kuhn, - PowerPoint PPT Presentation

MPI-Checker Static Analysis for MPI Alexander Droste, Michael Kuhn, Thomas Ludwig November 15, 2015 Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Motivation 2 / 39 Motivation Clang Static Analyzer


  1. MPI-Checker – Static Analysis for MPI Alexander Droste, Michael Kuhn, Thomas Ludwig November 15, 2015

  2. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Motivation 2 / 39

  3. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Why is runtime analysis in HPC challenging? Large amount of resources are used State of the program can get very complex → Hard to survey Long run duration Is there a way to complement dynamic tooling? 3 / 39

  4. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Why is runtime analysis in HPC challenging? Large amount of resources are used State of the program can get very complex → Hard to survey Long run duration Is there a way to complement dynamic tooling? 3 / 39

  5. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Static analysis Extensive static analysis of the source code Executed in the frontend Verify focused aspects of the code In contrast to ’normal’ compiler errors, warnings: More computational resources are used Better suited for domain specific checks 4 / 39

  6. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work What are the benefits of static analysis for MPI? Analysis without running the program Unrelated to runtime resources Not affected by the commonness of a sequence at runtime Low maintenance effort 5 / 39

  7. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Clang Static Analyzer 6 / 39

  8. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Clang Static Analyzer Framework for static analysis: Core and checkers Provides two techniques to base a checker upon: AST-based analysis Path-sensitive analysis Descriptive HTML reports Extensible 7 / 39

  9. Motivation 5 about the range of x No assumptions can be made No differentiation of distinct paths invariant locally Works if a check can verify an range of x is unknown malloc (x > 0) || !(x > 0) (x < 2) || !(x < 2) N2 N1 N0 } f r e e ( i ) ; Clang Static Analyzer if (x > 0) 4 f r e e ( i ) ; if (x < 2) 3 int * i = malloc ( sizeof ( int ) ) ; 2 void memory( int x) { 1 AST-based analysis Future Work Evaluation Limitations MPI-Checker 8 / 39

  10. Motivation ��� � �� �������� ������� ������ ��������� ��� ������ ������ ������� ��� ���� �� �� ��������� �� ����� �� ����� �� ��� ���� ���� ������� � ������ ������ � �� �� �� �� �� �� �� ������ �� � �� ��� ���� �� ����������� ��������� �� ��� ��� �� �� � �� � �� ��� �� ��������� �������� ��� � �� �� � �� ��� � �� �� � �� ������ �� ������������ ����� ����� ������ �������������� �������� ������ ��� ������ ���� �������� �� �������������� �������� �� Distincts path sequences Symbolic execution Higher level of abstraction ������������ �� ���� ����������� ���� ��� ����� �� �� � �� ��� �� ��� ��������� �� � � �� ����������� �� �� �������� � ��� �������� ���� �� Clang Static Analyzer if (x < 2) MPI-Checker Limitations Evaluation Future Work Path-sensitive analysis 1 void memory( int x) { 2 int * i = malloc ( sizeof ( int ) ) ; 3 f r e e ( i ) ; � � �� ����������� �� �� �������� � ��� �������� ���� �� 4 if (x > 0) f r e e ( i ) ; 5 } ����� ��� �� ������������ ���� �� ����������� ����� ��� ����� ������ ������ ��� ����������� ����� �� ��� ����� ��� �� ����� ����� �� ��������� ������������ ���������� ����� ��� ������� �� �������� ���������� ��� ��� ������� ����� ������� �������� ���� �� ����������� ��� �� �������� �� ��� �������� �������������� �� � � �������� ����������� ���� 9 / 39

  11. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Symbolic execution Symbolic representation of values, memory regions Variables are defined by constraints to ranges Each node represents a program point and state Operations are conceptually transitions between nodes 10 / 39

  12. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work MPI-Checker 11 / 39

  13. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work MPI-Checker Realised as a Clang Static Analyzer checker Hybrid: Provides AST-based and path-sensitive checks Can verify C and C++ code Checks are MPI implementation independent 12 / 39

  14. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Path-sensitive Checks 13 / 39

  15. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Path-sensitive checks Check aspects of nonblocking communication Based on MPI request usage verification Request can be in different last user states Unused, used by nonblocking call, used by wait Requests are tracked by their symbolic memory region 14 / 39

  16. Motivation Checked when a call is symbolically executed Makes it impossible to wait for both nonblocking calls nb nb double nb used by nb unused nonblocking call Clang Static Analyzer Nonblocking call using a request that is already in use by a Double nonblocking Future Work Evaluation Limitations MPI-Checker 15 / 39

  17. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Unmatched wait Checks for waits on requests not used by a nonblocking call unused unmatched wait wait Request is in an undefined state → undefined behavior 16 / 39

  18. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Missing wait Checks if a nonblocking call is not matched by a wait Checked when a symbol goes out of scope unused used by nb missing wait nb oos Nonblocking operation might not complete 17 / 39

  19. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work AST-based Checks 18 / 39

  20. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Type mismatch 1 int buf ; 2 MPI_Send(&buf , * , MPI_DOUBLE, * , * , *) ; Buffer type, MPI datatype tag correspondence Clang already has type checking support limited to MPICH → MPI-Checker is MPI implementation independent 19 / 39

  21. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Type mismatch 1 int buf ; 2 MPI_Send(&buf , * , MPI_DOUBLE, * , * , *) ; Buffer type, MPI datatype tag correspondence Clang already has type checking support limited to MPICH → MPI-Checker is MPI implementation independent 19 / 39

  22. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Type mismatch 1 int buf ; 2 MPI_Send(&buf , * , MPI_DOUBLE, * , * , *) ; Buffer type, MPI datatype tag correspondence Support for all types defined by the MPI 3.1 standard Skipped: Custom buffer types, nullpointer constants, custom MPI types, MPI_BYTE, MPI_DATATYPE_NULL 20 / 39

  23. Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Incorrect buffer referencing 1 int **buf ; 2 MPI_Send( buf , * , MPI_INT, * , * , *) ; MPI functions specify void * as their buffer type Allows passing pointers not sufficiently dereferenced Subroutine of the type mismatch check 21 / 39

  24. Motivation MPI_Send(* , Convenience check -Wfloat-conversion is neither included in -Wall nor -Wextra -Wfloat-conversion can produce a lot of output Corresponds to -Wfloat-conversion Can handle expressions of arbitrary complexity Check if non-integer types are used for rank, count or tag 1.1 + x , * , * , * , *) ; 2 Clang Static Analyzer int x = 0; 1 Invalid argument type Future Work Evaluation Limitations MPI-Checker 22 / 39

Recommend


More recommend