Issue
I am working on a server with super configurations, it has 128 cpu-cores. When I run a parallelized code that utilizes full capacity of the cpu-cores only 8 cpu-cores are running in parallel. I can see that in htop
and number of threads working is, as shown below in the image, is 9
Is there any way to tell if I am restricted to usage of specific number of cpu-cores? How to do this in bash
image:
Solution
The application may run in a subset of the CPU set. Look at the cgroups to which the process is attached:
$ cat /proc/<pid>/cgroup
12:hugetlb:/
11:cpu,cpuacct:/user.slice
10:freezer:/
9:pids:/user.slice/user-500298949.slice/session-c16.scope
8:memory:/user.slice
7:cpuset:/
6:rdma:/
5:blkio:/user.slice
4:net_cls,net_prio:/
3:perf_event:/
2:devices:/user.slice
1:name=systemd:/user.slice/user-500298949.slice/session-c16.scope
0::/user.slice/user-500298949.slice/session-c16.scope
Look at the CPU list in the cpuset subsystem. In the above list, the cpuset subsystem of the process is at the root (typically /sys/fs/cgroup) of the cgroup hierarchy (i.e. 7:cpuset:/):
$ cat /sys/fs/cgroup/cpuset/cpuset.cpus
0-39
Answered By - Rachid K. Answer Checked By - Marilyn (WPSolving Volunteer)