![]() |
|
|
#1 |
|
Nov 2008
2×33×43 Posts |
I've just noticed that msieve doesn't detect the L3 cache on my Core i5. It seems to have only detected the L2:
Code:
using block size 10922 for processor cache size 256 kB |
|
|
|
|
|
#2 |
|
Tribal Bullet
Oct 2004
1101110101012 Posts |
Grrr. The problem is Intel's scheme for reporting cache sizes; basically every new processor that comes out has its own code for its cache size, although the L2 size is also reported in a standard way. That basically means that your cache size detection code has to be updated about once a year to account for new Intel processors.
Edit: OK, fixed in SVN now. It turns out that Intel moved to a more general architecture for reporting cache sizes around last year, and this should hopefully avoid having to touch the code over and over again. @Brian Gladman: Does MSVC have an intrinsic that runs the CPUID instruction with *both* EAX and ECX specified? The one you used in the current code only specifies EAX, and so the cache size is still misreported when compiling with MSVC. Last fiddled with by jasonp on 2010-10-25 at 12:21 |
|
|
|
|
|
#3 | |
|
Nov 2003
22×5×373 Posts |
Quote:
Take a small array. Time how long it takes to fill/empty it. Keep increasing the size of the array until the fill/empty time jumps suddenly. You've now exceeded the cache.... |
|
|
|
|
|
|
#4 |
|
P90 years forever!
Aug 2002
Yeehaw, FL
2×53×71 Posts |
|
|
|
|
|
|
#5 |
|
Nov 2003
22×5×373 Posts |
|
|
|
|
|
|
#6 |
|
Tribal Bullet
Oct 2004
3,541 Posts |
No matter how complex it is to read the Intel cache codes, that has to be better than figuring out the size dynamically. Look at the source for LMBench if you don't believe me; you need to fool the hardware prefetch mechanism, get timing information that is portable enough and accurate enough (and multiprocessor safe, which the x86 cycle counter is not), then time for long enough to get a robust answer, which is guaranteed to be longer than an entire small QS job takes.
Plus the machine has to be idle :) |
|
|
|
|
|
#7 | |
|
Oct 2007
2·53 Posts |
Quote:
|
|
|
|
|
|
|
#8 | |
|
May 2008
Worcester, United Kingdom
10248 Posts |
Quote:
Brian |
|
|
|
|
|
|
#9 |
|
Tribal Bullet
Oct 2004
3,541 Posts |
Thanks everybody.
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Detecting bigInt roots | mathPuzzles | Computer Science & Computational Number Theory | 9 | 2017-07-01 03:35 |
| Problem detecting GPU | VoltsNCodes | Msieve | 13 | 2013-06-14 15:14 |
| 8k fft and L2 cache | pman | Information & Answers | 1 | 2012-05-23 14:00 |
| Detecting arithmetic progressions | grandpascorpion | Math | 18 | 2007-03-28 15:08 |
| L3 cache. What could it buy us? | nomadicus | Hardware | 3 | 2003-08-09 22:23 |