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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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.
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.
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.
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.
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.
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.
T. F. Chan and T. P. Mathew. Domain decomposition algorithms. In Acta Numerica 1994, pages 61–143. Cambridge University Press, 1994.
D. B. et al. Swig 1.3 Development Documentation, 2004. http://www.swig.org/doc.html.
F2PY software package. http://cens.ioc.ee/projects/f2py2e.
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.
M. P. I. Forum. MPI: A message-passing interface standard. Internat. J. Supercomputer Appl., 8:159–416, 1994.
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.
C. Hughes and T. Hughes. Parallel and Distributed Programming Using C++. Addison Wesley, 2003.
H. P. Langtangen. Python Scripting for Computational Science. Texts in Computational Science and Engineering, vol 3. Springer, 2004.
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.
Matlab code vectorization guide. http://www.mathworks.com/support/tech-notes/1100/1109.html.
Numerical Python software package. http://sourceforge.net/projects/numpy.
P. S. Pacheco. Parallel Programming with MPI. Morgan Kaufmann Publishers, 1997.
Parallel software in C and C++. http://www.mathtools.net/C_C_/Parallel/.
R. Parsones and D. Quinlan. A++/P++ array classes for architecture independent finite difference computations. Technical report, Los Alamos National Lab., NM, 1994.
PyMPI software package. http://sourceforge.net/projects/pympi, 2004.
PyPar software package. http://datamining.anu.edu.au/~ole/pypar, 2004.
ScientificPython software package. http://starship.python.net/crew/hinsen.
B. F. Smith, P. E. Bjørstad, and W. Gropp. Domain Decomposition: Parallel Multilevel Methods for Elliptic Partial Differential Equations. Cambridge University Press, 1996.
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.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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
DOI: https://doi.org/10.1007/3-540-31619-1_9
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-29076-6
Online ISBN: 978-3-540-31619-0
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)