Martin Albrecht wrote: > Hi there, > > in the thread > > http://is.gd/4EMT8 > > David and I agreed that M4RI should have a better, more robust and cross- > platform mechanism to check for cache sizes. > > Thus I wrote a little C program to check for the cache size using timings of > random-ish memory access. > > The program is available at: > > http://sage.math.washington.edu/home/malb/cache.c > > On my Core 2 Duo and on my Opteron (both running Linux 64-bit) it does report > correct sizes. So far so good. On sage.math it reports L3 cache size instead > of L2 but I guess that this is probably what we want anyway (well, L2 is 3MB > which I don't check explicitly since I only check powers of two) > > I'd appreciate if those people on this list who have different hardware or > software (OSX, Solaris, PPC, Sparc) could compile the program and report back > whether the program reports correct sizes for them. To compile and run: > > gcc -std=c99 -O3 cache.c -o cache > ./cache > > Cheers, > Martin > >
His is on an HP C3600 running HP-UX 11.11. The has is a single PA-8600 processor running at 552MHz. The cache size is 1.5 MB. drkir...@hawk:~$ ./cache 8 0.009 2.937 16 0.017 1.991 32 0.035 2.033 64 0.078 2.227 128 0.206 2.647 256 0.455 2.208 512 1.026 2.255 1024 6.598 6.431 2048 13.274 2.012 4096 29.296 2.207 8192 72.191 2.464 16384 272.085 3.769 32768 930.273 3.419 65536 2126.173 2.286 512 16384 It would appear this cache program is not particularly good at guess cache sizes, but what is probably more important is that it is able to optimise the code so it works best on a particular processor. It is pretty irrelevant what it thinks that processor may or may not be. It's more important it optimises itself to run well on that processor. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---