You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Complex Calculate use avx2 are slower 3 times than normal #880
the time is Very different. the n=1e8,p=1. (12s with 4s). with n=1e6,p=1e2 time 1.1s(whit xsimd avx2) to 2.4s(normal) . I think maybe 2 reason. 1.the data input ,2 the data size could affect the time cost.
the code you use n=1e6,p=1e2 . with this parameter ,time ture speedup,I get the same with you. but when n=1e8,p=1,time will different,as i description above. when i change your code
//unsigned n = std::atoi("1000000");
// unsigned p = std::atoi("100");
unsigned n = std::atoi("100000000");
unsigned p = std::atoi("1");
unfortunately,can't execute. with n = std::atoi("1000000") p = std::atoi("100") certainly the time with yours. so if you make the n size enough,you will find time xmind will cost more, i debug find the internal ximd::sin or simd::cos time-consuming. if the data size small .such n=1e6 the function will not,but if you use n=1e8 and use std::sqrt((std::cos(x[i]) + std::sin(y[i])) / 2),not use std::sqrt((xmind::cos(x[i]) + xmind::sin(y[i])) / 2) time more
that great impact ximd::cos or ximd::sin, if the data size is small ,such you use n=1e6,not big different,but n=1e8,the result big different.)
Activity
serge-sans-paille commentedon Jan 10, 2023
Sorry, I cannot reproduce your timings. Here is the test program I've been using
compiled with
g++ test.cpp -O2 -mavx2 -o r -UUSE_XSIMD -DNDEBUG -Iinclude && time ./r 1000000 100org++ test.cpp -O2 -mavx2 -o r -DUSE_XSIMD -DNDEBUG -Iinclude && time ./r 1000000 100I get a consistent x2.5 speedup with xsimd on... same for
-O3and with clang.YggSky commentedon Jan 11, 2023
I use your code ,get the same result,even if i change the n=1e8,p=1. but when I change the data with my input
the time is Very different. the n=1e8,p=1. (12s with 4s). with n=1e6,p=1e2 time 1.1s(whit xsimd avx2) to 2.4s(normal) . I think maybe 2 reason. 1.the data input ,2 the data size could affect the time cost.
amyspark commentedon Jan 13, 2023
Here's a godbolt with the alternatives: https://godbolt.org/z/TosvEr9fz Both show the 2.5x speedup.
YggSky commentedon Jan 15, 2023
the code you use n=1e6,p=1e2 . with this parameter ,time ture speedup,I get the same with you. but when n=1e8,p=1,time will different,as i description above. when i change your code
unfortunately,can't execute. with n = std::atoi("1000000") p = std::atoi("100") certainly the time with yours. so if you make the n size enough,you will find time xmind will cost more, i debug find the internal ximd::sin or simd::cos time-consuming. if the data size small .such n=1e6 the function will not,but if you use n=1e8 and use
std::sqrt((std::cos(x[i]) + std::sin(y[i])) / 2),not use std::sqrt((xmind::cos(x[i]) + xmind::sin(y[i])) / 2)time morethat great impact ximd::cos or ximd::sin, if the data size is small ,such you use n=1e6,not big different,but n=1e8,the result big different.)