Sign in to follow this  
the_edd

'Standard' way of returning GPGPU calculations?

Recommended Posts

In the absence of CUDA and OpenCL, and accepting the hit in accuracy that conversions between floating point formats might produce along the way, what's the best way to return floating point GPU calculations to CPU land? "Best" meaning requiring the smallest number of widely available GL extensions. I'd be particularly interested in methods that work on both Windows and OS X. Apologies for the somewhat woolly question, I'm new to this :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Erik Rufelt
Rendering into/reading from a floating point texture could work well, depending on what you want to do.


Some specific things I'd like to try are numeric integration and collision tests.

So I was thinking of bundling the data in to one or more textures, rendering a quad that covers the "screen" such that each texel corresponds to a fragment. Then use the fragment shader to actually perform the per-texel work item.

So I'd need to look at rendering to a texture, or copying the framebuffer to a floating point texture afterwards.

Does that all sound about right?

Share this post


Link to post
Share on other sites
Yes, that all sounds about right. However, a word of caution: Having done GPGPU through both OpenGL and CUDA, let me say that the pain of using the former is extreme. Additionally, the available feature-set is reduced. If you choose not to use the standard GPGPU libraries out there, you will get less done, and your results will be less impressive.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
Yes, that all sounds about right. However, a word of caution: Having done GPGPU through both OpenGL and CUDA, let me say that the pain of using the former is extreme. Additionally, the available feature-set is reduced. If you choose not to use the standard GPGPU libraries out there, you will get less done, and your results will be less impressive.

What about a situation in which I already sent a mesh to the GPU's memory via OpenGL. Can I do GPGPU operations on it with OpenCL/CUDA? Will I get the same performance boost as with OpenGL?

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
Yes, that all sounds about right. However, a word of caution: Having done GPGPU through both OpenGL and CUDA, let me say that the pain of using the former is extreme. Additionally, the available feature-set is reduced. If you choose not to use the standard GPGPU libraries out there, you will get less done, and your results will be less impressive.


By the "standard GPGPU libraries" do you mean CUDA and OpenCL, or is there something else you can recommend that sits on top of OpenGL?

Share this post


Link to post
Share on other sites
I mean CUDA and OpenCL. There are libraries that sit on top of OpenGL -- notably, Brook and Sh/RapidMind -- but while simplifying the GPGPU development process, they don't offer any functionality beyond that which OpenGL offers.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
I mean CUDA and OpenCL. There are libraries that sit on top of OpenGL -- notably, Brook and Sh/RapidMind -- but while simplifying the GPGPU development process, they don't offer any functionality beyond that which OpenGL offers.


Thanks, I'll have a look at those. I wish I could use CUDA or OpenCL, but this app needs to work on older systems :/

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
Yes, as far as I know CUDA can work with vertex buffers.

As far as the drivers are concerned, it's mostly just a change in nomenclature.

I suppose if you don't want to go into reading and writing texture memory, you also have the option for using OpenGL in feedback mode. This means giving the shader some vertex data, the vertex shader does it's thing, and then optionally the geometry shader, and then instead of passing the data to the fragment shader (you can pass it too if you want to draw the scene for any reason), it gets written to a 'feedback buffer object' which is just another type of vertex buffer object with generated vertex information.
Of course, this method is a lot more complicated than just using CUDA would be. Not to mention that the extension only exists on G80 and newer cards (in other words, nothing that can't run CUDA)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this