Open JereKnuutinen opened 7 months ago
There is probably too little work to hide openmp overhead. The only place in the library OMP is used is this: https://github.com/ddemidov/mba/blob/9091b6702d7c6e8e4d50bd777c6d466052839c2c/mba/mba.hpp#L366, so you could comment it out if that makes it faster in your case.
Is there need for commenting since I think that compilers are suppose to ignore pragmas they do not understand?
I thought you want to keep using openmp in your outside project, but remove it from the mba code
I also noticed that the MBA does not give always same result if OpenMP is used in compilation. How that can be possible? If I do not use openMP or If I use older commits where openMP is not utilized this does not happen.
The only reason I can think of is that when using openmp the order of summation is unpredictable here:
https://github.com/ddemidov/mba/blob/3b296b212315b947f6094704f7c69fba5c1ed2e3/mba/mba.hpp#L414-L419
This could produce slightly different results with floating point arithmetic.
For some reason, the code gets slower when OpenMP is used together with the release build compared to case when I just comment target_link_libraries(example PUBLIC OpenMP::OpenMP_CXX) in my cmakelist. Is there some reason for this?