Skip to content

Commit 5b5b5e0

Browse files
v0.3.15: crash fixes, NVML build fix, doctor overhaul, measurement consistency
Crash fixes: - Fix core dump when RAPL permission denied (try/catch in C API boundary) - Fix os.geteuid() crash on Windows - Fix NEMB session leak on subprocess timeout - Handle TimeoutExpired in all measurement backends NVML / GPU: - Pass HAVE_NVML compile definition to codegreen-nemb target (was always stubs) - Add Windows NVML search paths - GPU detection in doctor command Measurement accuracy: - Consistent capture_output across JSON/human modes (was 22% discrepancy) - RAPL provider skips inaccessible domains instead of failing entirely - JSON budget exit code fixed (was exit 0 when exceeded) CLI improvements: - Doctor checks NEMB library, energy backend, RAPL perms, GPU, live sensor test - No silent fallbacks: refuses to run without real energy backend - Permission check before measurement with actionable fix instructions - JSON output: backend, domains, cv_percent, power_watts, outliers_removed - Command grouping: Measurement/Setup/Diagnostics/Validation panels - Config command: --edit creates user override, --reset reverts to defaults - --include-warmup flag, --repeat validation, CV N/A for n<3 - JavaScript added to Language enum Build & packaging: - cmake errors visible under pip install (stderr with captured output) - Python 3.14 classifier, min version 3.9 - Version via importlib.metadata (single source of truth) - Config path alignment between Python CLI and NEMB C++ backend - Production defaults in config.json Documentation: - 57+ doc issues fixed (license, broken commands, stale versions, help text) - Changelog entries for v0.3.11-v0.3.15
1 parent afd748a commit 5b5b5e0

32 files changed

Lines changed: 702 additions & 313 deletions

CITATION.cff

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
cff-version: 1.1.0
1+
cff-version: 1.2.0
22
message: "If you use this software, please cite it as below."
33
authors:
44
- family-names: Rajput
55
given-names: Saurabhsingh
6-
orcid: https://orcid.org/0000-0002-4630-2288
7-
title: "CodeGreen: A Modular Energy Measurement System for Multi-Language Software"
8-
version: v0.1.0
6+
orcid: https://orcid.org/0000-0002-4630-2288
7+
- family-names: Sharma
8+
given-names: Tushar
9+
title: "CodeGreen: Towards Improving Precision and Portability in Software Energy Measurement"
10+
version: v0.3.15
911
date-released: 2026-01-26
1012
url: "https://smart-dal.github.io/codegreen/"
1113
doi: 10.5281/zenodo.18371772

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ find_package(PkgConfig)
1616
find_package(Threads REQUIRED)
1717

1818
# Optional GPU library detection
19-
find_library(NVML_LIBRARY nvidia-ml PATHS /usr/local/cuda/lib64 /usr/lib/x86_64-linux-gnu)
20-
find_path(NVML_INCLUDE_DIR nvml.h PATHS /usr/local/cuda/include /usr/include/nvidia/gdk)
19+
find_library(NVML_LIBRARY nvidia-ml PATHS
20+
/usr/local/cuda/lib64 /usr/lib/x86_64-linux-gnu
21+
"C:/Windows/System32" "$ENV{ProgramFiles}/NVIDIA Corporation/NVSMI")
22+
find_path(NVML_INCLUDE_DIR nvml.h PATHS
23+
/usr/local/cuda/include /usr/include/nvidia/gdk
24+
"$ENV{CUDA_PATH}/include")
2125
find_library(ROCM_SMI_LIBRARY rocm_smi64 PATHS /opt/rocm/lib)
2226
find_path(ROCM_SMI_INCLUDE_DIR rocm_smi.h PATHS /opt/rocm/include/rocm_smi)
2327

INSTALL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ codegreen doctor
4747

4848
**Required:**
4949
- Linux (Ubuntu 20.04+, Debian 11+, Fedora 35+)
50-
- Python 3.8 or higher
51-
- CMake 3.15+
50+
- Python 3.9 or higher
51+
- CMake 3.16+
5252
- C++ compiler (gcc 9+ or clang 10+)
5353
- Make
5454

@@ -137,9 +137,9 @@ codegreen info
137137
codegreen doctor
138138
```
139139

140-
Run benchmark:
140+
Test energy measurement:
141141
```bash
142-
codegreen benchmark cpu_stress --duration 5
142+
codegreen run --repeat 3 -- python3 -c "sum(range(10**7))"
143143
```
144144

145145
---

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ JSON (default for `--json`), CSV, Markdown table, and text summary. The JSON out
9696

9797
Adding a new language requires only a JSON config file in `codegreen/instrumentation/configs/` plus the tree-sitter grammar. No Python code changes needed.
9898

99-
Currently supported: Python, C, C++, JavaScript, Java.
99+
Currently supported: Python, C, C++, Java. JavaScript config exists but is not yet exposed via CLI.
100100

101101
## Benchmarking
102102

codegreen/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
"""
2-
CodeGreen: Energy-aware software development tool
2+
CodeGreen: Know the true energy cost of your code.
33
4-
A comprehensive energy measurement and code optimization tool for developers
5-
and researchers who need precise, fine-grained energy consumption analysis.
4+
Precise, hardware-level energy measurement for any program. Reads directly
5+
from CPU and GPU energy counters (Intel/AMD RAPL, NVIDIA NVML, Apple
6+
IOReport, Windows EMI). No estimation, no modeling -- just what the
7+
hardware reports. Per-domain attribution, function-level profiling,
8+
statistical analysis, and CI/CD-ready JSON output.
69
"""
710

8-
__version__ = "0.3.14"
11+
try:
12+
from importlib.metadata import version as _pkg_version
13+
__version__ = _pkg_version("codegreen")
14+
except Exception:
15+
__version__ = "0.3.15" # fallback for dev/editable installs
916
__author__ = "Saurabhsingh Rajput"
1017
__email__ = "saurabh@dal.ca"
11-
__description__ = "Energy-aware software development tool"
18+
__description__ = "Know the true energy cost of your code -- hardware-level measurement via RAPL, NVML, IOReport, EMI"
1219

1320
# Ensure package root is on sys.path for imports
1421
import sys as _sys

0 commit comments

Comments
 (0)