Skip to main content

Part of the book series: Lecture Notes in Computational Science and Engineering ((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.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 129.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 169.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  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. 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. 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. 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. 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. 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.

    Article  Google Scholar 

  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. D. B. et al. Swig 1.3 Development Documentation, 2004. http://www.swig.org/doc.html.

    Google Scholar 

  9. F2PY software package. http://cens.ioc.ee/projects/f2py2e.

    Google Scholar 

  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. M. P. I. Forum. MPI: A message-passing interface standard. Internat. J. Supercomputer Appl., 8:159–416, 1994.

    Google Scholar 

  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.

    Article  Google Scholar 

  13. C. Hughes and T. Hughes. Parallel and Distributed Programming Using C++. Addison Wesley, 2003.

    Google Scholar 

  14. H. P. Langtangen. Python Scripting for Computational Science. Texts in Computational Science and Engineering, vol 3. Springer, 2004.

    Google Scholar 

  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. Matlab code vectorization guide. http://www.mathworks.com/support/tech-notes/1100/1109.html.

    Google Scholar 

  17. Numerical Python software package. http://sourceforge.net/projects/numpy.

    Google Scholar 

  18. P. S. Pacheco. Parallel Programming with MPI. Morgan Kaufmann Publishers, 1997.

    Google Scholar 

  19. Parallel software in C and C++. http://www.mathtools.net/C_C_/Parallel/.

    Google Scholar 

  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. PyMPI software package. http://sourceforge.net/projects/pympi, 2004.

    Google Scholar 

  22. PyPar software package. http://datamining.anu.edu.au/~ole/pypar, 2004.

    Google Scholar 

  23. ScientificPython software package. http://starship.python.net/crew/hinsen.

    Google Scholar 

  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. 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 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Cai, X., Langtangen, H.P. (2006). Parallelizing PDE Solvers Using the Python Programming Language. In: Bruaset, A.M., Tveito, A. (eds) Numerical Solution of Partial Differential Equations on Parallel Computers. Lecture Notes in Computational Science and Engineering, vol 51. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-31619-1_9

Download citation

Publish with us

Policies and ethics