30 likes | 143 Views
New Challenges for Cellular Automata Simulation on the GPU.
E N D
New Challenges for Cellular Automata Simulation on the GPU GoalSimple cellular automata (CA) simulations can be easily implemented on the GPU. We have achieved speeds of over 425 million cells per second for Conway’s Game of Life, which samples only the eight adjacent neighbors on a uniform rectilinear grid. However, CA simulations with more complex neighborhood queries are much harder to implement on the GPU efficiently. CA models of excitable media have proven to be useful in studying cardiac electrophysiological wave behavior. Without CA models, cardiac tissue simulations require solving elaborate systems of partial differential equations, which is often not practical becauseit can take days or weeks to simulate even small pieces of tissue. We have chosen the Gerhardt model as a starting point, and have modified it to produce more physiologically accurate behavior of heart cells. While making the model more physiologically accurate, we found it necessary to introduce the use of irregular neighborhood sampling, a sampling method that could be important in many GPGPU applications. An innate flaw in the sampling pattern of the Gerhardt model has led us to develop a new Staggered Grid model that is more GPU-friendly while preserving the same level of physiological accuracy. John Tran Don Jordan David Luebke University of Virginia - www.cs.virginia.edu/johntran/cagpu Modified Gerhardt model The original Gerhardt model works on a rectilinear grid, with each cell querying a fixed number of neighbors based on distances to the cell. This does not produce physiologically accurate results, so we improve the original model by randomly jittering the cell centers. This creates more accurate waves, but introduces the problem that the set of visible cells is non-regular and the neighbor set must be computed. Because it is inefficient to computethese distance calculations in a fragment shader, we precompute a visibility map and store this data into a 32-bit-per-texel texture map. Only 32 bits are required because for our chosen radius of 3 cell widths, there are 48 neighbors, 12 of which are always going to fall within the radius (blue) and 4 of which are never going to fall within the radius (white), leaving 32 cells that may be on or off (green or yellow) depending on the random locations of thecell centers. We can therefore sample a single texel in this visibility map per cell and unpack the 32 bits using fmod instructions to obtain the description of the cell’s neighborhood. The inherit problem remains that the Gerhardt model has to sample approximately 30 cells per pixel because of this large-radius neighborhood query. We therefore propose the Staggered Grid model. Our new Staggered Grid model The Staggered Grid model is a more physiologically accurate model using only adjacent neighbors. Like real cardiac cells, each cell in this model is a fixed height and a variable width. With this new layout, cells are considered neighbors if they directly contact each other, simulating gap junctions of real cardiac cells. The Gerhardt model allows for cells to be considered neighbors even if they are not directly contacting, which is not physiologically accurate. This grid is compressed into a rectilinear texture. The neighborhood of a cell (red) can be described with 4 values – the ID of the beginning neighbor on the row above (green), and the number of subsequent neighbors above the cell (number of blue cells in the row), and the equivalent for the row below the cell. The left and right cells (yellow) are assumed to be neighbors. This staggered grid also introduces enough randomness to create isotropic waves. Unfortunately, these waves currently do not quite match up to the curvature and dispersion properties of excitable media, although we are highly confident that we can get to that point with little modification to the parts of the model that will influence GPU performance. We are also designing this new model with the GPU in mind as a target platform. A straightforward GPU implementation of the staggered grid is already 2x faster than the Modified Gerhardt model. All performance tests done on a Pentium-4 2.53Ghz machine with 1G RAM and an Nvidia GeForce 6800 graphics card.