Efficient GPU Offloading with OpenMP for a Hyperbolic Finite Volume Solver on Dynamically Adaptive Meshes
收藏资源简介:
We identify and show how to overcome an OpenMP bottleneck in the administration of GPU memory. It arises for a wave equation solver on dynamically adaptive block-structured Cartesian meshes, which keeps all CPU threads busy and allows all of them to offload sets of patches to the GPU. Our studies show that multithreaded, concurrent, non-deterministic access to the GPU leads to performance breakdowns, since the GPU memory bookkeeping as offered through OpenMP's map clause, i.e., the allocation and freeing, becomes another runtime challenge besides expensive data transfer and actual computation. We, therefore, propose to retain the memory management responsibility on the host: A caching mechanism acquires memory on the accelerator for all CPU threads, keeps hold of this memory and hands it out to the offloading threads upon demand. We show that this user-managed, CPU-based memory administration helps us to overcome the GPU memory bookkeeping bottleneck and speeds up the time-to-solution of Finite Volume kernels by more than an order of magnitude.
我们明确并展示了如何克服图形处理器(GPU)内存管理中的OpenMP瓶颈。该瓶颈出现于动态自适应块结构笛卡尔网格上的波动方程求解器场景中:此时所有CPU线程均处于忙碌状态,且允许所有线程将补丁集卸载至GPU。我们的研究表明,对GPU的多线程并发非确定性访问会引发性能崩溃——这是因为通过OpenMP的map子句实现的GPU内存簿记(即内存分配与释放操作),除了高开销的数据传输与实际计算外,还带来了额外的运行时挑战。为此,我们提出将内存管理职责保留在主机端:通过缓存机制为所有CPU线程在加速器上预申请内存,持有该内存并按需分发给卸载线程。我们证明,这种用户管理、基于CPU的内存管理方案能够有效克服GPU内存簿记瓶颈,并将有限体积核的求解耗时提速一个数量级以上。



