Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Towards a Domain-Specific Language for Patterns-Oriented Parallel Programming Dalvan Griebler, Luiz Gustavo Fernandes Pontifícia Universidade Católica do Rio Grande do Sul - PUCRS Programa de Pós-Graduação em Ciência da Computação - PPGCC Grupo de Modelagem de Aplicações Paralelas - GMAP Brazilian Symposium on Programming Languages - SBLP October 2013 1 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Summary Introduction 1 Patterns-Oriented Parallel Programming (POPP) 2 DSL-POPP 3 Compilation Process Programming Interface and Implementation Levels of parallelism Results 4 Implementation Example of the DSL-POPP Tests Scenario Performance of DSL-POPP Conclusions 5 References 6 2 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Introduction Skeletons/Patterns ([1], [2], [3]) 3 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Introduction Skeletons/Patterns ([1], [2], [3]) Programming Interfaces (FastFlow [4], Muesli [5], SkeTo[6], Skandium [7] , eSkel[8], P3L [9], Lithium [10], Muskel [11] and Skil [12]) 3 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Introduction Skeletons/Patterns ([1], [2], [3]) Programming Interfaces (FastFlow [4], Muesli [5], SkeTo[6], Skandium [7] , eSkel[8], P3L [9], Lithium [10], Muskel [11] and Skil [12]) Main goals of DSL-POPP [13]: Reduce the effort without compromise the performance Patterns-Oriented Parallel Programming Abstract details of patterns implementation Offer different levels of parallelism 3 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Introduction Skeletons/Patterns ([1], [2], [3]) Programming Interfaces (FastFlow [4], Muesli [5], SkeTo[6], Skandium [7] , eSkel[8], P3L [9], Lithium [10], Muskel [11] and Skil [12]) Main goals of DSL-POPP [13]: Reduce the effort without compromise the performance Patterns-Oriented Parallel Programming Abstract details of patterns implementation Offer different levels of parallelism Paper contributions We propose the POPP model We introduce DSL-POPP We present a case study based on an image processing algorithm 3 / 21
Hybrid patterns P2 ... Pn P1 ... p1 pn m m subroutine n s1 ... sn s1 ... sn (pipeline) subroutine 1 subroutine 2 (master/slave) (master/slave) main routine (pipeline) Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Patterns-Oriented Parallel Programming (POPP) Master/Slave pattern Pipeline pattern code code M Main Routine blocks blocks P1 ... Pn Code Block 1 Code Block n . . . S1 Sn ... ... Subroutine 1 . . . Subroutine 1 Subroutine n p1 pn p1 pn subroutine 1 subroutine n Code Code Code Code . . . Code Code . . . . . . . . . m m main routine Block Block Block Block Block Block 1 n 1 n 1 n Legend: s1 ... sn s1 ... sn M,S : Master/Slave (main routine) m,s : master/slave (subrotine) subroutine 1 subroutine n P : Pipeline stage (main routine) p : pipeline stage (subroutine) main routine Figure: POPP model Figure: Master/Slave - Pipeline. 4 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Patterns-Oriented Parallel Programming (POPP) Master/Slave pattern Pipeline pattern code code M Main Routine blocks blocks P1 ... Pn Code Block 1 Code Block n . . . S1 Sn ... ... Subroutine 1 . . . Subroutine 1 Subroutine n p1 pn p1 pn subroutine 1 subroutine n Code Code Code Code . . . Code Code . . . . . . . . . m m main routine Block Block Block Block Block Block 1 n 1 n 1 n Legend: s1 ... sn s1 ... sn M,S : Master/Slave (main routine) m,s : master/slave (subrotine) subroutine 1 subroutine n P : Pipeline stage (main routine) p : pipeline stage (subroutine) main routine Figure: POPP model Figure: Master/Slave - Pipeline. Hybrid patterns P2 ... Pn P1 ... p1 pn m m subroutine n s1 ... sn s1 ... sn (pipeline) subroutine 1 subroutine 2 (master/slave) (master/slave) main routine (pipeline) Figure: Combination of Patterns. 4 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Compilation Process DSL-POPP $PipelinePattern int main(...){ include pthread.h @Pipeline{ include smmpi.h GCC @Stage(...){ Compiler SMMPI_send(...) } SMMPI_recv(...) @Stage(...){ pthread_create(...) } pthread_join(...) Pattern Tree } Binary Syntatic/Semantic Source-to-Source Code } Analysis Transformation DSL-POPP Precompiler System Source Code Figure: Compilation process. 5 / 21
Master Block $MasterSlavePattern void func_name(...){ Create Threads @Master{ @Slave(int num_th, void* buffer, int buf_size, Slave Block ... const POPP_LB_Policy){ ... ... Work 0.0 Work 0.n Work n.0 Work n.n } thread 0 } thread n } Join Threads Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Programming Interface and Implementation DSL-POPP Pipeline Block $PipelinePattern void func_name(...){ Stage Block @Pipeline{ ... C @Stage(int num_th, void* buffer, int buf_size){ thread 0 J r Work 0 o e i a } ... n t @Stage(int num_th, void* buffer, int buf_size){ e thread 1 T Work 0 h } T r h @Stage(int num_th, void* buffer, int buf_size){ e r ... a e thread 2 d } a Work 0 d s } s } (a) Pipeline 6 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Programming Interface and Implementation DSL-POPP Pipeline Block $PipelinePattern void func_name(...){ Stage Block @Pipeline{ ... C @Stage(int num_th, void* buffer, int buf_size){ thread 0 J r Work 0 o e i a } ... n t @Stage(int num_th, void* buffer, int buf_size){ e thread 1 T Work 0 h } T r h @Stage(int num_th, void* buffer, int buf_size){ e r ... a e thread 2 d } a Work 0 d s } s } (a) Pipeline Master Block $MasterSlavePattern void func_name(...){ Create Threads @Master{ @Slave(int num_th, void* buffer, int buf_size, Slave Block ... const POPP_LB_Policy){ ... ... Work 0.0 Work 0.n Work n.0 Work n.n } thread 0 } thread n } Join Threads (b) Master/Slave Figure: Syntax and logical structure of the DSL-POPP Policies for Load Balancing: POPP_LB_STATIC ; POPP_LB_DYNAMIC ; POPP_LB_COST . 6 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Levels of parallelism DSL-POPP Pipeline - Pipeline Pipeline - Master/Slave b) a) Master/Slave - Master/Slave Master/Slave - Pipeline c) d) Control threads (master) First level active threads Second level active threads Figure: Overview of thread graph in DSL-POPP . 7 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Implementation Example of the DSL-POPP Results List of images with 3000x2550 resolution ... IM1 IM2 IM3 IM4 IM39 IM40 Prewitt IM1 Sobel IM1 Roberts IM1 Figure: Overview of DSL-POPP Image Processing Algorithm Implementation. 8 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Implementation Example of the DSL-POPP Results List of images with 3000x2550 resolution ... Split IM1 IM2 IM3 IM4 IM39 IM40 ... n 1 2 Prewitt Split IM1 1 Sobel 2 IM1 IM1 Split . . . n Roberts IM1 Split Figure: Overview of DSL-POPP Image Processing Algorithm Implementation. 9 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Implementation Example of the DSL-POPP Results 10 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Implementation Example of the DSL-POPP Results 11 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Tests Scenario Results List of images with 3000x2550 resolution ... T est-1 IM1 IM2 IM3 IM4 IM39 IM40 Master/Slave Prewitt Split IM1 Master/Slave 1 Sobel 2 IM1 Split IM1 . . . n Master/Slave Roberts IM1 Split 12 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Tests Scenario Results Pipeline List of images with 3000x2550 resolution ... T est-2 IM1 IM2 IM3 IM4 IM39 IM40 ... Prewitt IM1 IM2 IM3 IM39 ... Sobel IM1 IM2 IM39 ... Roberts IM1 IM39 13 / 21
Introduction Patterns-Oriented Parallel Programming (POPP) DSL-POPP Results Conclusions References Tests Scenario Results List of images with 3000x2550 resolution ... T est-3.1 Master/Slave Split IM1 IM2 IM3 IM4 IM39 IM40 ... and n 1 2 Master/Slave Prewitt Split IM1 T est-3.2 Master/Slave 1 Sobel 2 IM1 Split IM1 . . . n Master/Slave Roberts IM1 Split 14 / 21
Recommend
More recommend