Skip to main content
Log in

Mostly Automated Formal Verification of Loop Dependencies with Applications to Distributed Stencil Algorithms

  • Published:
Journal of Automated Reasoning Aims and scope Submit manuscript

Abstract

The class of stencil programs involves repeatedly updating elements of arrays according to fixed patterns, referred to as stencils. Stencil problems are ubiquitous in scientific computing and are used as an ingredient to solve more involved problems. Their high regularity allows massive parallelization. Two important challenges in designing such algorithms are cache efficiency and minimizing the number of communication steps between nodes. In this paper, we introduce a mathematical framework for a crucial aspect of formal verification of both sequential and distributed stencil algorithms, and we describe its Coq implementation. We present a domain-specific embedded programming language with support for automating the most tedious steps of proofs that nested loops respect dependencies, applicable to sequential and distributed examples. Finally, we evaluate the robustness of our library by proving the dependency-correctness of some real-world stencil algorithms, including a state-of-the-art cache-oblivious sequential algorithm, as well as two optimized distributed kernels.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13

Similar content being viewed by others

Notes

  1. https://github.com/mit-plv/stencils.

  2. In this paper, for all \(a,b\in \mathbb {Z}\), we write |[ab|] for \(\{n \in \mathbb {Z}\mid a \le n \le b\}\).

  3. We will see in the next section that we do not need to guess these set expressions. They can be produced algorithmically.

References

  1. Betts, A., Chong, N., Donaldson, A., Qadeer, S., Thomson, P.: GPUVerify: a verifier for GPU kernels. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, pp. 113–132. ACM (2012)

  2. Boldo, S., Clément, F., Filliâtre, J.C., Mayero, M., Melquiond, G., Weis, P.: Formal proof of a wave equation resolution scheme: the method error. In: Interactive Theorem Proving, pp. 147–162. Springer (2010)

  3. Boldo, S., Clément, F., Filliâtre, J.C., Mayero, M., Melquiond, G., Weis, P.: Wave equation numerical resolution: a comprehensive mechanized proof of a C program. J. Autom. Reason. 50(4), 423–456 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  4. Cachera, D., Pichardie, D.: Embedding of systems of affine recurrence equations in Coq. In: TPHOLs, pp. 155–170. Springer (2003)

  5. Epperson, J.F.: An Introduction to Numerical Methods and Analysis. Wiley, Hoboken (2014)

    MATH  Google Scholar 

  6. Feautrier, P.: Automatic parallelization in the polytope model. In: Perrin, G.-R., Darte, A. (eds.) The Data Parallel Programming Model, pp. 79–103. Springer, Berlin (1996)

    Chapter  Google Scholar 

  7. Frigo, M., Strumpen, V.: Cache oblivious stencil computations. In: Proceedings of the 19th Annual International Conference on Supercomputing, pp. 361–366. ACM (2005)

  8. Frigo, M., Strumpen, V.: The cache complexity of multithreaded cache oblivious algorithms. Theory Comput. Syst. 45(2), 203–233 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  9. Gardner, M.: Mathematical games—the fantastic combinations of John Conway’s new solitaire game “Life”. Sci. Am. 223(4), 120–123 (1970)

    Article  Google Scholar 

  10. Grégoire, T., Chlipala, A.: Mostly automated formal verification of loop dependencies with applications to distributed stencil algorithms. In: International Conference on Interactive Theorem Proving, pp. 167–183. Springer (2016)

  11. Immler, F., Hölzl, J.: Numerical analysis of ordinary differential equations in Isabelle/HOL. In: Beringer, L., Felty, A. (eds.) Interactive Theorem Proving, pp. 377–392. Springer, Berlin (2012)

    Chapter  Google Scholar 

  12. Kelly, W., Pugh, W.: Unifying framework for iteration reordering transformations. In: Proceedings of IEEE First International Conference on Algorithms and Architectures for Parallel Processing, vol. 1, pp. 153–162 (1995)

  13. LeVeque, R.J.: Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems, vol. 98. SIAM, Philadelphia (2007)

    Book  MATH  Google Scholar 

  14. Li, G., Gopalakrishnan, G.: Scalable SMT-based verification of GPU kernel functions. In: Proceedings of the Eighteenth ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 187–196. ACM (2010)

  15. Li, G., Li, P., Sawaya, G., Gopalakrishnan, G., Ghosh, I., Rajan, S.P.: GKLEE: concolic verification and test generation for GPUs. In: PPOPP, pp. 215–224 (2012)

  16. Loechner, V.: PolyLib: A library for manipulating parameterized polyhedra. http://camlunity.ru/swap/Library/Conflux/Techniques%20-%20Code%20Analysis%20and%20Transformations%20(Polyhedral)/Free%20Libraries/polylib.ps. Accessed 10 Feb 2018.

  17. Maydan, D., Hennessy, J., Lam, M.: Efficient and exact data dependence analysis. In: Proceedings of the ACM SIGPLAN’91 Conference on Programming Language Design and Implementation (1991)

  18. Orchard, D., Mycroft, A.: Efficient and correct stencil computation via pattern matching and static typing. arXiv preprint: arXiv:1109.0777 (2011)

  19. Pugh, W.: The Omega test: a fast and practical integer programming algorithm for dependence analysis. In: Proceedings of the 1991 ACM/IEEE Conference on Supercomputing, pp. 4–13. ACM (1991)

  20. Solar-Lezama, A., Arnold, G., Tancau, L., Bodik, R., Saraswat, V., Seshia, S.: Sketching stencils. In: Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 167–178. ACM (2007)

  21. Tang, Y., Chowdhury, R.A., Kuszmaul, B.C., Luk, C.K., Leiserson, C.E.: The Pochoir stencil compiler. In: Proceedings of the Twenty-Third Annual ACM Symposium on Parallelism in Algorithms and Architectures, pp. 117–128. ACM (2011)

  22. Valiant, L.G.: A bridging model for parallel computation. Commun. ACM 33(8), 103–111 (1990)

    Article  Google Scholar 

  23. Xu, Z., Kamil, S., Solar-Lezama, A.: MSL: a synthesis enabled language for distributed implementations. In: Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, pp. 311–322. IEEE Press (2014)

Download references

Acknowledgements

This work was supported in part by the U.S. Department of Energy, Office of Science, Advanced Scientific Computing Research Program, under Award Number DE-SC0008923; and by National Science Foundation Grant CCF-1253229. We also thank Shoaib Kamil for feedback on this paper.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Thomas Grégoire.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Grégoire, T., Chlipala, A. Mostly Automated Formal Verification of Loop Dependencies with Applications to Distributed Stencil Algorithms. J Autom Reasoning 62, 193–213 (2019). https://doi.org/10.1007/s10817-018-9451-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10817-018-9451-y

Keywords

Navigation