ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.06k stars 412 forks source link

Tests only run Base versions of code #154

Closed ngzhian closed 3 years ago

ngzhian commented 3 years ago

By default the test runs only build Base, without any support of SSE/AVX. I was slightly confused by this:

$ git clone git@github.com:ermig1979/Simd.git
$ cd Simd
$ cmake -B build/ -S prj/cmake/
$ cmake --build build -j
$ ./build/Test -m=a -fe=Detection -fi=AlphaUnpremultiply

It looks like we hit this case https://github.com/ermig1979/Simd/blob/a51408c74f93c22652d57506b7909c0f3c59328a/prj/cmake/CMakeLists.txt#L172 and use COMMON_CXX_FLAGS which does not enable any extensions.

What is the recommended way to build tests with support for, e.g. SSE4.1? Should it be to add the flag -msse4.1 to that line in CMakeLists.txt?

ermig1979 commented 3 years ago

There is cmake parameter SIMD_TEST_FLAGS to build Test application with additional options. For example:

cmake -B build/ -S prj/cmake/ -DSIMD_TEST_FLAGS="-mavx2"

I can't set additional options to Test application by default because it will be crash on machines without support of coresponding extensions.

ngzhian commented 3 years ago

Thanks, I missed that CMake parameter. I guess it is possible to detect supported extensions on the current machine and set the flags appropriately, but I'm not sure how. This parameter will work, thanks!