Skip to content

Commit 27110ad

Browse files
Update README (#15)
Initial version of readme file
1 parent 7beba3c commit 27110ad

1 file changed

Lines changed: 168 additions & 2 deletions

File tree

README.md

Lines changed: 168 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,168 @@
1-
# cpu_scope
2-
CPUScope — Performance Forensics & Optimization Toolkit for HPC Workloads
1+
# CPUScope
2+
3+
[![CI](https://github.com/codingwithmagga/cpu_scope/actions/workflows/ci.yml/badge.svg)](https://github.com/codingwithmagga/cpu_scope/actions)
4+
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5+
[![C++20](https://img.shields.io/badge/C%2B%2B-20-brightgreen.svg)](https://en.cppreference.com/w/cpp/20)
6+
7+
**Performance forensics and optimization toolkit for CPU-bound HPC workloads**
8+
9+
---
10+
11+
## Overview
12+
13+
Developers building high-performance computing systems face a fundamental challenge: bridging the gap between application behavior and CPU architecture bottlenecks. Performance profilers generate terabytes of data; architects spend days correlating cache misses with code regions; optimization efforts often miss critical hotspots entirely.
14+
15+
CPUScope automates this workflow. By combining low-level hardware counters, intelligent bottleneck detection, and actionable optimization suggestions, it transforms raw profiling data into concrete insights. The toolkit targets HPC developers, performance engineers, and system architects who demand reproducible, architecture-aware optimization.
16+
17+
This project exemplifies Developer Technology engineering: bridging the gap between hardware capabilities and software optimization through open, maintainable, production-grade tooling. Every feature prioritizes developer experience—from one-command profiling to reference kernels with before/after comparisons.
18+
19+
---
20+
21+
## Key Features
22+
23+
- **Low-level profiling via Linux `perf` and hardware counters** – Direct access to CPU events (cache misses, branch mispredictions, SIMD utilization)
24+
- **Bottleneck detection** – Automatic classification of workloads as memory-bound, compute-bound, or branch-limited
25+
- **Optimization advisor** – Context-aware suggestions with code annotations
26+
- **Reference optimized kernels** – Before/after comparisons demonstrating optimization strategies
27+
- **Reproducible benchmark harness** – Scaling analysis across problem sizes and thread counts
28+
- **CPU architecture detection and dynamic adaptation** – Automatic tuning for target CPU (Intel, AMD, ARM)
29+
30+
---
31+
32+
## MVP Scope
33+
34+
| Feature | Status | Target Milestone |
35+
|---------|--------|--------------|
36+
| Project Infrastructure || [#1](https://github.com/codingwithmagga/cpu_scope/milestone/1) |
37+
| Core Profiling Engine | 🚧 | [#2](https://github.com/codingwithmagga/cpu_scope/milestone/2) |
38+
| Benchmark Harness | 🚧 | [#3](https://github.com/codingwithmagga/cpu_scope/milestone/2) |
39+
| Sample Kernels | 🚧 | [#4](https://github.com/codingwithmagga/cpu_scope/milestone/4) |
40+
| Bottleneck Analyzer | 🚧 | [#5](https://github.com/codingwithmagga/cpu_scope/milestone/5) |
41+
| CLI & MVP Integration | 🚧 | [#6](https://github.com/codingwithmagga/cpu_scope/milestone/6) |
42+
43+
See the [GitHub Issues](https://github.com/codingwithmagga/cpu_scope/issues) tracker for the full roadmap.
44+
45+
---
46+
47+
## Quick Start
48+
49+
### Prerequisites
50+
51+
- **CMake** ≥ 3.25
52+
- **GCC** ≥ 13 or **Clang** ≥ 17
53+
- **Linux** 5.x+ (for `perf` and hardware counter access)
54+
- **Build essentials** (ninja, ccache recommended)
55+
- Proper `perf` permissions (see [Troubleshooting](#troubleshooting))
56+
57+
### Clone & Build
58+
59+
```bash
60+
git clone https://github.com/codingwithmagga/cpu_scope.git
61+
cd cpu_scope
62+
mkdir build
63+
cd build
64+
cmake -S .. -B . -G Ninja \
65+
-DCMAKE_BUILD_TYPE=Release \
66+
-DCPUSCOPE_BUILD_TESTS=ON
67+
cmake --build .
68+
```
69+
70+
### Run Tests
71+
72+
```bash
73+
cd build
74+
ctest --output-on-failure
75+
```
76+
77+
### Run First Benchmark
78+
79+
Note: Currently not implemented
80+
81+
```bash
82+
./build/cpuscope_cli run spmv --size 1000
83+
```
84+
85+
---
86+
87+
## Development
88+
89+
### Code Formatting
90+
91+
Format all source files to project standards:
92+
93+
```bash
94+
scripts/format.sh
95+
```
96+
97+
Check formatting compliance (CI use):
98+
99+
```bash
100+
scripts/check-format.sh
101+
```
102+
103+
### Static Analysis
104+
105+
Run clang-tidy linting (requires compile_commands.json):
106+
107+
```bash
108+
scripts/lint.sh
109+
```
110+
111+
### Architecture
112+
113+
- **`lib/`** – Core library (profiling, detection, analysis)
114+
- **`cli/`** – Command-line interface
115+
- **`tests/`** – Unit tests (Google Test)
116+
117+
---
118+
119+
## Troubleshooting
120+
121+
### `perf` Permission Denied
122+
123+
Enable perf for non-root users:
124+
125+
```bash
126+
echo 1 | sudo tee /proc/sys/kernel/perf_event_paranoid
127+
```
128+
129+
Or run with elevated privileges:
130+
131+
```bash
132+
sudo ./build/cpuscope_cli run spmv --size 1000
133+
```
134+
135+
### CMake Configuration Failures
136+
137+
Ensure dependencies are installed:
138+
139+
```bash
140+
# Ubuntu/Debian
141+
sudo apt-get install -y cmake ninja-build ccache
142+
143+
# Fedora/RHEL
144+
sudo dnf install -y cmake ninja-build ccache
145+
```
146+
147+
---
148+
149+
## Contributing
150+
151+
Contributions are welcome! Please:
152+
153+
1. Follow the [C++ code style](https://google.github.io/styleguide/cppguide.html) (enforced by `.clang-format` and `.clang-tidy`)
154+
2. Add tests for new features
155+
3. Ensure all CI checks pass before submitting a PR
156+
4. Include clear commit messages
157+
158+
---
159+
160+
## License
161+
162+
This project is licensed under the MIT License — see [LICENSE](LICENSE) for details.
163+
164+
---
165+
166+
## Contact
167+
168+
For questions or suggestions, open an [issue](https://github.com/codingwithmagga/cpu_scope/issues) on GitHub.

0 commit comments

Comments
 (0)