The first-time model compilation takes a long time #30053
-
I encountered an issue where the first-time model compilation takes a long time, and there is a delay of several seconds even on different performance PCs. std::shared_ptr<ov::Model> SegmentationModel::prepareModel(ov::Core& core)
{
std::shared_ptr<ov::Model> model = core.read_model(modelFileName);
prepareInputsOutputs(model);
ov::set_batch(model, 1);
return model;
}
ov::CompiledModel SegmentationModel::compileModel(std::string& deviceName, ov::Core& core)
{
auto model = prepareModel(core);
core.set_property({ov::enable_mmap(true)});
compiledModel = core.compile_model(model, deviceName, {ov::cache_dir(cachePath)});
return compiledModel;
} The dynamic library I packaged includes: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @max-my You are using So, it's expected I would say. Could you please try to remove More details about the feature is here https://docs.openvino.ai/2025/openvino-workflow/running-inference/optimize-inference/optimizing-latency/model-caching-overview.html |
Beta Was this translation helpful? Give feedback.
Hi @max-my
You are using
ov::cache_dir(cachePath)
which enables OpenVINO models caching feature, which means on first application run you will have to compile model from scratch and store results tocachePath
on a disk, while the second and next application runs leverage a compiled blob fromcachePath
and application starts faster.So, it's expected I would say. Could you please try to remove
ov::cache_dir(cachePath)
option and confirm that in all cases application runs slower?More details about the feature is here https://docs.openvino.ai/2025/openvino-workflow/running-inference/optimize-inference/optimizing-latency/model-caching-overview.html