Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
54723def
Commit
54723def
authored
Jan 24, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaked the way we compute the number of threads to use when building.
parent
344165cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
setup.py
setup.py
+3
-4
No files found.
setup.py
View file @
54723def
...
...
@@ -137,7 +137,7 @@ class CMakeBuild(build_ext):
else
:
cmake_args
+=
[
'-DCMAKE_BUILD_TYPE='
+
cfg
]
# 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
)
...
...
@@ -162,9 +162,8 @@ def num_available_cpu_cores(ram_per_build_process_in_gb):
try
:
mem_bytes
=
os
.
sysconf
(
'SC_PAGE_SIZE'
)
*
os
.
sysconf
(
'SC_PHYS_PAGES'
)
mem_gib
=
mem_bytes
/
(
1024.
**
3
)
# Assume hyperthreading so divide by 2
num_cores
=
int
(
ceil
(
multiprocessing
.
cpu_count
()
/
2.0
))
# Require 4gb of ram per build thread.
num_cores
=
multiprocessing
.
cpu_count
()
# make sure we have enough ram for each build process.
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
# and return that.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment