View Issue Details

IDProjectCategoryView StatusLast Update
0004445Spring engineGeneralpublic2014-06-24 17:32
Reportermalric Assigned TojK  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version97.0.1+git 
Target Version98.0 
Summary0004445: Detection of number of hardware cores is broken
DescriptionCurrently the detection of number of hardware cores is broken as it relies on a field that instead represents the maximum number of cores per physical package. For more info see://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-2a-manual.pdf, page 220 of the pdf:

Bits 23-16: Maximum number of addressable IDs for logical processors in this physical package

In the thread at https://software.intel.com/en-us/forums/topic/287414 some code is mentioned that should solve the problem (which I think is also used in 0ad). Same/similar code is also found at https://github.com/0ad/0ad/blob/457c40559f90356d8d7c4e1542830c6e24075077/source/lib/sysdep/arch/x86_x64/topology.cpp
Steps To Reproduce1) Start spring on an affected processor
2) infolog.txt will contain "Warning: Set ThreadPool workers to 4, but there are just 1 cores!"
TagsNo tags attached.
Checked infolog.txt for Errors

Activities

malric

2014-06-18 08:56

reporter   ~0013293

I am investigating for a patch, as I can reproduce this.

@jk: can you please comment why you choose to use cpuid? I can use it, but the code is a bit big/complex, and, at least on Linux I think (but did not check extensively) it would be very similar to what information is provided in /proc/cpuinfo.

jK

2014-06-18 11:54

developer   ~0013296

cause there is no boost function and it is portable (Linux, Windows, OSX)

malric

2014-06-18 13:44

reporter   ~0013297

Ok, will continue with cpuid implementation then.

malric

2014-06-19 22:54

reporter   ~0013304

Update: I managed to make the detection working as expected on Linux (tested on a couple of systems), but still need to take into account some corner cases, integrate the code into spring, make it work on windows (and I have no dev env setup yet) and make a patch.

malric

2014-06-22 23:14

reporter   ~0013317

Last edited: 2014-06-23 00:30

Sent pull request at: https://github.com/spring/spring/pull/109

Edit: think there is a merge conflict (first time doing this in github, so need to sort this out).

Edit2: sorted out the code, updated pull request.

Tested on i7 (4 real cores, 8 with HT) and Core2 duo (2 real cores).

Tested on both Linux and Win7 (on the i7).

jK

2014-06-24 17:32

developer   ~0013347

merged

big thanks :D

Issue History

Date Modified Username Field Change
2014-06-18 08:54 malric New Issue
2014-06-18 08:56 malric Note Added: 0013293
2014-06-18 11:54 jK Note Added: 0013296
2014-06-18 13:44 malric Note Added: 0013297
2014-06-19 21:25 abma Target Version => 98.0
2014-06-19 22:54 malric Note Added: 0013304
2014-06-22 23:14 malric Note Added: 0013317
2014-06-22 23:19 malric Note Edited: 0013317
2014-06-23 00:30 malric Note Edited: 0013317
2014-06-24 17:30 jK Changeset attached => spring develop 53b93263
2014-06-24 17:32 jK Note Added: 0013347
2014-06-24 17:32 jK Status new => resolved
2014-06-24 17:32 jK Resolution open => fixed
2014-06-24 17:32 jK Assigned To => jK