xcode 我可以在 intel iris 上运行 Cuda 或 opencl 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40560336/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I run Cuda or opencl on intel iris?
提问by Fudoli
I have a Macbook pro mid 2014 with intel iris and intel core i5 processor 16GB of RAM. I am planing to learn some ray-traced 3D. But, I am not sure, if my laptop can render fast without any nvidia's hardware.
我有一台 2014 年年中的 Macbook pro,配备英特尔虹膜和英特尔酷睿 i5 处理器,内存为 16GB。我打算学习一些光线追踪 3D。但是,我不确定我的笔记本电脑是否可以在没有任何 nvidia 硬件的情况下快速渲染。
So, I would appreciate it, if someone can tell me if I can use Cuda if not, then could you please teach me in a very easy way how to enable OpenCL in after affects. I am looking for any tutorial for beginners to learn how to create or build OpenCL?
因此,我将不胜感激,如果有人能告诉我是否可以使用 Cuda,那么您能否以非常简单的方式教我如何在后期影响中启用 OpenCL。我正在寻找任何适合初学者学习如何创建或构建 OpenCL 的教程?
回答by huseyin tugrul buyukisik
Cuda works only on nvidia hardware but there may be some libraries converting it to run on cpu cores(not igpu).
Cuda 仅适用于 nvidia 硬件,但可能有一些库将其转换为在 cpu 内核(而不是 igpu)上运行。
AMD is working on "hipify"ing old cuda kernels to translate them to opencl or similar codes so they can become more general.
AMD 正致力于“hipify”旧的 cuda 内核,将它们转换为 opencl 或类似的代码,以便它们变得更通用。
Opencl works everywhere as long as both hardware and os supports. Amd, Nvidia, Intel, Xilinx, Altera, Qualcomm, MediaTek, Marvell, Texas Instruments .. support this. Maybe even Raspberry pi-x can support in future.
只要硬件和操作系统都支持,Opencl 可以在任何地方工作。Amd、Nvidia、Intel、Xilinx、Altera、Qualcomm、MediaTek、Marvell、Texas Instruments .. 支持这一点。也许将来甚至 Raspberry pi-x 也可以支持。
Documentation for opencl in stackoverflow.com is under development. But there are some sites:
stackoverflow.com 中的 opencl 文档正在开发中。但是有一些网站:
Some overview of hardware, benchmark and parallel programming subjects
Scratch-a-pixel-raytracing-tutorial(I read it then wrote its teraflops gpu version)
If it is Iris Graphics 6100:
如果是 Iris Graphics 6100:
Your integrated gpu has 48 execution units each having 8 ALU units that can do add,multiply and many more operations. Its clock frequency can rise to 1GHz. This means a maximum of 48*8*2(1 add+1multiply)*1G = 768 Giga floating point operations per second but only if each ALU is capable of concurrently doing 1 addition and 1 multiplication. 768 Gflops is more than a low-end discrete gpu such as R7-240 of AMD.(As of 19.10.2017, AMD's low-end is RX550 with 1200 GFlops, faster than Intel's Iris Plus 650 which is nearly 900 GFlops). Ray tracing needs re-accessing to too many geometry data so a device should have its own memory(such as with Nvidia or Amd), to let CPU do its work.
您的集成 GPU 有 48 个执行单元,每个执行单元有 8 个 ALU 单元,可以执行加法、乘法和更多操作。它的时钟频率可以上升到1GHz。这意味着每秒最多 48*8*2(1 add+1multiply)*1G = 768 Giga 浮点运算,但前提是每个 ALU 能够同时进行 1 次加法和 1 次乘法。768 Gflops不仅仅是AMD的R7-240这样的低端独立gpu。(截至2017年10月19日,AMD的低端是RX550,1200 GFlops,比Intel的Iris Plus 650快近900 GFlops)。光线追踪需要重新访问过多的几何数据,因此设备应该有自己的内存(例如 Nvidia 或 Amd),让 CPU 完成它的工作。
How you install opencl on a computer can change by OS and hardware type, but building a software with an opencl-installed computer is similar:
在计算机上安装 opencl 的方式会因操作系统和硬件类型而异,但使用安装了 opencl 的计算机构建软件是类似的:
- Query platforms. Result of this can be AMD, Intel, Nvidia,duplicate of these because of overlapped installations of wrong drivers,experimental platforms prior to newer opencl version supports.
- Query devices of a platform(or all platforms). This gives individual devices (and their duplicates if there are driver errors or some other things to fix).
- Create a context(or multiple) using a platform
Using a context(so everything will have implicit sync in it):
- Build programs using kernel strings. Usually CPU can take less time than a GPU to build a program.(there is binary load option to shurtcut this)
- Build kernels(as objects now) from programs.
- Create buffers from host-side buffers or opencl-managed buffers.
- Create a command queue (or multiple)
- 查询平台。其结果可能是 AMD、Intel、Nvidia,由于错误驱动程序的重叠安装,在较新的 opencl 版本支持之前的实验平台,这些重复。
- 查询一个平台(或所有平台)的设备。这提供了单个设备(如果存在驱动程序错误或其他一些需要修复的问题,则它们的副本)。
- 使用平台创建一个(或多个)上下文
使用上下文(因此所有内容都将具有隐式同步):
- 使用内核字符串构建程序。通常 CPU 可以比 GPU 花费更少的时间来构建程序。(有二进制加载选项可以缩短这个)
- 从程序构建内核(现在作为对象)。
- 从主机端缓冲区或 opencl 管理的缓冲区创建缓冲区。
- 创建一个命令队列(或多个)
Just before computing(or an array of computations):
就在计算(或计算数组)之前:
- Select buffers for a kernel as its arguments.
- Enqueue buffer write(or map/unmap) operations on "input" buffers
- 为内核选择缓冲区作为其参数。
- 在“输入”缓冲区上排队缓冲区写入(或映射/取消映射)操作
Compute:
计算:
- Enqueue nd range kernel(with specifying which kernel runs and with how many threads)
- Enqueue buffer read(or map/unmap) operations on "output" buffers
- Don't forget to synchronize with host using clFinish() if you haven't used blocking type enqueueBufferRead.
- Use your accelerated data.
- Enqueue nd range kernel(指定运行哪个内核以及有多少线程)
- 在“输出”缓冲区上排队缓冲区读取(或映射/取消映射)操作
- 如果您没有使用阻塞类型 enqueueBufferRead,请不要忘记使用 clFinish() 与主机同步。
- 使用您的加速数据。
After opencl is no more needed:
在不再需要 opencl 之后:
- Be sure all command queues are empty / finished doing kernel work.
- Release all in the opposite order of creation
- 确保所有命令队列都是空的/完成内核工作。
- 以相反的创建顺序释放所有
If you need to accelerate an open source software, you can switch a hotspot parallelizable loop with a simple opencl kernel, if it doesn't have another acceleration support already. For example, you can accelerate air-pressure and heat-advection part of powdertoy sand-box simulator.
如果你需要加速一个开源软件,你可以用一个简单的 opencl 内核切换热点可并行循环,如果它没有另一个加速支持的话。例如,您可以加速粉状玩具沙盒模拟器的气压和热平流部分。
回答by tera
Yes, you can, because OpenCL is supported by MacOSnatively.
From your question it appears you are not seeking advice on programming, which would have been the appropriate subject for Stack Overflow. The first search hit on Google explains how to turn on OpenCL accelerated effects in After Effects(Project Settings dialog -> Video Rendering and Effects), but I have no experience with that myself.
从您的问题来看,您似乎不是在寻求有关编程的建议,这对于 Stack Overflow 来说是合适的主题。谷歌上的第一个搜索解释了如何在 After Effects 中打开 OpenCL 加速效果(项目设置对话框 -> 视频渲染和效果),但我自己没有这方面的经验。