diff options
author | Ray Molenkamp <github@lazydodo.com> | 2019-11-13 06:55:39 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2019-11-13 06:55:39 +0300 |
commit | d60a60f0cb85087ddebcb47910847f1a0c4b916c (patch) | |
tree | ced2886d1048b56e2b02c4a24744f4d18b6d079d /build_files/build_environment/cmake/tbb.cmake | |
parent | c69872bd2ff31690156ca5c15a54de850d8e17a7 (diff) |
Add support for the TBB allocator on windows.
The heap on windows is single threaded causing it to lag behind linux in performance in allocation heavy multithreaded scenarios, BVH building is a prime example.
See https://developer.blender.org/D6218 for benchmark results
for testing with the allocator enabled/disabled you can set the environment variable TBB_MALLOC_DISABLE_REPLACEMENT=1 to disable the TBB allocator.
Reviewed By: @sergey
Differential Revision: https://developer.blender.org/D6218
Diffstat (limited to 'build_files/build_environment/cmake/tbb.cmake')
-rw-r--r-- | build_files/build_environment/cmake/tbb.cmake | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/build_files/build_environment/cmake/tbb.cmake b/build_files/build_environment/cmake/tbb.cmake index 26c52e00c76..597c1bfe00c 100644 --- a/build_files/build_environment/cmake/tbb.cmake +++ b/build_files/build_environment/cmake/tbb.cmake @@ -15,13 +15,21 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ***** END GPL LICENSE BLOCK ***** - -set(TBB_EXTRA_ARGS - -DTBB_BUILD_SHARED=Off - -DTBB_BUILD_TBBMALLOC=On - -DTBB_BUILD_TBBMALLOC_PROXY=Off - -DTBB_BUILD_STATIC=On +if(WIN32) + set(TBB_EXTRA_ARGS + -DTBB_BUILD_SHARED=On + -DTBB_BUILD_TBBMALLOC=On + -DTBB_BUILD_TBBMALLOC_PROXY=On + -DTBB_BUILD_STATIC=On ) +else() + set(TBB_EXTRA_ARGS + -DTBB_BUILD_SHARED=Off + -DTBB_BUILD_TBBMALLOC=On + -DTBB_BUILD_TBBMALLOC_PROXY=Off + -DTBB_BUILD_STATIC=On + ) +endif() # CMake script for TBB from https://github.com/wjakob/tbb/blob/master/CMakeLists.txt ExternalProject_Add(external_tbb @@ -39,6 +47,10 @@ if(WIN32) if(BUILD_MODE STREQUAL Release) ExternalProject_Add_Step(external_tbb after_install COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc.dll + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.dll COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tbb/include/ ${HARVEST_TARGET}/tbb/include/ DEPENDEES install ) @@ -46,6 +58,7 @@ if(WIN32) if(BUILD_MODE STREQUAL Debug) ExternalProject_Add_Step(external_tbb after_install COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib DEPENDEES install ) endif() |