support ing enhanced except ion handl ing w ith openmp 

Get Complete Project Material File(s) Now! »

SUPPORTING ENHANCED EXCEPTION HANDLING WITH OPENMP

The proliferation of parallel processing in shared-memory applications has encouraged developing assistant frameworks such as OpenMP. OpenMP has become increasingly prevalent due to the simplicity it o ers to elegantly and incrementally introduce par-allelism. However, it still lacks some high-level language features that are essential in object-oriented programming. One such mechanism is that of exception handling. In languages such as Java, the concept of exception handling has been an integral as-pect to the language since the first release. For OpenMP to be truly embraced within this object-oriented community, essential object-oriented concepts such as exception handling need to be given some attention.
The o cial OpenMP standard has little specification on error recovery, as the chal-lenges of supporting exception-based error recovery in OpenMP extends to both the semantic specifications and related runtime support. This chapter proposes a system-atic mechanism for exception handling with the co-use of OpenMP directives, which is based on a Java implementation of OpenMP. The concept of exception handling with OpenMP directives has been formalized and categorized. Hand in hand with this ex-ception handling proposal, a flexible approach to thread cancellation is also proposed (as an extension to OpenMP directives) that supports this exception handling within parallel execution. The runtime support and its implementation are discussed. The eval-uation shows that while there is no prominent overhead introduced, the new approach provides a more elegant coding style which increases parallel development e ciency and software robustness.
The contributions of this chapter can be divided into three parts:
The categorization and formalization of object-oriented exception handling in OpenMP parallel regions.
The concept of flexible thread cancellation is proposed, which provides a better approach for managing the control flow of a program, as well as facilitating exception handling on threads.
Usability and performance are evaluated through an OpenMP implementation for Java.
The contents of this chapter are based on published papers in the Proceedings of the 11th International Workshop on OpenMP [60], and International Journal of Parallel Programming [61].
This chapter is organized as follows. Section 3.1 starts o with the introduction. Sec-tion 3.2 reviews the latest studies related to the OpenMP error recovery models, and finds that there is no dedicated error recovery model for object-oriented programming. Section 3.3 gives an overview of the current state of using error recovery in object-oriented languages, and lists the problems programmers are facing. In Section 3.4, an extended parallel cancellation solution is discussed, which will give programmers more flexibility to express parallel control flow and is also useful with alongside exception handling. In Section 3.5, exception handling with OpenMP is comprehensively dis-cussed. Implementation issues are discussed in Section 3.6 and the evaluation of the new runtime support is provided in Section 3.7. Section 3.8 summarizes this chapter.

INTRODUCTION

The OpenMP programming framework still has some way to go before it is widely used for general software development. In particular, the current OpenMP standard lacks support for essential programming features such as mechanisms for error recovery. As a matter of fact, OpenMP is mainly used for compute-intensive applications that are deterministic and less error-prone, such as batch-like, or numerical and scientific computations. For other kinds of parallel programs (such as server-side applications [62, 63], games [64], desktop and mobile platform software [65]), which are typically interaction-based, handling unexpected situations is essential for robustness.
Exception handling is an error recovery mechanism which enables programs to an-ticipate and recover from abnormal situations and consequently avoid any abrupt termination of applications. Compared with other error handling approaches (e.g. error code based, callback function based [66]), exception-based recovery is more compliant with object-oriented principles, due to its support for user-defined exceptions. In object-oriented languages, useful information about an error is typically stored in an instance of an Exception class. Moreover, it is lexically clearer and more flexible to directly sur-round code that could potentially throw exceptions in try-catch-finally blocks. OpenMP does not provide rich support for object-oriented exception handling in parallel envi-ronments. If anything, considering that a parallelized application is likely to introduce more potential problems than that in a sequential application, this lack of support for exception handling makes it especially di cult to write robust object-oriented paral-lel code using the OpenMP approach. This is especially important to recognize in an object-oriented language such as Java, where exception handling is an integral part of the language. As Android and multi-core mobile devices continue their dominance, par-allel programming is evermore relevant and presents another opportunity for OpenMP to embrace this community of developers.
A direct combination of the conventional object-oriented exception handling model with OpenMP is not feasible. This is due to the conventional exception handling mech-anism being only compatible with single-stream control flow. The catch block works as a backup execution stream and does not execute unless the specified exception oc-curs inside its paired try block. Moreover, it is guaranteed that at most one exception may occur within the contained try block, since the control flow is executed sequen-tially. Therefore, either an exception is handled adequately and the program continues running, or the exception is propagated upwards (and may potentially terminate the program if not handled at a higher level). However, this procedure becomes more com-plicated when developing code in OpenMP, because OpenMP directives change the context of the (otherwise lexically sequential) source code. That is, certain regions of the code might be executed in parallel (i.e. the parallel regions), and multiple exceptions in those parallel regions may need to be handled di erently. In other words, exception handling with multiple control flows cannot simply adopt the conventional sequential try-catch-finally policy. Since the program deals with multiple threads, there are several factors that need to be considered.

READ  The importance of time in stereo correspondence

RELATED WORK

Although the o cial OpenMP standard does not have a comprehensive error handling mechanism at the moment, several error handling models have been proposed for OpenMP. Gatlin [66] initially classifies error handling into three categories based on exception, callback function and error-code. Exception-based error handling is widely used in object-oriented languages such as C++ and Java, but combining this mechanism with parallelization approaches in OpenMP has not been studied in depth so far. On the contrary, error recovery models that are based on callback functions are widely used in di erent domains, but they seem to be too complicated to use. Low level languages such as C and Fortran mainly use this approach to handle errors, as these languages lack proper exception handling mechanisms. For this category, Duran et al. [67] introduces a model for error recovery in OpenMP that is based on callback functions. The model proposes a mechanism for registering callback functions using the onerror clause to specify a function that is called in case of a specific error. Moreover, Wong et al. [68] discussed the necessity of error-handling models in OpenMP. However, they argue that the model must support exception-unaware languages (e.g. C and Fortran), thus their model does not include the semantics of exception throwing and try-catch blocks. Kao [69] discussed the issue of exception handling in C++ OpenMP programs, however, some concerns are only confined in C++. For example, C++ manages memory by pointers and allocated memory needs to be reclaimed manually when handling exceptions. As a comparison, in Java, Java Virtual Machine (JVM) is responsible for garbage collections and its exception handling does not require any explicit memory management. Another example is Java supports finally keyword, by which resource handlers can be safely closed no matter whether exception happens, but in C++, it is not available.

1 introduction 
1.1 Shared-memory Parallel Programming
1.2 OpenMP
1.3 Thesis Motivation
1.4 Thesis Contribution
1.5 Thesis Structure
2 background 
2.1 Shared-Memory Parallel Systems
2.2 Shared-Memory Parallel Programming
2.3 OpenMP
2.4 Pyjama
3 support ing enhanced except ion handl ing w ith openmp 
3.1 Introduction
3.2 Related work
3.3 Problem Overview
3.4 Cancellations
3.5 Exception Handling
3.6 Implementation
3.7 Evaluation
4 support ing asynchron izat ion in openmp for event-dr iven programming 
4.1 Introduction
4.2 Background
4.3 Programming Model
4.4 Implementation Overview
4.5 Evaluation
4.6 Related Work
4.7 Summary
5 performance model ing of event-dr iven programs w ith openmp
5.1 Introduction
5.2 Performance measurement of event handling execution
5.3 Evaluation
5.4 Summary
6 java openmp benchmarks and evaluations
6.1 Introduction
6.2 PolyBench for Java OpenMP
6.3 Evaluation
6.4 Results
6.5 Related Work
6.6 Summary
7 conclusions
7.1 Future works
GET THE COMPLETE PROJECT
T OWA R D S O B J E C T – O R I E N T E D O P E N M P PA R A L L E L P R O G R A M M I N G

Related Posts