yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11152
Re: EIGEN_NO_ALIGN
Hi Vaclav,
what I did is just removed flags "-DEIGEN_DONT_VECTORIZE
-DEIGEN_DONT_ALIGN -DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT"
for some builds. I had a couple of strange crashes somewhere in
quaternion-calculation, but now it seems OK. The speedup, which I measured
was only about 2%, so I am not sure, that it gives a positive effect. So,
from my point of view the vectorization in Yade code at the moment
is useless.
2014-07-30 8:58 GMT+02:00 Václav Šmilauer <eu@xxxxxxxx>:
> 1. supporting aligned types with boost::python (in minieigen) is hard or
> impossible, see http://lists.boost.org/boost-users/2008/04/35638.php ,
> http://stackoverflow.com/questions/17364949/make-boostpython-respect-data-alignment> ,
> http://stackoverflow.com/questions/13177573/how-to-expose-aligned-class-with-boost-python
> . But actually there seems to be no definitive statement that it is "not
> supported" and perhaps boost::python does the right thing automatically and
> problems come from elsewhere. I contacted the authors of boost::python
> directly to clarify that, there was no reaction.
>
> 2. All libraries MUST be compiled with EIGEN_NO_ALIGN or without it, mixing
> those will lead to crashes (packet instruction on unaligned address, leads
> to SIGFPU or SIGSEGV or SIGILL - don't remember anymore)
I see. We mostly use minieigen (without vectorization) from packages
and do not link minieigen directly to libyade. It seems, there are no crashes
at least.
> 3. Vectorization is only meaningful when compiling for targets supporting
> packet instructions from the SSE2 set (IIRC) and higher. Compiling with
> -march=i686 (which is what debian packages do by default) will probably
> produce functioning builds, but they will effectively have no vectorization.
> For that, -march=native (or something higher than i686 in general) is
> needed.
AFAIK (and according to Eigen3 FAQ) SSE2 instructions are enabled for
x86-64 archs by default [1]. Not sure about Debian. -march is not in default
flags either. Default flags, used for Debian packages are the following:
dpkg-buildflags --get CXXFLAGS
-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security
Maybe there are some "hidden" flags for each particular arch.
So, generally, I think the code should be adopted to use vectorization
(large matrices, simple operations with them etc.). Just enabling it, does
not give any visible benefit.
[1] http://eigen.tuxfamily.org/index.php?title=FAQ#How_can_I_enable_vectorization.3F
Cheers
Anton
References