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 NumberOfLogicalCPU can be reliably obtained from the processor field of /proc/cpuinfo across almost all architectures, NumberOfPhysicalCPU relies on the cpu cores field 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 NumberOfPhysicalCPU is unavailable, setting it equal to NumberOfLogicalCPU is more reasonable than defaulting to 1. This provides better out-of-the-box behavior.
  • Impact on MPI: The current implementation forces NumberOfPhysicalCPU to 1 when unavailable, which cascades to MPIEXEC_MAX_NUMPROCS (via cmake/cmake!1405 (merged)). This causes issues with software packages that require higher values (e.g., ginkgo requires at least 3).

Merge request reports

Loading