Can I target the CPU via OpenCL while developing with CUDA toolkit OpenCL sdk?
I am a newbie to GPGPU concepts and for the开发者_如何学JAVA last couple of months I have been slowly educating myself on the differences between CUDA and OPENCL. I realized that OpenCL specification allows the programmer to target a compute device (so whatever GPU/CPU architecture) but the CUDA C approach has no such abstraction since it always targets a compatible Nvidia GPU architecture. So I was wondering if I write an OPENCL kernel using Nvidia's implementation in the CUDA environment can I still target a CPU? As far as I understand AMD Stream environment allows you to do this with their OpenCL implementation.
Thanks in advance.
You can still target CPUs on a system with Nvidia's GPU-based OpenCL installed, if that is what you mean. Nvidia's OpenCL implementation only supports Nvidia GPUs, but AMD's implementation, which can be installed alongside NVidia's, supports CPUs as well.
Similar to OpenGL, OpenCL (on Linux and Windows) uses a wrapper library to delegate between multiple implementations.
NVIDIA OpenCL, ATI OpenCL, AMD OpenCL (CPU) are just three different implementations of the same API: OpenCL. That means as long as you code in OpenCL and stick to the spec, your executable should run properly on any platform/hardware that supports OpenCL, be it a GPU or a CPU.
In your case, developing with NVIDIA OpenCL using CUDA sdk shouldn't hinder you from running your app on other environments like AMD Stream or whatever (e.g. OpenCL on Power), as long as the target platform has an OpenCL compliant driver installed.
精彩评论