cmake_host_system_information: Incorrect NUMBER_OF_PHYSICAL_CORES on aarch64
I am encountering an issue with Cmake on an AWS aarch64
instance. The NUMBER_OF_PHYSICAL_CORES
reported by Cmake is incorrect and shows as 1, while the instance has 16 cores. The NUMBER_OF_LOGICAL_CORES
is reported correctly as 16. I would appreciate if the community can look into it.
The following outputs from various commands might be helpful in debugging this issue:
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(Aarch64testing VERSION 1 DESCRIPTION "ARM64_TEST" LANGUAGES C)
cmake_host_system_information(RESULT PHYSICAL_CORE_COUNT QUERY NUMBER_OF_PHYSICAL_CORES)
cmake_host_system_information(RESULT LOGICAL_CORE_COUNT QUERY NUMBER_OF_LOGICAL_CORES)
message("PHYSICAL_CORE_COUNT is ${PHYSICAL_CORE_COUNT}")
message("LOGICAL_CORE_COUNT is ${LOGICAL_CORE_COUNT}")
$ cmake ../test/
-- The C compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
PHYSICAL_CORE_COUNT is 1
LOGICAL_CORE_COUNT is 16
-- Configuring done
-- Generating done
-- Build files have been written to: /home/admin/temp_build
$ cmake --version
cmake version 3.25.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ uname -a
Linux ip-172-31-18-163 5.10.0-20-cloud-arm64 #1 SMP Debian 5.10.158-2 (2022-12-13) aarch64 GNU/Linux
$ nproc
16
$ getconf _NPROCESSORS_ONLN
16
$ lscpu
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 4
NUMA node(s): 1
Vendor ID: ARM
Model: 3
Model name: Cortex-A72
Stepping: r0p3
BogoMIPS: 166.66
L1d cache: 512 KiB
L1i cache: 768 KiB
L2 cache: 8 MiB
NUMA node0 CPU(s): 0-15
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec store bypass: Not affected
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Branch predictor hardening, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
$ cat /proc/cpuinfo
processor : 0
BogoMIPS : 166.66
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 1
BogoMIPS : 166.66
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
...
processor : 15
BogoMIPS : 166.66
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
Edited by Nidhin Jose