summaryrefslogtreecommitdiff
path: root/cpuinfo.spec
blob: c8df54579ce76df7a73240f74b6b543a0a3b6ed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
%bcond_with check
 
%global commit0 eb4a6674bfe9cf91b63b9817412ae5f6862c8432
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
 
Summary:        A library to detect information about host CPU
Name:           cpuinfo
License:        BSD-2-Clause
# The project has no version, this is the last git commit date YY.M.D
Version:        23.2.14
Release:        %{?shortcommit0}%{?dist}.1
 
URL:            https://github.com/pytorch/%{name}
Source0:        %{url}/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz

Patch0:         0001-cpuinfo-fedora-cmake-changes.patch

ExclusiveArch:  x86_64 aarch64
 
BuildRequires:  cmake
BuildRequires:  gcc-c++
%if %{with check}
BuildRequires:  gtest-devel
%endif
BuildRequires:  make
 
%description
cpuinfo is a library to detect essential for performance
optimization information about host CPU.
 
Features
* Cross-platform availability:
  * Linux, Windows, macOS, Android, and iOS operating systems
  * x86, x86-64, ARM, and ARM64 architectures
* Modern C/C++ interface
  * Thread-safe
  * No memory allocation after initialization
  * No exceptions thrown
* Detection of supported instruction sets, up to AVX512 (x86)
  and ARMv8.3 extensions
* Detection of SoC and core information:
  * Processor (SoC) name
  * Vendor and microarchitecture for each CPU core
  * ID (MIDR on ARM, CPUID leaf 1 EAX value on x86) for each CPU core
* Detection of cache information:
  * Cache type (instruction/data/unified), size and line size
  * Cache associativity
  * Cores and logical processors (hyper-threads) sharing the cache
* Detection of topology information (relative between logical
  processors, cores, and processor packages)
* Well-tested production-quality code:
  * 60+ mock tests based on data from real devices
  * Includes work-arounds for common bugs in hardware and OS kernels
  * Supports systems with heterogenous cores, such as big.LITTLE and Max.Med.Min
* Permissive open-source license (Simplified BSD)
 
%package devel
Summary:        Headers and libraries for cpuinfo
Requires:       %{name}%{?_isa} = %{version}-%{release}
 
%description devel
This package contains the developement libraries and headers
for cpuinfo.
 
%prep
%autosetup -p1 -n %{name}-%{commit0}

%build
%cmake \
%if %{with check}
    -DCPUINFO_BUILD_UNIT_TESTS=ON \
%else
    -DCPUINFO_BUILD_UNIT_TESTS=OFF \
%endif
    -DCPUINFO_BUILD_MOCK_TESTS=OFF \
    -DCPUINFO_BUILD_BENCHMARKS=OFF \
    -B "./build" \
    -S "."
 
%{__cmake} --build "./build" -j --verbose

%install
DESTDIR="%{buildroot}" %{__cmake} --install "./build"

%check
%if %{with check}
%ctest
%endif

%files
%{_bindir}/isa-info
%{_bindir}/cpu-info
%{_bindir}/cache-info
%ifarch x86_64
%{_bindir}/cpuid-dump
%endif
%{_libdir}/lib%{name}.so.*

%files devel
%license LICENSE
%doc README.md
%dir %{_datadir}/%{name}
%{_includedir}/%{name}.h
%{_datadir}/%{name}/%{name}-*.cmake
%{_libdir}/lib%{name}*.so
%{_libdir}/pkgconfig/lib%{name}.pc

%changelog
* Sun Jan 28 2024 Binshuo Zu <274620705z@gmail.com> - 23.2.14.giteb4a667.1
- Package init