in reply to Re^6: Fast algorithm for 2d array queries (GPU OpenGL::Array)
in thread Fast algorithm for 2d array queries

but GPU works in parallel, so it should be faster

Only if the required algorithm can be coded to make use of the inherent concurrency of the GPU instruction set.

And (without expending great effort into looking at what instructions are available) I see three problems:

  1. Instructions applicable to the task.

    GPU are great at applying a single operation, or a restricted set of pairs of operations (multiply & add) to multiple values concurrently.

    But unless a way can be devised to perform a boolean test & increment instruction using the usually mathematical instruction set; it's not gonna fly.

  2. Integers versus float/double operands.

    Most GPU instructions deal with floating point values. The OPs problem revolves around integer values and boolean operations. If the data has to be converted first, if might kill any gains.

  3. Memory transfers.

    Shipping large volumes of data from cpu to gpu memory and back can be a major sap on performance and throughput.

I'm not saying it isn't possible. I am saying that it might take considerable R&D to make it work.

Better, if you know how to do it, I'd love to learn :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^7: Fast algorithm for 2d array queries (GPU OpenGL::Array)