The last time I pondered how to check the number of CPU cores in the system from software. It might be equally useful to check if various SIMD extensions (SSE ... SSE4) are present. The good old CPUID instruction on Intel and AMD can do the trick.
This code snippet must be compiled with GCC, since it uses the inline assembler feature:
I got the description of the feature bits from this Intel document; except that it does not describe ECX:bit 28 as the flag for AVX (Advanced Vector Extensions to be released in 2010). This info is from sandpile.org.
Friday, December 19, 2008
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment