Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Core threading safe ? #27366

Open
Jsy0220 opened this issue Nov 1, 2024 · 5 comments
Open

Is Core threading safe ? #27366

Jsy0220 opened this issue Nov 1, 2024 · 5 comments
Assignees
Labels
category: Core OpenVINO Core (aka ngraph) support_request

Comments

@Jsy0220
Copy link

Jsy0220 commented Nov 1, 2024

Hi, I tried to use OpenVino in my application for multiple model inference. I have some question about ov::Core:

  1. Does it needed one for each model in one application ?
  2. If only single one needed, Are all methods of it thread-safe ?
@ilya-lavrenov
Copy link
Contributor

Hi @Jsy0220

You can have a single Core for your application.
The responsibility of Core is to manage OpenVINO inference devices (plugins) and main methods are:

  • compile_model
  • some manipulation with devices to get their properties (like get_property)
  • read_model

These methods are thread safe and if you access the same device from multiple threads (eg. call compile_model for different models) or read different models in parallel (via read_model) - the Core will ensure proper initialization of inference plugins and frontends to read models.

@avitial avitial added category: Core OpenVINO Core (aka ngraph) support_request labels Nov 4, 2024
@Jsy0220
Copy link
Author

Jsy0220 commented Nov 5, 2024

@ilya-lavrenov I see. Thank you!!

@Jsy0220 Jsy0220 closed this as completed Nov 5, 2024
@Jsy0220 Jsy0220 reopened this Nov 22, 2024
@Jsy0220
Copy link
Author

Jsy0220 commented Nov 22, 2024

@ilya-lavrenov Hi, I tried to use one core in my application, but it seems failed. My application includes multiple models and each one runs in a thread and owns a core, that is ok. Now I modified to all models share one core and each one still runs in a thread respectively, but one of the models would load failed at ov::core::compile_model() due to Cannot create reorder primitive: unsupported reorder case.
Do you know why ?

openvino version: 2022.1.0

@ilya-lavrenov
Copy link
Contributor

ilya-lavrenov commented Nov 22, 2024

it's not related to single / multiple cores usage or single / multiple threads.

Could you please try latest 2024.5 OpenVINO? You are using 2.5 year old release

Is it possible to share your model to reproduce on our side?

@Jsy0220
Copy link
Author

Jsy0220 commented Nov 25, 2024

@ilya-lavrenov sorry, I can't share this model. Do you know some possible reasons ?It only happened under single core. Do models share some resource if using one core ?
And another question: is there any advantage using single core in one application compare to using multiple cores ?
Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) support_request
Projects
None yet
Development

No branches or pull requests

4 participants