Code Complexity versus Performance for GPU-accelerated Scientific Applications
A Wk. Umayanganie Munipala, Shirley Moore · 2016
Summary form only given. Graphics Processing Units (GPUs) are becoming widely used as parallel accelerators in high-performance computing. GPU programming until recently, has been done by using low-level programming models such as CUDA and OpenCL. The directive-based OpenACC programming model has been growing in popularity due to its higher level of abstraction. This technique, which uses “directive” or “pragma” statements to annotate source code written in traditional high-level languages such as Fortran, C, and C++, is intended to allow a single code base to work across multiple computational platforms. We attempt to compare code complexity and performance of CUDA, OpenCL, and OpenACC implementations for three benchmark codes - the Game of Life (GOL) example code, the LULESH hydrodynamics proxy application, and the CloverLeaf mini-app from the Mantevo suite For the GOL C, CUDA C, and OpenCL codes and the LULESH C++, CUDA, and OpenCL codes, we measured source lines of code (SLOC) and cyclomatic complexity using the Oxbow toolkit static analysis tools. We ran the commercial McCabe IQ tool on the CloverLeaf Fortran90, Fortran90 + OpenACC, and Fortran portion of CloverLeaf_CUDA to measure cyclomatic complexity, design complexity, and essential complexity. We found that the CUDA and OpenCL implementations have significantly more lines of code than the corresponding OpenACC implementations but that the measured cyclomatic complexity is not always higher. The CUDA and OpenCL implementations generally have better performance, but there is not a drastic difference if the OpenACC code is optimized. We conclude that the available metrics and tools for measuring complexity of GPU programs are inadequate, since they do not quantify the portability and maintainability of the codes, and that specialization and extensions are needed.