opencl矩阵库
我想使用 OpenCL 将物理模拟算法移植到 GPU 上以提高性能;我没有 OpenCL 经验,我正在四处寻找。计算主要是小密集矩阵(3x3)和向量积、叉积等。
是否有一些“标准”/推荐的库用于此类基本操作?我当然不想自己编写矩阵乘法和求逆(不花时间,而且效率低下)
由于 OpenCL 没有类、运算符重载等,我是否必须编写
mmul(a,mtrans (b))
而不是a*b.transpose()
例如?OpenCL(或预处理器)是否有一些(计划中的)扩展/演进,以使符号更像数学?我的印象是回到了fortran年代。 (我知道有 CUDA,但它受供应商限制)
I would like to port a physics simulation algorithm to GPU using OpenCL for performance; I have no experience with OpenCL, and I am looking around. The computations are mostly small dense matrix (3x3) and vector products, cross-products and so on.
Is there some "standard"/recommended library for such basic operations? I certainly don't want to code matrix multiplications and inversions myself (not time, and it would be inefficent)
As OpenCL does not have classes, operator overloading etc, do I have to write
mmul(a,mtrans(b))
instead ofa*b.transpose()
for instance?Are there some (planned) extensions/evolution of OpenCL (or pre-processor, for that matter) to make the notation more math-like? I have the impression of going back to fortran years. (I know there is CUDA, but it is vendor-bound)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回答你的问题:
To answer your questions:
如果您知道自己仅限于 3 维对象,那么您可能会考虑使用 double3 类型(如果您的 GPU 不支持双精度,则使用 float3 类型)。
到目前为止,仅支持向量,因此您必须自己对矩阵乘法或求逆的任何使用进行一些编码。但是,您可能对以下内置 几何函数。特别是,dot 产品和 <定义了 href="http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/cross.html" rel="noreferrer">交叉 产品。
您可能还有兴趣知道有 保留用于矩阵未来实现的数据类型:例如,参见 double n x m。就您的情况而言,如果将来可用,您将能够对矩阵使用 double3x3 类型。
If you know for a fact that you are limited to 3-dimensional objects, then you might consider using the double3 type (or float3 if your gpu doesn't support double precision).
So far, only vectors are supported, so you will have to do some coding yourself regarding any use of matrix multiplication or inversion. However, you might be interested in the following built-in geometric functions. In particular, dot products and cross products are defined.
You might also be interested to know that there are reserved data types for futures implentations of matrices: see for example double n x m. In your case, if available in the future, you will be able to use double3x3 types for your matrices.