Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent excessive parallel jobs during compilation #4004

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def build_extensions(self):
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(config.upper(), build_dir),
'-DPYTHON_EXECUTABLE:FILEPATH=' + sys.executable]

make_args = ['-j8'] if not os.environ.get('MAKEFLAGS') else []
make_args = ['-j' + str(min(8, len(os.sched_getaffinity(0))))] if not os.environ.get('MAKEFLAGS') else []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like sched_getaffinity is only available on some UNIX platforms. What is the return value of it when not available?

Copy link
Contributor Author

@njzjz njzjz Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. The method doesn't exist on other platforms, per python/cpython#81781. I'll fix that.

if self.verbose:
make_args.append('VERBOSE=1')

Expand Down