0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SMT環境で物理コア数を取得するスクリプト

Last updated at Posted at 2020-11-26

SMT環境で、スレッドが含まれたのコア数ではなく、物理コア数がほしいときもあると思います。
それ以外についても、加工しやすい形になっていないことが多いので単純に数をechoするだけです。

物理コア数の合計

echo $(($(grep physical.id /proc/cpuinfo|sort -u|wc -l)*$(grep core.id /proc/cpuinfo|sort -u|wc -l)))

論理コア数の合計 (nosmtだと上記と一致する。)

echo $(grep core.id /proc/cpuinfo|wc -l)
nproc

CPU数

echo $(grep physical.id /proc/cpuinfo|sort -u|wc -l)

1CPUあたりの物理コア数

echo $(grep core.id /proc/cpuinfo|sort -u|wc -l)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?