[IE TESTS] Add local_cache arg to the subgraphDumper (#6063)
This commit is contained in:
1 parent
9214fa72e2
commit
a7a9364b41
3 files changed
+32
-12
No files matched your search
@@ -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.
|
||||
|
||||
+4
-1
@@ -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 \"<path>\" " << input_folders_message << "\n";
|
||||
std::cout << " --local_cache \"<path>\" " << input_folders_message << "\n";
|
||||
std::cout << " --output_folder \"<path>\" " << output_folder_message << "\n";
|
||||
std::cout << " --path_regex \"<path>\" " << path_regex_message << "\n";
|
||||
std::cout << " --constants_size_threshold \"<value>\" " << constants_size_threshold_message << "\n";
|
||||
|
||||
+27
-11
@@ -19,17 +19,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
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<SubgraphsDumper::Model> findModelsInDirs(const std::vector<std::string> &dirs) {
|
||||
std::vector<std::string> input_folder_content;
|
||||
std::vector<std::string> 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<SubgraphsDumper::OPCache> &cache,
|
||||
uint8_t& ret_code,
|
||||
const std::vector<SubgraphsDumper::Model>& 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<std::string> local_cache_dirs = CommonTestUtils::splitStringByDelimiter(FLAGS_local_cache);
|
||||
std::vector<std::string> 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;
|
||||
|
||||
Reference in new issue
Block a user