一句话:提出 DafnyMPI 库,使 Dafny 能验证 MPI 程序的无死锁、终止与功能等价。
MPI 广泛用于并行高性能编程,但编写无 bug 的 MPI 软件仍很困难。本文提出 DafnyMPI,一种可扩展的 MPI 软件形式化验证方法。与依赖定制并发逻辑的已有框架不同,DafnyMPI 复用面向顺序程序的验证语言 Dafny,并扩展其并发推理能力。该库要求用户预先指定通信拓扑,并验证 MPI_ISEND、MPI_WAIT 等通信原语调用满足前置条件。作者用核心演算形式化 DafnyMPI,证明这些前置条件足以保证无死锁;功能等价通过消息载荷上的 rely-guarantee 推理和读写缓冲区安全使用系统证明;终止与无运行时错误则由标准 Dafny 技术证明。最后,作者验证了三个经典偏微分方程数值求解程序,展示了方法的适用性。
The Message Passing Interface (MPI) is widely used in parallel, high-performance programming, yet writing bug-free software that uses MPI remains difficult. We introduce DafnyMPI, a novel, scalable approach to formally verifying MPI software. DafnyMPI allows proving deadlock freedom, termination, and functional equivalence with simpler sequential implementations. In contrast to existing specialized frameworks, DafnyMPI avoids custom concurrency logics and instead relies on Dafny, a verification-ready programming language used for sequential programs, extending it with concurrent reasoning abilities. DafnyMPI is implemented as a library that enables safe MPI programming by requiring users to specify the communication topology upfront and to verify that calls to communication primitives such as MPI_ISEND and MPI_WAIT meet their preconditions. We formalize DafnyMPI using a core calculus and prove that the preconditions suffice to guarantee deadlock freedom. Functional equivalence is proved via rely-guarantee reasoning over message payloads and a system that guarantees safe use of read and write buffers. Termination and the absence of runtime errors are proved using standard Dafny techniques. To further demonstrate the applicability of DafnyMPI, we verify numerical solutions to three canonical partial differential equations. We believe DafnyMPI demonstrates how to make formal verification viable for a broader class of programs and provides proof engineers with additional tools for software verification of parallel and concurrent systems.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{FedchinMSF26,
title = {DafnyMPI: A Dafny Library for Verifying Message-Passing Concurrent Programs},
author = {Aleksandr Fedchin and Antero Mejr and Hari Sundar and Jeffrey S. Foster},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {POPL},
year = {2026},
doi = {10.1145/3776705}
}