From a1946c69461a60e4c1d996375984d2d2e95b6bf8 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 14 Jan 2025 10:42:43 +0100 Subject: [PATCH 1/3] Check 'dot' tool presence in PATH before calling in visualize tree --- src/core/src/pass/visualize_tree.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/src/pass/visualize_tree.cpp b/src/core/src/pass/visualize_tree.cpp index 62e86abcc34b63..2068db3476b1d8 100644 --- a/src/core/src/pass/visualize_tree.cpp +++ b/src/core/src/pass/visualize_tree.cpp @@ -692,6 +692,9 @@ void ov::pass::VisualizeTree::render() const { if (!m_dot_only && ov::util::to_lower(ext) != ".dot") { #ifndef _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"); From b8906b32f8eb2a7d98fb2026cdb3580de48644bc Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 14 Jan 2025 13:50:17 +0100 Subject: [PATCH 2/3] Hide render under debug flag and add missing visualization test if-stmts --- .../offline_transformations/pruning_test.cpp | 18 +++++++++++------- src/core/src/pass/visualize_tree.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/common/transformations/tests/offline_transformations/pruning_test.cpp b/src/common/transformations/tests/offline_transformations/pruning_test.cpp index 3f8e9356692ec8..924e25f6f42d22 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(); - manager.register_pass( - std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationComplexReshapeWithMasks.svg", - modifier); + if (VISUALIZE_TESTS_TREE) { + manager.register_pass( + std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationComplexReshapeWithMasks.svg", + modifier); + } } comparator.enable(FunctionsComparator::CmpValues::ACCURACY); } @@ -4929,10 +4931,12 @@ TEST_P(TransformationTestsBoolParamF, MaskPropagationReshapedPassThroughP) { }; manager.register_pass(); - auto postfix = (add_shape_of) ? "True" : "False"; - manager.register_pass( - std::string(VISUALIZE_TREE_ROOT) + "MaskPropagationReverseFlattenWithMasks" + postfix + ".svg", - modifier); + if (VISUALIZE_TESTS_TREE) { + auto postfix = (add_shape_of) ? "True" : "False"; + manager.register_pass( + 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 2068db3476b1d8..1ea28435d96139 100644 --- a/src/core/src/pass/visualize_tree.cpp +++ b/src/core/src/pass/visualize_tree.cpp @@ -690,7 +690,7 @@ void ov::pass::VisualizeTree::render() const { out.close(); if (!m_dot_only && ov::util::to_lower(ext) != ".dot") { -#ifndef _WIN32 +#if defined(ENABLE_DEBUG_CAPS) && !defined(_WIN32) std::stringstream ss; if (system("command -v dot > /dev/null 2>&1") != 0) { OPENVINO_THROW("Graphviz 'dot' command not found in PATH"); From da165cef157e735563ef73c4b331c56c76f4f13e Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Tue, 14 Jan 2025 14:32:48 +0100 Subject: [PATCH 3/3] Move under ENABLE_OPENVINO_DEBUG --- src/core/src/pass/visualize_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/src/pass/visualize_tree.cpp b/src/core/src/pass/visualize_tree.cpp index 1ea28435d96139..b74a8fcebe388a 100644 --- a/src/core/src/pass/visualize_tree.cpp +++ b/src/core/src/pass/visualize_tree.cpp @@ -690,7 +690,7 @@ void ov::pass::VisualizeTree::render() const { out.close(); if (!m_dot_only && ov::util::to_lower(ext) != ".dot") { -#if defined(ENABLE_DEBUG_CAPS) && !defined(_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");