Results 1 to 6 of 6
We are working on our subscription renewal and now since Red Hat has changed their subscription model we need to give them the number of physical CPU sockets on each ...
- 06-30-2011 #1Just Joined!
- Join Date
- Jun 2011
- Posts
- 1
How do I get the physical CPU socket count in RHEL?
We are working on our subscription renewal and now since Red Hat has changed their subscription model we need to give them the number of physical CPU sockets on each system.
I have tried looking thru /proc/cpuinfo as well as tried to parse data out from dmidecode but both of those solutions count each individual core as a CPU.
Is there a clean and easy way to determine the number of sockets on each system? We also use RHN Satellite to manage our systems but I believe that is pulling the same data from dmidecode.
Help!
- 07-04-2011 #2Just Joined!
- Join Date
- Jul 2011
- Location
- Kolkata, India
- Posts
- 1
how to get number of physical CPUs / socketed CPUs / number of cores
Hi all,
As i have seen in so many complicated processes / apps to get number of physically socketed CPUs. But guys, i think its really simple to get the stats.Here are my 2 cents..
1. number of physical processors :
# cat /proc/cpuinfo | grep "physical id" | sort -n | uniq | wc -l
2. number of cores :
# cat / proc/cpuinfo | grep "cpu cores" | uniq
3. find if ht enabled
# cat /proc/cpuinfo | grep "ht" | uniq
if u see "ht" in flags then ht is enabled
suppose cpuinfo gives u the numbers
CPUs = 24 (0 to 23 )
siblings in each CPU = 12
CPU cores in each CPU = 6
that means each CPU is hyper threading enabled.
siblings (12 ) = cores (6) x hyper-threading (2)
number of physical CPUs = 24 / 12 = 2 !
chaos!
prabin
- 07-05-2011 #3
- 07-14-2011 #4Just Joined!
- Join Date
- Jul 2011
- Posts
- 1
A little expansion on what was provided makes it scriptable
Code:#!/bin/bash numCPU=`cat /proc/cpuinfo | grep -c processor` numPhys=`cat /proc/cpuinfo | grep "physical id" | sort -n | uniq | wc -l` numCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'` cat /proc/cpuinfo | grep -q "ht" isHT=$? numThrd=1 if [ $isHT -eq 0 ] then numThrd=2 fi sibs=$(($numCores * $numThrd)) socks=$(($numCPU / $sibs)) echo "Physical sockets are $socks"
- 03-13-2012 #5Just Joined!
- Join Date
- Mar 2012
- Posts
- 1
Code:#!/bin/bash numCPU=`cat /proc/cpuinfo | grep -c processor` numPhys=`cat /proc/cpuinfo | grep "physical id" | sort -n | uniq | wc -l` numCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'` cat /proc/cpuinfo | grep -q "ht" isHT=$? numThrd=1 if [ $isHT -eq 0 ] then numThrd=2 fi sibs=$(($numCores * $numThrd)) socks=$(($numCPU / $sibs)) ARR[1]="Physical sockets are $socks" case $numThrd in 1) ARR[2]="Hyperthreading is NOT enabled" ;; 2) ARR[2]="Hyperthreading is enabled" ;; esac ARR[3]="Number of cores not counting hyperthreads is $numCores" ARR[0]="" for i in $(seq 0 ${#ARR[*]}); do echo ${ARR[$i]} done
- 03-22-2012 #6Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
Micro tweak so it doesn't barf if there are no physical cores (VM)
Code:#!/bin/bash numCPU=`cat /proc/cpuinfo | grep -c processor` numPhys=`cat /proc/cpuinfo | grep "physical id" | sort -n | uniq | wc -l` numCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'` if [ -Z $numCores ]; then numCores=0 fi cat /proc/cpuinfo | grep -q "ht" isHT=$? numThrd=1 if [ $isHT -eq 0 ] then numThrd=2 fi sibs=$(($numCores * $numThrd)) if [ $sibs -ne "0" ]; then socks=$(($numCPU / $sibs)) else socks="0, Virtual Machine?" fi echo "Physical sockets are $socks"RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.


Reply With Quote
