I am trying to build ITK-5.0.0 with TBB.
I have already successfully built TBB.
After cmake config I get this error
Could not find a package configuration file provided by "TBB" with any of
the following names:
TBBConfig.cmake
tbb-config.cmake
Add the installation prefix of "TBB" to CMAKE_PREFIX_PATH or set "TBB_DIR"
to a directory containing one of the above files.
TBB is not a normal CMake-managed library. Instead of creating a TBBConfig.cmake file when you build it, they provide a way for you to generate a customized version of TBBConfig.cmake. But the binary release of TBB does contain TBBConfig.cmake, which is what you are supposed to point at when configuring ITK.
@hjmjohnson has tried to convince TBB people to add better CMake support, and might have further suggestions.
But ITK-4.13 did not require TBBConfig.cmake
It only has TBBFind.cmake file.
I want to understand what is the difference between this two versions.
Thank you
Plain ITK-4.13 did not make use of TBB at all. Only the remote module TBBImageToImageFilter did. And the drawback of FindTBB.cmake approach is necessity of specifying about 20 paths for include directories and release and debug libraries for TBB components (tbb, tbb_malloc, tbbmalloc_proxy etc). Also, there is an outstanding PR which adds back FindTBB.cmake. It would be good if you tested and reviewed that PR - it might be a solution you are looking for.
Would it be possible to use a newer version of TBB? Versions of TBB since about late 2017 come with a TBBConfig.cmake file which does away with the need for the FindTBB.cmake at all.
I am testing it right now.
And one more question.
When I configure with cmake it has variable with name TBB_MALLOC_PROXY_LIBRARY. Is it required to give path to that file?
I applied patch to 5.0.0, it compiles fine, but for running examples it still causes error
CMake Error at /usr/local/lib/cmake/ITK-5.0/Modules/ITKTBB.cmake:15 (find_package):
Could not find a package configuration file provided by "TBB" with any of
the following names:
TBBConfig.cmake
tbb-config.cmake
Add the installation prefix of "TBB" to CMAKE_PREFIX_PATH or set "TBB_DIR"
to a directory containing one of the above files. If "TBB" provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
/usr/local/lib/cmake/ITK-5.0/ITKModuleAPI.cmake:76 (include)
/usr/local/lib/cmake/ITK-5.0/ITKModuleAPI.cmake:31 (itk_module_load)
/usr/local/lib/cmake/ITK-5.0/ITKModuleAPI.cmake:129 (_itk_module_config_recurse)
/usr/local/lib/cmake/ITK-5.0/ITKConfig.cmake:82 (itk_module_config)
CMakeLists.txt:19 (find_package)
And the last question please.
When I am building there is TBB_DIR variable. I can not understand which directory path I have to give to that variable.
Do you have any idea?
Just to make it clear.
As I understand 4.13 version does not have TBB_DIR variable, so we don’t need to have TBBConfig.cmake file.
And 5.0.0 requires TBBConfig.cmake file.
Am I right?
ITK 4.13 did not have TBB support. ITK 5.0 has support for TBB, and requires TBBConfig.cmake which comes with newer binary distributions of TBB. TBB also has a procedure to generate TBBConfig.cmake for a TBB you compiled yourself, but that is not easy. PR991 tries to alleviate the restriction of requiring TBBConfig.cmake.
And you don’t have to build with TBB - that is an optional feature which allows better load balancing, and is supposed to ease general parallel performance, especially when ITK-based program is not the only one making high CPU use.
Right,
I have tried this version already, the problem is I can not run examples to see if library has been built successfully or not, because it anyway needs TBB_DIR( TBBConfig.cmake).
In this case how can i test libraries?
Can you run the prebuilt binaries from Intel? You can download them from Github. https://github.com/intel/tbb/releases The precompiled binaries work with all the compilers that ITK 5 supports so in general this should not be an issue. The only reason I can think of is that your internal IT policy forbids you to download precompiled binaries. Could you elaborate more on why you cannot use the precompiled binaries for TBB?
The reason why, is that we are using a commercial thirdparty library which comes with tbb. To avoid conflicts, we build tbb ourselves, adding a prefix to the library names. The build process of TBB (for Windows), however, does not generate the appropriate TBBConfig.cmake file.
If you build TBB on Windows it does not generate a TBBConfig.cmake.
We build TBB with a prefix for all libs, to avoid any conflict with TBB coming from a package we license from Spatial. This was the purpose of the patch, so I can manually specify the different library paths.