From a7dd186b060eb54151bac21c3e95273c951ab0bb Mon Sep 17 00:00:00 2001 From: "Sutic, Aleksandar" Date: Tue, 22 Oct 2024 16:17:56 -0700 Subject: [PATCH 1/4] [openvino] Support debug builds --- recipes/openvino/all/conanfile.py | 86 ++++++++++++++++++------------- 1 file changed, 51 insertions(+), 35 deletions(-) diff --git a/recipes/openvino/all/conanfile.py b/recipes/openvino/all/conanfile.py index 8e6af66ae2c3f..ee780d6d18af0 100644 --- a/recipes/openvino/all/conanfile.py +++ b/recipes/openvino/all/conanfile.py @@ -44,7 +44,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", "seq"] } default_options = { "shared": False, @@ -62,7 +64,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 @@ -169,7 +173,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") self.requires("pugixml/1.14") if self._target_x86_64: self.requires("xbyak/6.73") @@ -227,8 +232,15 @@ 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_SYSTEM_TBB"] = False toolchain.cache_variables["ENABLE_TBBBIND_2_5"] = False + if self.options.threading == "tbb": + toolchain.cache_variables["ENABLE_SYSTEM_TBB"] = True + toolchain.cache_variables["THREADING"] = "TBB" + elif self.options.threading == "omp": + toolchain.cache_variables["THREADING"] = "OMP" + else: + toolchain.cache_variables["THREADING"] = "SEQ" toolchain.cache_variables["ENABLE_SYSTEM_PUGIXML"] = True if self._protobuf_required: toolchain.cache_variables["ENABLE_SYSTEM_PROTOBUF"] = True @@ -301,14 +313,18 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + debug = "d" if self.settings.build_type == "Debug" and self.settings.os == "Windows" else "" + self.cpp_info.set_property("cmake_find_mode", "config") self.cpp_info.set_property("cmake_file_name", "OpenVINO") self.cpp_info.set_property("pkg_config_name", "openvino") openvino_runtime = self.cpp_info.components["Runtime"] openvino_runtime.set_property("cmake_target_name", "openvino::runtime") - openvino_runtime.requires = ["onetbb::libtbb", "pugixml::pugixml"] - openvino_runtime.libs = ["openvino"] + openvino_runtime.requires = ["pugixml::pugixml"] + if self.options.threading == "tbb": + openvino_runtime.append("onetbb::libtbb") + openvino_runtime.libs = [f"openvino{debug}"] if self._preprocessing_available: openvino_runtime.requires.append("ade::ade") if self._target_x86_64: @@ -326,54 +342,54 @@ def package_info(self): if not self.options.shared: # HW plugins if self.options.enable_cpu: - openvino_runtime.libs.append("openvino_arm_cpu_plugin" if self._target_arm else \ - "openvino_intel_cpu_plugin") - openvino_runtime.libs.extend(["openvino_onednn_cpu", "openvino_snippets", "mlas"]) + openvino_runtime.libs.append(f"openvino_arm_cpu_plugin{debug}" if self._target_arm else \ + f"openvino_intel_cpu_plugin{debug}") + openvino_runtime.libs.extend([f"openvino_onednn_cpu{debug}", f"openvino_snippets{debug}", f"mlas{debug}"]) if self._target_arm: - openvino_runtime.libs.append("arm_compute-static") + openvino_runtime.libs.append(f"arm_compute-static{debug}") if self.options.get_safe("enable_gpu"): - openvino_runtime.libs.extend(["openvino_intel_gpu_plugin", "openvino_intel_gpu_graph", - "openvino_intel_gpu_runtime", "openvino_intel_gpu_kernels"]) + openvino_runtime.libs.extend([f"openvino_intel_gpu_plugin{debug}", f"openvino_intel_gpu_graph{debug}", + f"openvino_intel_gpu_runtime{debug}", f"openvino_intel_gpu_kernels{debug}"]) if not self.options.enable_cpu or Version(self.version) >= "2024.4.0": - openvino_runtime.libs.append("openvino_onednn_gpu") + openvino_runtime.libs.append(f"openvino_onednn_gpu{debug}") # SW plugins if self.options.enable_auto: - openvino_runtime.libs.append("openvino_auto_plugin") + openvino_runtime.libs.append(f"openvino_auto_plugin{debug}") if self.options.enable_hetero: - openvino_runtime.libs.append("openvino_hetero_plugin") + openvino_runtime.libs.append(f"openvino_hetero_plugin{debug}") if self.options.enable_auto_batch: - openvino_runtime.libs.append("openvino_auto_batch_plugin") + openvino_runtime.libs.append(f"openvino_auto_batch_plugin{debug}") # Preprocessing should come after plugins, because plugins depend on it if self._preprocessing_available: - openvino_runtime.libs.extend(["openvino_gapi_preproc", "fluid"]) + openvino_runtime.libs.extend([f"openvino_gapi_preproc{debug}", f"fluid{debug}"]) # Frontends if self.options.enable_ir_frontend: - openvino_runtime.libs.append("openvino_ir_frontend") + openvino_runtime.libs.append(f"openvino_ir_frontend{debug}") if self.options.enable_onnx_frontend: - openvino_runtime.libs.extend(["openvino_onnx_frontend", "openvino_onnx_common"]) + openvino_runtime.libs.extend([f"openvino_onnx_frontend{debug}", f"openvino_onnx_common{debug}"]) openvino_runtime.requires.extend(["protobuf::libprotobuf", "onnx::onnx"]) if self.options.enable_tf_frontend: - openvino_runtime.libs.extend(["openvino_tensorflow_frontend"]) + openvino_runtime.libs.extend([f"openvino_tensorflow_frontend{debug}"]) openvino_runtime.requires.extend(["protobuf::libprotobuf", "snappy::snappy"]) if self.options.enable_tf_lite_frontend: - openvino_runtime.libs.extend(["openvino_tensorflow_lite_frontend"]) + openvino_runtime.libs.extend([f"openvino_tensorflow_lite_frontend{debug}"]) openvino_runtime.requires.extend(["flatbuffers::flatbuffers"]) if self.options.enable_tf_frontend or self.options.enable_tf_lite_frontend: - openvino_runtime.libs.extend(["openvino_tensorflow_common"]) + openvino_runtime.libs.extend([f"openvino_tensorflow_common{debug}"]) if self.options.enable_paddle_frontend: - openvino_runtime.libs.append("openvino_paddle_frontend") + openvino_runtime.libs.append(f"openvino_paddle_frontend{debug}") openvino_runtime.requires.append("protobuf::libprotobuf") if self.options.enable_pytorch_frontend: - openvino_runtime.libs.append("openvino_pytorch_frontend") + openvino_runtime.libs.append(f"openvino_pytorch_frontend{debug}") # Common private dependencies should go last, because they satisfy dependencies for all other libraries if Version(self.version) < "2024.0.0": - openvino_runtime.libs.append("openvino_builders") - openvino_runtime.libs.extend(["openvino_reference", "openvino_shape_inference", "openvino_itt", + openvino_runtime.libs.append(f"openvino_builders{debug}") + openvino_runtime.libs.extend([f"openvino_reference{debug}", f"openvino_shape_inference{debug}", f"openvino_itt{debug}", # utils goes last since all others depend on it - "openvino_util"]) + f"openvino_util{debug}"]) # set 'openvino' once again for transformations objects files (cyclic dependency) - # openvino_runtime.libs.append("openvino") - full_openvino_lib_path = os.path.join(self.package_folder, "lib", "openvino.lib").replace("\\", "/") if self.settings.os == "Windows" else \ + # openvino_runtime.libs.append(f"openvino{debug}") + full_openvino_lib_path = os.path.join(self.package_folder, "lib", f"openvino{debug}.lib").replace("\\", "/") if self.settings.os == "Windows" else \ os.path.join(self.package_folder, "lib", "libopenvino.a") openvino_runtime.system_libs.insert(0, full_openvino_lib_path) # Add definition to prevent symbols importing @@ -386,35 +402,35 @@ def package_info(self): openvino_runtime_c = self.cpp_info.components["Runtime_C"] openvino_runtime_c.set_property("cmake_target_name", "openvino::runtime::c") - openvino_runtime_c.libs = ["openvino_c"] + openvino_runtime_c.libs = [f"openvino_c{debug}"] openvino_runtime_c.requires = ["Runtime"] if self.options.enable_onnx_frontend: openvino_onnx = self.cpp_info.components["ONNX"] openvino_onnx.set_property("cmake_target_name", "openvino::frontend::onnx") - openvino_onnx.libs = ["openvino_onnx_frontend"] + openvino_onnx.libs = [f"openvino_onnx_frontend{debug}"] openvino_onnx.requires = ["Runtime", "onnx::onnx", "protobuf::libprotobuf"] if self.options.enable_paddle_frontend: openvino_paddle = self.cpp_info.components["Paddle"] openvino_paddle.set_property("cmake_target_name", "openvino::frontend::paddle") - openvino_paddle.libs = ["openvino_paddle_frontend"] + openvino_paddle.libs = [f"openvino_paddle_frontend{debug}"] openvino_paddle.requires = ["Runtime", "protobuf::libprotobuf"] if self.options.enable_tf_frontend: openvino_tensorflow = self.cpp_info.components["TensorFlow"] openvino_tensorflow.set_property("cmake_target_name", "openvino::frontend::tensorflow") - openvino_tensorflow.libs = ["openvino_tensorflow_frontend"] + openvino_tensorflow.libs = [f"openvino_tensorflow_frontend{debug}"] openvino_tensorflow.requires = ["Runtime", "protobuf::libprotobuf", "snappy::snappy"] if self.options.enable_pytorch_frontend: openvino_pytorch = self.cpp_info.components["PyTorch"] openvino_pytorch.set_property("cmake_target_name", "openvino::frontend::pytorch") - openvino_pytorch.libs = ["openvino_pytorch_frontend"] + openvino_pytorch.libs = [f"openvino_pytorch_frontend{debug}"] openvino_pytorch.requires = ["Runtime"] if self.options.enable_tf_lite_frontend: openvino_tensorflow_lite = self.cpp_info.components["TensorFlowLite"] openvino_tensorflow_lite.set_property("cmake_target_name", "openvino::frontend::tensorflow_lite") - openvino_tensorflow_lite.libs = ["openvino_tensorflow_lite_frontend"] + openvino_tensorflow_lite.libs = [f"openvino_tensorflow_lite_frontend{debug}"] openvino_tensorflow_lite.requires = ["Runtime", "flatbuffers::flatbuffers"] From 8c1e1f8ca0837d52a963fb7d935fb966bebe962d Mon Sep 17 00:00:00 2001 From: "Sutic, Aleksandar" Date: Thu, 24 Oct 2024 17:01:54 -0700 Subject: [PATCH 2/4] Address review comments --- recipes/openvino/all/conanfile.py | 64 ++++++++++++++++--------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/recipes/openvino/all/conanfile.py b/recipes/openvino/all/conanfile.py index ee780d6d18af0..70abd522dc918 100644 --- a/recipes/openvino/all/conanfile.py +++ b/recipes/openvino/all/conanfile.py @@ -313,7 +313,9 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - debug = "d" if self.settings.build_type == "Debug" and self.settings.os == "Windows" else "" + def l(name): + debug = "d" if self.settings.build_type == "Debug" and self.settings.os in ["Windows", "Macos"] else "" + return f"{name}{debug}" self.cpp_info.set_property("cmake_find_mode", "config") self.cpp_info.set_property("cmake_file_name", "OpenVINO") @@ -324,7 +326,7 @@ def package_info(self): openvino_runtime.requires = ["pugixml::pugixml"] if self.options.threading == "tbb": openvino_runtime.append("onetbb::libtbb") - openvino_runtime.libs = [f"openvino{debug}"] + openvino_runtime.libs = [l("openvino")] if self._preprocessing_available: openvino_runtime.requires.append("ade::ade") if self._target_x86_64: @@ -342,54 +344,54 @@ def package_info(self): if not self.options.shared: # HW plugins if self.options.enable_cpu: - openvino_runtime.libs.append(f"openvino_arm_cpu_plugin{debug}" if self._target_arm else \ - f"openvino_intel_cpu_plugin{debug}") - openvino_runtime.libs.extend([f"openvino_onednn_cpu{debug}", f"openvino_snippets{debug}", f"mlas{debug}"]) + openvino_runtime.libs.append(l("openvino_arm_cpu_plugin") if self._target_arm else \ + l("openvino_intel_cpu_plugin")) + openvino_runtime.libs.extend([l("openvino_onednn_cpu"), l("openvino_snippets"), l("mlas")]) if self._target_arm: - openvino_runtime.libs.append(f"arm_compute-static{debug}") + openvino_runtime.libs.append(l("arm_compute-static")) if self.options.get_safe("enable_gpu"): - openvino_runtime.libs.extend([f"openvino_intel_gpu_plugin{debug}", f"openvino_intel_gpu_graph{debug}", - f"openvino_intel_gpu_runtime{debug}", f"openvino_intel_gpu_kernels{debug}"]) + openvino_runtime.libs.extend([l("openvino_intel_gpu_plugin"), l("openvino_intel_gpu_graph"), + l("openvino_intel_gpu_runtime"), l("openvino_intel_gpu_kernels")]) if not self.options.enable_cpu or Version(self.version) >= "2024.4.0": - openvino_runtime.libs.append(f"openvino_onednn_gpu{debug}") + openvino_runtime.libs.append(l("openvino_onednn_gpu")) # SW plugins if self.options.enable_auto: - openvino_runtime.libs.append(f"openvino_auto_plugin{debug}") + openvino_runtime.libs.append(l("openvino_auto_plugin")) if self.options.enable_hetero: - openvino_runtime.libs.append(f"openvino_hetero_plugin{debug}") + openvino_runtime.libs.append(l("openvino_hetero_plugin")) if self.options.enable_auto_batch: - openvino_runtime.libs.append(f"openvino_auto_batch_plugin{debug}") + openvino_runtime.libs.append(l("openvino_auto_batch_plugin")) # Preprocessing should come after plugins, because plugins depend on it if self._preprocessing_available: - openvino_runtime.libs.extend([f"openvino_gapi_preproc{debug}", f"fluid{debug}"]) + openvino_runtime.libs.extend([l("openvino_gapi_preproc"), l("fluid")]) # Frontends if self.options.enable_ir_frontend: - openvino_runtime.libs.append(f"openvino_ir_frontend{debug}") + openvino_runtime.libs.append(l("openvino_ir_frontend")) if self.options.enable_onnx_frontend: - openvino_runtime.libs.extend([f"openvino_onnx_frontend{debug}", f"openvino_onnx_common{debug}"]) + openvino_runtime.libs.extend([l("openvino_onnx_frontend"), l("openvino_onnx_common")]) openvino_runtime.requires.extend(["protobuf::libprotobuf", "onnx::onnx"]) if self.options.enable_tf_frontend: - openvino_runtime.libs.extend([f"openvino_tensorflow_frontend{debug}"]) + openvino_runtime.libs.extend([l("openvino_tensorflow_frontend")]) openvino_runtime.requires.extend(["protobuf::libprotobuf", "snappy::snappy"]) if self.options.enable_tf_lite_frontend: - openvino_runtime.libs.extend([f"openvino_tensorflow_lite_frontend{debug}"]) + openvino_runtime.libs.extend([l("openvino_tensorflow_lite_frontend")]) openvino_runtime.requires.extend(["flatbuffers::flatbuffers"]) if self.options.enable_tf_frontend or self.options.enable_tf_lite_frontend: - openvino_runtime.libs.extend([f"openvino_tensorflow_common{debug}"]) + openvino_runtime.libs.extend([l("openvino_tensorflow_common")]) if self.options.enable_paddle_frontend: - openvino_runtime.libs.append(f"openvino_paddle_frontend{debug}") + openvino_runtime.libs.append(l("openvino_paddle_frontend")) openvino_runtime.requires.append("protobuf::libprotobuf") if self.options.enable_pytorch_frontend: - openvino_runtime.libs.append(f"openvino_pytorch_frontend{debug}") + openvino_runtime.libs.append(l("openvino_pytorch_frontend")) # Common private dependencies should go last, because they satisfy dependencies for all other libraries if Version(self.version) < "2024.0.0": - openvino_runtime.libs.append(f"openvino_builders{debug}") - openvino_runtime.libs.extend([f"openvino_reference{debug}", f"openvino_shape_inference{debug}", f"openvino_itt{debug}", + openvino_runtime.libs.append(l("openvino_builders")) + openvino_runtime.libs.extend([l("openvino_reference"), l("openvino_shape_inference"), l("openvino_itt"), # utils goes last since all others depend on it - f"openvino_util{debug}"]) + l("openvino_util")]) # set 'openvino' once again for transformations objects files (cyclic dependency) - # openvino_runtime.libs.append(f"openvino{debug}") - full_openvino_lib_path = os.path.join(self.package_folder, "lib", f"openvino{debug}.lib").replace("\\", "/") if self.settings.os == "Windows" else \ + # openvino_runtime.libs.append(l("openvino")) + full_openvino_lib_path = os.path.join(self.package_folder, "lib", l("openvino") + ".lib").replace("\\", "/") if self.settings.os == "Windows" else \ os.path.join(self.package_folder, "lib", "libopenvino.a") openvino_runtime.system_libs.insert(0, full_openvino_lib_path) # Add definition to prevent symbols importing @@ -402,35 +404,35 @@ def package_info(self): openvino_runtime_c = self.cpp_info.components["Runtime_C"] openvino_runtime_c.set_property("cmake_target_name", "openvino::runtime::c") - openvino_runtime_c.libs = [f"openvino_c{debug}"] + openvino_runtime_c.libs = [l("openvino_c")] openvino_runtime_c.requires = ["Runtime"] if self.options.enable_onnx_frontend: openvino_onnx = self.cpp_info.components["ONNX"] openvino_onnx.set_property("cmake_target_name", "openvino::frontend::onnx") - openvino_onnx.libs = [f"openvino_onnx_frontend{debug}"] + openvino_onnx.libs = [l("openvino_onnx_frontend")] openvino_onnx.requires = ["Runtime", "onnx::onnx", "protobuf::libprotobuf"] if self.options.enable_paddle_frontend: openvino_paddle = self.cpp_info.components["Paddle"] openvino_paddle.set_property("cmake_target_name", "openvino::frontend::paddle") - openvino_paddle.libs = [f"openvino_paddle_frontend{debug}"] + openvino_paddle.libs = [l("openvino_paddle_frontend")] openvino_paddle.requires = ["Runtime", "protobuf::libprotobuf"] if self.options.enable_tf_frontend: openvino_tensorflow = self.cpp_info.components["TensorFlow"] openvino_tensorflow.set_property("cmake_target_name", "openvino::frontend::tensorflow") - openvino_tensorflow.libs = [f"openvino_tensorflow_frontend{debug}"] + openvino_tensorflow.libs = [l("openvino_tensorflow_frontend")] openvino_tensorflow.requires = ["Runtime", "protobuf::libprotobuf", "snappy::snappy"] if self.options.enable_pytorch_frontend: openvino_pytorch = self.cpp_info.components["PyTorch"] openvino_pytorch.set_property("cmake_target_name", "openvino::frontend::pytorch") - openvino_pytorch.libs = [f"openvino_pytorch_frontend{debug}"] + openvino_pytorch.libs = [l("openvino_pytorch_frontend")] openvino_pytorch.requires = ["Runtime"] if self.options.enable_tf_lite_frontend: openvino_tensorflow_lite = self.cpp_info.components["TensorFlowLite"] openvino_tensorflow_lite.set_property("cmake_target_name", "openvino::frontend::tensorflow_lite") - openvino_tensorflow_lite.libs = [f"openvino_tensorflow_lite_frontend{debug}"] + openvino_tensorflow_lite.libs = [l("openvino_tensorflow_lite_frontend")] openvino_tensorflow_lite.requires = ["Runtime", "flatbuffers::flatbuffers"] From fef9485e97a9461836416a02da87842468f1fde1 Mon Sep 17 00:00:00 2001 From: "Sutic, Aleksandar" Date: Fri, 25 Oct 2024 12:19:25 -0700 Subject: [PATCH 3/4] OneDNN doesn't modify its debug library name --- recipes/openvino/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openvino/all/conanfile.py b/recipes/openvino/all/conanfile.py index 70abd522dc918..2af63395b676e 100644 --- a/recipes/openvino/all/conanfile.py +++ b/recipes/openvino/all/conanfile.py @@ -353,7 +353,7 @@ def l(name): openvino_runtime.libs.extend([l("openvino_intel_gpu_plugin"), l("openvino_intel_gpu_graph"), l("openvino_intel_gpu_runtime"), l("openvino_intel_gpu_kernels")]) if not self.options.enable_cpu or Version(self.version) >= "2024.4.0": - openvino_runtime.libs.append(l("openvino_onednn_gpu")) + openvino_runtime.libs.append("openvino_onednn_gpu") # SW plugins if self.options.enable_auto: openvino_runtime.libs.append(l("openvino_auto_plugin")) From da40cd35be734206f38136a209104faa946aef04 Mon Sep 17 00:00:00 2001 From: "Sutic, Aleksandar" Date: Mon, 28 Oct 2024 12:27:09 -0700 Subject: [PATCH 4/4] Fix typo for TBB runtime --- recipes/openvino/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openvino/all/conanfile.py b/recipes/openvino/all/conanfile.py index 2af63395b676e..1b15c1720aae8 100644 --- a/recipes/openvino/all/conanfile.py +++ b/recipes/openvino/all/conanfile.py @@ -325,7 +325,7 @@ def l(name): openvino_runtime.set_property("cmake_target_name", "openvino::runtime") openvino_runtime.requires = ["pugixml::pugixml"] if self.options.threading == "tbb": - openvino_runtime.append("onetbb::libtbb") + openvino_runtime.requires.append("onetbb::libtbb") openvino_runtime.libs = [l("openvino")] if self._preprocessing_available: openvino_runtime.requires.append("ade::ade")