There is growing interest in using standard language constructs for accelerated computing, avoiding the need for (often vendor-specific) external APIs. These constructs hold the potential to be more portable and much more `future-proof'. For Fortran codes, the current focus is on the {\tt do concurrent} (DC) loop. While there have been some successful examples of GPU-acceleration using DC for benchmark and/or small codes, its widespread adoption will require demonstrations of its use in full-size applications. Here, we look at the current capabilities and performance of using DC in a production application called Magnetohydrodynamic Algorithm outside a Sphere (MAS). MAS is a state-of-the-art model for studying coronal and heliospheric dynamics, is over 70,000 lines long, and has previously been ported to GPUs using MPI+OpenACC. We attempt to eliminate as many of its OpenACC directives as possible in favor of DC. We show that using the NVIDIA {\tt nvfortran} compiler's Fortran 202X preview implementation, unified managed memory, and modified MPI launch methods, we can achieve GPU acceleration across multiple GPUs without using a single OpenACC directive. However, doing so results in a slowdown between 1.25x and 3x. We discuss what future improvements are needed to avoid this loss, and show how we can still retain close
翻译:摘要:当前学界对使用标准语言结构进行加速计算日益关注,以避免依赖(通常由供应商专有的)外部应用程序接口。这类结构具有更强的可移植性和更高的“未来兼容性”潜力。对于Fortran代码,当前焦点集中于{\tt do concurrent}(DC)循环。尽管已有研究在基准测试或小型代码中成功利用DC实现GPU加速,但其大规模应用仍需在完整规模的实际程序中展示可行性。本文研究了在生产级应用MAS(Magnetohydrodynamic Algorithm outside a Sphere)中使用DC的现有能力与性能表现。MAS作为研究日冕及日球层动力学的先进模型,代码量超过7万行,且先前已通过MPI+OpenACC移植至GPU。我们尝试尽可能消除其OpenACC指令,改用DC替代。实验表明,利用NVIDIA {\tt nvfortran}编译器的Fortran 202X预览实现、统一内存管理及改进的MPI启动方法,可在完全不使用OpenACC指令的情况下实现多GPU加速。然而,此方案导致计算速度降低1.25至3倍。本文讨论了避免此类性能损失所需的未来改进方向,并展示了如何仍能保持接近原性能的实现策略。