用于SSE和AVX的SIMD数学库 [英] SIMD math libraries for SSE and AVX

查看:377
本文介绍了用于SSE和AVX的SIMD数学库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找SSE和AVX的SIMD数学库(最好是开源的).我的意思是,例如,如果我有一个具有8个浮点值的AVX寄存器v,我希望sin(v)一次返回所有8个值的sin.

I am looking for SIMD math libraries (preferably open source) for SSE and AVX. I mean for example if I have a AVX register v with 8 float values I want sin(v) to return the sin of all eight values at once.

AMD有一个专有图书馆Lib​​M http://developer.amd.com/tools/cpu-development/libm/具有一些SIMD数学功能,但LibM仅在检测到Intel CPU没有的FMA4时才使用AVX.另外,我不确定它是否完全使用了AVX,因为所有函数名称都以s4(d2)结尾,而不是以s8(d4)结尾.与Intel CPU上的标准数学库相比,它提供了更好的性能,但并没有更好.

AMD has a propreitery library, LibM http://developer.amd.com/tools/cpu-development/libm/ which has some SIMD math functions but LibM only uses AVX if it detects FMA4 which Intel CPUs don't have. Also I'm not sure it fully uses AVX as all the function names end in s4 (d2) and not s8 (d4). It give better performance than the standard math libraries on Intel CPUs but it's not much better.

英特尔将SVML作为其C ++编译器的一部分,但该编译器套件在Windows上非常昂贵.此外,英特尔削弱了非英特尔CPU上的库.

Intel has the SVML as part of it's C++ compiler but the compiler suite is very expensive on Windows. Additionally, Intel cripples the library on non-Intel CPUs.

我找到了以下AVX库, http://software-lisc.fbk.eu/avx_mathfun/,它支持一些数学函数(exp,log,sin,cos和sincos).它为我提供了非常快速的结果,比SVML更快,但是我尚未检查准确性.它仅适用于单个浮点,而不适用于Visual Studio(尽管这很容易修复).它基于另一个SSE库.

I found the following AVX library, http://software-lisc.fbk.eu/avx_mathfun/, which supports a few math functions (exp, log, sin, cos, and sincos). It gives very fast results for me, faster than SVML, but I have not checked the accuracy. It only works on single floating point and does not work in Visual Studio (though that would be easy to fix). It's based on another SSE library.

还有其他建议吗?

我发现一个SO线程对此主题有很多答案 C语言中的矢量Trig函数?

I found a SO thread that has many answers on this subject Vectorized Trig functions in C?

推荐答案

我已经实现了Vecmathlib https://bitbucket.org/eschnett/vecmathlib/作为其他两个项目(爱因斯坦工具包和pocl http://pocl.sourceforge.net/). Vecmathlib是开源的,是用C ++编写的.

I have implemented Vecmathlib https://bitbucket.org/eschnett/vecmathlib/ as a generic libraries for two other projects (The Einstein Toolkit, and pocl http://pocl.sourceforge.net/). Vecmathlib is open source, and is written in C++.

这篇关于用于SSE和AVX的SIMD数学库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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