Parallelizing a Real-Time Physics Engine Using Transactional Memory
The simulation of the dynamics and kinematics of solid bodies is an important problem in a wide variety of fields in computing ranging from animation and interactive environments to scientific simulations. While rigid body simulation has a significant amount of potential parallelism, efficiently synchronizing irregular accesses to the large amount of mutable shared data in such programs remains a hurdle. There has been a significant amount of interest in transactional memory systems for their potential to alleviate some of the problems associated with fine-grained locking and more broadly for writing correct and efficient parallel programs. While results so far are promising, the effectiveness of TM systems has so far been predominantly evaluated on small benchmarks and kernels.
In this paper we present our experiences in parallelizing ODE, a real-time physics engine that is widely used in commercial and open source games. Rigid body simulation in ODE consists of two main phases that are amenable to effective coarse-grained parallelization and which are also suitable for using transactions to orchestrate shared data synchronization. We found ODE to be a good candidate for applying parallelism and transactions to - it is a large real world application, there is a large amount of potential parallelism, it exhibits irregular access patterns and the amount of contention may vary at runtime. We present an experimental evaluation of our implementation of the parallel transactional ODE engine that shows speedups of up to 1.27x relative to the sequential version.
KeywordsCollision Detection Transactional Memory Main Thread Work Thread Thread Pool
Unable to display preview. Download preview PDF.
- 1.Dice, D., Shalev, O., Shavit, N.: Transactional Locking II. In: Proceedings of the 20th International Symposium on Distributed Computing (DISC), Stockholm, Sweeden (September 2006)Google Scholar
- 2.Open Dynamics Engine, http://ode.org
- 3.Minh, C.C., Chung, J., Kozyrakis, C., Olukotun, K.: STAMP: Stanford Transactional Applications for Multi-Processing. In: IISWC 2008, pp. 35–46 (2008)Google Scholar
- 4.Guerraoui, R., Kapalka, M., Vitek, J.: STMBench7: A benchmark for software transactional memory. In: Proceedings of the 2nd European Systems Conference (March 2007)Google Scholar
- 5.Carey, M.J., DeWitt, D.J., Kant, C., Naughton, J.F.: A status report on the OO7 OODBMS benchmarking effort. In: OOPSLA 1994: Proc. 9th Annual Conference on Object-oriented Programming Systems, Language, and Applications, pp. 414–426 (October 1994)Google Scholar
- 6.Woo, S.C., Ohara, M., Torrie, E., Singh, J.P., Gupta, A.: The SPLASH-2 Programs: Characterization and Methodological Considerations. In: Proceedings of the 22nd Annual International Symposium on Computer ArchitectureGoogle Scholar
- 7.Ansari, M., Kotselidis, C., Jarvis, K., Lujan, M., Kirkham, C., Watson, I.: Lee-TM: A Non-trivial Benchmark for Transactional Memory. In: Proc. 7th International Conference on Algorithms and Architectures for Parallel Processing (2008)Google Scholar
- 8.Kestor, G., Stipic, S., Unsal, O.S., Cristal, A., Valero, M.: RMS-TM: A Transactional Memory Benchmark for Recognition, Mining and Synthesis Applications. In: 4th Workshop on Transactional Computing (TRANSACT) (2009)Google Scholar
- 9.Harmanci, D., Felber, P., Sukraut, M., Fetzer, C.: TMunit: A transactional memory unit testing and workload generation tool Technical Report RR-I-08-08.1, Universite de Neuchatel, Institute Informatique (August 2008)Google Scholar
- 10.Adl-Tabatabai, A.-R., Lewis, B.T., Menon, V., Murphy, B.R., Saha, B., Shpeisman, T.: Compiler and runtime support for efficient software transactional memory. In: Proc. 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 26–37 (June 2006)Google Scholar
- 11.Reinders, J.: Intel Threading Building Blocks. O’Reilly Media (2007)Google Scholar
- 12.Sweeney, T.: The Next Mainstream Programming Language: A Game Developers Perspective. Invited Talk at the International Symposium on Principles of Programming Languages (2006)Google Scholar
- 13.Brown, S., Attaway, S., Plimpton, S., Hendrickson, B.: Parallel strategies for crash and impact simulations. In: Computer Methods in Applied Mechanics and Engineering, vol. 184, pp. 375–390 (2000)Google Scholar
- 14.Grinberg, I., Wiseman, Y.: Scalable parallel collision detection simulation. In: Proceedings of the Ninth IASTED International Conference on Signal and Image Processing (2007)Google Scholar
- 15.Lawlor, O.S., Chakravorty, S., Wilmarth, T.L., Choudhury, N., Dooley, I., Zheng, G., Kal, L.V.: ParFUM: a parallel framework for unstructured meshes for scalable dynamic physics applications. In: Engineering with Computers (December 2006)Google Scholar
- 16.Figueiredo, M., Fernando, T.: An Efficient Parallel Collision Detection Algorithm for Virtual Prototype Environments. In: 10th International Conference on Parallel and Distributed Systems (2004)Google Scholar
- 17.Tang, M., Manocha, D., Tong, R.: Multi-core collision detection between deformable models. In: SIAM/ACM Joint Conference on Geometric and Physical Modeling (2009)Google Scholar
- 18.Zyulkyarov, F., Gajinov, V., Unsal, O., Cristal, A., Ayguad, E., Harris, T., Valero, M.: Atomic Quake: Using Transactional Memory in an Interactive Multiplayer Game Server. In: 14th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP) (Febuary 2009)Google Scholar
- 19.Lawlor, O.S., Kale, L.V.: A voxel-based parallel collision detection algorithm. In: Proceedings of the 16th International Conference on Supercomputing (2002)Google Scholar