DirectCompute versus OpenCL for GPU programming?

为君一笑 提交于 2019-12-07 11:43:06

问题


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)?


回答1:


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!




回答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.




回答3:


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



来源:https://stackoverflow.com/questions/2915350/directcompute-versus-opencl-for-gpu-programming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!