Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Check for 'dot' tool presence in PATH before calling in VisualizeTree pass and make it debug only (#28432)

Arseniy Obolenskiy4e3c4572e643
diff --git a/src/common/transformations/tests/offline_transformations/pruning_test.cpp b/src/common/transformations/tests/offline_transformations/pruning_test.cpp
index 3f8e9356692..924e25f6f42 100644
--- a/src/common/transformations/tests/offline_transformations/pruning_test.cpp
+++ b/src/common/transformations/tests/offline_transformations/pruning_test.cpp
@@ -4738,9 +4738,11 @@ TEST_F(TransformationTestsF, MaskPropagationComplexReshape) {
};
manager.register_pass<ov::pass::ShrinkWeights>();
- manager.register_pass<pass::VisualizeTree>(
- std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationComplexReshapeWithMasks.svg",
- modifier);
+ if (VISUALIZE_TESTS_TREE) {
+ manager.register_pass<pass::VisualizeTree>(
+ std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationComplexReshapeWithMasks.svg",
+ modifier);
+ }
}
comparator.enable(FunctionsComparator::CmpValues::ACCURACY);
}
@@ -4929,10 +4931,12 @@ TEST_P(TransformationTestsBoolParamF, MaskPropagationReshapedPassThroughP) {
};
manager.register_pass<ov::pass::ShrinkWeights>();
- auto postfix = (add_shape_of) ? "True" : "False";
- manager.register_pass<pass::VisualizeTree>(
- std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationReverseFlattenWithMasks" + postfix + ".svg",
- modifier);
+ if (VISUALIZE_TESTS_TREE) {
+ auto postfix = (add_shape_of) ? "True" : "False";
+ manager.register_pass<pass::VisualizeTree>(
+ std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationReverseFlattenWithMasks" + postfix + ".svg",
+ modifier);
+ }
comparator.enable(FunctionsComparator::CmpValues::ACCURACY);
}
diff --git a/src/core/src/pass/visualize_tree.cpp b/src/core/src/pass/visualize_tree.cpp
index 62e86abcc34..b74a8fcebe3 100644
--- a/src/core/src/pass/visualize_tree.cpp
+++ b/src/core/src/pass/visualize_tree.cpp
@@ -690,8 +690,11 @@ void ov::pass::VisualizeTree::render() const {
out.close();
if (!m_dot_only && ov::util::to_lower(ext) != ".dot") {
-#ifndef _WIN32
+#if defined(ENABLE_OPENVINO_DEBUG) && !defined(_WIN32)
std::stringstream ss;
+ if (system("command -v dot > /dev/null 2>&1") != 0) {
+ OPENVINO_THROW("Graphviz 'dot' command not found in PATH");
+ }
ss << "dot -T" << output_format << " " << dot_file << " -o" << m_name;
auto cmd = ss.str();
auto stream = popen(cmd.c_str(), "r");