Extract and Extend Parallelism using C/C++ Extension for Array Notation on Multicore and Many-core Platforms

Shuo Li, Robert Geva2014

TL;DR

This paper introduces a C/C++ extension for array notation, enabling financial modelers and developers to express complex numerical computations more concisely and efficiently. By leveraging this extension, the authors demonstrate significant performance gains on both multicore and many-core (Intel Xeon Phi) platforms for quantitative finance tasks, bridging the gap between high-level modeling languages and low-level performance optimization.

What Problem Does This Paper Address?

Quantitative finance relies heavily on computationally intensive numerical algorithms. Traditionally, high-level languages like R or Matlab offer elegant array operations but suffer from poor runtime performance. Conversely, low-level languages like C/C++ provide excellent performance but require verbose, scalar code, leading to a significant productivity loss when translating models to production software. This gap creates a challenge for developers who need both expressiveness and performance. The paper addresses this by exploring a C/C++ extension that aims to provide the best of both worlds: a concise, array-oriented syntax that compiles to highly optimized, parallel code.

Methods

The core of the paper is the exploration of Intel's C/C++ extension for array notation. This extension introduces a new syntax for referring to array sections (sub-arrays) and allows standard C/C++ operators and functions to be applied directly to these sections. Key features include:

  • Array Section Notation: A flexible way to define sub-arrays using [<lower bound> : <length> : <stride>].
  • Operator and Assignment Maps: C/C++ operators are implicitly mapped to operate element-wise on array sections, enabling parallel execution without explicit loops. Assignment operations also occur in parallel.
  • Reduction Operations: Built-in functions like _sec_reduce_add and _sec_reduce_mul allow for efficient aggregation of array section elements.
  • Function Maps: Scalar functions can be applied to array sections, leveraging vectorized function implementations.
  • Implicit Index: The sec_implicit_index(rank) function allows referencing the index of an element within a section, useful for generating data based on position.

The authors apply these extensions to three representative quantitative finance algorithms: Black-Scholes-Merton formula, Monte Carlo European option simulation, and Binomial option pricing model. They compare scalar C implementations against versions using the array notation, measuring performance on Intel multicore (Xeon) and many-core (Xeon Phi) platforms. They also explore the use of OpenMP for threading parallelism in conjunction with array notation.

Datasets

The paper does not explicitly mention specific named datasets. Instead, it uses synthetic data representative of quantitative finance workloads. The input data for the financial models (e.g., stock prices, strike prices, expiry times) are assumed to be stored in single-precision floating-point C arrays. The problem size is varied, with up to 15 million option data points considered for performance evaluation. The paper focuses on demonstrating the performance characteristics of the array notation extension rather than evaluating on a fixed, publicly available benchmark dataset.

Key Insights and Ideas

  • Bridging the Abstraction Gap: The array notation extension effectively bridges the semantic gap between high-level modeling languages and low-level C/C++ code, allowing financial modelers to express their ideas more directly while retaining performance.
  • Implicit Parallelism: The syntax allows developers to express parallelism implicitly. The compiler can then automatically vectorize and parallelize operations across array sections, reducing the need for manual loop unrolling or SIMD intrinsics.
  • Performance Gains on Many-Core: The array notation is particularly effective on many-core architectures like Intel Xeon Phi, which have a large number of cores and wide SIMD units. The extension allows these architectures to be utilized more effectively than traditional scalar code.
  • Hybrid Parallelism: The approach facilitates a hybrid parallelism model, where array notation handles data parallelism (SIMD) and OpenMP can be used to manage thread parallelism across cores, enabling efficient execution on heterogeneous systems.
  • Code Simplification: For certain algorithms, the array notation can eliminate entire loops, leading to more concise and readable code.

Key Results

The paper demonstrates significant performance improvements across the evaluated quantitative finance algorithms:

  • Black-Scholes-Merton Formula: Achieved up to a 20x speedup on multicore platforms and showed substantial gains on Xeon Phi compared to scalar implementations.
  • Monte Carlo Simulation: Saw performance improvements of over 9.8x on multicore platforms, attributed to better utilization of vector registers and reduced overhead. The Xeon Phi also showed significant advantages due to its specialized exponential function.
  • Binomial Option Pricing: Array notation enabled higher abstraction and performance records on multicore platforms.

The performance figures presented in the bar charts (e.g., page 72 for Monte Carlo, page 74 for Black-Scholes-Merton) clearly illustrate the benefits of vectorized and parallelized array notation over scalar and serial execution.

Limitations and Future Work

  • Compiler Dependency: The array notation is an extension specific to Intel compilers. This limits its portability to other compiler toolchains.
  • Undefined Behavior with Overlap: The paper notes that assignments to overlapping array sections can lead to undefined behavior, requiring the use of temporary arrays to ensure correctness.
  • Future Work: The authors suggest that this extension can be further applied to other computationally intensive domains beyond quantitative finance. They also imply that continued development of such extensions will be crucial for harnessing the full potential of modern parallel hardware. The paper also touches upon the potential for asynchronous offload to many-core coprocessors, suggesting further exploration in hybrid programming models.

Summary updated

BibTeX
@misc{li2014extract,
  author = {Shuo Li and Robert Geva},
  title = {{Extract and Extend Parallelism using C/C++ Extension for Array Notation on Multicore and Many-core Platforms}},
  year = {2014},
  doi = {10.1145/2627373.2627385},
}
Figure