Solving Ordinary Differential Equations on GPUs

  • Karsten Ahnert
  • Denis Demidov
  • Mario Mulansky


Ordinary Differential Equations (ODEs) are a fundamental mathematical tool to model physical, biological or chemical systems, and they are widely used in engineering, economics and social sciences. Given their vast appearance, it is of crucial importance to develop efficient numerical routines for solving ODEs that employ the computational power of modern GPUs. Here, we present a high-level approach to compute numerical solutions of ODEs by developing a generic implementation of the most common algorithms and combining this with modern C\(++\) libraries like VexCL and Thrust. Our approach is based on generic programming and results in highly scalable and easy-to-use source code.


Initial Value Problem Lorenz System Memory Allocation Lorenz Attractor Template Parameter 
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.



This work has been partially supported by the Russian Foundation for Basic Research (RFBR) grants No. 12-07-0007, 12-01-00333a, and by the Russian Government Program of Competitive Growth of Kazan Federal University. M. M. thankfully acknowledges financial support through the visitors program of the MPIPKS, Dresden (Germany).


  1. 1.
    Ahnert, K.: Odeint v2 - Solving Ordinary Differential Equations in C\(++\). (Oct 2011)
  2. 2.
    Ahnert, K., Mulansky, M.: Odeint — solving ordinary differential equations in C++. AIP Conf. Proc. 1389, 1586–1589 (2011)CrossRefGoogle Scholar
  3. 3.
    Alexandrescu, A.: Modern C++ Design: Generic Programming and Design Patterns Applied. Addison-Wesley Longman Publishing, Boston (2001)Google Scholar
  4. 4.
    Bell, N., Hoberock, J.: Thrust: A Productivity-Oriented Library for CUDA, Chap. 26, pp. 359–371. Elsevier, USA (2011)Google Scholar
  5. 5.
    Cohen, A.H., Holmes, P.J., Rand, R.H.: The nature of the coupling between segmental oscillators of the lamprey spinal generator for locomotion: a mathematical model. J. Math. Biol. 13, 345–369 (1982)CrossRefzbMATHMathSciNetGoogle Scholar
  6. 6.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms. MIT Press, Cambridge (2001)zbMATHGoogle Scholar
  7. 7.
    Demidov, D.: VexCL: Vector Expression Template Library for OpenCL. (July 2012)
  8. 8.
    Demidov, D., Ahnert, K., Rupp, K., Gottschling, P.: Programming CUDA and OpenCL: a case study using modern C++ libraries. SIAM J. Sci. Comput. 35(5), C453–C472 (2013)CrossRefzbMATHMathSciNetGoogle Scholar
  9. 9.
    Frenkel, D., Smit, B.: Understanding Molecular Simulation from Algorithms to Applications. Academic, San Diego (2002)Google Scholar
  10. 10.
    Galassi, M., Davies, J., Theiler, J., Gough, B., Jungman, G., Alken, P., Booth, M., Rossi, F.: GNU Scientific Library. Network Theory, Bristol (2007)Google Scholar
  11. 11.
    Gottschling, P., Wise, D.S., Adams, M.D.: Representation-transparent matrix algorithms with scalable performance. In: Proceedings of the 21st Annual International Conference on Supercomputing, pp. 116–125. ACM, New York (2007)Google Scholar
  12. 12.
    Gregor, D.: The Boost Function Library. (2001)
  13. 13.
    Guennebaud, G., Jacob, B., et al.: Eigen v3. (2010)
  14. 14.
    Hairer, E., Nørsett, S.P., Wanner, G.: Solving Ordinary Differential Equations I: Nonstiff Problems, 2nd edn. Springer, Berlin (1993) (corr. 3rd printing 1993; corr. 3rd edn. 2009)zbMATHGoogle Scholar
  15. 15.
    Hairer, E., Wanner, G.: Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems, 2nd edn. Springer, Berlin (1996) (2nd printing edn. 2010)CrossRefzbMATHGoogle Scholar
  16. 16.
    Hindmarsh, A.C., Brown, P.N., Grant, K.E., Lee, S.L., Serban, R., Shumaker, D.E., Woodward, C.S.: SUNDIALS: suite of nonlinear and differential/algebraic equation solvers. ACM Trans. Math. Softw. (TOMS) 31(3), 363–396 (2005)Google Scholar
  17. 17.
    Intel Math Kernel Library Reference Manual, Intel, Version 11.1 (2013)Google Scholar
  18. 18.
    Izhikevich, E.M., Ermentrout, B.: Phase model. Scholarpedia 3(10), 1487 (2008)CrossRefGoogle Scholar
  19. 19.
    Jones, J.E.: On the determination of molecular fields. II. From the equation of state of a gas. R. Soc. Lond. Proc. Ser. A 106, 463–477 (1924)CrossRefGoogle Scholar
  20. 20.
    Kuramoto, Y.: Chemical Oscillations, Waves, and Turbulence. Springer, New York (1984)CrossRefzbMATHGoogle Scholar
  21. 21.
    Leimkuhler, B., Reich, S.: Simulating Hamiltonian Dynamics, vol. 14. Cambridge University Press, Cambridge (2004)zbMATHGoogle Scholar
  22. 22.
    Moore, R.E., Kearfott, R.B., Cloud, M.J.: Methods and Applications of Interval Analysis, vol. 2. SIAM, Philadelphia (1979)CrossRefzbMATHGoogle Scholar
  23. 23.
    Munshi, A., et al.: The OpenCL Specification. Khronos OpenCL Working Group 1, pp. 11–15 (2009)Google Scholar
  24. 24.
    NVIDIA CUDA Programming Guide. NVIDIA Corporation, Version 5.5 (2013)Google Scholar
  25. 25.
    OpenMP Architecture Review Board: OpenMP Application Program Interface Version 3.0. (May 2008)
  26. 26.
    Ott, E.: Chaos in Dynamical Systems. Cambridge University Press, Cambridge (2002)CrossRefzbMATHGoogle Scholar
  27. 27.
    Pikovsky, A., Rosenblum, M., Kurths, J.: Synchronization: A Universal Concept in Nonlinear Sciences. Cambridge University Press, Cambridge (2001)CrossRefGoogle Scholar
  28. 28.
    Poschel, T., Schwager, T.: Computational Granular Dynamics: Models and Algorithms. Springer, Berlin/Heidelberg [u.a.] (2010)Google Scholar
  29. 29.
    Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P.: Numerical Recipes: The Art of Scientific Computing, 3rd edn. Cambridge University Press, Cambridge (2007)Google Scholar
  30. 30.
    R Core Team: R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna (2013)Google Scholar
  31. 31.
    Reinders, J.: Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism. O’Reilly Media, Inc., Sebastopol (2010)Google Scholar
  32. 32.
    Rupp, K., Rudolf, F., Weinbub, J.: ViennaCL - A High Level Linear Algebra Library for GPUs and Multi-Core CPUs. In: International Workshop on GPUs and Scientific Applications, pp. 51–56 (2010)Google Scholar
  33. 33.
    Schabel, M.C., Watanabe, S.: The Boost Units Library. (2010)
  34. 34.
    Soetaert, K., Cash, J.R., Mazzia, F.: Solving Differential Equations in R. Springer, Berlin/New York (2012)CrossRefzbMATHGoogle Scholar
  35. 35.
    Sparrow, C.: The Lorenz Equations: Bifurcations, Chaos, and Strange Attractors, vol. 41. Springer, New York (1982)zbMATHGoogle Scholar
  36. 36.
    Stepanov, A., Lee, M: The Standard Template Library, vol. 1501. Hewlett Packard Laboratories, Palo Alto (1995)Google Scholar
  37. 37.
    Teschl, G.: Ordinary Differential Equations and Dynamical Systems, vol. 140. AMS Bookstore, Providence (2012)zbMATHGoogle Scholar
  38. 38.
    Verlet, L.: Computer “experiments” on classical fluids. I. Thermodynamical properties of Lennard-Jones molecules. Phys. Rev. 159(1), 98–103 (1967)Google Scholar
  39. 39.
    Walter, J., Koch, M.: The Boost uBLAS Library. (2002)

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Karsten Ahnert
    • 1
  • Denis Demidov
    • 2
  • Mario Mulansky
    • 3
    • 4
  1. 1.Ambrosys GmbHPotsdamGermany
  2. 2.Kazan Branch of Joint Supercomputer CenterRussian Academy of SciencesKazanRussia
  3. 3.Max-Planck Institute for the Physics of Complex SystemsDresdenGermany
  4. 4.TU-Dresden, Institute for Theoretical PhysicsDresdenGermany

Personalised recommendations