7 ms·
So why would you go with OpenCL? Is it portability? For a while I thought that was worth it but I am having a hard time remaining convinced of that.
by smosher 13y ago
So why would you go with OpenCL? Is it portability? For a while I thought that was worth it but I am having a hard time remaining convinced of that.
- cronin101 13y agoI've been working on a rather large computation library using OpenCL. OpenCL is useful for providing an abstraction over multiple device types. If you are only interested in producing highly-tuned parallel code to execute on NVidia hardware, I suggest sticking to CUDA for the above reasons. I utilised the OpenCL programming interface to write code that would run the same kernel functions on CPU and/or GPU devices (using heuristics to trade-off latency/throughput) which is something that is not possible afaik using the CUDA toolchain. TL;DR YMMV and horses for courses.
- apaprocki 13y agoFYI regarding highly-tuned code -- An ex ATI/AMD GPU core designer told me that the price you pay for writing optimized code in OpenCL versus the device specific assembler is roughly 3x. Something to keep in mind if you're targeting a large enough system to OpenCL and you find spots that can't be pushed any faster.
- cronin101 13y agoUnlike previous versions, OpenCL 2.0 been shown to only be about 30%[1] slower than CUDA and can approach comparable performance given enough optimisation. Since I am working on code generation of Kernels to perform dynamic tasks, I can't afford to write at the lowest level available. (I'm accelerating Python/Ruby routines though so OpenCL gives a significant bonus without much pain at all.) [1] http://dl.acm.org/citation.cfm?id=2066955 http://dl.acm.org/citation.cfm?id=2066955 (Sorry about the paywall, I access through University VPN)
- deleted 13y ago[deleted]
- dljsjr 13y agoPortability, accessibility, etc. "Because it's hard" is never a good excuse to not do something.
- jamesaguilar 13y ago> "Because it's hard" is never a good excuse to not do something. Well that's certainly not true in the general case.
- dljsjr 13y agoOn the contrary, I'd argue that it's not true in specific cases. "Because it's hard" is a cop-out. "It's too hard to accomplish given constraint [X]" where X is a deadline, financial constraints, or other real/tangible resource limitations might be one thing. But if you're working on your own timeline on some sort of open-source project, or there is nothing external preventing you from acquiring the expertise/resources to conquer the hard problem, then "Because it's hard" is an absolutely shitty excuse to not do something.
- jamesaguilar 13y agoI suggest you read "It's too hard" when written by other developers as, "It's too hard [given that I spend N hours a week on this and would rather actually accomplish something in the next two months than learn the 'right' API]." Or, "It's too hard [given various constraints that I'm not going to explain to you but are valid to me.]" It'll save you having to give speeches about shitty excuses. That said, if it makes sense for your project, make it happen! :)
- robryan 13y agoEven if the long term goal is more portable GPU support it still makes some sense to get a CUDA implementation up first if it is easier to get to. It then allows real world testing faster, can always go to openCL later once they know more.
- 13y ago
- rprospero 13y agoWell, the portability can be a killer feature. I've been writing quite a bit of OpenCL code lately. I have an AMD GPU, so CUDA is a non-starter. I'll eventually replace the AMD card with an NVIDIA one, so it won't be as big of a problem, but my OpenCL code will still be fine then.
- metrix 13y agoYou go with OpenCL so that you can use AMD's Fusion processor that will start will soon allow a GPU and CPU to share main memory.
- fiatmoney 13y agoYou can do this already, and also with Intel's Ivy Bridge (at least on Windows).
- stonemetal 13y agoCUDA code is GPU only, OpenCL can run on both CPU and GPU. There are limits so it isn't all win, but it means you don't have to implement twice.
- DiabloD3 13y agoOpenCL is a standards compliant compute API that is supported by Nvidia, AMD, Intel, IBM, Sony, Apple, and several other companies. Nvidia is in the slow process of eventually discontinuing further CUDA support, and it is recommended to write new code in OpenCL only.
- qb45 13y ago> Nvidia is in the slow process of eventually discontinuing further CUDA support, and it is recommended to write new code in OpenCL only. [Citation needed] Their OpenCL support is still limited to v1.1 (released in 2010), while just few months ago they've released a new major version of CUDA with tons of features nowhere to be seen in (any vendor's) OpenCL.
- smosher 13y agoYeah, you're going to have to back that up. CUDA is meant to be supported on all future nVidia cards.
- pjmlp 13y agoHow come, given that only CUDA has direct support for C++ and FORTRAN compilers that target the GPU?
- m_mueller 13y agoFurthermore Python[1], Matlab[2], F#[3]. Furthermore parallel device debuggers (TotalView, Allinea), profilers (NVIDIA). There's a long way for OpenCL to catch up, if ever (because there might be a better standard coming further down the line). [1] http://www.techpowerup.com/181585/NVIDIA-CUDA-Gets-Python-Support.html http://www.techpowerup.com/181585/NVIDIA-CUDA-Gets-Python-Su... [2] http://www.mathworks.com/discovery/matlab-gpu.html http://www.mathworks.com/discovery/matlab-gpu.html [3] https://www.quantalea.net/media/pdf/2012-11-29_Zurich_FSharp_Users.pdf https://www.quantalea.net/media/pdf/2012-11-29_Zurich_FSharp...
- pjmlp 13y agoIt is the same story as OpenGL vs DirectX, it is all about the support the developers get from the vendors.