Skip to content

Commit 93c5dc5

Browse files
bkorayfacebook-github-bot
authored andcommitted
Use half of available CPUs
Summary: During intensive builds using all available cores tends to crash the machine. Cutting default number of jobs by half prevents that. Reviewed By: wez Differential Revision: D25027757 fbshipit-source-id: 5ea6c77fe4363b9ee09e50de1a5cc33281872e1d
1 parent 3fc1854 commit 93c5dc5

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

build/fbcode_builder/getdeps/builder.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,7 @@ def get_jobs_argument(num_jobs_arg: int) -> str:
288288
return "-j" + str(num_jobs_arg)
289289
290290
import multiprocessing
291-
num_jobs = multiprocessing.cpu_count()
292-
if sys.platform == "win32":
293-
num_jobs //= 2
291+
num_jobs = multiprocessing.cpu_count() // 2
294292
return "-j" + str(num_jobs)
295293
296294

build/fbcode_builder/getdeps/buildopts.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,7 @@ def __init__(
7373
if not num_jobs:
7474
import multiprocessing
7575

76-
num_jobs = multiprocessing.cpu_count()
77-
if is_windows():
78-
# On Windows the cpu count tends to be the HT count.
79-
# Running with that level of concurrency tends to
80-
# swamp the system and make hard to perform other
81-
# light work. Let's halve the number of cores here
82-
# to win that back. The user can still specify a
83-
# larger number if desired.
84-
num_jobs = int(num_jobs / 2)
76+
num_jobs = multiprocessing.cpu_count() // 2
8577

8678
if not install_dir:
8779
install_dir = os.path.join(scratch_dir, "installed")

0 commit comments

Comments
 (0)