Abstract

Parallel patterns are a high-level programming paradigm that enables non-experts in parallelism to develop structured parallel programs that are maintainable, adaptive, and portable whilst achieving good performance on a variety of parallel systems. However, there still exists a large base of legacy-parallel code developed using ad-hoc methods and incorporating low-level parallel/concurrency libraries such as pthreads without any parallel patterns in the fundamental design. This code would benefit from being restructured and rewritten into pattern-based code. However, the process of rewriting the code is laborious and error-prone, due to typical concurrency and pthreading code being closely intertwined throughout the business logic of the program. In this paper, we present a new software restoration methodology, to transform legacy-parallel programs implemented using pthreads into structured farm and pipeline patterned equivalents. We demonstrate our restoration technique on a number of benchmarks, allowing the introduction of patterned farm and pipeline parallelism in the resulting code; we record improvements in cyclomatic complexity and speedups on a number of representative benchmarks.

Highlights

  • Parallel patterns are a well-established high-level parallel programming model for producing portable, maintainable, adaptive, and efficient parallel code

  • This paper makes the following specific research contributions: 1. we present a novel software restoration methodology for converting legacyparallel applications into their structured parallel equivalents, via the farm and pipeline patterns; 2. we present a new set of restoration transformations that attempt to systematically, (i) eliminate pthread operations from legacy C/C?? programs; (ii) perform code repair, fixing any bugs introduced in i; and, (iii) reshape code in preparation for parallel pattern introduction; 3. we evaluate these transformations on a set of benchmarks, demonstrating that removal of parallelism can allow us to manually derive structured parallel code that is comparable to the original legacy-parallel version in terms of performance, while being more portable, adaptive, and maintainable

  • For each benchmark we evaluate the effectiveness of our technique using standard metrics, such as McCabe’s Cyclomatic Complexity [31], lines of code and difference in runtimes between the original pthread version and the restored Threading Building Blocks (TBB) version, using the maximum number of available cores; these results are summarised in Table 1, which labels if each benchmark is a standard task from implementation (F) or a pipeline (P), where each stage can be farmed

Read more

Summary

Introduction

Parallel patterns are a well-established high-level parallel programming model for producing portable, maintainable, adaptive, and efficient parallel code. We present a new methodology for the restoration of legacy-parallel code into an equivalent patterned form, through the application of a number of identified program transformations; the ultimate goal of which is to provide a semi-automatic way of converting legacy-parallel code into an equivalent patterned code, increasing its maintainability, adaptivity, and portability whilst either improving or maintaining performance. In Lines 14–34, we show the function for the middle stage of the pipeline, which reads an integer from the input queue, increments it by one, puts it into the output queue. Add_to_queue (Lines 36–47) is shown here; read_from_queue is defined Both functions use one mutex lock and two conditional variables. The latter are used for synchronisation when threads are waiting to insert an element into a full queue or for reading from an empty queue (e.g. at the start of the program). The thread signals that an element has been added to the queue (queue-[queue_cond_write conditional variable, Line 45) and releases the queue lock (Line 46) before returning

Parallelism Elimination
Code Repair
Image Convolution
Discussion
Related Work
Conclusions
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

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.