Registered Member
|
I am trying to vectorize the summation of exponential function evaluations for a project I am working on. The code below shows the basic idea. I had hoped that the Eigen sum of the exponentials would be vectorized, and faster, but the output is
Time A: 1.192 Time B: 0.347 which says that the Eigen version is quite a bit slower. This is in MSVC with SSE2 enabled, and openMP for good measure but OPENMP doesn't seem to make a difference in the results. Anyone have any ideas? Am I missing something obvious?
|
Moderator
|
First of all, Eigen vectorizes exp for float only, not double. Then, your example is biased because sexp2 is not used, and therefore the compiler is free to cut out the loop. Using gcc and a modified benchmark I get:
Time A: 0.005229 Time B: 0.006288 using:
and using floats we see the effect of vectorization: Time A: 0.002032 Time B: 0.007636 |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]