Abstract
Processes in computer simulations tend to be highly repetitive. In particular, parameter studies further exasperate the situation as the same model is repeatedly executed with only partially varying parameters. Consequently, computer simulations perform identical computations, with identical code, identical input, and hence identical output. These redundant computations waste significant amounts of time and energy.
Memoization, dating back to 1968, enables the caching of such identical intermediate results, thereby significantly speeding up those computations. However, until now, automated approaches were limited to pure functions. At ACM SIGSIM-PADS 2016 we published, to the best of our knowledge, the first practical approach for automated memoization for impure code. In this work, we extend this approach and evaluate the performance characteristics of a number of extensions that deal with questions posed at PADS: (1) To reduce and bound the memory footprint, we investigate several cache eviction strategies. (2) We allow the original and the memoized code to coexist via a runtime-switch and analyze the crossover point, thereby mitigating memoization overhead. (3) By optionally persisting the Memoization Cache to disk, we expand the scope to exploratory parameter studies where cached results can now be reused across multiple simulation runs.
Altogether, automated memoization for impure code is a valuable technique, the versatility of which we explore further in this article. It sped up a case study of an OFDM network simulation by a factor of more than 80 with an only marginal increase of memory consumption.
Supplemental Material
Available for Download
Supplemental movie, appendix, image and software files for, On Automated Memoization in the Field of Simulation Parameter Studies
- Umut A. Acar. 2009. Self-adjusting computation: (An overview). In Proceedings of the 2009 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation. 1--6. Google ScholarDigital Library
- Umut A. Acar, Amal Ahmed, and Matthias Blume. 2008. Imperative self-adjusting computation. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 309--322. Google ScholarDigital Library
- Roger Arditi and Lev R. Ginzburg. 1989. Coupling in predator-prey dynamics: Ratio-dependence. J. Theoret. Biol. 139, 3 (1989), 311--326.Google ScholarCross Ref
- Davide Cingolani, Alessandro Pellegrini, and Francesco Quaglia. 2015. Transparently mixing undo logs and software reversibility for state recovery in optimistic PDES. In Proceedings of the 3rd ACM SIGSIM Conference on Principles of Advanced Discrete Simulation. 211--222. Google ScholarDigital Library
- Steve Ferenci, Richard Fujimoto, Mostafa Ammar, Kalyan Perumalla, and George Riley. 2002. Updateable simulation of communication networks. In Proceedings of the 16th Workshop on Parallel and Distributed Simulation. 107--114. Google ScholarDigital Library
- Harald Friis. 1946. A note on a simple transmission formula. Proc. Inst. Radio Eng. 34, 5 (1946), 254--256.Google ScholarCross Ref
- Marty Hall and James Mayfield. 1993. Improving the performance of AI software: Payoffs and pitfalls in using automatic memoization. In Proceedings of the 6th International Symposium on Artificial Intelligence.Google Scholar
- Thomas Henderson, Sumit Roy, Sally Floyd, and George Riley. 2006. ns-3 project goals. In Proceedings of the 1st Workshop on ns-2: The IP Network Simulator. Google ScholarDigital Library
- Ralf Hinze. 2000. Memo functions, polytypically! In Proceedings of the 2nd Workshop on Generic Programming. 17--32.Google Scholar
- Maria Hybinette and Richard Fujimoto. 1997. Cloning: A novel method for interactive parallel simulation. In Proceedings of the 29th Winter Simulation Conference. 444--451. Google ScholarDigital Library
- Maria Hybinette and Richard Fujimoto. 2001. Cloning parallel simulations. ACM Trans. Model. Comput. Simul. 11, 4 (2001), 378--407. Google ScholarDigital Library
- ISO. 2014. ISO/IEC 14882:2014 Information Technology — Programming Languages — C++. International Organization for Standardization, Geneva, Switzerland. 1358 pages.Google Scholar
- Kazutaka Kamimura, Ryosuke Oda, Tatsuhiro Yamada, Tomoaki Tsumura, Hiroshi Matsuo, and Yasuhiko Nakashima. 2012. A speed-up technique for an auto-memoization processor by reusing partial results of instruction regions. In Proceedings of the 3rd International Conference on Networking and Computing. 49--57. Google ScholarDigital Library
- William Landi. 1992. Undecidability of static analysis. ACM Lett. Prog. Lang. Syst. 1, 4 (1992), 323--337. Google ScholarDigital Library
- Pierre L’Ecuyer. 1999. Good parameters and implementations for combined multiple recursive random number generators. Operat. Res. 47, 1 (1999), 159--164. Google ScholarDigital Library
- Makoto Matsumoto and Takuji Nishimura. 1998. Mersenne Twister: A 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Trans. Model. Comput. Simul. 8, 1 (1998), 3--30. Google ScholarDigital Library
- James Mayfield, Tim Finin, and Marty Hall. 1995. Using automatic memoization as a software engineering tool in real-world AI systems. In Proceedings of the 11th Conference on Artificial Intelligence for Applications. 87--93. Google ScholarDigital Library
- Paul McNamee and Marty Hall. 1998. Developing a tool for memoizing functions in C++. ACM SIGPLAN Not. 33, 8 (1998), 17--22. Google ScholarDigital Library
- Donald Michie. 1967. Memo Functions: A Language Feature with “Rote-Learning” Properties. Technical Report. Edinburgh University, Dept. of Machine Intelligence and Perception.Google Scholar
- Donald Michie. 1968. Memo functions and machine learning. Nature 218, 5136 (1968), 19--22.Google Scholar
- Jack Mostow and Donald Cohen. 1985. Automating program speedup by deciding what to cache. In Proceedings of the 9th International Joint Conference on Artificial Intelligence. 165--172. Google ScholarDigital Library
- Peter Norvig. 1991. Techniques for automatic memoization with applications to context-free parsing. Computational Linguistics 17, 1 (1991), 91--98. Google ScholarDigital Library
- Robin Popplestone. 1967. Memo Functions and the POP-2 Language. Technical Report. Edinburgh University, Dept. of Machine Intelligence and Perception.Google Scholar
- Robert Rönngren, Michael Liljenstam, and Johan Montagnat. 1996. Transparent incremental state saving in time warp PDES. In Proceedings of the 10th Workshop on Parallel and Distributed Simulation. 70--77. Google ScholarDigital Library
- Markus Schordan, Thomas Oppelstrup, David Jefferson, and Peter Barnes. 2016. Automatic generation of reversible C++ code and its performance in a scalable kinetic Monte-Carlo application. In Proceedings of the 4th ACM SIGSIM Conference on Principles of Advanced Discrete Simulation. 111--122. Google ScholarDigital Library
- Christoph Sommer. 2017. Veins. (23 June 2017). veins.car2x.org, retrieved Aug 17, 2017.Google Scholar
- Christoph Sommer, Reinhard German, and Falko Dressler. 2011. Bidirectionally coupled network and road traffic simulation for improved IVC analysis. IEEE Trans. Mobile Comput. 10, 1 (2011), 3--15. Google ScholarDigital Library
- Mirko Stoffers, Ralf Bettermann, and Klaus Wehrle. 2017. Automated memoization: Automatically identifying memoization units in simulation parameter studies. In Proceedings of the 21st IEEE/ACM International Symposium on Distributed Simulation and Real Time Applications. Google ScholarDigital Library
- Mirko Stoffers, Daniel Schemmel, Oscar Soria Dustmann, and Klaus Wehrle. 2016. Automated memoization for parameter studies implemented in impure languages. In Proceedings of the 4th ACM SIGSIM Conference on Principles of Advanced Discrete Simulation. 221--232. Google ScholarDigital Library
- Tomoaki Tsumura, Ikuma Suzuki, Yasuki Ikeuchi, Hiroshi Matsuo, Hiroshi Nakashima, and Yasuhiko Nakashima. 2007. Design and evaluation of an auto-memoization processor. In Proceedings of the 25th International Multi-Conference on Parallel and Distributed Computing and Networks. 230--235. Google ScholarDigital Library
- Andràs Varga. 2001. The OMNeT++ discrete event simulation system. In Proceedings of the 15th European Simulation MC.Google Scholar
- Roberto Vitali, Alessandro Pellegrini, and Francesco Quaglia. 2010. Autonomic Log/restore for advanced optimistic simulation systems. In Proceedings of the 18th Symposium on Modeling, Analysis and Simulation of Comp. and Telecommunication Systems. 319--327. Google ScholarDigital Library
- Cheng-Xiang Wang, Matthias Pätzold, and Qi Yao. 2007. Stochastic modeling and simulation of frequency-correlated wideband fading channels. IEEE Trans. Vehic. Tech. 56, 3 (2007), 1050--1063.Google ScholarCross Ref
- Darrin West and Kiran Panesar. 1996. Automatic incremental state saving. In Proceedings of the 10th Workshop on Parallel and Distributed Simulation. 78--85. Google ScholarDigital Library
- Neng-Fa Zhou and Taisuke Sato. 2003. Efficient fixpoint computation in linear tabling. In Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming. 275--283. Google ScholarDigital Library
Index Terms
- On Automated Memoization in the Field of Simulation Parameter Studies
Recommendations
Automated Memoization for Parameter Studies Implemented in Impure Languages
SIGSIM-PADS '16: Proceedings of the 2016 ACM SIGSIM Conference on Principles of Advanced Discrete SimulationIn computer simulations many processes are highly repetitive. These repetitions are amplified further when a parameter study is conducted where the same model is repeatedly executed with varying parameters, especially when performing multiple runs to ...
Automated memoization: automatically identifying memoization units in simulation parameter studies
DS-RT '17: Proceedings of the 21st International Symposium on Distributed Simulation and Real Time ApplicationsSimulations, and in particular large scale parameter studies, typically exhibit a considerable amount of redundancies. These redundancies can be avoided by memoization, a technique that stores and re-uses intermediate results. This requires a ...
Using automatic memoization as a software engineering tool in real-world AI systems
CAIA '95: Proceedings of the 11th Conference on Artificial Intelligence for ApplicationsMemo functions and memoization are well-known concepts in AI programming. They have been discussed since the sixties and are often used as examples in introductory programming texts. However, the automation of memoization as a practical software ...
Comments