FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-109649: Fix test_os.test_process_cpu_count_affinity() by vstinner · Pull Request #111689 · python/cpython · GitHub

/ cpython Public

gh-109649: Fix test_os.test_process_cpu_count_affinity() - #111689

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:process_cpu_count
Nov 3, 2023
Merged

gh-109649: Fix test_os.test_process_cpu_count_affinity()#111689
vstinner merged 1 commit into
python:mainfrom
vstinner:process_cpu_count

Conversation

vstinner commented Nov 3, 2023
edited
Loading

Copy link
Copy Markdown
Member

When CPUs are isolated on Linux, os.process_cpu_count() is smaller than os.cpu_count(). Fix the test for this case.

Example with "isolcpus=5,11 rcu_nocbs=5,11" options passed to a Linux command line to isolated two logical CPUs:

$ ./python -c 'import os; print(os.process_cpu_count(), "/", os.cpu_count())'
10 / 12

When CPUs are isolated on Linux, os.process_cpu_count() is smaller
than os.cpu_count(). Fix the test for this case.

Example with "isolcpus=5,11 rcu_nocbs=5,11" options passed to a Linux
command line to isolated two logical CPUs:

$ ./python -c 'import os; print(os.process_cpu_count(), "/", os.cpu_count())'
10 / 12

vstinner commented Nov 3, 2023

Copy link
Copy Markdown
Member Author

@corona10 @gpshead: Do you think that it would be worth it to document this special case in os.process_cpu_count()?

"On Linux, if some CPUs are isolated, os.process_cpu_count() reports less usable CPUs than os.cpu_count()."

Or is it a known fact?

I'm asking if we should "advertize" more this function to users this way ;-)

gpshead commented Nov 3, 2023

Copy link
Copy Markdown
Member

: Do you think that it would be worth it to document this special case in os.process_cpu_count()?

"On Linux, if some CPUs are isolated, os.process_cpu_count() reports less usable CPUs than os.cpu_count()."

Or is it a known fact?

I think we can consider this "known" in the sense that the number of possible ways for this to be true on a system is more than we can accurately enumerate in our docs.

vstinner enabled auto-merge (squash) November 3, 2023 17:27

vstinner commented Nov 3, 2023

Copy link
Copy Markdown
Member Author

Ok, thanks for the review @gpshead.

vstinner merged commit 244e37b into python:main Nov 3, 2023
vstinner deleted the process_cpu_count branch November 3, 2023 23:53
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…n#111689)

When CPUs are isolated on Linux, os.process_cpu_count() is smaller
than os.cpu_count(). Fix the test for this case.

Example with "isolcpus=5,11 rcu_nocbs=5,11" options passed to a Linux
command line to isolated two logical CPUs:

$ ./python -c 'import os; print(os.process_cpu_count(), "/", os.cpu_count())'
10 / 12
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…n#111689)

When CPUs are isolated on Linux, os.process_cpu_count() is smaller
than os.cpu_count(). Fix the test for this case.

Example with "isolcpus=5,11 rcu_nocbs=5,11" options passed to a Linux
command line to isolated two logical CPUs:

$ ./python -c 'import os; print(os.process_cpu_count(), "/", os.cpu_count())'
10 / 12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL