Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openvino: Add threading option supporting tbb and omp #23068

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions recipes/openvino/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class OpenvinoConan(ConanFile):
"enable_tf_frontend": [True, False],
"enable_tf_lite_frontend": [True, False],
"enable_paddle_frontend": [True, False],
"enable_pytorch_frontend": [True, False]
"enable_pytorch_frontend": [True, False],
# Threading
"threading": ["tbb", "omp"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • seq is also available to disable the threading
  • can we enable threading since 2024.4 ? because before that version OpenMP support was not enough tested / supported.

}
default_options = {
"shared": False,
Expand All @@ -63,7 +65,9 @@ class OpenvinoConan(ConanFile):
"enable_tf_frontend": True,
"enable_tf_lite_frontend": True,
"enable_paddle_frontend": True,
"enable_pytorch_frontend": True
"enable_pytorch_frontend": True,
# Threading
"threading": "tbb"
}

@property
Expand Down Expand Up @@ -166,7 +170,8 @@ def build_requirements(self):
self.tool_requires("cmake/[>=3.18 <4]")

def requirements(self):
self.requires("onetbb/2021.10.0")
if self.options.threading == "tbb":
self.requires("onetbb/2021.10.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.requires("onetbb/2021.10.0")
# https://github.com/openvinotoolkit/openvino/blob/2024.0.0/src/core/include/openvino/core/parallel.hpp#L186-L190
self.requires("onetbb/2021.10.0", transitive_headers=True, transitive_libs=True)

TBB includes are being used in a public header, if I understand it correctly.

self.requires("pugixml/1.14")
if self._target_x86_64:
self.requires("xbyak/6.73")
Expand Down Expand Up @@ -218,8 +223,14 @@ def generate(self):
toolchain.cache_variables["ENABLE_OV_ONNX_FRONTEND"] = self.options.enable_onnx_frontend
toolchain.cache_variables["ENABLE_OV_PYTORCH_FRONTEND"] = self.options.enable_pytorch_frontend
# Dependencies
toolchain.cache_variables["ENABLE_SYSTEM_TBB"] = True
toolchain.cache_variables["ENABLE_TBBBIND_2_5"] = False
if self.options.threading == "tbb":
toolchain.cache_variables["ENABLE_SYSTEM_TBB"] = True
toolchain.cache_variables["ENABLE_TBBBIND_2_5"] = False
toolchain.cache_variables["THREADING"] = "TBB"
else:
toolchain.cache_variables["ENABLE_SYSTEM_TBB"] = False
toolchain.cache_variables["ENABLE_TBBBIND_2_5"] = False
toolchain.cache_variables["THREADING"] = "OMP"
toolchain.cache_variables["ENABLE_SYSTEM_PUGIXML"] = True
if self._protobuf_required:
toolchain.cache_variables["ENABLE_SYSTEM_PROTOBUF"] = True
Expand Down Expand Up @@ -298,7 +309,10 @@ def package_info(self):

openvino_runtime = self.cpp_info.components["Runtime"]
openvino_runtime.set_property("cmake_target_name", "openvino::runtime")
openvino_runtime.requires = ["onetbb::libtbb", "pugixml::pugixml"]
if self.options.threading == "tbb":
openvino_runtime.requires = ["onetbb::libtbb", "pugixml::pugixml"]
else:
openvino_runtime.requires = ["pugixml::pugixml"]
Greendogo marked this conversation as resolved.
Show resolved Hide resolved
openvino_runtime.libs = ["openvino"]
if self._preprocessing_available:
openvino_runtime.requires.append("ade::ade")
Expand Down
Loading