Advertisement

Parallelizing PDE Solvers Using the Python Programming Language

  • Xing Cai
  • Hans Petter Langtangen
Part of the Lecture Notes in Computational Science and Engineering book series (LNCSE, volume 51)

Summary

This chapter aims to answer the following question: Can the high-level programming language Python be used to develop sufficiently efficient parallel solvers for partial differential equations (PDEs)? We divide our investigation into two aspects, namely (1) the achievable performance of a parallel program that extensively uses Python programming and its associated data structures, and (2) the Python implementation of generic software modules for parallelizing existing serial PDE solvers. First of all, numerical computations need to be based on the special array data structure of the Numerical Python package, either in pure Python or in mixed-language Python-C/C++ or Python/Fortran setting. To enable high-performance message passing in parallel Python software, we use the small add-on package pypar, which provides efficient Python wrappers to a subset of MPI routines. Using concrete numerical examples of solving wave-type equations, we will show that a mixed Python-C/Fortran implementation is able to provide fully comparable computational speed in comparison with a pure C or Fortran implementation. In particular, a serial legacy Fortran 77 code has been parallelized in a relatively straightforward manner and the resulting parallel Python program has a clean and simple structure.

Keywords

Internal Boundary Numerical Operation Python Program Parallelization Approach Fortran Subroutine 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    D. Ascher, P. F. Dubois, K. Hinsen, J. Hugunin, and T. Oliphant. Numerical Python. Technical report, Lawrence Livermore National Lab., CA, 2001. http://www.pfdubois.com/numpy/numpy.pdf.Google Scholar
  2. 2.
    D. L. Brown, W. D. Henshaw, and D. J. Quinlan. Overture: An object-oriented framework for solving partial differential equations. In Y. Ishikawa, R. R. Oldehoeft, J. V. W. Reynders, and M. Tholburn, editors, Scientific Computing in Object-Oriented Parallel Environments, Lecture Notes in Computer Science, vol 1343, pages 177–184. Springer, 1997.Google Scholar
  3. 3.
    A. M. Bruaset, X. Cai, H. P. Langtangen, and A. Tveito. Numerical solution of PDEs on parallel computers utilizing sequential simulators. In Y. Ishikawa, R. R. Oldehoeft, J. V. W. Reynders, and M. Tholburn, editors, Scientific Computing in Object-Oriented Parallel Environments, Lecture Notes in Computer Science, vol 1343, pages 161–168. Springer, 1997.Google Scholar
  4. 4.
    X. Cai and H. P. Langtangen. Developing parallel object-oriented simulation codes in Diffpack. In H. A. Mang, F. G. Rammerstorfer, and J. Eberhardsteiner, editors, Proceedings of the Fifth World Congress on Computational Mechanics, 2002.Google Scholar
  5. 5.
    X. Cai, H. P. Langtangen, and H. Moe. On the performance of the Python programming language for serial and parallel scientific computations. Scientific Programming, 13(1):31–56, 2005.Google Scholar
  6. 6.
    X. Cai, G. K. Pedersen, and H. P. Langtangen. A parallel multi-subdomain strategy for solving Boussinesq water wave equations. Advances in Water Resources, 28(3):215–233, 2005.CrossRefGoogle Scholar
  7. 7.
    T. F. Chan and T. P. Mathew. Domain decomposition algorithms. In Acta Numerica 1994, pages 61–143. Cambridge University Press, 1994.Google Scholar
  8. 8.
    D. B. et al. Swig 1.3 Development Documentation, 2004. http://www.swig.org/doc.html.Google Scholar
  9. 9.
    F2PY software package. http://cens.ioc.ee/projects/f2py2e.Google Scholar
  10. 10.
    L. Formaggia, M. Sala, and F. Saleri. Domain decomposition techniques. In A. M. Bruaset and A. Tveito, editors, Numerical Solution of Partial Differential Equations on Parallel Computers, volume 51 of Lecture Notes in Computational Science and Engineering, pages 135–163. Springer-Verlag, 2005.Google Scholar
  11. 11.
    M. P. I. Forum. MPI: A message-passing interface standard. Internat. J. Supercomputer Appl., 8:159–416, 1994.Google Scholar
  12. 12.
    S. Glimsdal, G. K. Pedersen, and H. P. Langtangen. An investigation of domain decomposition methods for one-dimensional dispersive long wave equations. Advances in Water Resources, 27(11):1111–1133, 2005.CrossRefGoogle Scholar
  13. 13.
    C. Hughes and T. Hughes. Parallel and Distributed Programming Using C++. Addison Wesley, 2003.Google Scholar
  14. 14.
    H. P. Langtangen. Python Scripting for Computational Science. Texts in Computational Science and Engineering, vol 3. Springer, 2004.Google Scholar
  15. 15.
    H. P. Langtangen and X. Cai. A software framework for easy parallelization of PDE solvers. In C. B. Jensen, T. Kvamsdal, H. I. Andersson, B. Pettersen, A. Ecer, J. Periaux, N. Satofuka, and P. Fox, editors, Parallel Computational Fluid Dynamics. Elsevier Science, 2001.Google Scholar
  16. 16.
    Matlab code vectorization guide. http://www.mathworks.com/support/tech-notes/1100/1109.html.Google Scholar
  17. 17.
    Numerical Python software package. http://sourceforge.net/projects/numpy.Google Scholar
  18. 18.
    P. S. Pacheco. Parallel Programming with MPI. Morgan Kaufmann Publishers, 1997.Google Scholar
  19. 19.
    Parallel software in C and C++. http://www.mathtools.net/C_C_/Parallel/.Google Scholar
  20. 20.
    R. Parsones and D. Quinlan. A++/P++ array classes for architecture independent finite difference computations. Technical report, Los Alamos National Lab., NM, 1994.Google Scholar
  21. 21.
    PyMPI software package. http://sourceforge.net/projects/pympi, 2004.Google Scholar
  22. 22.
    PyPar software package. http://datamining.anu.edu.au/~ole/pypar, 2004.Google Scholar
  23. 23.
    ScientificPython software package. http://starship.python.net/crew/hinsen.Google Scholar
  24. 24.
    B. F. Smith, P. E. Bjørstad, and W. Gropp. Domain Decomposition: Parallel Multilevel Methods for Elliptic Partial Differential Equations. Cambridge University Press, 1996.Google Scholar
  25. 25.
    D. M. Wu and T. Y. Wu. Three-dimensional nonlinear long waves due to moving surface pressure. Proc. 14th Symp. Naval Hydrodyn., pages 103–129, 1982.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Xing Cai
    • 1
    • 2
  • Hans Petter Langtangen
    • 1
    • 2
  1. 1.Simula Research LaboratoryLysakerNorway
  2. 2.Department of InformaticsUniversity of OsloOsloNorway

Personalised recommendations