pytorch/cpuinfo
CPU INFOrmation library (x86/x86-64/ARM/ARM64, Linux/Windows/Android/macOS/iOS)
What it solves
This library provides a reliable way for software to detect the specific capabilities and physical layout of the host CPU. It helps developers write performance-optimized code that adapts to the hardware it is running on, such as choosing the right instruction set or optimizing memory access based on cache size.
How it works
It acts as a cross-platform interface that queries the operating system and hardware registers to gather detailed information. Once initialized, it provides a thread-safe C/C++ API to access data about the processor name, microarchitecture, supported instruction sets (like AVX or NEON), cache hierarchy, and core topology. It is designed to be lightweight, performing no memory allocations after its initial setup.
Who it’s for
It is intended for C and C++ developers building performance-sensitive applications—such as machine learning frameworks—that need to run efficiently across a wide variety of hardware, including mobile devices (Android/iOS) and desktop systems (Linux/Windows/macOS).
Highlights
- Cross-platform support for x86, x86-64, ARM, and ARM64 architectures.
- Detects supported instruction sets, cache details, and core topology.
- Handles heterogeneous core designs like ARM's big.LITTLE.
- Thread-safe, exception-free, and allocation-free after initialization.
- Production-quality code tested against 60+ real-world device configurations.
Related
- Project
- Project
- Project
- Project
- Project