Skip to main content
QUICK REVIEW

[论文解读] C Language Extensions for Hybrid CPU/GPU Programming with StarPU

Ludovic Courtès|arXiv (Cornell University)|Apr 3, 2013
Parallel Computing and Optimization Techniques参考文献 16被引用 10
一句话总结

本文提出了一种基于StarPU的C语言扩展,用于混合CPU/GPU编程,通过GCC编译器扩展将基于任务的并行计算直接集成到C语言中。通过将StarPU的任务模型嵌入语言,该方法简化了编程,减少了错误,并支持编译时诊断,同时保持与标准C语言的兼容性。

ABSTRACT

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.

研究动机与目标

  • 解决使用StarPU C库接口进行混合CPU/GPU编程时的复杂性和易错性。
  • 通过将StarPU的任务驱动编程模型直接集成到C语言中,降低开发者的入门门槛。
  • 通过向编译器暴露任务和数据依赖信息,实现编译时诊断和静态分析。
  • 通过抽象低层调度和数据传输细节,提升在异构系统间的性能可移植性。
  • 为未来扩展(如OpenCL内核生成、嵌套任务和混合集群中的MPI支持)奠定基础。

提出的方法

  • 扩展GCC编译器套件,添加直接映射到StarPU任务编程模型的语言扩展。
  • 引入注解以定义任务、其实现方式(CPU/GPU)以及数据访问模式(只读、只写、读写)。
  • 使用编译器注解表示任务依赖关系和数据传输,支持静态分析和错误检测。
  • 支持每个任务的多种实现方式(例如,C用于CPU,OpenCL用于GPU),并允许根据运行时可用性自动选择。
  • 与StarPU运行时调度器集成,自动在CPU和GPU上调度任务并管理数据移动。
  • 通过确保在不使用编译器插件时注解程序仍为有效顺序C代码,实现向后兼容性。

实验结果

研究问题

  • RQ1是否可以设计C语言扩展,以一种提升可用性和正确性的方式嵌入StarPU的任务驱动编程模型?
  • RQ2编译器注解如何暴露任务和数据依赖信息,以支持静态错误检测和诊断?
  • RQ3将StarPU任务模型集成到C语言中,能在多大程度上减轻开发者的认知负担和实现复杂度?
  • RQ4如何利用编译时知识来指导混合CPU/GPU系统中的运行时调度决策?
  • RQ5未来扩展(如OpenCL内核生成、嵌套任务和通过StarPU-MPI支持集群环境)如何集成到语言扩展框架中?

主要发现

  • 所提出的C语言扩展成功将StarPU的任务驱动编程模型嵌入C语言,提供更直观且不易出错的接口。
  • 编译器插件可通过分析任务注解和数据依赖关系,在编译时检测程序错误,提升代码正确性。
  • 在不使用插件编译时,使用扩展的程序仍为有效的顺序C代码,确保向后兼容性和逐步采用。
  • 该集成支持更好的静态分析,使编译器能够识别任务定义和数据访问模式中的不一致。
  • 未来工作在从C循环生成OpenCL内核、支持嵌套任务以及通过额外注解扩展至集群环境(如StarPU-MPI)方面展现出巨大潜力。
  • 该方法表明,通过语言级支持任务驱动编程,可显著降低混合CPU/GPU编程的复杂性,同时保持性能可移植性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。