Sponsored Content
Operating Systems Solaris How to calculate total number of cores on my servers ? Post 303035222 by ron323232 on Thursday 16th of May 2019 02:32:34 PM
Old 05-16-2019
How to calculate total number of cores on my servers ?

Hi,

I want to get total number of cores on my all non-global zones on Solaris 10. I got two methods and both are giving different results. Below link is a script, which tells me that total cores are 8
Mandalika's scratchpad: Oracle Solaris: Show Me the CPU, vCPU, Core Counts and the Socket-Core-vCPU Mapping
Code:
Total number of physical processors: 2
Number of virtual processors: 16
Total number of cores: 8
Number of cores per physical processor: 4
Number of hardware threads (strands or vCPUs) per core: 2
Processor speed: 3067 MHz (3.06 GHz)

But below command, tells me, total cores are 16
Code:
# echo "`kstat -m cpu_info|grep -w core_id|uniq|wc -l` core(s) "
      16 core(s)

Which is supposed to be accurate and I should keep using in all servers ?

Thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk help needed to calculate total

Hi all, I have a flat file like 10 steven 25 mike 47 Charles 127 Nancy 34 steven 23 mike 67 Charles 7761 Nancy 8 steven 54 mike 88 Charles 1267 Nancy I need to calculate the total of steven and all the members , for this I am using like grep "`sed -n 1p patterns.txt`"... (7 Replies)
Discussion started by: senthilkumar_ak
7 Replies

2. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

3. Shell Programming and Scripting

Calculate total of log by hour

Hi, Just wondering, is there anyway I can get the total of logs generated by hours ? Let say I have these logs, Sep 23 04:48:43 hsbcufs: NOTICE: realloccg /: file system full Sep 23 04:48:47 hsbcufs: NOTICE: alloc: /: file system full Sep 23 04:48:51 hsbcufs: NOTICE: realloccg /: file... (14 Replies)
Discussion started by: dehetoxic
14 Replies

4. Shell Programming and Scripting

Help with sum total number of record and total number of record problem asking

Input file SFSQW 5192.56 HNRNPK 611.486 QEQW 1202.15 ASDR 568.627 QWET 6382.11 SFSQW 4386.3 HNRNPK 100 SFSQW 500 Desired output file SFSQW 10078.86 3 QWET 6382.11 1 QEQW 1202.15 1 HNRNPK 711.49 2 ASDR 568.63 1 The way I tried: (2 Replies)
Discussion started by: patrick87
2 Replies

5. Shell Programming and Scripting

writing a simple script to get total number of cpus/cores in server

Hi, I am very new to scripting and I wanted to write a unix shell script which can give me, 1)number of cpu's in a box 2)number of cores per cpu 3)total number of cores in abox (ie multiplying 1&2) I am also trying to figure out how to check if hyper-threading is enabled in the... (8 Replies)
Discussion started by: steven12
8 Replies

6. Shell Programming and Scripting

How do I calculate total number of active and non active hosts?

#!/bin/bash for digit in $(seq 1 10) do if ping -c1 -w2 192.168.1.$digit &> /dev/null then echo "192.168.1.$digit is UP" else echo "192.168.1.$digit is DOWN" fi done (3 Replies)
Discussion started by: fusetrips
3 Replies

7. Shell Programming and Scripting

How to calculate the total number of weeks from a specify year?

Hi anyone can help? How to calculate total number of weeks from a specify date, for example, 01 Jan 2012. Thx! (2 Replies)
Discussion started by: rayray2013
2 Replies

8. Shell Programming and Scripting

Calculate total value from a row

HI I have a file # cat marks.txt MARKS LIST 2013 Name english french chinese latin total_marks wer 34 45 67 23 wqa 12 39 10 56 wsy 23 90 23 78 Now i need to find the total marks of each student using... (11 Replies)
Discussion started by: Priya Amaresh
11 Replies

9. Shell Programming and Scripting

Calculate the total

Hi All , I have the following script as below , I tried to modify to meet the requirement , could someone help ? very thanks ================================================================================================ while read STR NAME; do Total=0 MyString="$STR" GetData () {... (18 Replies)
Discussion started by: ust3
18 Replies
HWLOC-CALC(1)							       hwloc							     HWLOC-CALC(1)

NAME
hwloc-calc - Operate on cpu mask strings and objects SYNOPSIS
hwloc-calc [options] <location1> [<location2> [...] ] OPTIONS
-p --physical Use OS/physical indexes instead of logical indexes for both input and output. -l --logical Use logical indexes instead of physical/OS indexes for both input and output (default). --pi --physical-input Use OS/physical indexes instead of logical indexes for input. --li --logical-input Use logical indexes instead of physical/OS indexes for input (default). --po --physical-input Use OS/physical indexes instead of logical indexes for output. --lo --logical-output Use logical indexes instead of physical/OS indexes for output (default). -N --number-of <type|depth> Report the number of objects of the given type or depth that intersect the CPU set. This is convenient for finding how many cores, NUMA nodes or PUs are available in a machine. -I --intersect <type|depth> Find the list of objects of the given type or depth that intersect the CPU set and report the comma-separated list of their indexes instead of the cpu mask string. This may be used for determining the list of objects above or below the input objects. When combined with --physical, the list is convenient to pass to external tools such as taskset or numactl --physcpubind or --membind. This is different from --largest since the latter requires that all reported objects are strictly included inside the input objects. -H --hierarchical <type1>.<type2>... Find the list of objects of type <type2> that intersect the CPU set and report the space-separated list of their hierarchical indexes with respect to <type1>, <type2>, etc. For instance, if socket.core is given, the output would be Socket:1.Core:2 Socket:2.Core:3 if the input contains the third core of the second socket and the fourth core of the third socket. --largest Report (in a human readable format) the list of largest objects which exactly include all input objects. None of these output objects intersect each other, and the sum of them is exactly equivalent to the input. No largest object is included in the input This is different from --intersect where reported objects may not be strictly included in the input. --sep <sep> Change the field separator in the output. By default, a space is used to separate output objects (for instance when --hierarchi- cal or --largest is given) while a comma is used to separate indexes (for instance when --intersect is given). --single Singlify the output to a single CPU. --taskset Display CPU set strings in the format recognized by the taskset command-line program instead of hwloc-specific CPU set string format. This option has no impact on the format of input CPU set strings, both formats are always accepted. --restrict <cpuset> Restrict the topology to the given cpuset. -i <file>, --input <file> Read topology from XML file <file> (instead of discovering the topology on the local machine). If <file> is "-", the standard input is used. XML support must have been compiled in to hwloc for this option to be usable. -i <directory>, --input <directory> Read topology from the chroot specified by <directory> (instead of discovering the topology on the local machine). This option is generally only available on Linux. The chroot was usually created by gathering another machine topology with hwloc-gather- topology. -i <specification>, --input <specification> Simulate a fake hierarchy (instead of discovering the topology on the local machine). If <specification> is "node:2 pu:3", the topology will contain two NUMA nodes with 3 processing units in each of them. The <specification> string must end with a number of PUs. --if <format>, --input-format <format> Enforce the input in the given format, among xml, fsroot and synthetic. -v Verbose output. --version Report version and exit. DESCRIPTION
hwloc-calc generates and manipulates CPU mask strings or objects. Both input and output may be either objects (with physical or logical indexes), CPU lists (with physical or logical indexes), or CPU mask strings (always physically indexed). If objects or CPU mask strings are given on the command-line, they are combined and a single output is printed. If no object or CPU mask strings are given on the command-line, the program will read the standard input. It will combine multiple objects or CPU mask strings that are given on the same line of the standard input line with spaces as separators. Different input lines will be processed separately. Command-line arguments and options are processed in order. For instance, it means that changing the type of input indexes with --li or changing the input topology with -i only affects the processing the following arguments. NOTE: It is highly recommended that you read the hwloc(7) overview page before reading this man page. Most of the concepts described in hwloc(7) directly apply to the hwloc-calc utility. EXAMPLES
hwloc-calc's operation is best described through several examples. To display the (physical) CPU mask corresponding to the second socket: $ hwloc-calc socket:1 0x000000f0 To display the (physical) CPU mask corresponding to the third socket, excluding its even numbered logical processors: $ hwloc-calc socket:2 ~PU:even 0x00000c00 To combine two (physical) CPU masks: $ hwloc-calc 0x0000ffff 0xff000000 0xff00ffff To display the list of logical numbers of processors included in the second socket: $ hwloc-calc --intersect PU socket:1 4,5,6,7 To bind GNU OpenMP threads logically over the whole machine, we need to use physical number output instead: $ export GOMP_CPU_AFFINITY=`hwloc-calc --physical --intersect PU machine:0` $ echo $GOMP_CPU_AFFINITY 0,2,1,3 To display the list of NUMA nodes, by physical indexes, that intersect a given (physical) CPU mask: $ hwloc-calc --physical --intersect NUMAnode 0xf0f0f0f0 0,2 To display the physical index of a processor given by its logical index: $ hwloc-calc PU:2 --physical-output --intersect PU 3 To display the set of CPUs near network interface eth0: $ hwloc-calc os=eth0 0x00005555 To display the indexes of sockets near PCI device whose bus ID is 0000:01:02.0: $ hwloc-calc pci=0000:01:02.0 --intersect Socket 1 To display the list of per-socket cores that intersect the input: $ hwloc-calc 0x00003c00 --hierarchical socket.core Socket:2.Core:1 Socket:3.Core:0 To display the (physical) CPU mask of the entire topology except the third socket: $ hwloc-calc all ~socket:3 0x0000f0ff To combine both physical and logical indexes as input: $ hwloc-calc PU:2 --physical-input PU:3 0x0000000c To synthetize a set of cores into largest objects on a 2-node 2-socket 2-core machine: $ hwloc-calc core:0 --largest Core:0 $ hwloc-calc core:0-1 --largest Socket:0 $ hwloc-calc core:4-7 --largest NUMANode:1 $ hwloc-calc core:2-6 --largest Socket:1 Socket:2 Core:6 $ hwloc-calc socket:2 --largest Socket:2 $ hwloc-calc socket:2-3 --largest NUMANode:1 To get the set of first threads of all cores: $ hwloc-calc core:all.pu:0 RETURN VALUE
Upon successful execution, hwloc-calc displays the (physical) CPU mask string, (physical or logical) object list, or (physical or logical) object number list. The return value is 0. hwloc-calc will return nonzero if any kind of error occurs, such as (but not limited to): failure to parse the command line. SEE ALSO
hwloc(7), hwloc-gather-topology(1) 1.4.1 Feb 27, 2012 HWLOC-CALC(1)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy