Investigation of the Opencl SYCL Programming Model
Total Page:16
File Type:pdf, Size:1020Kb
Investigation of the OpenCL SYCL Programming Model Angelos Trigkas August 22, 2014 MSc in High Performance Computing The University of Edinburgh Year of Presentation: 2014 Abstract OpenCL SYCL is a new heterogeneous and parallel programming framework created by the Khronos Group that tries to bring OpenCL programming into C++. In particular, it enables C++ developers to create OpenCL kernels, using all the popular C++ features, such as classes, inheritance and templates. What is more, it dramatically reduces programming effort and complexity, by letting the runtime system handle system resources and data transfers. In this project we investigate Syclone, a prototype SYCL implementation that we acquired from Codeplay Ltd. To do that we compare SYCL in terms of both programmability and performance with another two established parallel programming models, OpenCL and OpenMP. In particular, we have chosen six scientific applications and ported them in all three models. Then we run benchmarking experiments to assess their performance on an Intel Xeon Phi based platform. The results have shown that SYCL does great from a programmability perspective. However, its performance still does not match that of OpenCL or OpenMP. Contents Chapter 1 Introduction .......................................................................................................... 1 1.1 Motivation ...................................................................................................................................... 1 1.2 Project Goals ................................................................................................................................. 2 1.3 Report Structure ......................................................................................................................... 3 Chapter 2 Background Theory ........................................................................................... 5 2.1 OpenCL Programming model ................................................................................................. 5 2.1.1 Platform Model .................................................................................................................................... 6 2.1.2 Execution Model ................................................................................................................................. 6 2.1.3 Memory Model ..................................................................................................................................... 8 2.1.4 Programming Model ......................................................................................................................... 9 2.2 OpenCL SPIR .................................................................................................................................. 9 2.3 Intel Xeon Phi ............................................................................................................................ 10 2.3.1 Hardware ............................................................................................................................................ 11 2.3.2 Software ............................................................................................................................................... 12 2.3.3 OpenCL on Intel Xeon Phi ............................................................................................................ 13 Chapter 3 The OpenCL SYCL Programming Model .................................................. 15 3.1 Relevant C++ features ............................................................................................................ 16 3.1.1 Function Objects .............................................................................................................................. 16 3.1.2 Lambda Expressions ...................................................................................................................... 17 3.2 SYCL Platform Model .............................................................................................................. 18 i 3.3 SYCL Execution Model ............................................................................................................ 18 3.4 SYCL Memory Model ............................................................................................................... 19 3.5 SYCL Programming Model .................................................................................................... 19 3.6 SYCL Application Example.................................................................................................... 20 Chapter 4 Application Development with SYCL ........................................................ 24 4.1 Applications ............................................................................................................................... 24 4.1.1 27stencil............................................................................................................................................... 25 4.1.2 Le_core .................................................................................................................................................. 26 4.1.3 Himeno ................................................................................................................................................. 27 4.1.4 Mandel .................................................................................................................................................. 28 4.1.5 GEMM .................................................................................................................................................... 28 4.1.6 Bitonic ................................................................................................................................................... 29 4.2 Development with SYCL ........................................................................................................ 29 4.2.1 Device Selection ............................................................................................................................... 29 4.2.2 Kernel Definition ............................................................................................................................. 30 4.3 Comparison of OpenCL, SYCL and OpenMP ................................................................... 32 Chapter 5 Performance Results and Analysis ........................................................... 40 5.1 Experimental Platform .......................................................................................................... 40 5.2 SYCLONE Installation .............................................................................................................. 41 5.3 Experimental Setup ................................................................................................................. 41 5.4 Experimental Results ............................................................................................................. 45 5.5 Discussion ................................................................................................................................... 50 Chapter 6 Conclusion ........................................................................................................... 59 Appendix A Extensive OpenMP Results ..................................................................... 63 A.1 OpenMP Xeon Phi Results .................................................................................................... 63 ii A.2 OpenMP Xeon Results ............................................................................................................ 65 References ............................................................................................................................... 70 iii List of Tables Table 1: Device query results ...........................................................................................43 Table 2: OpenCL and SYCL execution parameters ........................................................44 Table 3: 27stencil OpenMP execution times on Xeon Phi ..............................................63 Table 4: Himeno OpenMP execution times on Xeon Phi ...............................................63 Table 5: Le core OpenMP execution times on Xeon Phi ................................................64 Table 6: Mandel OpenMP execution times on Xeon Phi ................................................64 Table 7: GEMM OpenMP execution times on Xeon Phi ................................................64 Table 8: Bitonic OpenMP execution times on Xeon Phi ................................................65 Table 9: 27stencil OpenMP execution times on Xeon ....................................................65 Table 10: Himeno OpenMP execution times on Xeon ....................................................66 Table 11: Le core OpenMP execution times on Xeon.....................................................66 Table 12: Mandel OpenMP execution times on Xeon ....................................................67 Table 13: GEMM OpenMP execution times on Xeon ....................................................67 Table 14: Bitonic OpenMP execution times on Xeon .....................................................68 iv List of Figures Figure 1: OpenCL platform model (image source [3])...................................................... 6 Figure 2: Example of a 2-dimensional kernel space decomposition in OpenCL (image source