PDA

View Full Version : OpenGL vs.CPU based vector reduction



Lior D
02-20-2011, 01:40 PM
Hello all. This is a much hated "general question".
I am a total newbie to this field, and learning things from scratch. We are thinking of moving physical 2d drawing from CPU to OpenGL, on LINUX.

My associates and I are looking for doing the following:
We have a very large vector, which represents a physical wave vs. time. The challenge is that the wector is of 1-100 million sample points, of possibly varying sample rate, and with a large number of "y" values.
Needless to day, the display does not have 10000 pixels in width, let alone 100 times more, so some reduction is required.
The application should provide zoom in and zoom out, and fast. Today's products in the industry rely on proprietary algorithms, and it's done in the CPU, on LINUX machines (RedHat and SUSE), w/o any HW accl..
My question is very simple. Should moving to OpenGL infrastructure eable our product to be faster (as a result of HW accler.) and will be simpler, in the sense that the reduction algorithms are handled by the OpenGL?
I mean is it something which makes sense to try, or am I completely off?

Dark Photon
02-20-2011, 06:18 PM
My question is very simple. Should moving to OpenGL infrastructure eable our product to be faster (as a result of HW accler.) and will be simpler, in the sense that the reduction algorithms are handled by the OpenGL?
I mean is it something which makes sense to try, or am I completely off?
If the data is already on the GPU, it's definitely worth a shot. If not, then maybe. Depends on a lot of things, like how much computation per memory access, speed of GPU, upload/download speed, etc. But reductions is one area where the GPUs massive memory bandwidth and number of cores can really shine.

You can do it in OpenGL with GLSL shaders for starters. But for that final perf++ you may want to use OpenCL or CUDA, as that lets you use local memory on the GPU cores to optimize away some memory accesses and/or computation. To get started, I suggest the OpenCL Programming Book or CUDA By Example.

Lior D
02-20-2011, 09:02 PM
Thanks.
Actually, OpenCL is the next item on the menu. There are a lot of operations requiered by the users, which can be easily translated into matrice mutlpilcation or vector dot/cross product.
I assume that with the new OpenGL/OpenCL sceheme, performance of these operations has the potential of being MUCH faster in OpenCL vs. old school CPU based C.
Am I correct?
I will look into the GLSL shaders.
-Lior