-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Segmentation fault when running test_get_runtime_model
test
#18388
Comments
Hi, |
hey @abhamedewar at first please try to install openvino and reproduce the problem following the instruction. |
Thank you for assigning me the issue. |
Hi @mlukasze, I followed the installation instructions from the following link: Build OpenVINO™ Runtime for Linux systems. Ran the command provided for reproduction, but the test passed. I do not get any error. |
Hi @abhamedewar , I am very happy to see that issue is being looked at! As far as I remember the problem was only reproducible under specific circumstances (like running all tests together). @akuporos as a reporter, do you remember a case? |
Hi @abhamedewar, I caught the segfault with next cmake options: |
Hi @akuporos, To build the OpenVINO Runtime Python API we need to enable the -DENABLE_WHEEL=ON option in the CMake step, this will generate a wheel file in the build folder. (As per the installation instructions) But in the command that you have provided above the -DENABLE_WHEEL flag is OFF which will not generate openvino wheel file for python. To run the file test_compiled_model.py we need to install openvino using the wheel file right? Am I missing anything here?? |
Hi @abhamedewar, It's possible to run python applications without building&installation of the wheel.
|
Hi, |
Hello @PiwkoWazzap, Sorry for the late reply, I have been out of office. I assigned you, thanks for taking a look! |
Hi @PiwkoWazzap, are you still working on it? I'm updating the tasks' statuses. @akuporos is this task still valid? |
Hi , Can i try this? |
Hi @sanbuphy, of course! Please let us know if you have any questions. If you wish you can use our work in progress roadmap for new contributors - it could help you get started. If you do, please let us know if it was useful and how it can be improved. |
Hello @sanbuphy, do you have any questions or need any help? |
HI , I'm sorry, but I will have to wait until the weekend to start contributing to projects. I usually finish work very late during weekdays(in china you know,I usually don't have the energy to continue my research) . I will take a look at it over the weekend. |
Sure, no worries, just checking in. :) There's no rush, take your time - I'm just periodically checking our board for activity in the tasks, sometimes they get abandoned. |
Hi @sanbuphy! Please let us know if we can help with the task. :) I am happy to announce that we have created a channel dedicated to Good First Issues support on our Intel DevHub Discord server! Join it to receive support, engage in discussions, ask questions and talk to OpenVINO developers. |
|
Did you follow https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/docs/test_examples.md? Can you please share your PYTHONPATH environment variable? |
Hi, I was testing the issue on windows 11, the
which happens during the destruction of
openvino/src/plugins/auto/src/common.hpp Line 202 in e40e5b8
A simple walkaround would be to keep the dynamic library alive by making the import gc
def test_get_runtime_model(device):
compiled_model = generate_relu_compiled_model(device)
runtime_model = compiled_model.get_runtime_model()
assert isinstance(runtime_model, Model)
del runtime_model
gc.collect() But I'm not sure if this counts as a proper fix to the issue |
Hi @FredBill1, thanks for taking a look! cc @jiwaszki |
Hi, thanks for assigning me the issue. I found that the previous comment had a mistake and I've updated it. I also wrote a piece of C++ code that can reproduce the issue, which makes it a bit easier to debug. #include <iostream>
#include <memory>
#include "openvino/core/model.hpp"
#include "openvino/opsets/opset8.hpp"
#include "openvino/runtime/core.hpp"
std::shared_ptr<ov::Model> create_simple_model() {
auto data = std::make_shared<ov::opset8::Parameter>(ov::element::f32, ov::Shape{3, 1, 2});
auto mul_constant = ov::opset8::Constant::create(ov::element::f32, ov::Shape{1}, {1.5});
auto mul = std::make_shared<ov::opset8::Multiply>(data, mul_constant);
auto res = std::make_shared<ov::opset8::Result>(mul);
return std::make_shared<ov::Model>(ov::ResultVector{res}, ov::ParameterVector{data});
}
int main(int argc, char* argv[]) {
auto model = create_simple_model();
auto core = std::make_shared<ov::Core>();
auto compiled_model = std::make_shared<ov::CompiledModel>(core->compile_model(model, "CPU"));
auto runtime_model = compiled_model->get_runtime_model();
std::cout << compiled_model << ' ' << runtime_model << std::endl;
core.reset();
compiled_model.reset(); // FreeLibrary happens here
runtime_model.reset(); // segmentation fault happens here
std::cout << compiled_model << ' ' << runtime_model << std::endl;
} |
…ence to the CompiledModel
Hi, I've created 2 PRs: |
…ime and assign the shared objects to the recreated object
…the shared objects to the recreated object (#22900) ### Details: The detailed cause of the issue is described in #18388 (comment). Details of this PR are in #22874 (comment) @ilya-lavrenov. I have tested the changes against the following code and it worked as expected: ```cpp #include <iostream> #include <memory> #include "openvino/core/model.hpp" #include "openvino/opsets/opset8.hpp" #include "openvino/runtime/core.hpp" std::shared_ptr<ov::Model> create_simple_model() { auto data = std::make_shared<ov::opset8::Parameter>(ov::element::f32, ov::Shape{3, 1, 2}); auto mul_constant = ov::opset8::Constant::create(ov::element::f32, ov::Shape{1}, {1.5}); auto mul = std::make_shared<ov::opset8::Multiply>(data, mul_constant); auto res = std::make_shared<ov::opset8::Result>(mul); return std::make_shared<ov::Model>(ov::ResultVector{res}, ov::ParameterVector{data}); } int main(int argc, char* argv[]) { const auto devices = {"CPU", "GPU", "AUTO", "MULTI:GPU,CPU", "BATCH:GPU", "HETERO:CPU,GPU"}; for (auto&& device : devices) { std::cout << "Device: " << device << std::endl; auto model = create_simple_model(); auto core = std::make_shared<ov::Core>(); auto compiled_model = std::make_shared<ov::CompiledModel>(core->compile_model(model, device)); auto runtime_model = compiled_model->get_runtime_model(); std::cout << compiled_model << ' ' << runtime_model << std::endl; core.reset(); compiled_model.reset(); // FreeLibrary happens here runtime_model.reset(); // segmentation fault happens here std::cout << compiled_model << ' ' << runtime_model << std::endl; } } ``` ``` Device: CPU 000002327F6F63E0 000002327EF0A950 0000000000000000 0000000000000000 Device: GPU 0000023213B85510 000002327F6F39B0 0000000000000000 0000000000000000 Device: AUTO 000002327F234920 000002327F14B720 0000000000000000 0000000000000000 Device: MULTI:GPU,CPU 0000023212DFDEF0 000002327FB153B0 0000000000000000 0000000000000000 Device: BATCH:GPU 75 warnings generated. 0000023212DE6C60 000002327F14D340 0000000000000000 0000000000000000 Device: HETERO:CPU,GPU 0000023212DAFC80 000002327F14BA40 0000000000000000 0000000000000000 ``` ### Tickets: - Closes #18388 --------- Co-authored-by: Roman Kazantsev <[email protected]> Co-authored-by: Ilya Lavrenov <[email protected]>
Context
One of our tests results in a segfault error when ran by itself. This is probably related to Model object destruction. This task regards finding the error and fixing it. This task allows for quick familiarization with the internals of OpenVINO Python API.
Reproduction
The issue is reproducible with the following command:
which needs to be ran from
openvino/src/bindings/python
.Resources
Contact points
@jiwaszki
@akuporos
@p-wysocki
Ticket: 113294
The text was updated successfully, but these errors were encountered: