Abstract

The speed of mathematical function evaluations can significantly contribute to the overall performance of numerical simulations. Two common approaches to evaluate a mathematical function are by direct evaluation or by means of lookup tables of precomputed values. Direct evaluation is the standard approach, and lookup tables are common in graphics applications and field-programmable gate array computing. We address the usage of direct function evaluation versus lookup tables for evaluating general univariate functions on general-purpose CPUs for large-scale numerical simulation. We introduce a small C++ library called FunC (for Function Comparator) that can be run on a given system to quickly and conveniently evaluate the performance of direct evaluation relative to various lookup table implementations for arbitrary user-specified functions. A user can then make an informed decision as to which method can be expected to be most efficient for their application. Using functions relevant to the Chaste software library for the simulation of cardiac models, FunC successfully predicts that lookup table implementations outperform direct evaluation. After implementing higher-order lookup tables in Chaste to test these predictions, we demonstrate the effects of table size on two simulations, one small and one large. For the small simulation, we see an increase in the simulation speed of up to 25% for tables using cubic interpolation over those using linear interpolation and up to 144% for cubic tables over direct evaluation. For the more realistic large simulation, we see an increase in the simulation speed by up to 86% for lookup tables over direct evaluation.

Keywords

  1. lookup table
  2. direct function evaluation
  3. heart simulation
  4. cardiac potentials

MSC codes

  1. 65A05
  2. 65Y20
  3. 68U20

Get full access to this article

View all available purchase options and get full access to this article.

Supplementary Material


PLEASE NOTE: These supplementary files have not been peer-reviewed.


Index of Supplementary Materials

Title of paper: Direct Function Evaluation vs. Lookup Tables: When to Use Which?

Authors: Kevin R. Green, Tanner A. Bohn, and Raymond J. Spiteri

File: Appendix.pdf

Type: PDF

Contents: Appendices containing: 1. code listings, sample program usage, and sample program output. 2. Candidate functions identified for LUT evaluation in the cardiac cell models discussed in the main paper.

References

1.
G. E. Alefeld, F. A. Potra, and Y. Shi, Algorithm 748: Enclosing zeros of continuous functions, ACM Trans. Math. Softw., 21 (1995), pp. 327--344, https://doi.org/10.1145/210089.210111.
2.
S. Balay, S. Abhyankar, M. F. Adams, J. Brown, P. Brune, K. Buschelman, L. Dalcin, V. Eijkhout, W. D. Gropp, D. Kaushik, M. G. Knepley, D. A. May, L. C. McInnes, K. Rupp, B. F. Smith, S. Zampini, H. Zhang, and H. Zhang, PETSc Web page, http://www.mcs.anl.gov/petsc, 2017.
3.
W. Boehm and A. Müller, On de Casteljau's algorithm, Comput. Aided Geom. Design, 16 (1999), pp. 587--605, https://doi.org/10.1016/S0167-8396(99)00023-0.
4.
Boost, Boost C++ Libraries, http://www.boost.org/, 2017 (last accessed 2018-02-26).
5.
R. P. Brent, Algorithms for Minimization without Derivatives, Prentice-Hall, Englewood Cliffs, NJ, 1973.
6.
S. A. Buehler, P. Eriksson, and O. Lemke, Absorption lookup tables in the radiative transfer model ARTS, J. Quant. Spectrosc. Radiat. Transf., 112 (2011), pp. 1559--1567, https://doi.org/10.1016/j.jqsrt.2011.03.008.
7.
J. Cooper, S. Mckeever, and A. Garny, On the application of partial evaluation to the optimisation of cardiac electrophysiological simulations, in Proceedings of the 2006 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, PEPM '06, ACM, New York, 2006, pp. 12--20.
8.
J. Cooper, R. J. Spiteri, and G. R. Mirams, Cellular cardiac electrophysiology modeling with Chaste and CellML, Front. Physiol., 5 (2015), 511, https://doi.org/10.3389/fphys.2014.00511.
9.
A. A. Cuellar, C. M. Lloyd, P. F. Nielsen, D. P. Bullivant, D. P. Nickerson, and P. J. Hunter, An overview of CellML 1.1, a biological model description language, SIMULATION, 79 (2003), pp. 740--747, https://doi.org/10.1177/0037549703040939.
10.
M. A. Dias, D. O. Sales, and F. S. Osorio, Automatic generation of LUTs for hardware neural networks, Neurocomputing, 180 (2016), pp. 108--120, https://doi.org/10.1016/j.neucom.2015.07.111.
11.
M. Frigo and S. G. Johnson, The design and implementation of FFTW3, Proc. IEEE, 93 (2005), pp. 216--231.
12.
K. R. Green, T. Bohn, and R. J. Spiteri, FunC source code, https://github.com/uofs-simlab/func, 2018.
13.
N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., SIAM, Philadelphia, 2002, https://doi.org/10.1137/1.9780898718027.
14.
S. F. Hsiao, C. S. Wen, and P. H. Wu, Compression of lookup table for piecewise polynomial function evaluation, in 2014 17th Euromicro Conference on Digital System Design, IEEE, 2014, pp. 279--284, https://doi.org/10.1109/DSD.2014.53.
15.
G. G. Lorentz, Bernstein Polynomials, Mathematical Expositions, no. 8, University of Toronto Press, Toronto, 1953.
16.
C. Luo and Y. Rudy, A model of ventricular cardiac action potential, Circ. Res., 68 (1991), pp. 1501--1526.
17.
M. E. Marsh, S. T. Ziaratgahi, and R. J. Spiteri, The secrets to the success of the Rush--Larsen method and its generalizations, IEEE Trans. Biomed. Eng., 59 (2012), pp. 2506--2515.
18.
E. J. Mlawer, S. J. Taubman, P. D. Brown, M. J. Iacono, and S. A. Clough, Radiative transfer for inhomogeneous atmospheres: RRTM, a validated correlated-k model for the longwave, J. Geophys. Res-Atmos., 102 (1997), pp. 16663--16682, https://doi.org/10.1029/97JD00237.
19.
S. A. Niederer, E. Kerfoot, A. P. Benson, M. O. Bernabeu, O. Bernus, C. Bradley, E. M. Cherry, R. Clayton, F. H. Fenton, A. Garny, E. Heidenreich, S. Land, M. Maleckar, P. Pathmanathan, G. Plank, J. F. Rodríguez, I. Roy, F. B. Sachse, G. Seemann, O. Skavhaug, and N. P. Smith, Verification of cardiac tissue electrophysiology simulators using an N-version benchmark, Philos. Trans. R. Soc. Lond. Ser. A Math. Phys. Eng. Sci., 369 (2011), pp. 4331--4351, https://doi.org/10.1098/rsta.2011.0139.
20.
M. Pharr and R. Fernando, GPU Gems 2: Programming Techniques for High-Performance Graphics and General-Purpose Computation, Addison-Wesley, Reading, MA, 2005.
21.
PyCml, CellML Tools in Python, https://chaste.cs.ox.ac.uk/cellml/, 2011.
22.
T. Sasao, S. Nagayama, and J. T. Butler, Numerical function generators using LUT cascades, IEEE Trans. Comput., 56 (2007), pp. 826--838, https://doi.org/10.1109/TC.2007.1033.
23.
R. J. Spiteri and S. Torabi Ziaratgahi, Operator splitting for the bidomain model revisited, J. Comput. Appl. Math., 296 (2016), pp. 550--563.
24.
J. Sundnes, G. T. Lines, and X. Cai, Computing the Electrical Activity in the Heart, Springer-Verlag, Berlin, 2006.
25.
K. H. W. J. ten Tusscher and A. V. Panfilov, Alternans and spiral breakup in a human ventricular tissue model, Am. J. Physiol. Heart Circ. Physiol., 291 (2006), pp. H1088--H1100, https://doi.org/10.1152/ajpheart.00109.2006.
26.
L. Tornqvist, P. Vartia, and Y. O. Vartia, How should relative changes be measured?, Amer. Statist., 39 (1985), pp. 43--46, https://www.jstor.org/stable/2683905.
27.
L. Tung, A Bi-domain Model for Describing Ischemic Myocardial D-C Potentials, Ph.D. thesis, Massachusetts Institute of Technology, Cambridge, MA, 1978.
28.
University of Oxford, Department of Computer Science, Chaste --- Cancer, Heart and Soft Tissue Environment, 2014, http://www.cs.ox.ac.uk/chaste/.
29.
C. Wilcox, M. M. Strout, and J. M. Bieman, Mesa: Automatic generation of lookup table optimizations, in Proceedings of the 4th International Workshop on Multicore Software Engineering, IWMSE '11, 2011, ACM, New York, pp. 1--8, https://doi.org/10.1145/1984693.1984694.
30.
C. Wilcox, M. M. Strout, and J. M. Bieman, Tool support for software lookup table optimization, Scientific Programming, 19 (2011), pp. 213--229.
31.
A. Yamamoto, Y. Kitamura, and Y. Yamane, Computational efficiencies of approximated exponential functions for transport calculations of the characteristics method, Ann. Nucl. Energy, 31 (2004), pp. 1027--1037, https://doi.org/10.1016/j.anucene.2004.01.003.
32.
Y. Zhang, L. Deng, P. Yedlapalli, S. P. Muralidhara, H. Zhao, M. Kandemir, C. Chakrabarti, N. Pitsianis, and X. Sun, A special-purpose compiler for look-up table and code generation for function evaluation, in Proceedings of the Conference on Design, Automation and Test in Europe, European Design and Automation Association, Leuven, Belgium, 2010, pp. 1130--1135, http://dl.acm.org/citation.cfm?id=1870926.1871200.

Information & Authors

Information

Published In

cover image SIAM Journal on Scientific Computing
SIAM Journal on Scientific Computing
Pages: C194 - C218
ISSN (online): 1095-7197

History

Submitted: 19 July 2018
Accepted: 21 March 2019
Published online: 4 June 2019

Keywords

  1. lookup table
  2. direct function evaluation
  3. heart simulation
  4. cardiac potentials

MSC codes

  1. 65A05
  2. 65Y20
  3. 68U20

Authors

Affiliations

Metrics & Citations

Metrics

Citations

If you have the appropriate software installed, you can download article citation data to the citation manager of your choice. Simply select your manager software from the list below and click Download.

View Options

View options

PDF

View PDF

Media

Figures

Other

Tables

Share

Share

Copy the content Link

Share with email

Email a colleague

Share on social media

The SIAM Publications Library now uses SIAM Single Sign-On for individuals. If you do not have existing SIAM credentials, create your SIAM account https://my.siam.org.