Reference for Learners¶
Glossary¶
ACPI - Advanced Configuration and Power Interface; industry-standard specification for OS-directed power and thermal management
C-state - CPU idle/sleep power state (C0=active, C1/C2/C3+=sleeping levels)
DVFS - Dynamic Voltage and Frequency Scaling; technique for reducing power by lowering CPU frequency and voltage during low-demand periods
EPP - Energy-Performance Preference; hardware register allowing trade-off control between energy and performance (MSR 0x774)
Frequency Scaling - Adjusting CPU clock frequency (measured in GHz) dynamically based on workload
Governor - Linux kernel component implementing the policy for frequency selection (performance, powersave, ondemand, conservative, userspace)
HWP - Hardware P-State (Intel SpeedShift Technology); hardware-managed autonomous frequency control replacing OS control
Leakage Power - Static power consumption when transistors are powered but not switching (temperature-dependent)
MSR - Model-Specific Register; hardware register for CPU-level configuration (e.g., IA32_PERF_CTL for frequency control)
P-state - Performance state; a defined frequency-voltage pair (P0=max turbo, P1=nominal, P2-P15=lower states)
Scaling Driver - Linux kernel driver translating frequency policies into hardware register changes (intel_pstate or acpi-cpufreq)
S-state - System sleep state (S0=working, S1-S4=increasing sleep levels, S5=off)
T-state - Thermal throttling state; automatic frequency reduction under thermal stress
Thermal Throttling - Automatic frequency reduction when CPU temperature exceeds safe limits
Turbo Boost - Intel feature allowing opportunistic frequency increase beyond nominal when thermal/power headroom exists
Voltage Regulator - Power delivery circuit converting main voltage to CPU core voltage; per-core VRs available on modern CPUs
Common Issues & Solutions¶
Cannot write to sysfs frequency files (Permission denied)
Cause: Insufficient permissions for
/sys/devices/system/cpu/*/cpufreq/writesSolution: Run with
sudoor add user to power management group:sudo usermod -a -G cgroup_rw $USER
Frequency doesn’t change when I modify sysfs
Cause: Scaling driver not loaded or frequency already at requested level
Solution: Check
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driverto verify driver is active
CPU frequency keeps oscillating between different values
Cause: Normal behavior with ondemand or conservative governor responding to utilization changes
Solution: This is expected with dynamic governors. Use performance governor if stability required:
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
System becomes unresponsive after frequency change
Cause: Usually temporary during frequency scaling transition (10-50 microseconds)
Solution: If persistent, frequency may be set too low for system to remain responsive. Increase minimum frequency:
echo 1500000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Thermal throttling occurring frequently
Cause: Cooling capacity insufficient for power consumption or thermal management settings too aggressive
Solution: Check: (1) Actual temperature (
sensors), (2) BIOS thermal limits, (3) Cooling system health, (4) Reduce maximum frequency if necessary
Turbo Boost doesn’t activate
Cause: Disabled via no_turbo setting, or thermal/power limits prevent activation
Solution: Check
cat /sys/devices/system/cpu/intel_pstate/no_turbo(0=enabled). If thermally limited, verify cooling and BIOS settings
Cannot disable turbo boost (no_turbo always resets)
Cause: Some systems re-enable turbo at boot; may require BIOS setting change
Solution: Check BIOS for “Turbo Boost” option; also ensure no background service resetting it. Can make persistent via systemd service
Different cores have different frequencies
Cause: Normal on modern CPUs with per-core frequency capability (Skylake+)
Solution: This is expected with HWP enabled. To force all cores to same frequency, disable HWP or use kernel parameters
Reading Materials for Further Learning¶
Official Documentation¶
Intel RAPL (Running Average Power Limit) - Technical specification for Intel power monitoring and capping
ACPI Specification - Complete definition of ACPI power states and interfaces
Intel 64 and IA-32 Architectures Software Developer’s Manual - MSR register definitions (IA32_PERF_CTL at 0x199, IA32_PM_ENABLE at 0x770)
Linux Kernel cpufreq Documentation - Complete reference for Linux frequency scaling
Foundational Concepts¶
Energy Patterns for Software - Catalog of energy-efficient design patterns
Green Software Foundation - Industry resources for sustainable computing
Tools and Practical Guides¶
Intel Power Gadget - User-friendly power measurement tool for Windows/Mac
Linux cpupower tool - Command-line frequency scaling management
Turbostat - Thermal status and frequency monitoring tool
Advanced Topics¶
Intel SpeedShift (HWP) Overview - Hardware P-State information (check your CPU’s ARK entry)
Frequency Scaling and Performance Analysis - Detailed performance implications
Power Measurement in HPC - Overview of energy measurement tools and techniques
Case Studies and Research¶
Energy Efficient Computing from the Lab to Reality - Real-world HPC energy optimization studies
IT4Innovations National Supercomputing Center publications on energy-aware scheduling and resource management
Quick Reference: Common Commands¶
View Current Frequency Information¶
# Current frequency (kHz)
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
# All frequency information for a CPU
cat /sys/devices/system/cpu/cpu0/cpufreq/*
# Real-time frequency on all CPUs
turbostat
Change Frequency Governor¶
# View available governors
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
# Change to performance governor (all CPUs)
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Change to powersave
echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Change to ondemand with custom threshold
echo ondemand | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo 85 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
Frequency Scaling (Intel)¶
# Disable turbo boost
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
# Enable turbo boost
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
# Limit maximum frequency to 80%
echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
# Set minimum frequency to 60%
echo 60 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
Frequency Scaling (ACPI CPUFreq)¶
# Set specific frequency (in kHz)
echo 2400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
# Set frequency range
echo 1200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 3000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Temperature and Thermal Monitoring¶
# View CPU temperatures
sensors
# Monitor frequency and power in real-time
watch -n 1 'turbostat sleep 1'
# Check for thermal throttling events
dmesg | grep -i throttle
Power Measurement (if available)¶
# Using perf (Intel RAPL)
sudo perf stat -e power/energy-pkg/ <command>
# Using likwid (if installed)
likwid-powermeter <command>
# Using powerstat
sudo powerstat -R 60 1 # 60 samples, 1-second intervals
Key Takeaways¶
Power is a constraint: Modern CPUs are power-limited. Understanding power management is essential for performance prediction.
Frequency-power trade-off: Frequency affects power non-linearly (P ∝ V²×f). Small frequency reductions yield significant power savings.
Multiple control levels: P-states (active), C-states (idle), T-states (thermal), S-states (system)—each serves different purposes.
Governor selection matters: Performance, powersave, ondemand, and conservative governors suit different workloads. Choose wisely.
Hardware has gotten smarter: HWP (Hardware P-State) handles frequency autonomously, responding faster than OS control.
Measurement is essential: Before and after power data proves optimization effectiveness. Use profiling tools liberally.
System-specific: Optimal settings depend on your workload, hardware, and facility constraints. Benchmark and validate on your system.
Getting Help¶
Consult instructor-guide.md for teaching resources
Check Linux kernel cpufreq documentation for detailed references
Review common issues section above before debugging
Benchmark your own hardware to understand baseline behavior
Join HPC and green computing communities for best practices