How to use _mm256_log_ps by leveraging Intel OpenC

2019-08-27 12:06发布

I found that _mm256_log_ps can't be used with GCC7. Most common suggestions on stackoverflow is to use ICC or leveraging OpenCL SDK.

After downloading SDK and extracting RPM file, there are three .so files: __ocl_svml_l9.so, __ocl_svml_e9.so, __ocl_svml_h8.so

Can someone teach me how to call _mm256_log_ps with these .so files?

Thank you.

1条回答
The star\"
2楼-- · 2019-08-27 12:45

You can use the log function from the Eigen library:

#include <Eigen/Core>

void foo(float* data, int size)
{
    Eigen::Map<Eigen::ArrayXf> arr(data, size);
    arr = arr.log();
}

Depending on the compile flags this generates optimized SSE or AVX code (as well as SIMD for other architectures). The implementation is based on http://gruntthepeon.free.fr/ssemath/ which is based on cephes.

查看更多
登录 后发表回答