Top Banner
Automatic MPI to AMPI Conversion using Photran Stas Negara, Kuo-Chuan Pan, Gengbin Zheng, Natasha Negara, Ralph Johnson, Laxmikant Kalé, Paul Ricker 8 th Annual Workshop on Charm++ and its Applications April 28, 2010
14

Presentation outline

Jan 20, 2016

Download

Documents

reidar

Automatic MPI to AMPI Conversion using Photran Stas Negara , Kuo-Chuan Pan, Gengbin Zheng, Natasha Negara, Ralph Johnson, Laxmikant Kal é, Paul Ricker 8 th Annual Workshop on Charm++ and its Applications April 28, 2010. Presentation outline. MPI to AMPI code transformation Tool Evaluation - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Presentation outline

Automatic MPI to AMPI Conversion using Photran

Stas Negara, Kuo-Chuan Pan, Gengbin Zheng, Natasha Negara, Ralph Johnson, Laxmikant Kalé,

Paul Ricker

8th Annual Workshop on Charm++ and its Applications

April 28, 2010

Page 2: Presentation outline

2

Presentation outline

• MPI to AMPI code transformation

• Tool

• Evaluation

• Future work

Page 3: Presentation outline

3

MPI to AMPI code transformation (1 of 5)

• Remove global variables

• Write pack/unpack subroutine

• Rename main PROGRAM to MPI_MAIN subroutine

Page 4: Presentation outline

4

MPI to AMPI code transformation (2 of 5)

MODULE MyMod

REAL :: p, r

INTEGER,

PRIVATE :: i, j

...

END MODULE

Fortran global variables:

• Module variables

• Saved subprogram variables

• Common block variables

SUBROUTINE MySub

REAL, SAVE :: p, r

INTEGER :: c = 0, i

...END SUBROUTINE

PROGRAM MyProg INTEGER :: i COMMON /CB/ i i = 3 CALL PrintValEND PROGRAM

SUBROUTINE PrintVal INTEGER :: j COMMON /CB/ j print *, “j=“, jEND SUBROUTINE

Page 5: Presentation outline

5

MPI to AMPI code transformation (3 of 5)

Global variables privatization:1. Generate stubs for the derived type and its

containing module2. Add an extra parameter to each

subprogram* and every call site3. Remove every global variable:

a. Declare the corresponding field in the derived type

b. Replace every access to the variable with the access to the corresponding field

c. Delete global variable

Page 6: Presentation outline

6

MPI to AMPI code transformation (4 of 5)PROGRAM MyProg INTEGER :: i COMMON /CB/ i i = 3 CALL PrintValEND PROGRAM

SUBROUTINE PrintVal INTEGER :: j COMMON /CB/ j print *, “j=“, jEND SUBROUTINE

MODULE GenMod

TYPE GenType

END TYPE

END MODULE

PROGRAM MyProg USE GenMod TYPE(GenType) :: p INTEGER :: i COMMON /CB/ i i = 3 CALL PrintVal(p)END PROGRAM

SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p INTEGER :: j COMMON /CB/ j print *, “j=“, jEND SUBROUTINE

MODULE GenMod

TYPE GenType

END TYPE

END MODULE

SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p INTEGER :: j COMMON /CB/ j print *, “j=“, jEND SUBROUTINE

MODULE GenMod

TYPE GenType

INTEGER :: f

END TYPE

END MODULE

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

SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p INTEGER :: j COMMON /CB/ j print *, “j=“, p%fEND SUBROUTINE

MODULE GenMod

TYPE GenType

INTEGER :: f

END TYPE

END MODULE

PROGRAM MyProg USE GenMod TYPE(GenType) :: p p%f = 3 CALL PrintVal(p)END PROGRAM

SUBROUTINE PrintVal(p) USE GenMod TYPE(GenType) :: p print *, “j=“, p%fEND SUBROUTINE

MODULE GenMod

TYPE GenType

INTEGER :: f

END TYPE

END MODULE

Page 7: Presentation outline

7

MODULE GenMod

TYPE GenType

REAL, ALLOCATABLE :: ar(:)

END TYPE

END MODULE

MPI to AMPI code transformation (5 of 5)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 ENDIFEND SUBROUTINE

Page 8: Presentation outline

8

Tool (1 of 2)

• 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

Page 9: Presentation outline

9

Page 10: Presentation outline

10

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

Page 11: Presentation outline

11

Evaluation (2 of 4)

Page 12: Presentation outline

12

Evaluation (3 of 4)

Page 13: Presentation outline

13

Evaluation (4 of 4)

Page 14: Presentation outline

14

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


Related Documents