![]() Regarding, I take your point that a lot of multiprocessing using the standard libraries may not benefit, as processes may be restricted to the processor group of the parent process (python).įor my use case it works well: I launch a queue of blocking jobs, using a thread pool. Īs the reporter i just want to say this is working for me with 3.6.3. Os.cpu_count() is specified to return the total number of processors, not the number of usable processors. NET still uses the old way that python did until now:Īlthough some of this stuff is used in code for python multiprocess code which that might actually get a boost (since different process can get scheduled to different groups) We can see such code builtin python stdlib itself: One should be careful with this modification because of the Windows definition of process groups.įor example, if multi-threaded code thinks that by reading the value of the new os.cpu_count() it can use all the cores returned, by default it cannot as in windows processes by default can run only in a single process group (how it worked before). New changeset 58521fdba1657f6553a1ead5cbaa100967a167b3 by Antoine Pitrou (Christopher Wilcox) in branch '3.6':īpo-30581: Windows: os.cpu_count() returns wrong number of processors ( #2934) ( #3267) I reopen the issue to backport the bugfix to 3.6. Someone might backport this to 3.6 if they want. New changeset c67bae04780f9d7590f9f91b4ee5f31c5d75b3c3 by Antoine Pitrou (Christopher Wilcox) in branch 'master':īpo-30581: Windows: os.cpu_count() returns wrong number of processors ( #2934)įixed. He had thought that my solution that way had other limitations under WoW64. I have reached back out to the Windows API dev and will see if GetLogicalProcessorInformationEx will allow us to do this. GetMaximumProcessorCount returns a simulated count in WoW64. I was reviewing the docs for the os module and cpu_count should always return the number of cpus on the system, not the usable CPUs. GetActiveProcessorCount, on the other hand, returns "the number of active processors in a processor group or in the system", which adds even more confusion. This method will only report 32 cores under 32 bit as that is all the program can access in 32 bit mode.Ībout GetMaximumProcessorCount, MS doc states that it returns the "maximum number of logical processors that a processor group or the system can have", so maybe it also includes "empty" CPU sockets. One of the things that makes this interesting is that in 32 bit processes (wow64) your processor is simulated to fit in the confines of that old system. I had also written an implementation that iterated over GetProcessorInformationEx and he advised against it. I ended up reaching out to the guy who authored the GetMaximumProcessorCount function. I agree that the MS Docs for this are a bit confusing. Here it is being suggested to use GetLogicalProcessorInformationEx: MS documentation is not clear on what function should be used as there are many returning different values. I am going to work on this if no one else has started.Īuthor: Giampaolo Rodola' (giampaolo.rodola) * Its my first bug on so if you need more info just let me know The maintainer of psutil asked me to raise this bug, also had a quick check on #python IRC. See for some further disucssion of this topic Yes, i believe its reporting the number of processors in the current group only, not across all groups.Īttached output of windows sysinternals/coreinfo showing 2 processor groups Maybe the function only returns infos from the first package? ![]() It seems like you have two physical CPU packages. Note: For information about the physical processors shared by logical processors, call GetLogicalProcessorInformationEx with the RelationshipType parameter set to RelationProcessorPackage (3). The number of logical processors in the current group. It seems to return the number of *logical* CPUs: "GetSystemInfo(&sysinfo) return sysinfo.dwNumberOfProcessors " On Windows, os.cpu_count() is currently implemented with: I suppose this is because the windows api call used is not aware of processor groups, and reports only the number of processors in the current processor group ( eg GetSystemInfo vs GetMaximumProcessorCount ) Os.cpu_count() reports 40 cores on platform1 and 56 on platform2 14 cores/CPU = total 56 logical cpus with hyperthreading 20 cores/CPU = total 80 logical cpus with hyperthreading Tried it on 2 similar systems, both running windows 7 / 10 with python 3.6.1 64bit (anaconda): Os.cpu_count() seems to report incorrect values on windows systems with >64 logical processors Os.cpu_count() returns wrong number of processors on system with > 64 logical processorsĬrwilcox, giampaolo.rodola, paul.moore, pitrou, robbuckley, steve.dower, tim.golden, tzickel, vstinner, zach.wareĬreated on 12:49 by robbuckley, last changed 14:58 by admin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |