[Paper Review] Dynamic Loop Parallelisation
This paper proposes a dynamic loop parallelisation system that enables runtime selection of which loop in a nested loop region to parallelise, using a source-to-source compiler and directive-based annotations similar to OpenMP. The approach outperforms static OpenMP if-clause methods and enables auto-tuning via profiling, especially in non-perfectly-nested or dynamically changing loop scenarios, with performance gains observed on large-scale shared-memory systems.
Regions of nested loops are a common feature of High Performance Computing (HPC) codes. In shared memory programming models, such as OpenMP, these structure are the most common source of parallelism. Parallelising these structures requires the programmers to make a static decision on how parallelism should be applied. However, depending on the parameters of the problem and the nature of the code, static decisions on which loop to parallelise may not be optimial, especially as they do not enable the exploitation of any runtime characteristics of the execution including changes to the iterations of the loops to be parallelised. We have developed a system that allows a code to make a dynamic choice, at runtime, of what parallelism is applied to nested loops. Our method for providing dynamic decisions on which loop to parallelise significantly outperforms the standard methods for acheiving this through OpenMP (using if clauses).
Motivation & Objective
- Address the limitation of static loop parallelisation in OpenMP, where a single, fixed choice of which loop to parallelise may be suboptimal at runtime.
- Overcome performance degradation caused by changing workloads or non-perfectly-nested loops in HPC applications.
- Enable automatic, dynamic selection of the best loop for parallelisation at runtime without requiring manual code changes.
- Improve scalability on large shared-memory systems (100–1000s of cores) by adapting parallelisation strategy based on actual execution characteristics.
- Develop a practical, user-transparent system using source-to-source compilation and a lightweight runtime library to support dynamic decisions.
Proposed method
- Use a source-to-source compiler to automatically generate multiple versions of loops within a nested loop region, each annotated with directives indicating potential parallelisation targets.
- Introduce a directive-based interface (similar to OpenMP) allowing programmers to specify alternative parallelisation strategies for each loop level.
- Implement a runtime library that evaluates performance heuristics and profiling data to decide at execution time which loop version to execute in parallel.
- Apply a relaxed profiling mechanism that records only loop iteration counts and timing, avoiding costly internal loop counting to reduce overhead.
- Use code duplication as a performance optimization, enabling separate execution paths for different parallelisation choices without runtime branching penalties.
- Integrate a decision function that selects between heuristic-based choices and profiling-based decisions, with profiling only triggered when heuristics fail.
Experimental results
Research questions
- RQ1Can dynamic loop parallelisation at runtime outperform static OpenMP loop parallelisation using the if clause, especially under variable or irregular workloads?
- RQ2How does the overhead of profiling affect the performance of dynamic loop selection, and can it be reduced without sacrificing decision accuracy?
- RQ3To what extent can dynamic loop selection improve performance in non-perfectly-nested loop regions where static choices are suboptimal?
- RQ4Does automatic code duplication for multiple loop versions lead to performance gains despite being considered a code-smell in software engineering?
- RQ5Can a lightweight, directive-based system achieve effective auto-tuning of loop parallelisation with minimal programmer effort and no major code refactoring?
Key findings
- The dynamic loop parallelisation system significantly outperforms the standard OpenMP if-clause approach, especially in cases with variable or irregular workloads.
- The relaxed profiling mechanism reduced overhead by eliminating internal loop iteration counting, leading to faster decision-making and improved performance, particularly at high thread counts.
- The dynamic system correctly selected the optimal loop for parallelisation in cases where the static if-clause method failed, such as at 12 and 16 threads in the CFD benchmark.
- Even with profiling overhead, the dynamic approach achieved performance comparable to heuristic-only decisions, demonstrating its practical viability.
- Code duplication, while typically discouraged, proved beneficial in this context by eliminating nested parallel region overheads and enabling efficient runtime selection.
- The system demonstrated scalability and adaptability on large shared-memory systems, suggesting strong potential for future HPC workloads with 100–1000s of cores.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.