Compiler analysis for OpenMP tasks correctness

OpenMP has become the most frequently used programming model for shared memory parallel systems by virtue of its simplicity and scalability. Notwithstanding its easiness, the constant evolution of OpenMP brings forth difficulties when it comes to keep up with its capabilities. Compilers are key tools to anticipate bugs that may appear at runtime. Despite this, most compilers do not diagnose common mistakes that cause execution errors. Furthermore, many compilers do not yet implement the latest extensions of the OpenMP asynchronous model, and there are no checking systems to properly identify errors in that model. In this paper, we focus on the mistakes derived from the usage of OpenMP tasks. We define a data-flow algorithm that computes the live tasks at every point of the program. Based on that, we present different scenarios and the analyses that allow detecting possible runtime failures, loss of performance or non-deterministic results. We have implemented all the analyses in the Mercurium source-to-source compiler, which, based on the results, suggests changes to the user in order to avoid runtime problems. We test our implementation with over 70 students and 6 benchmarks, as well as with the results of the Oracle Solaris Studio 12.3 compiler, which warns about correctness issues related to the scope of variables in OpenMP.