diff --git a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/README.md b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/README.md index 1f21dd1c07f..07b50de8409 100644 --- a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/README.md +++ b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/README.md @@ -17,6 +17,7 @@ Outcome of a build is a `subgrpahsDumper` binary located in building artifacts f ## Running The tool takes two command line parameters: * `--input_folders` - Required. Comma separated paths to the input folders with IRs +* `--local_cache` - Optional. Comma separated paths to the local cache folders with IRs. * `--output_folder` - Required. Path to the output folders where to serialize IRs * `--path_regex` - Optional. regular expression to be applied in input folders recursive discovery * `--constants_size_threshold` - Optional. Maximum size of constant in megabytes to be serialized. diff --git a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/include/gflag_config.hpp b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/include/gflag_config.hpp index c37e45c445b..13ad0007de7 100644 --- a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/include/gflag_config.hpp +++ b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/include/gflag_config.hpp @@ -9,6 +9,7 @@ static const char help_message[] = "Print a usage message."; static const char input_folders_message[] = "Required. Comma separated paths to the input folders with IRs"; +static const char local_cache_message[] = "Optional. Comma separated paths to the local cache folders with IRs"; static const char output_folder_message[] = "Required. Path to the output folders where to serialize IRs"; static const char path_regex_message[] = "Optional. regular expression to be applied in input " "folders recursive discovery"; @@ -21,7 +22,8 @@ static const char eliminate_dynamism_message[] = "Optional. If specified dynamic "and replaced by propagated upper bound values (if possible)"; DEFINE_bool(h, false, help_message); -DEFINE_string(input_folders, ".", input_folders_message); +DEFINE_string(input_folders, "", local_cache_message); +DEFINE_string(local_cache, ".", input_folders_message); DEFINE_string(output_folder, "output", output_folder_message); DEFINE_string(path_regex, ".*", output_folder_message); DEFINE_double(constants_size_threshold, 1., constants_size_threshold_message); @@ -37,6 +39,7 @@ static void showUsage() { std::cout << "\n"; std::cout << " -h " << help_message << "\n"; std::cout << " --input_folders \"\" " << input_folders_message << "\n"; + std::cout << " --local_cache \"\" " << input_folders_message << "\n"; std::cout << " --output_folder \"\" " << output_folder_message << "\n"; std::cout << " --path_regex \"\" " << path_regex_message << "\n"; std::cout << " --constants_size_threshold \"\" " << constants_size_threshold_message << "\n"; diff --git a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp index 0bd42bf169d..16f8f55a98b 100644 --- a/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp +++ b/inference-engine/tests/functional/plugin/conformance/subgraphs_dumper/src/main.cpp @@ -19,17 +19,8 @@ #include #include -int main(int argc, char *argv[]) { - uint8_t ret_code = 0; - - gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true); - if (FLAGS_h) { - showUsage(); - return 0; - } - SubgraphsDumper::ClonersMap::constant_size_threshold_mb = FLAGS_constants_size_threshold; +std::vector findModelsInDirs(const std::vector &dirs) { std::vector input_folder_content; - std::vector dirs = CommonTestUtils::splitStringByDelimiter(FLAGS_input_folders); for (const auto &dir : dirs) { if (!CommonTestUtils::directoryExists(dir)) { std::string msg = "Input directory (" + dir + ") doesn't not exist!"; @@ -51,9 +42,13 @@ int main(int argc, char *argv[]) { std::string msg = "Output directory (" + FLAGS_output_folder + ") doesn't not exist!"; throw std::runtime_error(msg); } + return models; +} +void cacheModels(std::unique_ptr &cache, + uint8_t& ret_code, + const std::vector& models) { auto ie = InferenceEngine::Core(); - auto cache = SubgraphsDumper::OPCache::make_cache(); time_t rawtime; struct tm *timeinfo; char buffer[20]; @@ -92,6 +87,27 @@ int main(int argc, char *argv[]) { } } } +} + + +int main(int argc, char *argv[]) { + uint8_t ret_code = 0; + + gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true); + if (FLAGS_h) { + showUsage(); + return 0; + } + SubgraphsDumper::ClonersMap::constant_size_threshold_mb = FLAGS_constants_size_threshold; + + std::vector local_cache_dirs = CommonTestUtils::splitStringByDelimiter(FLAGS_local_cache); + std::vector dirs = CommonTestUtils::splitStringByDelimiter(FLAGS_input_folders); + auto cachedOps = findModelsInDirs(local_cache_dirs); + auto models = findModelsInDirs(dirs); + + auto cache = SubgraphsDumper::OPCache::make_cache(); + cacheModels(cache, ret_code, cachedOps); + cacheModels(cache, ret_code, models); cache->serialize_cached_ops(FLAGS_output_folder); return ret_code;