|
|
@ -137,7 +137,7 @@ class CMakeBuild(build_ext):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
|
|
|
|
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
|
|
|
|
# Do a parallel build
|
|
|
|
# Do a parallel build
|
|
|
|
build_args += ['--', '-j'+str(num_available_cpu_cores(4))]
|
|
|
|
build_args += ['--', '-j'+str(num_available_cpu_cores(2))]
|
|
|
|
|
|
|
|
|
|
|
|
build_folder = os.path.abspath(self.build_temp)
|
|
|
|
build_folder = os.path.abspath(self.build_temp)
|
|
|
|
|
|
|
|
|
|
|
@ -162,9 +162,8 @@ def num_available_cpu_cores(ram_per_build_process_in_gb):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
|
|
|
|
mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
|
|
|
|
mem_gib = mem_bytes/(1024.**3)
|
|
|
|
mem_gib = mem_bytes/(1024.**3)
|
|
|
|
# Assume hyperthreading so divide by 2
|
|
|
|
num_cores = multiprocessing.cpu_count()
|
|
|
|
num_cores = int(ceil(multiprocessing.cpu_count()/2.0))
|
|
|
|
# make sure we have enough ram for each build process.
|
|
|
|
# Require 4gb of ram per build thread.
|
|
|
|
|
|
|
|
mem_cores = int(floor(mem_gib/float(ram_per_build_process_in_gb)+0.5));
|
|
|
|
mem_cores = int(floor(mem_gib/float(ram_per_build_process_in_gb)+0.5));
|
|
|
|
# We are limited either by RAM or CPU cores. So pick the limiting amount
|
|
|
|
# We are limited either by RAM or CPU cores. So pick the limiting amount
|
|
|
|
# and return that.
|
|
|
|
# and return that.
|
|
|
|