BioMedIA / irtk-refactored-deprecated

Apache License 2.0
8 stars 7 forks source link

Add multi-threading support using TBB #60

Closed schuhschuh closed 8 years ago

schuhschuh commented 8 years ago

TBB is currently not listed in IRTKBuildDeps.cmake.

Here the code from the previous IRTKInclude.cmake:

# Option to produce multi-threaded executables using TBB
OPTION(BUILD_TBB_EXE "Build multi-threaded executables using TBB" OFF)
MARK_AS_ADVANCED(BUILD_TBB_EXE)

IF (BUILD_TBB_EXE)
  FIND_PACKAGE(TBB REQUIRED)
  IF (TBB_FOUND)
    # Attention: DO NOT define TBB_DEPRECATED by default or before including the
    #            other TBB header files, in particular parallel_for. The deprecated
    #            behavior of parallel_for is to not choose the chunk size (grainsize)
    #            automatically!
    #
    # http://software.intel.com/sites/products/documentation/doclib/tbb_sa/help/tbb_userguide/Automatic_Chunking.htm
    ADD_DEFINITIONS(-DHAS_TBB)
    INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIRS})
    LINK_DIRECTORIES(${TBB_LIBRARY_DIRS})
    LINK_LIBRARIES(${TBB_LIBRARIES})
  ENDIF (TBB_FOUND)
ENDIF(BUILD_TBB_EXE)

The option would of course now rather be called WITH_TBB, which I would recommend to automatically set to ON by default when TBB is available.