Are geometric build-in functions of OpenCL noticeably faster than a naive plain Java implementation?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Are geometric build-in functions of OpenCL noticeably faster than a naive plain Java implementation?

gouessej
Administrator
Hi!

In several 3D engines written in Java, lots of operations are performed on vectors and matrices, I think about dot product, cross product, distance, normalization, addition, subtraction, multiplication... Are such operations noticeably faster with OpenCL than with plain Java?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Are geometric build-in functions of OpenCL noticeably faster than a naive plain Java implementation?

Michael Bien
sure, its much faster. But only if you have lots of parallelism in your computation e.g doing thousands of operations in parallel.

On 09/10/2010 11:47 AM, gouessej [via jogamp] wrote:
Hi!

In several 3D engines written in Java, lots of operations are performed on vectors and matrices, I think about dot product, cross product, distance, normalization, addition, subtraction, multiplication... Are such operations noticeably faster with OpenCL than with plain Java?




-- 
http://michael-bien.com/
Reply | Threaded
Open this post in threaded view
|

Re: Are geometric build-in functions of OpenCL noticeably faster than a naive plain Java implementation?

Demoscene Passivist
Administrator
In reply to this post by gouessej
Generally speaking: Yes!

OpenCL implements a massive parallel execution model. So as long as u can parallelize ur problem and u have a massive parallel hardware device (like current multicore CPUs or standard consumer GPUs)  u are good to go with OpenCL. This is ofcourse the case for the basic vector/matrice operations u mentioned.

In comparison to native Java the speedup to expect is at least 10x up to a couple of 100x depending on the operations u use.

The downside however is that there is a significant overhead cost involved in "setting-up" ur data to be processed by OpenCL, and collecting the results. So if u got only very little data the setup overhead may be higher that the actual processing time in plain Java. For most 3D engines however this is definitly not the case.
Reply | Threaded
Open this post in threaded view
|

Re: Are geometric build-in functions of OpenCL noticeably faster than a naive plain Java implementation?

gouessej
Administrator
Ok it seems to be worth a try. When I have some time, I will make a benchmark by using TUER once with the current plain Java math library and once with an OpenCL implementation of the same library. I hope the overhead cost is not so high because I know I have a lot of small chunks of data to treat.
Julien Gouesse | Personal blog | Website