Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Fix Windows ninja builds when MAX_JOBS is specified (pytorch#65444)
Browse files Browse the repository at this point in the history
Summary:
Reported by cloudhan in pytorch#64733 (comment)

Fixes regression introduced by pytorch@047e682

cc malfet seemethere

Pull Request resolved: pytorch#65444

Reviewed By: dagitses, seemethere

Differential Revision: D31103260

Pulled By: malfet

fbshipit-source-id: 9d5454a64cb8a0b96264119cf16582cc5afed284
  • Loading branch information
malfet authored and facebook-github-bot committed Sep 22, 2021
1 parent cbc3db8 commit 923f066
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/setup_helpers/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def build(self, my_env: Dict[str, str]) -> None:
# then. Until then, we use "--" to pass parameters to the
# underlying build system.
build_args += ['--']
if IS_WINDOWS:
if IS_WINDOWS and not USE_NINJA:
# We are likely using msbuild here
build_args += ['/p:CL_MPCount={}'.format(max_jobs)]
else:
Expand Down
4 changes: 4 additions & 0 deletions tools/test/test_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def test_build_jobs(self, mock_cpu_count: unittest.mock.MagicMock) -> None:
# MAX_JOBS, USE_NINJA, IS_WINDOWS, want
(( '8', True, False), ['-j', '8']), # noqa: E201,E241
(( None, True, False), None), # noqa: E201,E241
(( '7', False, False), ['-j', '7']), # noqa: E201,E241
(( None, False, False), ['-j', '13']), # noqa: E201,E241
(( '6', True, True), ['-j', '6']), # noqa: E201,E241
(( None, True, True), None), # noqa: E201,E241
(( '11', False, True), ['/p:CL_MPCount=11']), # noqa: E201,E241
(( None, False, True), ['/p:CL_MPCount=13']), # noqa: E201,E241
]
for (max_jobs, use_ninja, is_windows), want in cases:
Expand Down

0 comments on commit 923f066

Please sign in to comment.