zlfeng83 / java-statistical-analysis-tool

Automatically exported from code.google.com/p/java-statistical-analysis-tool
0 stars 0 forks source link

L2CacheSize can be zero #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run DANN classifier

What is the expected output?
Program must terminate with results

What do you see instead?
Infinite loop in jsat.linear.DenseMatrix.transpose(Matrix)

What version of the product are you using? 
JSAT_r754.jar

On what operating system?
Windows 7

Please provide any additional information below.
jsat.linear.DenseMatrix.transpose(Matrix) relies on the variable NB2 (increment 
by that value) where NB2 = (int)Math.sqrt(SystemInfo.L2CacheSize / 16.0D);

However, SystemInfo.L2CacheSize was set to 0 in my machine. This results to NB2 
= 0 (no increment), and the loop condition will never satisfy the terminal 
condition.

I manually ran the "wmic cpu get L2CacheSize, NumberOfCores" command and I got:

L2CacheSize  NumberOfCores
0            4

CPUZ reports that my machine have 256 x 4 L2 Cache size.

We probably need to either set it to some value or throw some exception if 
L2CacheSize is zero.

Original issue reported on code.google.com by kensto...@gmail.com on 25 Jan 2014 at 8:12

GoogleCodeExporter commented 9 years ago
Huh, I didn't know wmic could return a 0 value for that. Could you by chance 
give me the details of your hardware set up? Not that it will help me solve the 
problem - I'm just curious as to what hardware made wmic return 0. 

For now I would recommend simply setting the value of L2 cache size in the 
source code to the correct value for your hardware. 

At the bare minimum I will find a reasonable lower bound for the L2 cache size 
given decent hardware. If a weird value is returned, I will set it to the 
minimum. First I'm going to look around about decent ways to estimate the L2 
cache size as a fall back. 

Thanks for the report!

Original comment by eraf...@gmail.com on 25 Jan 2014 at 9:20

GoogleCodeExporter commented 9 years ago
My machine is an Intel Core i7-2630QM running Windows 7 64-bit. Maybe mine is 
an isolated case, but I agree with your suggestions.

Original comment by kensto...@gmail.com on 25 Jan 2014 at 9:31

GoogleCodeExporter commented 9 years ago
I think you may want to file a bug report with Microsoft as well. Found this 
http://support.microsoft.com/kb/894569 which seems to indicate is a known 
possible issue for Windows XP, no indication of Windows Vista/7/8. I've got 2 
other machines with i7s that don't have this issue. 

Could you try the work around in that bug report and tell me if it produces a 
value inline with what CPUZ tells you? If so I'll probably just add that to the 
code and then add the "lower bound" cache size when none is found / and error 
occurs. 

Original comment by eraf...@gmail.com on 25 Jan 2014 at 9:38

GoogleCodeExporter commented 9 years ago
It's still 0 (2nd line for L2 Cache).

C:\Windows\system32>wmic
wmic:root\cli>memcache get maxcachesize,description
Description   MaxCacheSize
Cache Memory  32
Cache Memory  0

Original comment by kensto...@gmail.com on 25 Jan 2014 at 9:43

GoogleCodeExporter commented 9 years ago
If you use the current head revision (r802) you should be good. 256KB seems to 
be a good minimum cache size (all the way back to the Pentium II even), so that 
is now used as a catch all. 

I tried some quick code to try and estimate it but it wasn't working well and 
didn't seem worth the effort. 

If you could confirm that the head revision resolves the issue I would 
appreciate it. 

Original comment by eraf...@gmail.com on 25 Jan 2014 at 10:32

GoogleCodeExporter commented 9 years ago
I confirm that r802 fixes the issue or is a better fallback.

My L2CacheSize is 266752. I think it's a typo in the line "sizeToUse = 
256*1042;" which should be 1024.

Thanks!

Original comment by kensto...@gmail.com on 25 Jan 2014 at 10:43

GoogleCodeExporter commented 9 years ago
r803 's comment log should explain the typo. Good luck on your problem, I hope 
JSAT is more useful to you now that this weirdness is resolved. 

Original comment by eraf...@gmail.com on 25 Jan 2014 at 10:46