Jump to content

  • Log In with Google      Sign In   
  • Create Account


Cuda / OpenCL vs Rendered Textures


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 tamato   Members   -  Reputation: 112

Like
0Likes
Like

Posted 13 March 2013 - 03:24 PM

I plan on working on two projects and don't know what the best way to go about it is.

 

One project would be to do a particle simulation on the gpu, the other a raytracer on a volume of data, of course all in the gpu.

 

I'm not at all familiar with Cuda or OpenCL other then they are good for this type of work. 

 

What I would like to know is if Cuda or OpenCL is better then just using rendered to textures, why are they better?

 

Are they faster in some way? Easier to work with? What are the pro's and con's?

 

Thanks

 

 



Sponsor:

#2 MJP   Moderators   -  Reputation: 10086

Like
1Likes
Like

Posted 13 March 2013 - 07:26 PM

If you need interaction with a more traditional graphics pipeline, then I wouldn't use either. Both D3D and OpenGL support compute shaders, and generally they are better to work with if you need to use the results of your computation for rendering. I would say a particle simulation falls into this category, since after you simulate them you will probably want to render them as quads. Also using compute shaders leaves the door open for DrawIndirect, which can be really useful for particles. For a raytracer, you probably won't need to interact with a D3D/GL context so CUDA and CL might make more sense. I'm not really experienced with OpenCL so I can't really give you a good comparison against Cuda. In terms of Cuda vs. compute shaders, Cuda is much closer to writing standard C/C++ code.



#3 blueshogun96   Crossbones+   -  Reputation: 792

Like
1Likes
Like

Posted 13 March 2013 - 07:53 PM

If you want a basic rundown of how CUDA compares to OpenCL and vice versa, read this: http://streamcomputing.eu/blog/2010-04-22/difference-between-cuda-and-opencl/

 

I myself am just getting started learning CUDA.  Currently, I'm reading the book known as "CUDA C by Example".  Like MJP already stated, it's very much like C and I haven't used OpenCL yet either.

 

I'd say they are both a bit overkill for a simple particle engine (unless you're massively drawing and updating millions of particles like rain or snow).  I've seen raytracing done using shaders many times before, so it depends on what scale you're doing it on, I guess.  Like I said, I'm still learning this myself. ^^

 

Shogun.


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png


#4 Geometrian   Crossbones+   -  Reputation: 1414

Like
0Likes
Like

Posted 13 March 2013 - 08:30 PM

My first GPU particle system was originally written with a fragment program and an FBO. My second one used a vertex program and the transform feedback buffer.

 

Nowadays, I have an OpenCL based particle system. I actually don't think it's overkill; using OpenCL makes it (fairly) easy to handle dynamic branching, within reason. At any rate, the OpenCL kernel writes particles' informations directly to a shared VBO. It more portable and robust than either of the previous versions, too.

 

I eventually gave up on CUDA. Although it has nice primitives and a more expressive language, it is a pain to use compared to OpenCL and it's not cross-platform.


And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.

#5 tamato   Members   -  Reputation: 112

Like
0Likes
Like

Posted 14 March 2013 - 09:39 AM

For a raytracer, you probably won't need to interact with a D3D/GL context so CUDA and CL might make more sense.


And one last thing. Is there a better way I could have phrased the title to this post? It feels awkward but couldn't come up with anything better.

 

Is this because everything could be done in CUDA or CL including the visualization?

 

Thanks to your reply's I'll be looking into compute shaders and drawIndirect, I know next to nothing about these. 

If there are any good resources on these I would be really interested in them.

 

Also, the title to this post feels awkward, but I couldn't come up with anything better. Is there a better way to phrase it?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS