Originally posted by: SystemAdmin
// --- OS ---
AIX ep5710g 3 5
// --- Compiler ---
IBM XL C/C++ Enterprise Edition V8.0 for AIX
Version: 08.00.0000.0014
// --- Calling the prtconf command
> prtconf | grep Processors
Number Of Processors:
16 // --- User program foo.cpp ----
#include <iostream>
#include <unistd.h>
#include <sys/systemcfg.h>
int main()
{
//
// SC_NPROCESSORS_CONF Number of processors configured.
std::cout << "_SC_NPROCESSORS_CONF\t ="
<< sysconf(_SC_NPROCESSORS_CONF)
<< std::endl;
//
// _SC_NPROCESSORS_ONLN Number of processors online
std::cout << "_SC_NPROCESSORS_ONLN\t ="
<< sysconf(_SC_NPROCESSORS_ONLN)
<< std::endl;
//
// ncpus Identifies the number of CPUs active on a machine.
// Uniprocessor (UP) machines are identified by a 1.
// Values greater than 1 indicate multiprocessor (MP) machines.
std::cout << "_system_configuration.ncpus\t ="
<< _system_configuration.ncpus
<< std::endl;
return 0;
}
//
> xlC_r foo.cpp
> ./a.out
_SC_NPROCESSORS_CONF =*32*
_SC_NPROCESSORS_ONLN =*32*
_system_configuration.ncpus =*32*
It seems that number of proceesors produced by prtconf and sysconf() are inconsistent.
Thanks,
Alex Vinokur
#AIX-Forum