From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: e63b27eb52,f19613495899e6db X-Google-Attributes: gide63b27eb52,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 15 Oct 2009 19:00:08 +0100 From: Dave User-Agent: Thunderbird 2.0.0.19 (X11/20090218) MIME-Version: 1.0 Newsgroups: comp.sys.hp.hpux,comp.unix.aix,comp.unix.tru64 Subject: Re: Determine number of CPUs References: <4ad5a2ed@212.67.96.135> <0d6fd7de-fb03-44ef-9fea-d60a38c594f8@j39g2000yqh.googlegroups.com> In-Reply-To: <0d6fd7de-fb03-44ef-9fea-d60a38c594f8@j39g2000yqh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.78.42.15 Message-ID: <4ad76334@212.67.96.135> X-Trace: 15 Oct 2009 19:00:20 GMT, 213.78.42.15 Path: g2news2.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!212.67.96.135!213.78.42.15 Xref: g2news2.google.com comp.sys.hp.hpux:1322 comp.unix.aix:3678 comp.unix.tru64:117 sjm wrote: > On 14 Oct, 11:07, Dave wrote: > >> 3) It gives the number of physical CPUs, rather than cores. > > Well it all depends what *you* define as a "physical CPU" and what you > are trying to achieve by that definition. In particular, IBM and Intel > offer conflicting definitions of what is a CHIP, a CPU, a PROCESSOR > and a CORE. Intel mainly make chips (as well as other stuff), so they > refer to these CHIPS as PROCESSORS, even if they have multiple CORES. > IBM mainly make systems (as well as other stuff) so they refer to > CORES as PROCESSORS, even if there is more than one PROCESSOR per > CHIP. And then you have to add that contemporary IBM chips like POWER5 > can have more than one THREAD per CORE, and more than one CORE per > CHIP, and more than one CHIP per SOCKET. > > So what was it that you wanted to know? Let me give you the background, as clearly I need to to avoid confusion. 1) I'm well aware there is some ambiguity in these terms. I use a Sun T5240 which has two CPUs, 16 cores and 128 hardware threads. Depending on how you test for 'cpus' you can get 2 or 128. (I'm not sure if there is a way of finding the cores, so getting 16) 2) Sage http://www.sagemath.org/ is a large maths program, which makes heavy use of programs written by lots of people in lots of languages (C, C++, Fortran, Perl, Python) and perhaps a few others. The basic concept of Sage is to not write a maths package from scratch, but to make use of all the existing maths software (some of which took many man-years to develop), and tie them all together with a common interface (a web browser). Users write their programs in a single language (pyton) by typing into their browser. It uses things like ATLAS for linear algebra, maxima for calculus etc. 3) Several of the 100 or so packages in Sage make use of autoconf. 4) One package in Sage (libm4ri) makes use of this autoconf macro http://www.nongnu.org/autoconf-archive/ax_count_cpus.html which is supposed to count the number of CPUs. As you can see if you read it, the macro's documentation is not exactly clear about what are CPUs. I suspect it was written before the days of multi-core processors. Even ignoring the fact of the ambiguity, I'm told by users of the autoconf mailing list that the macro is badly written. 5) It would be nice to modify that macro so it counts the number of processors fitted in a box (I'm aware too that some sockets on motherboards can take a single or dual CPU). Then, for the good of the community, there would a be a macro which did just this. 6) Having discussed with the author of the lib4mri, the number of cores would be most useful to his package. Hence really we need a new macro which determines the number of cores. Perhaps I should just forget about that macro, and find a way of counting the cores. Either way, what options are available to me? The only HP-UX box I have access to is an old single processor box, so I can't really do much testing on that. For Solaris I have access to numerous machines, with processors varying from 1 to 4, and cores varying from 1 to 16. For AIX I have easy access to only one machine. I'm not sure of the spec of that. I know on Solaris, an admin can limit the number of CPUs in different zones, take processors off-line. Clearly this gets quite complex. Probably the best solution is the user specifies how many CPUs he has in some environment variable, but an automatic method, even if not 100% right, would be useful. Ultimately, nobody is going to die because of a failure of this. I believe this is one of those things that is really impossible to do right, but if someone can tell me some commands that might be useful, I'd be interested. Dave -- I respectfully request that this message is not archived by companies as unscrupulous as 'Experts Exchange' . In case you are unaware, 'Experts Exchange' take questions posted on the web and try to find idiots stupid enough to pay for the answers, which were posted freely by others. They are leeches.