SystemInformation: Let NumberOf{Physical,Logical}CPU respect each other
This has been reported by cmake/cmake#18780 (closed), and I'd like to retell the story here.
This change is motivated by several factors:
- Architecture compatibility: While
NumberOfLogicalCPUcan be reliably obtained from theprocessorfield of/proc/cpuinfoacross almost all architectures,NumberOfPhysicalCPUrelies on thecpu coresfield which is absent on RISC-V and PowerPC architectures. Furthermore, obtaining physical core count at user level is challenging on RISC-V. - Sensible defaults: When
NumberOfPhysicalCPUis unavailable, setting it equal toNumberOfLogicalCPUis more reasonable than defaulting to1. This provides better out-of-the-box behavior. - Impact on MPI: The current implementation forces
NumberOfPhysicalCPUto 1 when unavailable, which cascades toMPIEXEC_MAX_NUMPROCS(via cmake/cmake!1405 (merged)). This causes issues with software packages that require higher values (e.g., ginkgo requires at least 3).