Ad

cpuinfo: CPU Information Library

CPUINFO provides a cross-platform library for detecting CPU hardware details, including architecture, instruction sets, cache, and topology.
Screenshot of pytorch/cpuinfo homepage

CPUINFO is a portable library designed for retrieving detailed information about a host's CPU. It aims to provide a consistent and reliable interface for accessing CPU-specific hardware characteristics across various operating systems and architectures. The library utilizes platform-specific methods like CPUID, /proc/[cpuinfo](/FOXBI/ch_cpuinfo), and registry access to gather data, supporting x86, x86-64, ARM, and ARM64 architectures on Linux, Windows, macOS, iOS, and Android.

CPUINFO offers comprehensive detection of instruction sets (up to AVX512 and ARMv8.3), cache details (size, associativity, line size), and processor topology. It's designed for production use with extensive testing and workarounds for system bugs. The library also supports various usage methods, including pkg-config integration, CMake, and Makefile integration, making it easy to incorporate into projects.

  • Cross-platform Support: Works on Linux, Windows, macOS, iOS, Android, and FreeBSD with x86, x86-64, ARM, and ARM64 architectures.
  • Comprehensive CPU Details: Detects processor name, microarchitecture, instruction sets, cache characteristics, and topology.
  • Production-Ready: Includes extensive testing, workarounds for common bugs, and a permissive BSD license.
  • Flexible Integration: Supports pkg-config, CMake, Makefile, and direct C/C++ usage.
  • Platform-Specific Detection: Employs appropriate methods (CPUID, /proc/cpuinfo, registry) for accurate data retrieval on different platforms.

CPUINFO is a mature and well-maintained library with a history of active development and a significant number of stars and forks. It has undergone extensive testing and incorporates workarounds for known issues. Recent commits indicate ongoing maintenance and support for newer platforms. A good level of documentation and example usage is also available.

CPUINFO is valuable for developers needing to dynamically determine CPU capabilities for performance optimization, feature enablement, or platform-specific logic. It enables informed decisions regarding software scaling and compatibility across a wide range of devices. It replaces manual methods and platform-specific code with a unified and reliable API.

Summarize:
Share:
Stars
1,189
Forks
415
Issues
119
Created
9 years ago
Commit
2 months ago
License
BSD-2-CLAUSE
Archived
No
Updated 50 minutes ago

Similar Repositories