在GPU和多核CPU上自动加速Numpy应用程序
Automatic acceleration of Numpy applications on GPUs and multicore CPUs
摘要:
像Numpy这样的框架是应用程序开发人员的热门选择,从图像处理到生物信息学再到机器学习。Numpy通常用于开发原型或部署,因为它为涉及数组的操作提供了有效的实现。这种方法要求每个操作都被急切地执行。每个操作的结果都需要存储在内存中,这增加了应用程序的内存占用。它还增加了带宽要求,因为所有使用都必须从该存储器读取。我们提出了一种方法,记录Numpy操作的顺序,以进行延迟执行。当需要数组的值时,例如当值存储到磁盘或显示在屏幕上时,计算这些值所需的操作序列被编译成函数并执行。这消除了在慢速内存中存储/加载中间体的需要,从而获得更好的性能。在库实现更有效的情况下(如矩阵-矩阵乘法),使用它们。该方法还允许我们无缝地针对多核CPU和NVIDIA GPU,从而将Numpy应用程序移植到这些架构中,而无需更改用户程序。该方法的好处是通过针对来自各个领域的计算样本进行评估,并且平均观察到Numpy的数量级性能改进。
英文摘要:
Frameworks like Numpy are a popular choice for application developers from varied fields such as image processing to bio-informatics to machine learning. Numpy is often used to develop prototypes or for deployment since it provides efficient implementation for operations involving arrays. Such an approach requires every operation to be executed eagerly. The result of each operation needs to be stored in memory which increases the memory footprint of the application. It also increases the bandwidth requirements since all uses must read from this memory. We propose an approach that records the sequence of Numpy operations for defered execution. When the values of an array are needed, for example when the values are stored to disk or displayed on screen, the sequence of operations required to compute these value are compiled into a function and executed. This removes the need to store/load intermediates in slow memory, resulting in better performance. In cases where the library implementation is more efficient (like matrix-matrix multiply), those are used instead. The approach also allows us to seamlessly target both multicore CPUs and NVIDIA GPUs, thereby porting the Numpy application to these architectures without changing the user program. The benefit of the approach is evaluated by targeting computation samples from various domains and on average on order of magnitude performance improvement over Numpy is observed.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。