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

fix #18388 by recreate ov::Model using the main runtime and assign the shared objects to the recreated object #22900

Merged
merged 5 commits into from
Feb 23, 2024

Conversation

FredBill1
Copy link
Contributor

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:

#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:

…ime and assign the shared objects to the recreated object
@FredBill1 FredBill1 requested review from a team as code owners February 17, 2024 14:24
@github-actions github-actions bot added category: inference OpenVINO Runtime library - Inference category: Core OpenVINO Core (aka ngraph) category: HETERO OpenVINO HETERO plugin category: AUTO OpenVINO AUTO device selection plugin category: CPP API OpenVINO CPP API bindings category: AUTO BATCH OpenVINO Auto Batch plugin labels Feb 17, 2024
@rkazants
Copy link
Contributor

build_jenkins

@github-actions github-actions bot added the category: build OpenVINO cmake script / infra label Feb 17, 2024
@rkazants
Copy link
Contributor

build_jenkins

@FredBill1
Copy link
Contributor Author

It seems that build on Linux RISC-V has hit the timeout of 150 minutes. The build is canceled at progress [4386/5001]. Shall we increase the timeout? @ilya-lavrenov

Build:
needs: Smart_CI
timeout-minutes: 150

@ilya-lavrenov
Copy link
Contributor

build_jenkins

@ilya-lavrenov ilya-lavrenov added this pull request to the merge queue Feb 23, 2024
Merged via the queue into openvinotoolkit:master with commit ac4efa5 Feb 23, 2024
105 checks passed
@ilya-lavrenov
Copy link
Contributor

@FredBill1 thank you for the contribution, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: AUTO BATCH OpenVINO Auto Batch plugin category: AUTO OpenVINO AUTO device selection plugin category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: HETERO OpenVINO HETERO plugin category: inference OpenVINO Runtime library - Inference ExternalPR External contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault when running test_get_runtime_model test
3 participants