[Paper Review] C Language Extensions for Hybrid CPU/GPU Programming with StarPU
This paper proposes C language extensions for hybrid CPU/GPU programming using StarPU, integrating task-based parallelism directly into the C language via GCC compiler extensions. By embedding StarPU's task model into the language, the approach simplifies programming, reduces errors, and enables compile-time diagnostics while maintaining compatibility with standard C.
Modern platforms used for high-performance computing (HPC) include machines with both general-purpose CPUs, and "accelerators", often in the form of graphical processing units (GPUs). StarPU is a C library to exploit such platforms. It provides users with ways to define "tasks" to be executed on CPUs or GPUs, along with the dependencies among them, and by automatically scheduling them over all the available processing units. In doing so, it also relieves programmers from the need to know the underlying architecture details: it adapts to the available CPUs and GPUs, and automatically transfers data between main memory and GPUs as needed. While StarPU's approach is successful at addressing run-time scheduling issues, being a C library makes for a poor and error-prone programming interface. This paper presents an effort started in 2011 to promote some of the concepts exported by the library as C language constructs, by means of an extension of the GCC compiler suite. Our main contribution is the design and implementation of language extensions that map to StarPU's task programming paradigm. We argue that the proposed extensions make it easier to get started with StarPU,eliminate errors that can occur when using the C library, and help diagnose possible mistakes. We conclude on future work.
Motivation & Objective
- Address the complexity and error-proneness of using StarPU’s C library interface for hybrid CPU/GPU programming.
- Lower the barrier to entry for developers by integrating StarPU’s task-based programming model directly into the C language.
- Enable compile-time diagnostics and static analysis by exposing task and data dependency information to the compiler.
- Improve performance portability across heterogeneous systems by abstracting low-level scheduling and data transfer details.
- Lay the foundation for future extensions such as OpenCL kernel generation, nested tasks, and MPI support in hybrid clusters.
Proposed method
- Extend the GCC compiler suite with language extensions that map directly to StarPU’s task programming model.
- Introduce annotations to define tasks, their implementations (CPU/GPU), and data access modes (read-only, write-only, read-write).
- Use compiler annotations to represent task dependencies and data transfers, enabling static analysis and error detection.
- Support multiple implementations per task (e.g., C for CPU, OpenCL for GPU) and allow automatic selection based on runtime availability.
- Integrate with StarPU’s run-time scheduler to schedule tasks across CPUs and GPUs while managing data movement automatically.
- Enable backward compatibility by ensuring annotated programs remain valid sequential C when the compiler plugin is not used.
Experimental results
Research questions
- RQ1Can C language extensions be designed to embed StarPU’s task-based programming model in a way that improves usability and correctness?
- RQ2How can compiler annotations expose task and data dependency information to enable static error detection and diagnostics?
- RQ3To what extent can the integration of StarPU’s task model into the C language reduce the cognitive and implementation burden on developers?
- RQ4What are the opportunities for leveraging compile-time knowledge to guide run-time scheduling decisions in hybrid CPU/GPU systems?
- RQ5How can future extensions such as OpenCL kernel generation, nested tasks, and MPI support be integrated into the language extension framework?
Key findings
- The proposed C language extensions successfully embed StarPU’s task-based programming model into the C language, enabling a more intuitive and less error-prone interface.
- The compiler plugin can detect programming errors at compile time by analyzing task annotations and data dependencies, improving code correctness.
- Programs using the extensions remain valid sequential C when compiled without the plugin, ensuring backward compatibility and gradual adoption.
- The integration enables better static analysis, allowing the compiler to identify inconsistencies in task definitions and data access modes.
- Future work shows promise in generating OpenCL kernels from C loops, supporting nested tasks, and extending to cluster environments via StarPU-MPI with additional annotations.
- The approach demonstrates that language-level support for task-based programming can significantly reduce the complexity of hybrid CPU/GPU programming while maintaining performance portability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.