NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Machine Learning-Driven Adaptive OpenMP For Portable Performance on Heterogeneous Systems

Giorgis Georgakoudis, Konstantinos Parasyris, Chunhua Liao, David Beckingsale, Todd Gamblin, Bronis R. de SupinskiarXiv 2023 · DOI

TL;DR

This paper introduces "adaptive OpenMP," a novel extension to OpenMP that uses machine learning to automatically tune code execution for heterogeneous systems (CPUs and GPUs). By defining code variants and letting ML models learn optimal choices at runtime, it significantly reduces the manual effort required for performance portability.

What Problem Does This Paper Address?

High-performance computing (HPC) systems are increasingly heterogeneous, featuring a mix of CPUs and GPUs. Achieving optimal performance across these diverse architectures is a major challenge, known as performance portability. Traditionally, adapting code for different systems requires developers to manually explore a vast number of configuration options, which is time-consuming, error-prone, and doesn't scale. Existing programming models offer abstractions but don't automatically solve the performance tuning problem. This paper addresses the need for an automated, machine learning-driven approach to adapt OpenMP programs for heterogeneous systems without requiring extensive manual tuning.

Methods

The core contribution is the adaptive OpenMP framework, which introduces a new #pragma omp adaptation directive. This directive, used with a begin/end pair or as a single directive, defines "adaptive regions" of code.

Key components of the approach include:

  • Producer-Consumer Pattern: The #pragma omp adaptation directive acts as a producer, defining an adaptation model based on specified features and variants. Other OpenMP constructs (like #pragma omp metadirective) or user code can act as consumers, using the model's output to select the best execution variant.
  • Novel Directives and Clauses: New clauses like model_name, features, variants, min_train_data, and model_type allow developers to specify how adaptation should occur.
  • Automated Profiling and Model Building: The runtime system transparently profiles adaptive regions, collects data, and trains machine learning models (e.g., decision trees, random forests) to predict optimal variants.
  • Compiler and Runtime Integration: The system leverages the Clang/LLVM compiler to generate code variants and integrates with the Apollo machine learning tuning library for runtime adaptation.

Datasets

The paper does not explicitly mention "datasets" in the traditional sense of pre-existing datasets for training ML models. Instead, it uses benchmark programs and proxy applications to generate profiling data at runtime.

The benchmarks used for evaluation include:

  • XSBench
  • RSBench
  • LULESH
  • AMGMK (relax)
  • Heat
  • FluidSim

These benchmarks are modified to incorporate the adaptive OpenMP directives and are run on various hardware configurations to collect performance data for model training and evaluation.

Key Insights and Ideas

  • ML-driven adaptation can be seamlessly integrated into OpenMP: The paper demonstrates that machine learning can be effectively incorporated into a widely used parallel programming model like OpenMP, making adaptive programming more accessible.
  • Producer-consumer pattern simplifies complex adaptation: By decoupling the model definition (producer) from its usage (consumer), the framework allows for flexible and coordinated adaptation across multiple code regions.
  • Automated tuning significantly reduces developer burden: The system automates the laborious process of profiling, model building, and variant selection, freeing developers from manual tuning.
  • Runtime adaptation is crucial for dynamic environments: Heterogeneous systems and varying workloads necessitate dynamic adaptation, which this approach provides, rather than static, compile-time decisions.
  • Even limited training data can yield benefits: Experiments show that models trained on subsets of data (e.g., Adaptive-25) can still provide significant speedups, highlighting the robustness of the approach.

Key Results

The paper evaluates adaptive OpenMP across three main use-cases:

  1. CPU-GPU Execution Selection: Adaptive models successfully identified the optimal device (CPU or GPU) for execution, achieving speedups of up to 4x on Intel systems for AMGMk and up to 3x for XSBench. Notably, on AMD GPUs, where OpenMP offloading is less mature, adaptive models correctly predicted CPU execution as faster.
  2. GPU Thread Selection: For GPU thread configurations, adaptive models achieved modest speedups, up to 1.4x, demonstrating that the optimal number of threads is program, input, and machine dependent.
  3. CPU-GPU Co-scheduling: For workloads that can be partitioned between CPU and GPU, adaptive models achieved speedups of up to 1.14x for XSBench and 1.5x for RSBench on Intel+P100 systems.

Overall, adaptive OpenMP consistently tracked the fastest configuration and achieved performance comparable to or better than static, best-case configurations, with minimal overhead.

Limitations and Future Work

Limitations

  • Feature Selection: The effectiveness of adaptation relies on developers identifying "good" feature variables that strongly correlate with execution time. For some algorithms, finding such features can be difficult (e.g., condition number for Conjugate Gradient).
  • Data Collection for Training: Training effective models may require multiple application runs to collect sufficient profiling data, which can be time-consuming. While the system can delegate this to runtime exploration, it might incur overhead.

Future Work

  • More Code Variants: Expand the adaptation directive to support a wider range of code variants beyond simple execution choices.
  • Advanced Analysis: Develop automated analyses to identify suitable code regions for adaptation, determine optimal code variants, select features, and choose appropriate machine learning models.
  • Explore Other ML Models: Investigate and integrate more advanced machine learning models.
  • Bayesian Optimization: Explore Bayesian optimization techniques to reduce the overhead of exploration for variant space searching.

Summary updated

BibTeX
@misc{georgakoudis2023machine,
  author = {Giorgis Georgakoudis and Konstantinos Parasyris and Chunhua Liao and David Beckingsale and Todd Gamblin and Bronis R. de Supinski},
  title = {{Machine Learning-Driven Adaptive OpenMP For Portable Performance on Heterogeneous Systems}},
  year = {2023},
  eprint = {2303.08873},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.08873},
}
Figure