Abstract
The parallel programming tools and packages are evolving rapidly. However the complexity of parallel thinking does not allow to implement many algorithms for the end user. In most cases only expert programmers risk to involve in parallel programming and program debugging. In this paper we extend the ideas from [3] of template programming for a certain class of problems which could be solved by using general master‐slave paradigm. The template is suitable for solution of the coarse grain and middle grain granularity problem set. Actually, it could be applied to solve any problem P, which is decomposable into a set of tasks P = U i N=0ti. The most effective application cases are obtained for the problems where all ti are independent. The template programming sets some requirements for the sequential version of the user program: The main program must comprise of several code blocks: data initialization, computation of one task ti and the processing of the result. The user has to define the data structures: initial data, one task data, the result data. These requirements do not require to rewrite the existing sequential code but to organize it into some logical parts. After these requirements (and naming conventions) are fulfilled, the parallel version of the code is obtained automatically by compiling and linking the code with the Master‐Slave Template library. In this paper we introduce the idea of the template programming and describe the layer structure of the Master‐Slave Template library. We show how the user has to adjust the sequential code to obtain a valid parallel version of the initial program. We also give examples of the prime number search problem and the Mandelbrot set calculation problem.
Highlights
ÔÖÓ Ö ÑÏ×ØÔØÓ×Ö»ÔÖÐÖÐ××Õ×ÖÐÙÓÙØÚÖÑÐÖ ÖÓÑ×ÓÒÖØÒÓÞØÐÒÒÝØØØÑ×ÓÓØ×oÒØØØÌÒÓØÒÙ××ÖÐ×ÖÓÕÓÕÖÙÖÙØÐØÖØÓÖÒÖÑ×ØÙÐÒoÝÖÐÝØÓÚÑÖÖ×Ô×ØÒÖÑÓÓØÒÔÙÖÛÐ××ÑÑ×ÐÖÐÒÒØ×ØÓÓÔØÒØÖØØÓ××ÐØÐÓÐÖÖ×oØØØÌÕÒÙÒÐÔÒÖØÓØÚÓÓÒÐÖÐØÓÚÒÓÒÖÖÓÓ×ÖÞÑÓÐÐÒØØÓÓÓÐÒÖÐ ÌÔ ÖØ×ÔÖÓ Ö Ñ ×ØÖÙ ØÙÖ o Ï Ö ÕÙ ÖØØØÙ× Ö Ó ÓÑÔÖ × Ó × Ú Ö Ð 1⁄2oÌØÒØÐÞØ ÓÒ Ô ÖØo 3⁄4o Ì ÓÑÔÙØ Ø ÓÒ Ð ÔÖÓ ×× ÒØÐÞØ ÓÒ Ô ÖØo ¿o Ì ÓÑÔÙØ Ø ÓÒ ÐÓÓÔ Û Ù× × Ø ÓÐÐÓÛ Ò ÔÖÓ ÙÖ ×.
́ μ Ì ÒÓÒ1 ÓÑÔÐ Ø Ø × Ø ÖÓÑ Ø Ø × ÔÓÓÐ ́ μ ÈÖÓ ×× Ø Ø × Ø Ò Ö ØÙÖÒ Ø Ö ×ÙÐØ Ö ́ μ ÙÔ Ø Ö ×ÙÐØ Ö ØÓ Ø ØÓØ Ð×o o Ì Ö ×ÙÐØ ÓÙØÔÙØ Ô ÖØo ÏÛÒÙÌØØÖ ×ÒÐÓÞÐÑØÖμØ×oÐØÝÝÒ ÒØ×ÖØÖÒØÒÙÚÐÖØÓÞÒ×ØÐÓÞÓÒÒÓØÒÔÔÓÒÖÖÖØØ×ÙoØÑÙÓÔÖÒÒÒ×Øo×ÛØØo× ×ÓÓÑÔÖ×ÓÔÔÖÒÖÓÖÑÒÑØÙÖÙÖØÐÒÖØÅ×ÑÖØÔÖo×ØÔÖÌÖÙÓÖÑØÙÔÖØÖÓÓÖÒÔÓØÙØÓÖÐÐ
ÐÔÐÓÛÖ ØÌÓÙÚÙÔÖØ××ÙÔÐÓÓÝ×××Ó××ÔØÒÐÌÐÖÖØÚ×ÝØØØØÒÙÚÓØ×Ð×ÖμÙÐÐÖØ×ÒÔØ×ÐÓÒÒØÝÒÓÖÑÒÒÙØÐÓ×ÓÔØÐÓÔÚÒ×ÔÒØÔÖÖÐÖÓÒÒØÓØÓÐÓÖ×ÒØÓØØ×ÖÜÓØÚÒØØÒ×ÔØÐÔÖÔÐoÔÐÖÖÚØÐØÖÔÔ×ÐÓÐÖÁ×ÑÔÖÚÙÔÖÖÓØÖ××ÐÖÓÓÓÖØÖ×Ö×ÙÚØ×ÖÖÓÒ×Õ×ÐÖÚÒ×ÖÓÙÙÙÓÖ×××ÒÐÑØÓØÐ×Ö×oÐÔØ×ÔÓ×ÙØÒØÐ××ØØÓÓÖÖ××oØ×ÒÓÖÓÙÒ×ÏÐÔÖÓÒÒÚÂ××ÖÙÑÛ×ÙÓÐÖÙÔØ×ØØÛÐÖÐÓÒ×ÙÖÓÛμÙÙØÑÓØÐÖ×ØÑØÖÓÓØØ×ØμÓÝÑÐÒ×ÓÜØÐÓØ×ØØØÐÔ×Ñ×ÔÝÓÓÒÐÒÖÖÓÚÒØØÑÖÙÚÓØÓØÓoÐ××ÑÖÒÓ×ÐÖÐØÇÔÖÒ×ÓÛÓÖØÑÑÔØ×ØÙÓØÑÓÖÓÐÐÓØÓÓÓØÒÖÅØÒoÚÔÓ× ̧×ØÖÓÓ×ØÙ×ÌÒ×ÓμÔÖ×ÑØØÖÐÔÐÖ×ÔØoÔÐÖØÖ×ØØÑÚ××ÓÁÛ×ÐØÔÖÓÒÖÓÖoÓÖÙÝÖÐØÐÔØÓÖØÓÓ×ØÆ××Ò×ÛØÖÙÑØ×ÔÖoÐ×××ÓØÕÖÖËÙÐØ×ÚÓÒØÓÙÐÓ×ÖÑ×ÐÐÖ×ÓÑÜÖoÙØÒÐÚÖØÔ×Ø×ØÐÓ×ØØÔÑØÑØÔÖÓ×ÖØÒÒÑÐÐØoÓÐØÒÐÓÓÑÖÓØÙÑ×ÓÓ×ÚØÇØØ×ÒØÓÓÔÛÖÒÔÒÒÐØÐØÖ×ÓÖ×ÖØÓÚoØÖÚ1Ñ×ÔØÖÒÓØÓØØÓØÏ×ÓÖÖØÐÓÓÒÓÓÓÛÓ×ÚÓÙÒÒÒÔ×ÒÑÐÙ×ÖØØÓÐÑÖÓØÐ×ÐÖÐÑØ××ÛÙÔ×ÐÙØÚÐÛÖ××ÓÐÓØÙÑÑØÓÐÒÓÛÓÝÙÚÐÓ×ÖÓÔÐ×ÓÒ×ÖÒØÙÖÐ×ÒÒÖ×ØÓÐÓ×××ÒÐÝÓÓ×Ø11 ̧Ðoo
Summary
Ï×ØÔØÓ×Ö»ÔÖÐÖÐ××Õ×ÖÐÙÓÙØÚÖÑÐÖ ÖÓÑ×ÓÒÖØÒÓÞØÐÒÒÝØØØÑ×ÓÓØ×oÒØØØÌÒÓØÒÙ××ÖÐ×ÖÓÕÓÕÖÙÖÙØÐØÖØÓÖÒÖÑ×ØÙÐÒoÝÖÐÝØÓÚÑÖÖ×Ô×ØÒÖÑÓÓØÒÔÙÖÛÐ××ÑÑ×ÐÖÐÒÒØ×ØÓÓÔØÒØÖØØÓ××ÐØÐÓÐÖÖ×oØØØÌÕÒÙÒÐÔÒÖØÓØÚÓÓÒÐÖÐØÓÚÒÓÒÖÖÓÓ×ÖÞÑÓÐÐÒØØÓÓÓÐÒÖÐ ÌÔ ÖØ×ÔÖÓ Ö Ñ ×ØÖÙ ØÙÖ o Ï Ö ÕÙ ÖØØØÙ× Ö Ó ÓÑÔÖ × Ó × Ú Ö Ð 1⁄2oÌØÒØÐÞØ ÓÒ Ô ÖØo 3⁄4o Ì ÓÑÔÙØ Ø ÓÒ Ð ÔÖÓ ×× ÒØÐÞØ ÓÒ Ô ÖØo ¿o Ì ÓÑÔÙØ Ø ÓÒ ÐÓÓÔ Û Ù× × Ø ÓÐÐÓÛ Ò ÔÖÓ ÙÖ ×. ́ μ Ì ÒÓÒ1 ÓÑÔÐ Ø Ø × Ø ÖÓÑ Ø Ø × ÔÓÓÐ ́ μ ÈÖÓ ×× Ø Ø × Ø Ò Ö ØÙÖÒ Ø Ö ×ÙÐØ Ö ́ μ ÙÔ Ø Ö ×ÙÐØ Ö ØÓ Ø ØÓØ Ð×o o Ì Ö ×ÙÐØ ÓÙØÔÙØ Ô ÖØo ÏÛÒÙÌØØÖ ×ÒÐÓÞÐÑØÖμØ×oÐØÝÝÒ ÒØ×ÖØÖÒØÒÙÚÐÖØÓÞÒ×ØÐÓÞÓÒÒÓØÒÔÔÓÒÖÖÖØØ×ÙoØÑÙÓÔÖÒÒÒ×Øo×ÛØØo× ×ÓÓÑÔÖ×ÓÔÔÖÒÖÓÖÑÒÑØÙÖÙÖØÐÒÖØÅ×ÑÖØÔÖo×ØÔÖÌÖÙÓÖÑØÙÔÖØÖÓÓÖÒÔÓØÙØÓÖÐÐ
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.