SWIFTSIM / SWIFT

Modern astrophysics and cosmology particle-based code. Mirror of gitlab developments at https://gitlab.cosma.dur.ac.uk/swift/swiftsim
http://www.swiftsim.com
GNU Lesser General Public License v3.0
88 stars 58 forks source link

AVX2 vectorization seems to cause to errors in tests #11

Open Harry-Chen opened 5 years ago

Harry-Chen commented 5 years ago

I tried to compile swift with icc 18 successfully, but encountered some errors when running make check.

If I do not provide any specific CFLAGS when running configuration script, it will automatically use -O3 -ansi-alias -xCORE-AVX2, which leads to:

If I use --no-vec, the script will use -O3 -xCORE-AVX2 -ansi-alias -no-simd -no-vec (weird that -xCORE-AVX2 still exists), which leads to:

If I disable AVX2 by manually specifying --no-optimization and CFLAGS="-O3 -mavx", all tests will pass.

By trying more compiling options I believe that enabling AVX2 does cause these tests to fail. I also read your jenkins build output and found that your CI server does not support AVX2 so that no errors were reported.

MatthieuSchaller commented 5 years ago

Hi! Thanks. We'll look into it.

Indeed our testing platform uses only AVX. Most likely a tolerance issue as we made sure our tests get for numerical accuracy get within a very narrow window. Some vectorized functions may push you out of that window depending on the compiler and level of instructions.
What compiler are you using for these tests?

Note that -xCORE-AVX2 activates more instructions than just the AVX2 set (despite what the name indicates) and it does hence make sense to have --no-vec -xCORE-AVX2 if you want all the benefits of the other instructions but want to prevent just SIMD.

Harry-Chen commented 5 years ago

The compiler I use is Intel ICC 18.0.3.

Most likely a tolerance issue as we made sure our tests get for numerical accuracy get within a very narrow window. Some vectorized functions may push you out of that window depending on the compiler and level of instructions.

This may be the case, as I noticed that some test cases have strict conditions. For example, testMaths only allows a relative error less than 4e-8, and enabling AVX2 gives one of 6e-8, which made it fail.