OpenCL or CUDA Which way to go?
Question
I'm investigating ways of using GPU in order to process streaming data. I had two choices but couldn't decide which way to go?
My criterias are as follows:
- Ease of use (good API)
- Community and Documentation
- Performance
- Future
I'll code in C and C++ under linux.
Solution
OpenCL
- interfaced from your production code
- portable between different graphics hardware
- limited operations but preprepared shortcuts
CUDA
- separate language (CUDA C)
- nVidia hardware only
- almost full control over the code (coding in a C-like language)
- lot of profiling and debugging tools
Bottom line -- OpenCL is portable, CUDA is nVidia only. However, being an independent language, CUDA is much more powerful and has a bunch of really good tools.
- Ease of use -- OpenCL is easier to use out of the box, but once you setup the CUDA coding environment it's almost like coding in C.
- Community and Documentation -- both have extensive documentation and examples, however I think CUDA has better.
- Performance -- CUDA allows for greater control, hence can be better fine-tuned for higher performance.
- Future -- hard to say really.
OTHER TIPS
My personal experiences were:
API: OpenCL has slightly more complex api. However most time you will spent with writing kernel code, and here both are almost identical.
Community: CUDA has a much bigger community then OpenCL up til now, but this will probably about to even out.
Documentation: Both are very well documented.
Performance: We made the experience, that OpenCL drivers are not yet fully optimized.
Future: The future lies with OpenCL as it is an open standard, not restricted to a vendor or specific hardware!
This assessment is from 2010, so probably out-dated.
OpenCL all the way unless you have a specific reason to use CUDA. OpenCL runs well on multicores like Intel i7 in addition to running on GPUs. By using OpenCL you can run it on a much wider range of hardware from Droid cell phones to the IBM Power7 compute nodes of the world's largest supercomputer, Blue Waters, which is supposed to come online next year.