OpenGL vs. OpenCL,选择哪个,为什么选择? [英] OpenGL vs. OpenCL, which to choose and why?

查看:502
本文介绍了OpenGL vs. OpenCL,选择哪个,为什么选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些功能使OpenCL可以在GLSL和GLSL上进行计算时独树一帜?尽管图形相关的术语和不切实际的数据类型,OpenGL是否有真正的警告?

What features make OpenCL unique to choose over OpenGL with GLSL for calculations? Despite the graphic related terminology and inpractical datatypes, is there any real caveat to OpenGL?

例如,可以通过使用其他纹理将a渲染到纹理来完成并行函数评估.缩小操作可以通过迭代渲染越来越小的纹理来完成.另一方面,不可能以任何有效的方式进行随机写访问(唯一的方法是通过纹理驱动的顶点数据渲染三角形). OpenCL有可能吗? OpenGL无法实现的其他功能?

For example, parallel function evaluation can be done by rendering a to a texture using other textures. Reducing operations can be done by iteratively render to smaller and smaller textures. On the other hand, random write access is not possible in any efficient manner (the only way to do is rendering triangles by texture driven vertex data). Is this possible with OpenCL? What else is possible not possible with OpenGL?

推荐答案

OpenCL专为计算而创建.使用OpenGL进行科学计算时,您始终必须考虑如何将计算问题映射到图形上下文(即,就纹理和诸如三角形等的几何图元而言)进行讨论.

OpenCL is created specifically for computing. When you do scientific computing using OpenGL you always have to think about how to map your computing problem to the graphics context (i.e. talk in terms of textures and geometric primitives like triangles etc.) in order to get your computation going.

在OpenCL中,您只需在内存缓冲区中使用计算内核来制定计算公式,就可以了.这实际上是一个大赢家(从深思熟虑并实现了这两个变体的角度说).

In OpenCL you just formulate you computation with a calculation kernel on a memory buffer and you are good to go. This is actually a BIG win (saying that from a perspective of having thought through and implemented both variants).

虽然内存访问模式相同(您的计算仍在GPU上进行-但这些天来GPU变得越来越灵活).

The memory access patterns are though the same (your calculation still is happening on a GPU - but GPUs are getting more and more flexible these days).

但是,除了使用十多个并行的"CPU"而又不打扰如何翻译之外,您还会期望什么? (愚蠢的例子)傅里叶到三角形和四边形...?

But what else would you expect than using more than a dozen parallel "CPUs" without breaking your head about how to translate - e.g. (silly example) Fourier to Triangles and Quads...?

这篇关于OpenGL vs. OpenCL,选择哪个,为什么选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆