良好的便携式 SIMD 库

发布于 2024-07-25 04:35:29 字数 1539 浏览 2 评论 0 原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

飞烟轻若梦 2024-08-01 04:35:29

由于您提到了矩阵和向量的高级运算,ATLAS英特尔的 MKL, PLASMA

一些 C++ 矩阵数学库包括来自 Boost、Armadillo、Eigen、IT++ 和 Newmat 的 uBLAS。 POOMA 库可能也包含其中一些内容。 这个问题也涉及MTL。

如果您正在寻找较低级别的可移植性原语,我的一位同事开发了一个围绕 SSE2、Altivec、VSX、Larrabee 和 Cell SPE 矢量操作的包装器。 它可以在我们的 源存储库,但如果您想将其作为您工作的一部分进行分发,则其许可(学术)可能不合适。 它还仍在进行重大开发,以满足其目标应用需求的范围。

Since you mention high-level operations on matrices and vectors, ATLAS, Intel's MKL, PLASMA, and FLAME may be of interest.

Some C++ matrix math libraries include uBLAS from Boost, Armadillo, Eigen, IT++, and Newmat. The POOMA library probably also includes some of these things. This question also refers to MTL.

If you're looking for lower-level portability primitives, a colleague of mine has developed a wrapper around SSE2, Altivec, VSX, Larrabee, and Cell SPE vector operations. It can be found in our source repository, but its licensing (academic) may not be appropriate if you want to distribute it as part of your work. It is also still under significant development to cover the range of application needs that it's targeted at.

回眸一遍 2024-08-01 04:35:29

Eigen is an MPL2-licensed header-only C++ library that has vector / matrix math that is optimized for SSE, Neon, and Altivec. They have more more sophisticated math operations in their add-on modules.

痞味浪人 2024-08-01 04:35:29

尝试 liboil 或相关的 ORC. 特别是ORC很有趣; 它实现了一种高级汇编语言,该语言被编译成特定于体系结构的代码。 相当复杂,比简单的包装库要复杂得多。

Try liboil or the related ORC. Especially ORC is interesting; it implements a high-level assembly language that is compiled into architecture specific code. Pretty sophisticated, much more so than a simple wrapper library.

森末i 2024-08-01 04:35:29

如果您不介意使用汇编程序,那么您始终可以对所有 SIMD 指令使用内部函数。 它们将是特定于处理器的,即 SSE4 内在函数只能在支持 SSE4 的 CPU 上运行,并且由您来确保扩展存在。

此处有一篇关于应用 SIMD 的好文章。

但是,您可以使用无需任何外部库即可生成 SIMD 代码的编译器。 VectorC 应该不错,尽管我个人从未使用过它。 据我所知,它不需要任何特殊的库,它只是发现那些可以从 SIMD 中受益的源代码,并编译到您指定的任何级别的 SSE。

If you don't mind getting down and dirty with assembler then you can always use the intrinsic functions for all the SIMD instructions. They will be processor specific, i.e. SSE4 intrinsics will only run on SSE4 enabled CPUs and it's up to you to make sure the extensions are there.

There is a good article here about applying SIMD.

You could, however, use a compiler that generates SIMD code for you without any external libraries. VectorC is supposed to be good although I've never used it personally. It doesn't require any special libraries as far as I know, it just spots those bits of source code that can benfit from SIMD and compiles to whatever level of SSE you specify.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文