Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Remove hard-coded number of threads for Windows Conditional Compilation builds (#33089)

Andrey Babushkinf8bd7bd58072
diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml
index 4e88db1badb..95005472d6b 100644
--- a/.github/workflows/windows_conditional_compilation.yml
+++ b/.github/workflows/windows_conditional_compilation.yml
@@ -175,6 +175,7 @@ jobs:
- name: Set SSL_CERT_FILE for model downloading for unit tests
run: echo SSL_CERT_FILE=$(python3 -m certifi) >> $env:GITHUB_ENV
+ # If the build fails due to running out of RAM, lower the number of link jobs
- name: CMake configure - CC COLLECT
run: |
cmake -G "${{ env.CMAKE_GENERATOR }}" `
@@ -186,17 +187,18 @@ jobs:
-DSELECTIVE_BUILD=COLLECT `
-DENABLE_UNITY_BUILD=ON `
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON `
+ -DCMAKE_JOB_POOLS:STRING=link_jobs=20 `
+ -DCMAKE_JOB_POOL_LINK:STRING=link_jobs `
-S ${{ env.OPENVINO_REPO }} `
-B ${{ env.BUILD_DIR }}
- name: Clean ccache stats
run: '& ccache --zero-stats'
- # If the build fails due to running out of RAM, please decrease the number of parallel jobs (--parallel n)
- name: Cmake build - CC COLLECT
run: |
- cmake --build ${{ env.BUILD_DIR }} --parallel 16 --config ${{ env.CMAKE_BUILD_TYPE }} && `
- cmake --build ${{ env.BUILD_DIR }} --parallel 16 --config ${{ env.CMAKE_BUILD_TYPE }} --target sea_itt_lib
+ cmake --build ${{ env.BUILD_DIR }} --parallel $ENV:NUMBER_OF_PROCESSORS --config ${{ env.CMAKE_BUILD_TYPE }} && `
+ cmake --build ${{ env.BUILD_DIR }} --parallel $ENV:NUMBER_OF_PROCESSORS --config ${{ env.CMAKE_BUILD_TYPE }} --target sea_itt_lib
- name: Show ccache stats
run: '& ccache --show-stats'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6497905c36c..35b03c9adf0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -145,6 +145,42 @@ endfunction()
# Build
#
+# Configure job pools (only for Ninja generators)
+if(CMAKE_GENERATOR MATCHES "Ninja")
+ # Because we use Ninja generator, we can set the number of parallel
+ # jobs separately for different tasks, like compiling and linking.
+ # Especially useful on Windows, we avoid to be out of memory during linking stage that way.
+ # Number of jobs will never exceed the amount passed in `--parallel` to `cmake --build` command,
+ # even if larger `JOB_POOL` specified.
+ # See also: https://cmake.org/cmake/help/latest/prop_gbl/JOB_POOLS.html
+
+ # Set default job pools.
+ # `four_jobs` is used in a few places across all CMake files to limit
+ # the number of concurrent jobs (e.g. to convert *.prototxt files
+ # in cmake/test_model_zoo.cmake:54).
+ set_property(GLOBAL PROPERTY JOB_POOLS "${CMAKE_JOB_POOLS};four_jobs=4")
+
+ if(CMAKE_JOB_POOLS)
+ message(STATUS "")
+ message(STATUS "Job pools configuration for Ninja generator:")
+ get_property(current_job_pools GLOBAL PROPERTY JOB_POOLS)
+ message(STATUS "CMAKE_JOB_POOLS is set to: ${CMAKE_JOB_POOLS}")
+ message(STATUS "JOB_POOLS global property is set to: ${current_job_pools}")
+
+ if(CMAKE_JOB_POOL_COMPILE)
+ message(STATUS "CMAKE_JOB_POOL_COMPILE is set to: ${CMAKE_JOB_POOL_COMPILE}")
+ endif()
+
+ if(CMAKE_JOB_POOL_LINK)
+ message(STATUS "CMAKE_JOB_POOL_LINK is set to: ${CMAKE_JOB_POOL_LINK}")
+ endif()
+
+ if(CMAKE_JOB_POOL_PRECOMPILE_HEADER)
+ message(STATUS "CMAKE_JOB_POOL_PRECOMPILE_HEADER is set to: ${CMAKE_JOB_POOL_PRECOMPILE_HEADER}")
+ endif()
+ endif()
+endif()
+
if(ENABLE_TESTS)
# add target with processed tests model zoo
include(cmake/test_model_zoo.cmake)
diff --git a/cmake/test_model_zoo.cmake b/cmake/test_model_zoo.cmake
index e2837aa82b9..44a616992b3 100644
--- a/cmake/test_model_zoo.cmake
+++ b/cmake/test_model_zoo.cmake
@@ -2,8 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
#
-set_property(GLOBAL PROPERTY JOB_POOLS four_jobs=4)
-
if(ENABLE_OV_ONNX_FRONTEND)
# if requirements are not installed automatically, we need to checks whether they are here
ov_check_pip_packages(REQUIREMENTS_FILE "${OpenVINO_SOURCE_DIR}/src/frontends/onnx/tests/requirements.txt"