Skip to content

Commit

Permalink
Merge branch 'master' into fc_compressed_transform_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
p-durandin authored Oct 30, 2023
2 parents 2853093 + cec6535 commit 258a7a5
Show file tree
Hide file tree
Showing 200 changed files with 5,487 additions and 2,781 deletions.
34 changes: 34 additions & 0 deletions .github/actions/system_info/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'System Information'
description: 'Information about the system'
runs:
using: "composite"
steps:
- if: runner.os == 'Linux'
shell: bash
run: |
# Install pre-requisites for Fedora
if [[ -e /etc/fedora-release ]]; then
yum update -y -q && yum install -y -q procps
fi
echo "System: ${{ runner.os }}"
echo "System Architecture: ${{ runner.arch }}"
echo "CPU Info: "; lscpu
echo "RAM Info: "; free -h --si
echo "MEMORY Info: "; df -h
- if: runner.os == 'macOS'
shell: bash
run: |
echo "System: ${{ runner.os }}"
echo "System Architecture: ${{ runner.arch }}"
echo "CPU and RAM Info: "; system_profiler SPHardwareDataType
echo "MEMORY Info: "; df -h
- if: runner.os == 'Windows'
shell: pwsh
run: |
echo "System: ${{ runner.os }}"
echo "System Architecture: ${{ runner.arch }}"
echo "CPU Info: "; Get-CimInstance –ClassName Win32_Processor | Select-Object -Property Name, NumberOfCores, NumberOfLogicalProcessors
echo "RAM info: $(systeminfo | Select-String 'Total Physical Memory:')"
7 changes: 7 additions & 0 deletions .github/workflows/android_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ jobs:
path: 'vcpkg'
fetch-depth: '0'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ jobs:
path: ${{ env.OPENVINO_REPO }}
submodules: 'true'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ jobs:
submodules: 'true'
ref: 'master'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/linux_conditional_compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ jobs:
lfs: 'true'
ref: 'master'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/linux_riscv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ jobs:
with:
path: 'openvino'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

- name: Init submodules for non-Conan dependencies
run: |
pushd ${OPENVINO_REPO}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ jobs:
repository: 'openvinotoolkit/openvino_contrib'
path: 'openvino_contrib'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ jobs:
path: 'openvino_contrib'
ref: 'master'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/windows_conditional_compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ jobs:
lfs: 'true'
ref: 'master'

#
# Print system info
#

- name: System info
uses: ./openvino/.github/actions/system_info

#
# Dependencies
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Install and OpenVINO™ Runtime for macOS {#openvino_docs_install_guides_installing_openvino_macos_header}
# Install OpenVINO™ Runtime for macOS {#openvino_docs_install_guides_installing_openvino_macos_header}

@sphinxdirective

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Install and OpenVINO™ Runtime on Windows {#openvino_docs_install_guides_installing_openvino_windows_header}
# Install OpenVINO™ Runtime on Windows {#openvino_docs_install_guides_installing_openvino_windows_header}

@sphinxdirective

Expand Down
104 changes: 53 additions & 51 deletions samples/cpp/model_creation_sample/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

// clang-format off
#include "openvino/openvino.hpp"
#include "openvino/opsets/opset1.hpp"
#include "openvino/opsets/opset8.hpp"
#include "openvino/opsets/opset13.hpp"

#include "samples/args_helper.hpp"
#include "samples/common.hpp"
Expand Down Expand Up @@ -84,127 +83,130 @@ std::shared_ptr<ov::Model> create_model(const std::string& path_to_weights) {
std::vector<ptrdiff_t> padBegin{0, 0};
std::vector<ptrdiff_t> padEnd{0, 0};

auto paramNode = std::make_shared<ov::opset8::Parameter>(ov::element::Type_t::f32, ov::Shape({64, 1, 28, 28}));
auto paramNode = std::make_shared<ov::opset13::Parameter>(ov::element::Type_t::f32, ov::Shape({64, 1, 28, 28}));

// -------convolution 1----
auto convFirstShape = Shape{20, 1, 5, 5};
auto convolutionFirstConstantNode = std::make_shared<opset8::Constant>(element::Type_t::f32, convFirstShape, data);
auto convolutionFirstConstantNode = std::make_shared<opset13::Constant>(element::Type_t::f32, convFirstShape, data);

auto convolutionNodeFirst = std::make_shared<opset8::Convolution>(paramNode->output(0),
convolutionFirstConstantNode->output(0),
Strides({1, 1}),
CoordinateDiff(padBegin),
CoordinateDiff(padEnd),
Strides({1, 1}));
auto convolutionNodeFirst = std::make_shared<opset13::Convolution>(paramNode->output(0),
convolutionFirstConstantNode->output(0),
Strides({1, 1}),
CoordinateDiff(padBegin),
CoordinateDiff(padEnd),
Strides({1, 1}));

// -------Add--------------
auto addFirstShape = Shape{1, 20, 1, 1};
auto offset = shape_size(convFirstShape) * sizeof(float);
auto addFirstConstantNode = std::make_shared<opset8::Constant>(element::Type_t::f32, addFirstShape, data + offset);
auto addFirstConstantNode = std::make_shared<opset13::Constant>(element::Type_t::f32, addFirstShape, data + offset);

auto addNodeFirst = std::make_shared<opset8::Add>(convolutionNodeFirst->output(0), addFirstConstantNode->output(0));
auto addNodeFirst =
std::make_shared<opset13::Add>(convolutionNodeFirst->output(0), addFirstConstantNode->output(0));

// -------MAXPOOL----------
Shape padBeginShape{0, 0};
Shape padEndShape{0, 0};

auto maxPoolingNodeFirst = std::make_shared<opset1::MaxPool>(addNodeFirst->output(0),
Strides{2, 2},
padBeginShape,
padEndShape,
Shape{2, 2},
op::RoundingType::CEIL);
auto maxPoolingNodeFirst = std::make_shared<opset13::MaxPool>(addNodeFirst->output(0),
Strides{2, 2},
Strides{1, 1},
padBeginShape,
padEndShape,
Shape{2, 2},
op::RoundingType::CEIL);

// -------convolution 2----
auto convSecondShape = Shape{50, 20, 5, 5};
offset += shape_size(addFirstShape) * sizeof(float);
auto convolutionSecondConstantNode =
std::make_shared<opset8::Constant>(element::Type_t::f32, convSecondShape, data + offset);
std::make_shared<opset13::Constant>(element::Type_t::f32, convSecondShape, data + offset);

auto convolutionNodeSecond = std::make_shared<opset8::Convolution>(maxPoolingNodeFirst->output(0),
convolutionSecondConstantNode->output(0),
Strides({1, 1}),
CoordinateDiff(padBegin),
CoordinateDiff(padEnd),
Strides({1, 1}));
auto convolutionNodeSecond = std::make_shared<opset13::Convolution>(maxPoolingNodeFirst->output(0),
convolutionSecondConstantNode->output(0),
Strides({1, 1}),
CoordinateDiff(padBegin),
CoordinateDiff(padEnd),
Strides({1, 1}));

// -------Add 2------------
auto addSecondShape = Shape{1, 50, 1, 1};
offset += shape_size(convSecondShape) * sizeof(float);
auto addSecondConstantNode =
std::make_shared<opset8::Constant>(element::Type_t::f32, addSecondShape, data + offset);
std::make_shared<opset13::Constant>(element::Type_t::f32, addSecondShape, data + offset);

auto addNodeSecond =
std::make_shared<opset8::Add>(convolutionNodeSecond->output(0), addSecondConstantNode->output(0));
std::make_shared<opset13::Add>(convolutionNodeSecond->output(0), addSecondConstantNode->output(0));

// -------MAXPOOL 2--------
auto maxPoolingNodeSecond = std::make_shared<opset1::MaxPool>(addNodeSecond->output(0),
Strides{2, 2},
padBeginShape,
padEndShape,
Shape{2, 2},
op::RoundingType::CEIL);
auto maxPoolingNodeSecond = std::make_shared<opset13::MaxPool>(addNodeSecond->output(0),
Strides{2, 2},
Strides{1, 1},
padBeginShape,
padEndShape,
Shape{2, 2},
op::RoundingType::CEIL);

// -------Reshape----------
auto reshapeFirstShape = Shape{2};
auto reshapeOffset = shape_size(addSecondShape) * sizeof(float) + offset;
auto reshapeFirstConstantNode =
std::make_shared<opset8::Constant>(element::Type_t::i64, reshapeFirstShape, data + reshapeOffset);
std::make_shared<opset13::Constant>(element::Type_t::i64, reshapeFirstShape, data + reshapeOffset);

auto reshapeFirstNode =
std::make_shared<opset8::Reshape>(maxPoolingNodeSecond->output(0), reshapeFirstConstantNode->output(0), true);
std::make_shared<opset13::Reshape>(maxPoolingNodeSecond->output(0), reshapeFirstConstantNode->output(0), true);

// -------MatMul 1---------
auto matMulFirstShape = Shape{500, 800};
offset = shape_size(reshapeFirstShape) * sizeof(int64_t) + reshapeOffset;
auto matMulFirstConstantNode =
std::make_shared<opset8::Constant>(element::Type_t::f32, matMulFirstShape, data + offset);
std::make_shared<opset13::Constant>(element::Type_t::f32, matMulFirstShape, data + offset);

auto matMulFirstNode =
std::make_shared<opset8::MatMul>(reshapeFirstNode->output(0), matMulFirstConstantNode->output(0), false, true);
std::make_shared<opset13::MatMul>(reshapeFirstNode->output(0), matMulFirstConstantNode->output(0), false, true);

// -------Add 3------------
auto addThirdShape = Shape{1, 500};
offset += shape_size(matMulFirstShape) * sizeof(float);
auto addThirdConstantNode = std::make_shared<opset8::Constant>(element::Type_t::f32, addThirdShape, data + offset);
auto addThirdConstantNode = std::make_shared<opset13::Constant>(element::Type_t::f32, addThirdShape, data + offset);

auto addThirdNode = std::make_shared<opset8::Add>(matMulFirstNode->output(0), addThirdConstantNode->output(0));
auto addThirdNode = std::make_shared<opset13::Add>(matMulFirstNode->output(0), addThirdConstantNode->output(0));

// -------Relu-------------
auto reluNode = std::make_shared<opset8::Relu>(addThirdNode->output(0));
auto reluNode = std::make_shared<opset13::Relu>(addThirdNode->output(0));

// -------Reshape 2--------
auto reshapeSecondShape = Shape{2};
auto reshapeSecondConstantNode =
std::make_shared<opset8::Constant>(element::Type_t::i64, reshapeSecondShape, data + reshapeOffset);
std::make_shared<opset13::Constant>(element::Type_t::i64, reshapeSecondShape, data + reshapeOffset);

auto reshapeSecondNode =
std::make_shared<opset8::Reshape>(reluNode->output(0), reshapeSecondConstantNode->output(0), true);
std::make_shared<opset13::Reshape>(reluNode->output(0), reshapeSecondConstantNode->output(0), true);

// -------MatMul 2---------
auto matMulSecondShape = Shape{10, 500};
offset += shape_size(addThirdShape) * sizeof(float);
auto matMulSecondConstantNode =
std::make_shared<opset8::Constant>(element::Type_t::f32, matMulSecondShape, data + offset);
std::make_shared<opset13::Constant>(element::Type_t::f32, matMulSecondShape, data + offset);

auto matMulSecondNode = std::make_shared<opset8::MatMul>(reshapeSecondNode->output(0),
matMulSecondConstantNode->output(0),
false,
true);
auto matMulSecondNode = std::make_shared<opset13::MatMul>(reshapeSecondNode->output(0),
matMulSecondConstantNode->output(0),
false,
true);

// -------Add 4------------
auto add4Shape = Shape{1, 10};
offset += shape_size(matMulSecondShape) * sizeof(float);
auto add4ConstantNode = std::make_shared<opset8::Constant>(element::Type_t::f32, add4Shape, data + offset);
auto add4ConstantNode = std::make_shared<opset13::Constant>(element::Type_t::f32, add4Shape, data + offset);

auto add4Node = std::make_shared<opset8::Add>(matMulSecondNode->output(0), add4ConstantNode->output(0));
auto add4Node = std::make_shared<opset13::Add>(matMulSecondNode->output(0), add4ConstantNode->output(0));

// -------softMax----------
auto softMaxNode = std::make_shared<opset8::Softmax>(add4Node->output(0), 1);
auto softMaxNode = std::make_shared<opset13::Softmax>(add4Node->output(0), 1);
softMaxNode->get_output_tensor(0).set_names({"output_tensor"});

// ------- OpenVINO function--
auto result_full = std::make_shared<opset8::Result>(softMaxNode->output(0));
auto result_full = std::make_shared<opset13::Result>(softMaxNode->output(0));

std::shared_ptr<ov::Model> fnPtr =
std::make_shared<ov::Model>(result_full, ov::ParameterVector{paramNode}, "lenet");
Expand Down
3 changes: 2 additions & 1 deletion src/bindings/c/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
set(TARGET_NAME openvino_c)

# Suppress warnings due to catch macro with legacy exception types
ov_deprecated_no_errors()
ov_disable_deprecated_warnings()

add_definitions(-DIN_OV_COMPONENT)

file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
Expand Down
6 changes: 3 additions & 3 deletions src/bindings/c/src/ov_infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ ov_status_e ov_infer_request_wait_for(ov_infer_request_t* infer_request, const i
if (!infer_request) {
return ov_status_e::INVALID_C_PARAM;
}

bool ret = true;
try {
infer_request->object->wait_for(std::chrono::milliseconds(timeout));
ret = infer_request->object->wait_for(std::chrono::milliseconds(timeout));
}
CATCH_OV_EXCEPTIONS

return ov_status_e::OK;
return ret ? ov_status_e::OK : ov_status_e::UNEXPECTED;
}

ov_status_e ov_infer_request_set_callback(ov_infer_request_t* infer_request, const ov_callback_t* callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/c/tests/ov_compiled_model_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ov_compiled_model_test : public ov_capi_test_base {
}
};

INSTANTIATE_TEST_SUITE_P(device_name, ov_compiled_model_test, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(ov_compiled_model, ov_compiled_model_test, ::testing::Values("CPU"));

TEST_P(ov_compiled_model_test, ov_compiled_model_inputs_size) {
auto device_name = GetParam();
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/c/tests/ov_core_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ov_core_test : public ov_capi_test_base {
ov_capi_test_base::TearDown();
}
};
INSTANTIATE_TEST_SUITE_P(device_name, ov_core_test, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(ov_core, ov_core_test, ::testing::Values("CPU"));

TEST_P(ov_core_test, ov_core_create_with_config) {
std::string plugins_xml = TestDataHelpers::generate_test_xml_file();
Expand Down
Loading

0 comments on commit 258a7a5

Please sign in to comment.