bvh icon indicating copy to clipboard operation
bvh copied to clipboard

Make OpenMP optional

Open reduz opened this issue 3 years ago • 3 comments

OpenMP requires separate redistributable for MSVC, an option to remove the dependency or use C++11 threads would be appreciated (even at the cost of slower BVH building).

reduz avatar Dec 15 '20 18:12 reduz

I may do this in the future, and in fact I have been thinking about it for some time. However, some people already use OpenMP/TBB/<insert your parallel programming library here> (I myself use OpenMP in my renderer), and thus shipping yet another thread pool implementation along with this library is not a very good idea. Thus, making this work without OpenMP means I have to design my own generic interface to OpenMP/TBB/<other library>, which is obviously harder than just using std::thread.

Note that OpenMP is simply disabled for MSVC so you shouldn't have any problem building this on Windows, and there should not be any added dependency on the generated executables. The traversal algorithms are in any case not parallelized (it's the user's responsibility to choose how to do that), only the construction algorithms benefit from OpenMP.

madmann91 avatar Dec 15 '20 19:12 madmann91

Re-reading your question again, it seems that you just want to disable OpenMP on Windows, which should already be the case (since OpenMP 3.0 is not supported there). Could you clarify your issue? Or did you mean something else?

madmann91 avatar Dec 17 '20 12:12 madmann91

Sorry, just catching up. Yeah, ideally would prefer a custom threadpool in C++11 since this is more portable, but if OpenMP gets disabled I guess it can be good enough. We are still evaluating alternatives, but if we end up going with this library we may pull request this implementation ourselves.

reduz avatar Dec 17 '20 13:12 reduz

The v2 branch now incorporates a custom thread pool based on std::thread.

madmann91 avatar Aug 09 '23 11:08 madmann91