1 / 14

Automated MPI to AMPI Code Transformation: A Photran IDE Approach

This presentation discusses an automatic tool for transforming MPI (Message Passing Interface) code to AMPI (Adaptive MPI). It outlines the process involved in the transformation, including the removal of global variables, writing pack/unpack subroutines, and adapting main programs to AMPI standards. The tool was evaluated on a 2D simulation of the Sedov-Taylor explosion, showing up to 8% improvement in load balancing. Future work aims to enhance packing/unpacking code generation for derived types and further assess the tool on complex problems, improving load balancers' effectiveness.

reidar
Télécharger la présentation

Automated MPI to AMPI Code Transformation: A Photran IDE Approach

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automatic MPI to AMPI Conversion using PhotranStas Negara, Kuo-Chuan Pan, Gengbin Zheng, Natasha Negara, Ralph Johnson, Laxmikant Kalé, Paul Ricker8th Annual Workshop on Charm++ and its ApplicationsApril 28, 2010

  2. Presentation outline • MPI to AMPI code transformation • Tool • Evaluation • Future work

  3. MPI to AMPI code transformation (1 of 5) • Remove global variables • Write pack/unpack subroutine • Rename main PROGRAM to MPI_MAIN subroutine

  4. MPI to AMPI code transformation (2 of 5) MODULE MyMod REAL :: p, r INTEGER, PRIVATE :: i, j ... END MODULE PROGRAM MyProg INTEGER :: i COMMON /CB/ i i = 3 CALL PrintVal END PROGRAM SUBROUTINE PrintVal INTEGER :: j COMMON /CB/ j print *, “j=“, j END SUBROUTINE Fortran global variables: • Module variables • Saved subprogram variables • Common block variables SUBROUTINE MySub REAL, SAVE :: p, r INTEGER :: c = 0, i ... END SUBROUTINE

  5. MPI to AMPI code transformation (3 of 5) Global variables privatization: • Generate stubs for the derived type and its containing module • Add an extra parameter to each subprogram* and every call site • Remove every global variable: • Declare the corresponding field in the derived type • Replace every access to the variable with the access to the corresponding field • Delete global variable

  6. MPI to AMPI code transformation (4 of 5) PROGRAM MyProg USE GenMod TYPE(GenType) :: p INTEGER :: i COMMON /CB/ i i = 3 CALL PrintVal(p) END PROGRAM PROGRAM MyProg USE GenMod TYPE(GenType) :: p INTEGER :: i COMMON /CB/ i i = 3 CALL PrintVal(p) END PROGRAM PROGRAM MyProg USE GenMod TYPE(GenType) :: p INTEGER :: i COMMON /CB/ i p%f = 3 CALL PrintVal(p) END PROGRAM PROGRAM MyProg USE GenMod TYPE(GenType) :: p p%f = 3 CALL PrintVal(p) END PROGRAM SUBROUTINE PrintVal INTEGER :: j COMMON /CB/ j print *, “j=“, j END SUBROUTINE MODULE GenMod TYPE GenType END TYPE END MODULE SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p INTEGER :: j COMMON /CB/ j print *, “j=“, j END SUBROUTINE MODULE GenMod TYPE GenType END TYPE END MODULE SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p INTEGER :: j COMMON /CB/ j print *, “j=“, j END SUBROUTINE MODULE GenMod TYPE GenType INTEGER :: f END TYPE END MODULE SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p INTEGER :: j COMMON /CB/ j print *, “j=“, p%f END SUBROUTINE MODULE GenMod TYPE GenType INTEGER :: f END TYPE END MODULE SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p print *, “j=“, p%f END SUBROUTINE MODULE GenMod TYPE GenType INTEGER :: f END TYPE END MODULE PROGRAM MyProg INTEGER :: i COMMON /CB/ i i = 3 CALL PrintVal END PROGRAM

  7. MPI to AMPI code transformation (5 of 5) MODULE GenMod TYPE GenType REAL, ALLOCATABLE :: ar(:) END TYPE END MODULE SUBROUTINE GenPUP(p, g) USE pupmod USE GenMod TYPE(GenType) :: g LOGICAL :: isAllocated INTEGER :: p, n(2) IF (.not. fpup_isunpacking(p)) THEN isAllocated = allocated(g%ar) ENDIF CALL fpup_logical(p, isAllocated) IF (isAllocated) THEN IF (fpup_isunpacking(p)) THEN CALL fpup_ints(p, n, 2) ALLOCATE(g%ar(n(1):n(2))) ELSE n(1) = LBOUND(g%ar, DIM=1) n(2) = UBOUND(g%ar, DIM=1) CALL fpup_ints(p, n, 2) ENDIF CALL fpup_doubles(p, g%ar, SIZE(g%ar)) IF (fpup_isdeleting(p)) THEN DEALLOCATE(g%ar) ENDIF ENDIF END SUBROUTINE

  8. Implemented in Java Based on Photran IDE Operates on Fortran 90 Requires “pure” Fortran code Completely automates the transformation, except packing/unpacking of derived types Accessible as a refactoring in Photran Tool (1 of 2)

  9. Evaluation (1 of 4) • Evaluated on FLASH project • Transformed 2D simulation of Sedov-Taylor explosion • Ran experiments on NCSA Abe using 16 physical processors • Employed GreedyLB and RefineLB • Achieved up to 8% improvement due to load balancing

  10. Evaluation (2 of 4)

  11. Evaluation (3 of 4)

  12. Evaluation (4 of 4)

  13. Future work • Automatically generate pack/unpack code for derived types • Minimize overhead of the transformation • Continue evaluation: • More complex and larger problems • More sophisticated load balancers

More Related