If anything else fails, you could get the number of physical CPUs with the help of the CPUID instruction (use either intrinsics or code the asm part on your own, isn't that difficult). This should work on Linux and Windows (however, I have done this on Windows).
On Windows, you could also have a look at the SYSTEM_INFORMATION structure: http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
Sadly, I can't provide you a way to get this info on Linux (except manually reading the /proc/cpuinfo file)
I need to know that too as being a host, I tried to sort it out using CPUID instrustions but didnt work, can anyone tell that?