Skip to content

[DOC] Model caching feature overview#5519

Merged
ilya-lavrenov merged 6 commits intoopenvinotoolkit:masterfrom
nosovmik:caching_overview
Jun 23, 2021
Merged

[DOC] Model caching feature overview#5519
ilya-lavrenov merged 6 commits intoopenvinotoolkit:masterfrom
nosovmik:caching_overview

Conversation

@nosovmik
Copy link
Copy Markdown
Contributor

@nosovmik nosovmik commented May 5, 2021

Details:

  • Model caching feature overview

Tickets:

  • 53433

@nosovmik nosovmik requested a review from a team as a code owner May 5, 2021 16:14
@openvino-pushbot openvino-pushbot added the category: docs OpenVINO documentation label May 5, 2021
@ledmonster
Copy link
Copy Markdown
Contributor

I'm very interested in this feature. Does GPU plugin support Import/Export capability?

@nosovmik
Copy link
Copy Markdown
Contributor Author

nosovmik commented May 7, 2021

I'm very interested in this feature. Does GPU plugin support Import/Export capability?

Thanks a lot for your interest in this feature :-) Right now model caching is enabled in 'master' for GNA (PR #4889) and Myriad (PR #4868) plugins, planned to be available in next official release.
For GPU, as far as I know, there is no clear plans to add such model caching support so far

@ledmonster
Copy link
Copy Markdown
Contributor

Thank you for reply.

For GPU, as far as I know, there is no clear plans to add such model caching support so far

Are there any reason for that? Do you recommend not to use GPU plugin? Or are there any difficulties around model caching for GPU plugin?

@nosovmik
Copy link
Copy Markdown
Contributor Author

nosovmik commented May 7, 2021

Are there any reason for that? Do you recommend not to use GPU plugin? Or are there any difficulties around model caching for GPU plugin?

Of course, it is not the reason to not use GPU plugin :-) This plugin already has a lot of other useful features for people to use and GPU team have a lot of new features for performance improvement in a pipeline :-)
By the way, can you please share some more information about your use case? Seems like your model takes quite a lot of time to load on GPU and you believe that 'model caching' feature will significantly improve this, right?

@ledmonster
Copy link
Copy Markdown
Contributor

ledmonster commented May 7, 2021

@nosovmik Thank you for quick and kind reply.

Seems like your model takes quite a lot of time to load on GPU and you believe that 'model caching' feature will significantly improve this, right?

Yes, I have a custom pose estimation model, and I want to run it in an embedded device (robot). Since CPU resource is limited, hopefully I want to run the model with GPU. But while CPU plugin takes less than 1 second to load the model, GPU plugin takes more than 30 seconds for that. So I want to cache the result of model optimization for GPU plugin.

@vladimir-paramuzov
Copy link
Copy Markdown

@ledmonster Did you get this 30 seconds for model loading with kernels cache enabled? Import/Export API is not implemented yet for GPU, but if you enable CACHE_DIR option, then GPU plugin will enable caching of compiled OCL kernels. And since the OCL kernels build is the most expensive stage on model loading, this caching may significantly improve loading time.

@ledmonster
Copy link
Copy Markdown
Contributor

if you enable CACHE_DIR option, then GPU plugin will enable caching of compiled OCL kernels.

Thank you. I didn't know that. I'll try it next week.

By the way, I can find that option in API Reference, but it is not listed in GPU Plugin documentation. Is the document missing some config parameters?

@ledmonster
Copy link
Copy Markdown
Contributor

ledmonster commented May 10, 2021

By specifying CACHE_DIR like this:

ie.set_config(config={"CACHE_DIR": "/tmp/openvino/gpu/"}, device_name="gpu")

cache files are created on first run, which is about 70MB, and initialization got faster on second run. While it took about 40 sec on first run, on second run, it took only 0.5 sec.

Thank you so much!!

@nosovmik
Copy link
Copy Markdown
Contributor Author

@andrew-zaytsev @ilya-lavrenov Can you please review this PR? Should I add someone else to this review?

@ilya-lavrenov ilya-lavrenov self-assigned this Jun 18, 2021
@ilya-lavrenov ilya-lavrenov added this to the 2022.1 milestone Jun 18, 2021
Please also note that very first LoadNetwork (when cache is not yet created) will take slightly longer time to 'export' compiled blob into a cache file
![caching_enabled]

## Even faster: use LoadNetwork(\<modelName\>)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modelName -> modelFileName? to be more specific

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to modelPath as used in code snippets

nosovmik and others added 5 commits June 21, 2021 14:37
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
- Moved code examples to snippets
- Added link to Model Caching overview from "Inference Engine Developer Guide"
- Few minor changes
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
@ilya-lavrenov ilya-lavrenov merged commit 4a4c3e8 into openvinotoolkit:master Jun 23, 2021
rnugmanx pushed a commit to rnugmanx/openvino that referenced this pull request Aug 26, 2021
* Docs: Model caching feature overview

* Update docs/IE_DG/Intro_to_Performance.md

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* Apply suggestions from code review

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* Review comments
- Moved code examples to snippets
- Added link to Model Caching overview from "Inference Engine Developer Guide"
- Few minor changes

* Update docs/IE_DG/Intro_to_Performance.md

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: docs OpenVINO documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants