24P150-P
Acceleration of plasma Particle-In-Cell simulation by GPU
プラズマ PIC 法シミュレーションの GPU による高速化
Kosuke Sawamoto, Yasunori Mizuno and Hiroshi Inuzuka
澤本晃佑, 水野保則,

犬塚博

Shizuoka University 3-5-1, Johoku, Naka-ku, Hamamatsu 432-8561, Japan
静岡大学浜松〒432-8561 静岡県浜松市中区城北 3-5-1

Particle-In-Cell (PIC) method is widely used in plasma simulation. In this poster we report the efficientalgorithm that runs PIC codes on Graphics Processing Unit (GPU). Especially, we focus on algorithms forthe process of particle-to-grid calculation which is the bottle neck operation for GPU. We try to optimize
the video memory access pattern by using a hash search algorithm. The calculation time of GPU isapproximately 30x faster than that of CPU (Intel Core2 Duo).

1. Introductiondifficult process to optimize for GPU. Process (i)PIC methods are one of the most important

executes the calculation of equation (1) thatmethods for plasma simulation and spend a longdepends on index of particle i and index of grid j.

time when a lot of particles are operated.

Operating these two indexes makes parallelization

The peak performance of NVIDIA GPU GeForcedifficult. To solve this problem, existent algorithms

GTX570 we use in our study is approximately[3,4] keep particles sorted state.

1.3TFLOPS. Using GPU for general purpose
computing, called General Purpose GPU (GPGPU),is become wide spread and we expect that GPU canspeed up PIC simulation too. In this poster, we

X: grid position, x: particle position, q: particle orreport about our algorithm for GPU, its calculation

grid charge, i: index of particle, j: index of grid.

time and simple simulation result.
2. Algorithm
2. PIC method

When we implement PIC code on GPU, it is thePIC method handles electric and magnetic field as

most important to optimize the pattern of video

differential values on calculation grids [2]. The

memory access because its access speed depends oncode contains below (i-iii) processes. Process (i)the pattern of parallel access [1]. Therefore thecalculates the grid charge density from particle

random access that depends on particle index i orposition, process (ii) calculates the grid field fromgrid index j of equation (1) is very slow. Accessgrid charge density by solving Poisson's equation

time of the worst case is about 1/8 slower than thatand process (iii) moves particle from grid field.

of the best pattern.

We have implemented all 3 processes to compute

In our study, we try to use a hash search algorithm

on GPU. Within these processes, (i) is the mostto dissolve the random access at one dimensionalelectrostatic model. Fig. 1 shows the image of data

the number of particle is 2M and the number of gridstructure. In this algorithm, particles that exist inis 16384. Since the result of CPU and of GPU isparticular range are stored in a linked list and links

same and we can see the instability occurs among

point the top of array. 32 particles are stored in thistwo streams, we can conclude that the result ofarray and one list is operated by 32 parallel

GPU is correct.

processes. This data structure can optimize theTable I. calculation time

video memory access by handling proper size arrayfor fast memory access pattern with one link.
In this data structure, particles that have moved toanother cell which handled by the neighbor list
should be inserted to the proper list after the process(iii). We draw these particles by using packing
operation.

CPU time [ms]GPU time [ms](i) density

158.8

1.5(ii) field

29.3

0.16(iii) move

233.7

1.9

packing

-9.3

total

421.8

12.9

Fig. 1. An image of data structure

4. Results
We execute a simple simulation, electron-electron

Fig. 2. Electron-electron two stream instability

two-stream instability [2], to measure calculation
times and to ensure that the simulation result

References

calculated by GPU is correct.

[1] NVIDIA: CUDA Programming Guide. (2011)

Table I shows CPU (Intel Core2 Duo) times and[2] C. K. Birdsall and A. B. Longdon: Plasma physics

GPU times of processes (i-iii) and packing. These

via computer simulation. (1985)

times are average values of 1000 steps. In this[3] George Stantchev, William Dorland, Nail Gumerov:

simulation, the number of particle is 8M and theFast parallel Particle-To-Grid interpolation for

number of grid is 65536 and CPU executes a single

plasma PIC simulations on the GPU, j. Parallel

thread. Although there is some overhead of packing

Distrib. Comput. 68(2008) 1339-1349

operation, GPU time is faster.

[4]Victor K. Decyk and Tajendra V. Singh: PlasmaFig. 2 shows vx-x phase-spaces of simulation

Particle-in-Cell Codes on GPUs: A Developer's

result. In images of phase-space, position x versus

Perspective, http://idre.ucla.edu/hpc/research/velocity v of particles are plotted. In this simulation,

documents/HPCC-victor-gpu.pdf (2010)