Skip to content

Commit 49548ad

Browse files
committed
Introduce _NBL_JOBS_OVERRIDE_, update CMakeLists.txt
1 parent f0d3e0a commit 49548ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ if(NOT CMAKE_BUILD_TYPE)
108108
endif()
109109

110110
option(_NBL_MEMORY_CONSUMPTION_CHECK_SKIP_ "Turn it ON to bypass memory consumption test given _NBL_JOBS_AMOUNT_. Be aware you are doing it on your own risk of potential build failures!" OFF)
111+
option(_NBL_JOBS_OVERRIDE_ "Override jobs with safe bias if required to respect currently available memory" OFF)
111112

112113
include(ProcessorCount)
113114

@@ -125,7 +126,7 @@ endif()
125126
cmake_host_system_information(RESULT _NBL_TOTAL_PHYSICAL_MEMORY_ QUERY TOTAL_PHYSICAL_MEMORY) # MB
126127
cmake_host_system_information(RESULT _NBL_AVAILABLE_PHYSICAL_MEMORY_ QUERY AVAILABLE_PHYSICAL_MEMORY) # MB
127128

128-
if(NBL_CI_MODE)
129+
if(_NBL_JOBS_OVERRIDE_)
129130
math(EXPR _CI_NBL_JOBS_AMOUNT_ "(${_NBL_AVAILABLE_PHYSICAL_MEMORY_} - 512)/(2*1024)") # override with safe bias, respect memory and don't take more then max processors we have
130131
if(_CI_NBL_JOBS_AMOUNT_ LESS _NBL_JOBS_AMOUNT_)
131132
message(WARNING "Overriding _NBL_JOBS_AMOUNT_: \"${_NBL_JOBS_AMOUNT_}\" with \"${_CI_NBL_JOBS_AMOUNT_}\"")

0 commit comments

Comments
 (0)