Table of Contents
Fetching ...

Pragma driven shared memory parallelism in Zig by supporting OpenMP loop directives

David Kacs, Joseph Lee, Justs Zarins, Nick Brown

TL;DR

This paper enhances the Zig compiler to add support for OpenMP loop directives, and demonstrates that not only does the integration of OpenMP with Zig scale comparatively to Fortran and C reference implementations of NPB, but furthermore Zig provides up to a 1.25 times performance increase compared to Fortran.

Abstract

The Zig programming language, which is designed to provide performance and safety as first class concerns, has become popular in recent years. Given that Zig is built upon LLVM, and-so enjoys many of the benefits provided by the ecosystem, including access to a rich set of backends, Zig has significant potential for high performance workloads. However, it is yet to gain acceptance in HPC and one of the reasons for this is that support for the pragma driven shared memory parallelism is missing. In this paper we describe enhancing the Zig compiler to add support for OpenMP loop directives. Then exploring performance using NASA's NAS Parallel Benchmark (NPB) suite. We demonstrate that not only does our integration of OpenMP with Zig scale comparatively to Fortran and C reference implementations of NPB, but furthermore Zig provides up to a 1.25 times performance increase compared to Fortran.

Pragma driven shared memory parallelism in Zig by supporting OpenMP loop directives

TL;DR

This paper enhances the Zig compiler to add support for OpenMP loop directives, and demonstrates that not only does the integration of OpenMP with Zig scale comparatively to Fortran and C reference implementations of NPB, but furthermore Zig provides up to a 1.25 times performance increase compared to Fortran.

Abstract

The Zig programming language, which is designed to provide performance and safety as first class concerns, has become popular in recent years. Given that Zig is built upon LLVM, and-so enjoys many of the benefits provided by the ecosystem, including access to a rich set of backends, Zig has significant potential for high performance workloads. However, it is yet to gain acceptance in HPC and one of the reasons for this is that support for the pragma driven shared memory parallelism is missing. In this paper we describe enhancing the Zig compiler to add support for OpenMP loop directives. Then exploring performance using NASA's NAS Parallel Benchmark (NPB) suite. We demonstrate that not only does our integration of OpenMP with Zig scale comparatively to Fortran and C reference implementations of NPB, but furthermore Zig provides up to a 1.25 times performance increase compared to Fortran.
Paper Structure (18 sections, 5 figures, 3 tables)

This paper contains 18 sections, 5 figures, 3 tables.

Figures (5)

  • Figure 1: Illustration of a choice of parsing, either A) parsing the entire pragma as a single token or B) separating the pragma into multiple tokens
  • Figure 2: Private variables stored in the extra_data array
  • Figure 3: Speedup against number of threads for the CG benchmark (class C) for both our approach in Zig and the Fortran reference implementation
  • Figure 4: Speedup against number of threads for the EP benchmark (class C) for both our approach in Zig and the Fortran reference implementation
  • Figure 5: Speedup against number of threads for the IS benchmark (class C) for both our approach in Zig and the C reference implementation