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 Path: g2news2.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!usenet.stanford.edu!newsfeed.news.ucla.edu!ihnp4.UCSD.Edu!sdd.hp.com!usenet01.boi.hp.com!not-for-mail From: Don Morris Newsgroups: comp.sys.hp.hpux,comp.unix.aix,comp.unix.tru64 Subject: Re: Determine number of CPUs Date: Wed, 14 Oct 2009 08:57:10 -0700 Organization: Hewlett-Packard Company Message-ID: References: <4ad5a2ed@212.67.96.135> NNTP-Posting-Host: hornet.americas.hpqcorp.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet01.boi.hp.com 1255535757 8440 15.13.190.20 (14 Oct 2009 15:55:57 GMT) X-Complaints-To: news@usenet01.boi.hp.com NNTP-Posting-Date: Wed, 14 Oct 2009 15:55:57 +0000 (UTC) User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <4ad5a2ed@212.67.96.135> Xref: g2news2.google.com comp.sys.hp.hpux:1313 comp.unix.aix:3672 comp.unix.tru64:112 Dave wrote: > Does anyone know the best way to determine the number of CPUs on AIX, > HP-UX? (I'll extend the code to test on Tru64 and IRIX if anyone wants > to give me the info, but that is hardly high on the priority list). > > The constraints are > > 1) It can be done from the shell. > 2) It must not require root privileges > 3) It gives the number of physical CPUs, rather than cores. For HP-UX, that's not likely to be compatible across all architectures. (PA and IPF have different commands to report physical sockets/cpus). Scheduling units is much easier (which may mean cores or hyperthreads within cores, etc.): mpsched -s |grep "Processor Count"|cut -d : -f 2 should work on all supported versions of HP-UX (11.11 and higher, in other words). (The cut part may not be perfect... I'm a C coder at heart, not a shell scripter... but the Processor Count line is what you want, getting that to a number should be doable). Don > > Finding the number of cores, and/or hardware threads would be a nice > addition, but I'm trying to improve an autoconf macro > > http://www.nongnu.org/autoconf-archive/ax_count_cpus.html > > which has a description of "Attempt to count the number of processors > present on the machine." > > In practice, I suspect the number of cores would be a more useful value > to have, but for now at least, I'll use physical processors, as that is > what the macro implies it does. (It was undoubtedly written without > multi-core CPUs in mind). Perhaps I'll write another macros called > AX_COUNT_CORES and AX_COUNT_THREADS, but for now, I just want to fix the > above macro which is broken. > > I've seen various methods on the web, but many simply do not work on the > hardware I've tried them on. > > http://unix.ittoolbox.com/groups/technical-functional/hp-ux-l/command-to-determine-how-many-cpus-187381 > > > says of HP to try > > /opt/ignite/bin/print_manifest | pg > > well, it does not work on my HP-UX box. > > I've seen some suggestions for AIX which involve greping syslog. But one > can hardly guarantee that the admin has not disabled that. > > I'm perhaps looking for the impossible, but something which will always > work, like: > > $ psrinfo -p > 2 > > does on Solaris. > -- kernel, n: A part of an operating system that preserves the medieval traditions of sorcery and black art.