我是 GPGPU 概念的新手,在过去的几个月里,我一直在慢慢地了解 CUDA 和 OPENCL 之间的差异。我意识到 OpenCL 规范允许程序员以计算设备为目标(因此无论 GPU/CPU 架构如何),但 CUDA C 方法没有这样的抽象,因为它始终以兼容的 Nvidia GPU 架构为目标。所以我想知道如果我在 CUDA 环境中使用 Nvidia 的实现编写 OPENCL 内核,我仍然可以针对 CPU 吗?据我了解,AMD Stream 环境允许您通过 OpenCL 实现来做到这一点。
提前致谢。
I am a newbie to GPGPU concepts and for the 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.
发布评论
评论(2)
如果您的意思是这样的话,您仍然可以在安装了 Nvidia 基于 GPU 的 OpenCL 的系统上定位 CPU。 Nvidia 的 OpenCL 实现仅支持 Nvidia GPU,但 AMD 的实现可以与 NVidia 一起安装,也支持 CPU。
与 OpenGL 类似,OpenCL(在 Linux 和 Windows 上)使用包装器库 在多个实现之间进行委托。
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) 只是同一 API OpenCL 的三种不同实现。这意味着只要您使用 OpenCL 进行编码并遵守规范,您的可执行文件就应该在任何支持 OpenCL 的平台/硬件上正常运行,无论是 GPU 还是 CPU。
就您而言,使用 CUDA sdk 使用 NVIDIA OpenCL 进行开发不应妨碍您在其他环境(例如 AMD Stream 或其他环境)上运行应用程序(例如 OpenCL on Power),只要目标平台安装了兼容 OpenCL 的驱动程序。
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.