DirectCompute versus OpenCL for GPU programming?
Asked Answered
G

3

4

I have some (financial) tasks which should map well to GPU computing, but I'm not really sure if I should go with OpenCL or DirectCompute. I did some GPU computing, but it was a long time ago (3 years). I did it through OpenGL since there was not really any alternative back then.

I've seen some OpenCL presentations and it looks really nice. I haven't seen anything about DirectCompute yet, but I expect it to also be good.

I'm not interested at the moment in cross-platform compatibility, and besides, I expect the two models to be similar enough to not cause a big headache when trying to go from one to the other.

So, did you use anyone of these two? Especially DirectCompute? How does it compare to OpenCL (and CUDA)?

Glabrous answered 26/5, 2010 at 17:34 Comment(2)
It depends on what hardware you have, what operating system(s) you want to target, and whether you want your code to be cross-platform.Midiron
DirectCompute is available only in windows and it requires DirectX 10 or newer video card.Dar
P
3

Given that you're looking to non-graphics computations, I would suggest that you prefer OpenCL over DirectCompute since you are likely to find more in the way of community assistance.

Given that you've already identified that going from one to another is relatively simple, i.e. once you've already done the work to parallelise your application, you could also consider CUDA over both OpenCL and DirectCompute for the same reason.

You've worked in OpenGL before; any of them ought to be a delight to use compared with that!

Punish answered 27/5, 2010 at 15:51 Comment(0)
M
2

I am learning OpenCL. When I was making similar decision to you, to me OpenCL's biggest advantage is good for heterogeneous environment (contrary to CUDA and other solutions). I don't mean hardware only, but OS as well. OpenCL is much more free standard than for example CUDA.

Writing code is expensive task. I would love to be able to use my gpgpu code in future, no metter: on many parallel cpu, on device of one or another vendor or different operating system. I can compute on my computer small tasks, while on much bigger machine at Univesity with many CPUs more task parrarel task, while on another with Tesla when more data-parrarel task. OpenCL gives such reuse of code on variety of hardware and OS.

Mendelian answered 25/1, 2011 at 21:30 Comment(0)
E
0

Another option is C++ AMP, which also targets GPUs and has a fallback CPU multi-core and SIMD instructions target. It will allow you to focus on compute, and if you do need to integrate with graphics, there is an interop layer for that too. Through the open spec, we should see implementations for other operating systems at some point. Please follow links from here for more info and feel free to post questions as you have them: http://blogs.msdn.com/b/nativeconcurrency/archive/2011/09/13/c-amp-in-a-nutshell.aspx

Element answered 16/3, 2012 at 22:31 Comment(2)
Do you have any particular reason to believe that C++ AMP will come to other platforms? I think before gcc and perhaps intel implements AMP, it cannot be really called cross-platform. Given also the speed of implementation of such stuff (OpenMP was not supported right away either), the "some point" might well be, if ever, in 5 years?Bindweed
@eudoxos, the point is that it is possible through the open spec. Given that AMD at the Fusion conference last year announced their intent to support C++ AMP in their compiler, and given that Microsoft really wants to see implementations on other platforms, I can say what I said: "we should see implementations for other operating systems at some point". You are right, nobody has said what the 'some point' may be, so it is up to each person to draw their own conclusions and share their beliefs - like I did.Element

© 2022 - 2024 — McMap. All rights reserved.