From 053fe6e4dbd0e737c7e567ee20c31eb093b5fafc Mon Sep 17 00:00:00 2001 From: likholat Date: Mon, 6 Nov 2023 20:20:34 +0100 Subject: [PATCH] [CUSTOM_OP][JAVA_API] Fixed custom_ops build without OV build, updated Torch version, fixed Java build and tests --- modules/custom_operations/README.md | 6 +++--- modules/custom_operations/tests/requirements.txt | 5 +++-- .../custom_operations/user_ie_extensions/CMakeLists.txt | 8 ++++++++ modules/java_api/CMakeLists.txt | 6 +++--- modules/java_api/build.gradle | 2 +- .../java/org/intel/openvino/PrePostProcessorTests.java | 4 ++-- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/modules/custom_operations/README.md b/modules/custom_operations/README.md index 13861ff47..4dec37e3f 100644 --- a/modules/custom_operations/README.md +++ b/modules/custom_operations/README.md @@ -34,14 +34,14 @@ The C++ code implementing the custom operation is in the `user_ie_extensions` di 2. Build the library: ```bash -cd user_ie_extensions +cd openvino_contrib/modules/custom_operations mkdir build && cd build -cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . --parallel 4 +cmake ../user_ie_extensions -DCMAKE_BUILD_TYPE=Release && cmake --build . --parallel 4 ``` If you need to build only some operations specify them with the `-DCUSTOM_OPERATIONS` option: ```bash -cmake .. -DCMAKE_BUILD_TYPE=Release -DCUSTOM_OPERATIONS="complex_mul;fft" +cmake ../user_ie_extensions -DCMAKE_BUILD_TYPE=Release -DCUSTOM_OPERATIONS="complex_mul;fft" ``` - Please note that [OpenCV](https://opencv.org/) installation is required to build an extension for the [fft](examples/fft) operation. Other extentions still can be built without OpenCV. diff --git a/modules/custom_operations/tests/requirements.txt b/modules/custom_operations/tests/requirements.txt index d7282db88..f115e7945 100644 --- a/modules/custom_operations/tests/requirements.txt +++ b/modules/custom_operations/tests/requirements.txt @@ -1,4 +1,5 @@ -torch==1.13.1 -# open3d==0.16.0 - need to update with new release +torch +onnx tensorboard pytest +# open3d==0.16.0 - need to update with new release diff --git a/modules/custom_operations/user_ie_extensions/CMakeLists.txt b/modules/custom_operations/user_ie_extensions/CMakeLists.txt index 65a13360e..506443152 100644 --- a/modules/custom_operations/user_ie_extensions/CMakeLists.txt +++ b/modules/custom_operations/user_ie_extensions/CMakeLists.txt @@ -2,6 +2,14 @@ # SPDX-License-Identifier: Apache-2.0 # +if(POLICY CMP0079) + cmake_policy(SET CMP0079 NEW) +endif() + +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() + set(TARGET_NAME "user_ov_extensions") set(CMAKE_CXX_STANDARD 11) diff --git a/modules/java_api/CMakeLists.txt b/modules/java_api/CMakeLists.txt index b7753c78a..11501196d 100644 --- a/modules/java_api/CMakeLists.txt +++ b/modules/java_api/CMakeLists.txt @@ -32,6 +32,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${JNI_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp) install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT java_api - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT java_api - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT java_api) + RUNTIME DESTINATION ${OV_CPACK_RUNTIMEDIR} COMPONENT java_api + ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT java_api + LIBRARY DESTINATION ${OV_CPACK_LIBRARYDIR} COMPONENT java_api) diff --git a/modules/java_api/build.gradle b/modules/java_api/build.gradle index 2496b3733..1b577c0fe 100644 --- a/modules/java_api/build.gradle +++ b/modules/java_api/build.gradle @@ -11,7 +11,7 @@ println 'CPU architecture: ' + arch def nativesCPP; -def openvinoVersion = "2023.0" +def openvinoVersion = "2023.2" def native_resources = [] def tbb_dir = System.getenv('TBB_DIR') diff --git a/modules/java_api/src/test/java/org/intel/openvino/PrePostProcessorTests.java b/modules/java_api/src/test/java/org/intel/openvino/PrePostProcessorTests.java index c3a98b311..51a4c26dc 100644 --- a/modules/java_api/src/test/java/org/intel/openvino/PrePostProcessorTests.java +++ b/modules/java_api/src/test/java/org/intel/openvino/PrePostProcessorTests.java @@ -77,7 +77,7 @@ public void testWrongElementType() { } assertTrue( exceptionMessage.contains( - "[ PARAMETER_MISMATCH ] Failed to set input blob with precision: FP32, if" - + " CNNNetwork input blob precision is: U8")); + "[ PARAMETER_MISMATCH ] Failed to set input tensor with precision: f32," + + " since the model input tensor precision is: u8")); } }