Open gpipelee opened 4 years ago
xtensor
is not linked to TBB
in xtensorConfig.cmake.in
. So users have to find TBB
and then link the target to it.
Is it a bug? The documentation https://xtensor.readthedocs.io/en/latest/build-options.html?highlight=XTENSOR_USE_TBB#external-dependencies says one can activate TBB
with only set(XTENSOR_USE_TBB 1)
I think we missed the link directive in the xtensorConfig.cmake.in file
There is another problem with find_dependency(TBB)
and find_package(TBB)
in xtensorConfig.cmake.in
. They both can only find the version, but not TBB_LIBRARIES
and TBB_INCLUDE_DIRS
. xtensor
has a customized FindTBB.cmake
. I am wondering what's the recommended way to make it work in xtensorConfig.cmake.in
Quoting @bluescarni from the Quantstack gitter channel
Usually for dependencies which do not provide CMake package config files I do ship FindXXX.cmake scripts, but I make sure to namespace them in order to minimise the chance of name collisions with other projects. For instance, if my library foo depends on library bar, I don't ship a Findbar.cmake, but rather a Findfoo_bar.cmake, and within Findfoo_bar.cmake I create an imported target called foo::bar, rather than something like bar::bar or similar.
I find this solution really stylish, we should implement it for TBB.
I'm trying to parallellize a for loop in which I sum submatrices to a given matrix. That is, I would like to do something like
Of course, in my actual code the views and the
rhs
of the+=
change over the iterations. The small example above fails to execute, and in my actual code the failure flags an 'heap corruption error'.I have a workaround, but this requires a new initialization for every kernel:
I'm not sure the tbb parallellized assignment of xtensor, i.e. the code below, is doing what I want...
Could you perhaps indicate the right way of doing what I want to do?