John Karlsson, Lars Löfquist

The use of GPU with OpenCL for simulation of a flocking model

Abstract

Today's PCs are moving towards more and more multi core processor, both the CPU and GPU. Using the GPU for non graphics calculations is referred to as GPGPU. To realize this requires a GPGPU language. In this report the OpenCL language is used, which is connectoed to Java through the library JavaCL. This report investigate differences by writing a Boids algorithm in Java and using OpenCL via JavaCL, and the performance gains it offers in various population quantities. Test results show that the rendering speed of the current test machine with 512 Boids is about 2.5 times higher for the GPU than the CPU, and with 1024 Boids is about 10 times higher. The conclusion is that the GPU implementation can handle about four times the number of Boids. We are also evaluating how complicated it is for a programmer, with no previous experience in GPGPU programming, to implement a JavaCL solution. This proved not to be to hard, and it was easy to start produce code, thanks to OpenCL is at a moderate level of abstraction.