We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
The community reviewed whether to reopen this question 2 years ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
NVIDIA不会很快取消OpenCL支持。
GPU上便携式代码的新出现的方法是SYCL。它可以从单个源文件中启用更高级别的编程,然后对CPU进行两次编译,一次用于GPU。然后,GPU部分通过OPENCL,CUDA或其他一些后端在GPU上运行。
但是,截至目前,在供应商中获得最佳支持的GPU框架是Opencl 1.2 ,这在这一点上已经建立得很好。 CPU代码(C/C ++)和GPU代码( opencl c )清楚地分开,这有助于清楚地表明在CPU和GPU之间需要复制数据的位置以及何时运行。 OpenCL在所有最新且最快的数据中心GPU上运行10年的GPU,在所有游戏和工作站GPU上,甚至在CPU上运行,如果您需要更多的内存。支持所有供应商(NVIDIA,AMD,Intel,Apple,Arm ...)。在NVIDIA GPU上,与CUDA相比,根本没有性能/效率折衷。它运行的速度也很快。
如果您选择从OpenCL开始,请查看此 opencl-wrapper 。本机Opencl C ++绑定有点麻烦,此轻量级包装器简化了很多学习和开发,同时保持功能和完整的性能。
CUDA是一种仅适用于NVIDIA GPU的专有GPU语言。它没有比OpenCL/SYCL提供的性能优势,但是将软件仅在NVIDIA硬件上运行。
HIP是一种专有的GPU语言,仅在7种非常昂贵的AMD数据中心/工作站GPU模型上支持。与OpenCL/SYCL相同的性能,但它将软件限制在AMD硬件的子集中。
如果您已经拥有大型代码库,则移植工具很棒,但是性能可能会受到影响。我的建议是要进行一个开放式框架(OpenCL/SYCL),并完全致力于它,而不是从仅在NVIDIA或AMD GPU上运行的专有语言(CUDA/HIP)开始,然后产生不良优化的端口来进行优化的端口支持其他硬件。移植是很多麻烦,甚至更多的麻烦是在不同的专有语言中维护相同代码的多种变体。使用OpenCL或SYCL,您只需要一个实现,并且在任何地方都可以运行。
Nvidia won't cancel OpenCL support anytime soon.
A newly emerging approach for portable code on GPU is SYCL. It enables higher level programming from a single source file that is then compiled twice, once for the CPU and once for GPU. The GPU part then runs on GPU via either OpenCL, CUDA or some other backend.
As of right now however, the best supported GPU framework across vendors is OpenCL 1.2, which is very well established at this point. CPU code (C/C++) and GPU code (OpenCL C) are clearly separated, which helps make clear which part runs where, and when data needs to be copied between CPU and GPU. OpenCL runs on 10 year old GPUs, on all of the latest and fastest data-center GPUs, on all gaming and workstation GPUs and even on CPUs if you need more memory. All vendors (Nvidia, AMD, Intel, Apple, ARM, ...) are supported. On Nvidia GPUs there is no performance/efficiency tradeoff at all compared to CUDA; it runs just as fast.
If you choose to start with OpenCL, have a look at this OpenCL-Wrapper. The native OpenCL C++ bindings are a bit cumbersome, and this lightweight wrapper simplifies learning and development a lot, while keeping functionality and full performance.
CUDA is a proprietary GPU language that only works on Nvidia GPUs. It offers no performance advantage over OpenCL/SYCL, but limits the software to run on Nvidia hardware only.
HIP is a proprietary GPU language, which is only supported on 7 very expensive AMD datacenter/workstation GPU models. Same performance as OpenCL/SYCL, but it limits the software to a subset of AMD hardware.
The porting tools are great if you already have a large code base, but performance could possibly suffer. My advice is to go for either one open framework (OpenCL/SYCL) and stay fully committed to it, rather than start with a proprietary language (CUDA/HIP) that only runs on Nvidia or AMD GPUs, and then generate poorly optimized ports to support the other hardware. Porting is a lot of trouble, and even more trouble is maintaining multiple variants of the same code in different proprietary languages. With OpenCL or SYCL you only need one implementation and it runs everywhere.