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

Concurrent CPU-GPU Task Programming using Modern C++

Tsung-Wei Huang, Yibo Lin · DOI

Introduction

The landscape of high-performance computing (HPC) has shifted significantly toward heterogeneous architectures that combine the general-purpose processing power of CPUs with the massive parallelism of GPUs. While these systems offer immense theoretical performance, the practical challenge of programming them remains a significant barrier. Developers are often forced to manage low-level details such as thread synchronization, memory offloading, and complex data movement between host and device. This paper introduces Heteroflow, a modern C++ library designed to simplify the development of parallel CPU-GPU programs through a task-based programming model.

The Challenge of Heterogeneous Programming

Efficiently utilizing a mix of CPUs and GPUs is often described as a "heroic" task. The fundamental differences in architecture—MIMD (Multiple Instruction, Multiple Data) for CPUs versus SIMT (Single Instruction, Multiple Threads) for GPUs—require distinct programming paradigms.

In fields like Very Large Scale Integration (VLSI) Computer-Aided Design (CAD), the complexity is compounded by the scale of the data. A single design can involve billions of tasks with intricate, non-linear dependencies. Traditional parallel programming models like OpenMP often struggle to scale in these environments, and manual management of CUDA streams and data "ping-ponging" becomes error-prone and difficult to maintain. The authors of Heteroflow seek to provide a framework where developers can achieve high performance without this level of manual effort.

The Heteroflow Framework

Heteroflow addresses these challenges by allowing developers to express computations as a Directed Acyclic Graph (DAG) of tasks. Built on C++17/20 standards, the library abstracts the mechanics of execution, allowing developers to focus on algorithmic logic.

Task-Based Programming Model

Heteroflow defines four specialized task types to handle the lifecycle of a heterogeneous application:

  • Host Tasks: Execute standard C++ callables on CPU cores.
  • Pull Tasks: Handle Host-to-Device (H2D) data transfers, acting as gateways for GPU data.
  • Push Tasks: Handle Device-to-Host (D2H) data transfers.
  • Kernel Tasks: Offload intensive computations to the GPU.

By using std::span and lambda closures, Heteroflow maintains stateful execution and data consistency without requiring explicit user-side concurrency controls. The use of precede and succeed methods allows for a readable, graph-like syntax that mirrors the logical flow of the application.

Automated Scheduling and Resource Allocation

The library's runtime executor employs sophisticated algorithms to optimize performance:

  • Device Placement: Heteroflow uses a union-find algorithm to group kernels with their associated data and a bin-packing strategy to distribute these groups across available GPUs. This minimizes unnecessary data movement.
  • Work-Stealing Scheduler: A pool of worker threads manages CPU tasks and asynchronous CUDA streams. To balance the load, idle threads can "steal" tasks from busy ones, ensuring high utilization across all processor cores.

Experimental Evaluation

The efficacy of Heteroflow was evaluated using two large-scale VLSI design automation benchmarks: timing analysis and standard cell placement.

VLSI Timing Analysis

Using the OpenTimer project and the netcard dataset (1.5 million gates), the researchers tested Heteroflow on a system with 40 CPU cores and 4 GPUs. The library achieved a remarkable reduction in runtime, dropping from 99 minutes to just 13 minutes—a 7.7x speedup. The results indicated that while adding CPU cores improved performance, the addition of GPUs provided the most significant scaling for this workload.

VLSI Standard Cell Placement

In tests using the DREAMPlace project and the bigblue4 dataset (2.2 million cells), Heteroflow demonstrated its ability to manage irregular task patterns. The system successfully saturated performance at approximately 20 CPU cores for a single-GPU configuration, proving its capability to handle the highly dependent tasks typical of CAD optimization.

Discussion and Future Work

Heteroflow represents a significant step toward making heterogeneous programming "transparent." By separating the "what" (logic) from the "how" (execution), it enables domain experts to leverage powerful hardware without becoming experts in low-level GPU orchestration.

While the current results in the VLSI CAD domain are promising, the authors acknowledge several areas for growth. Future work will focus on expanding the library's application to machine learning and general engineering simulations, developing a distributed scheduler for multi-node clusters, and further refining the scheduler to handle extremely irregular workloads more efficiently.

Conclusion

Heteroflow simplifies the complexity of modern C++ programming for CPU-GPU systems. Through its task-based DAG model and automated resource management, it provides a scalable and maintainable solution for high-performance applications, achieving significant speedups in complex real-world scenarios like VLSI design.

Summary updated

BibTeX
@inproceedings{huang2022concurrent,
  author = {Tsung-Wei Huang and Yibo Lin},
  title = {{Concurrent CPU-GPU Task Programming using Modern C++}},
  booktitle = {Workshops @ IPDPS},
  year = {2022},
  doi = {10.1109/ipdpsw55747.2022.00099},
}
Figure