<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ben Santora</title>
    <description>The latest articles on DEV Community by Ben Santora (@truelinux).</description>
    <link>https://dev.to/truelinux</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4285846%2F327a2e47-f8af-409b-96a9-9289ed3dbd81.png</url>
      <title>DEV Community: Ben Santora</title>
      <link>https://dev.to/truelinux</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/truelinux"/>
    <language>en</language>
    <item>
      <title>The ThinkPad T470p: A Powerhouse Microsoft Declares Obsolete</title>
      <dc:creator>Ben Santora</dc:creator>
      <pubDate>Sun, 06 Dec 2026 06:30:30 +0000</pubDate>
      <link>https://dev.to/truelinux/the-thinkpad-t470p-a-powerhouse-microsoft-declares-obsolete-4d88</link>
      <guid>https://dev.to/truelinux/the-thinkpad-t470p-a-powerhouse-microsoft-declares-obsolete-4d88</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp27vkirf2x2mlq9h2315.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp27vkirf2x2mlq9h2315.jpg" alt=" " width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Lenovo ThinkPad T470p looks like any other business laptop: black, squared-off, unassuming. Inside, it's a different class of machine. Where most 14-inch laptops of its day ran low-power dual-core chips, the T470p carries Intel's quad-core HQ processors, up to the Core i7-7700HQ and i7-7820HQ. That's four cores, eight threads, and turbo speeds near 4 GHz, from chips Intel designed for performance laptops.&lt;/p&gt;

&lt;p&gt;That headroom shows up wherever work runs in parallel. Compiling a large codebase, running several virtual machines at once, transcoding video or crunching data all spread across every core, and the T470p keeps up. Two memory slots take up to 32 GB of RAM, enough for heavy multitasking or a small home lab on the desk. Fast M.2 SSD storage keeps build times and boot times short.&lt;/p&gt;

&lt;p&gt;There's an optional 2560×1440 screen for anyone who lives in code or spreadsheets, and an optional Nvidia GeForce 940MX for light graphics work. Everything sits under the ThinkPad keyboard, still one of the best ever put in a laptop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Microsoft says it's done
&lt;/h3&gt;

&lt;p&gt;According to Microsoft, this machine has no future.&lt;/p&gt;

&lt;p&gt;Windows 11 requires a processor on Microsoft's supported list, and for Intel that list starts at 8th-generation Core. The T470p's chips are 7th generation. Microsoft doesn't care that a quad-core i7-7700HQ outruns plenty of the newer dual-core chips that made the cut. It isn't on the list, so the T470p can't officially run Windows 11.&lt;/p&gt;

&lt;p&gt;Windows 10 offers no way out. Microsoft ended support for it on October 14, 2025. Paying for Extended Security Updates buys time only until October 12, 2027. After that, a T470p left on Windows 10 stops getting security fixes altogether.&lt;/p&gt;

&lt;p&gt;Windows 11 can be forced onto unsupported hardware, but Microsoft is blunt about what happens next. Its support page warns that such devices "aren't guaranteed to receive updates, including but not limited to security updates," stamps a watermark on the desktop, and recommends rolling back to Windows 10 (which they no longer support - ?).&lt;/p&gt;

&lt;p&gt;So a laptop that can compile code, run a home lab and drive a 1440p screen gets marked for the landfill over a line on a compatibility chart.&lt;/p&gt;

&lt;p&gt;The hardware isn't the problem. Microsoft policy is the problem. Linux is the solution. Seek out these machines and others like them, deemed as trash by Microsoft. Find one for yourself and give it new life with a Linux distribution of your choice and watch it fly through your tasks . You'll not only have a powerful machine that'll last for years, you'll be helping to keep e-waste out of our landfills.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Sources: Microsoft Learn, "Windows 11 requirements" and "Windows 11 supported Intel processors"; Microsoft Support, "Windows 11 on devices that don't meet minimum system requirements" (updated Dec 12, 2024) and "Windows 10 support has ended on October 14, 2025".&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Ben Santora - December 2026&lt;/p&gt;

</description>
      <category>ai</category>
      <category>performance</category>
      <category>linux</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Run a Local SLM Without Overheating - Using RAPL on Linux</title>
      <dc:creator>Ben Santora</dc:creator>
      <pubDate>Sun, 06 Dec 2026 05:59:20 +0000</pubDate>
      <link>https://dev.to/truelinux/-run-a-local-slm-without-overheating-using-rapl-on-linux-3jgg</link>
      <guid>https://dev.to/truelinux/-run-a-local-slm-without-overheating-using-rapl-on-linux-3jgg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvriu49ukhbjr35obfy9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvriu49ukhbjr35obfy9k.png" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recently, I was testing a small language model (SLM) locally. My PC is an HP ENVY 17m laptop with an Intel Core i7-1165G7 (4 cores, 8 threads), Debian 12, and llama.cpp installed. It doesn't have a modern, high-end GPU, so it's not capable of running anything larger than a 8B, and I do this in CPU-only mode. The model tested in this article is &lt;strong&gt;Lunaris&lt;/strong&gt;, a Llama 3 8B model quantized to Q4_K_M, which is a 4.9 GB file.&lt;/p&gt;

&lt;p&gt;I gave Lunaris the task of writing fiction - it's what it's designed for. My goal here wasn't to write fiction, but to see what this particular PC was capable of handling during prolonged SLM inference in CPU-only mode. The first test I handed it - write a short story of about 400 words, resulted in the CPU package reaching &lt;strong&gt;94 °C&lt;/strong&gt; and the CPU throttled itself to stay safe - something I didn't want happening again and again.&lt;/p&gt;

&lt;p&gt;It turned out the fix was already on the laptop. Intel CPUs have a hardware power limiter called &lt;strong&gt;RAPL&lt;/strong&gt;, and Linux exposes it as plain files you can read and write. With nothing installed and a few lines of bash, the same task peaked at &lt;strong&gt;70 °C with no throttling&lt;/strong&gt;, and the output was identical.&lt;/p&gt;

&lt;p&gt;This article covers what RAPL is, how Linux exposes it, why it suits SLM inference so well, and the small setup I built on top of it.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why a CPU-only SLM runs so hot
&lt;/h3&gt;

&lt;p&gt;A language model writes one token (a word-piece) at a time. To produce each token, the CPU has to read the &lt;strong&gt;entire model&lt;/strong&gt; out of RAM: 4.9 GB for every token. During a reply the processor sits at full load, often for minutes at a time. That is a very different load from a browser or a compile job, which comes in bursts. Inference is a long, flat, maximum load, and that is exactly the kind of load that heat-soaks a laptop.&lt;/p&gt;

&lt;p&gt;The useful detail is that the &lt;strong&gt;bottleneck is memory bandwidth, not compute&lt;/strong&gt;. The cores spend much of their time waiting for data from RAM. On this machine, 6.1 tokens/s × 4.9 GB comes to about 30 GB/s, which is close to what dual-channel DDR4 actually delivers. When the cores can't be fed any faster, letting them boost to high clocks mostly turns electricity into heat.&lt;/p&gt;

&lt;p&gt;So you can make the CPU draw much less power and lose surprisingly little speed. RAPL is the tool for doing that.&lt;/p&gt;




&lt;h3&gt;
  
  
  What RAPL is
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;RAPL (Running Average Power Limit)&lt;/strong&gt; is built into Intel processors from Sandy Bridge onward. It caps how much power the CPU package may draw, averaged over a time window. The two limits that matter are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;PL1&lt;/strong&gt; (long-term): the power the chip may draw indefinitely.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;PL2&lt;/strong&gt; (short-term): a higher figure the chip may boost to briefly before it has to fall back to PL1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Less power means less heat, directly, and the CPU enforces the limit itself in hardware. No daemon has to keep up with the load.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Linux exposes it
&lt;/h3&gt;

&lt;p&gt;The kernel's &lt;code&gt;powercap&lt;/code&gt; framework turns RAPL into ordinary files under &lt;code&gt;/sys/class/powercap/&lt;/code&gt;. On my HP:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ls /sys/class/powercap/
intel-rapl  intel-rapl:0  intel-rapl:0:0  intel-rapl:0:1  intel-rapl-mmio  intel-rapl-mmio:0

$ cd /sys/class/powercap/intel-rapl/intel-rapl:0
$ cat name constraint_0_name constraint_1_name
package-0
long_term
short_term

$ cat constraint_0_power_limit_uw constraint_1_power_limit_uw
15000000
18000000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;intel-rapl:0&lt;/code&gt; is the whole CPU package. &lt;code&gt;constraint_0&lt;/code&gt; is PL1 and &lt;code&gt;constraint_1&lt;/code&gt; is PL2. Values are in &lt;strong&gt;microwatts&lt;/strong&gt;, so &lt;code&gt;15000000&lt;/code&gt; means 15 W. The subzones &lt;code&gt;intel-rapl:0:0&lt;/code&gt; and &lt;code&gt;:0:1&lt;/code&gt; are the cores and the uncore.&lt;/p&gt;

&lt;p&gt;The same folder also has a live energy counter. That means you can measure the package's real power draw with nothing but &lt;code&gt;cat&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;f&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj
&lt;span class="nv"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;sudo cat &lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; sleep 1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;b&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;sudo cat &lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"$(( (b - a) / 1000000 )) W"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Since kernel 5.10, &lt;code&gt;energy_uj&lt;/code&gt; is readable only by root.)&lt;/p&gt;

&lt;p&gt;Setting a limit is one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; 12000000 &lt;span class="o"&gt;|&lt;/span&gt; sudo tee /sys/class/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That one command caps PL1 at 12 W. It takes effect immediately and needs no reboot. It also &lt;strong&gt;resets at the next boot&lt;/strong&gt;, so you can experiment without risk: if a value feels wrong, reboot and you're back to the firmware defaults.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; many laptops also have &lt;code&gt;intel-rapl-mmio:0&lt;/code&gt;, a second copy of the limits that the firmware sets (30/51 W on this HP). The CPU obeys whichever limit is &lt;strong&gt;lower&lt;/strong&gt;, so a lower value written to &lt;code&gt;intel-rapl:0&lt;/code&gt; still takes effect, as the measurements below show.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Two more knobs Linux gives you
&lt;/h3&gt;

&lt;p&gt;With the &lt;code&gt;intel_pstate&lt;/code&gt; driver (the default on modern Intel), Linux also exposes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Turbo:&lt;/strong&gt; &lt;code&gt;/sys/devices/system/cpu/intel_pstate/no_turbo&lt;/code&gt;. Write &lt;code&gt;1&lt;/code&gt; to keep the cores at base clock.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Energy preference (EPP):&lt;/strong&gt; &lt;code&gt;/sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference&lt;/code&gt;. The choices are &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;performance&lt;/code&gt;, &lt;code&gt;balance_performance&lt;/code&gt;, &lt;code&gt;balance_power&lt;/code&gt; and &lt;code&gt;power&lt;/code&gt;. EPP tells the chip how to trade speed against efficiency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RAPL sets the ceiling, and turbo and EPP shape how the chip behaves underneath it. Together they make a complete "low-heat mode", and all of it is already in the kernel.&lt;/p&gt;




&lt;h3&gt;
  
  
  The setup: two power levels
&lt;/h3&gt;

&lt;p&gt;I run the laptop at one of two levels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Everyday level: PL1 15 W, PL2 18 W.&lt;/strong&gt; This is applied at every boot by a small systemd service, and normal desktop use doesn't notice it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Cool mode, only while a model runs:&lt;/strong&gt; turbo off, EPP &lt;code&gt;power&lt;/code&gt;, and PL1 = PL2 = 12 W, so there is no boost window at all.&lt;/p&gt;

&lt;h4&gt;
  
  
  The cool-mode script
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;/usr/local/sbin/slm-cool&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# slm-cool on|off|status - low-heat CPU mode for running a language model (Intel CPUs).&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail
&lt;span class="nv"&gt;RAPL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sys/class/powercap/intel-rapl/intel-rapl:0
&lt;span class="nv"&gt;PSTATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sys/devices/system/cpu/intel_pstate
&lt;span class="nv"&gt;COOL_W&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;12&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;PL1_W&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;15&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;PL2_W&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;18
&lt;span class="o"&gt;[&lt;/span&gt; -r /etc/slm-cool.conf &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; . /etc/slm-cool.conf

epp&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; f &lt;span class="k"&gt;in&lt;/span&gt; /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"$1"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$f"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
cap&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; * 1000000 &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$RAPL/constraint_0_power_limit_uw"&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$2&lt;/span&gt; * 1000000 &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$RAPL/constraint_1_power_limit_uw"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"${1:-}"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
  on&lt;span class="o"&gt;)&lt;/span&gt;     &lt;span class="nb"&gt;echo&lt;/span&gt; 1 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$PSTATE/no_turbo"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; epp power&lt;span class="o"&gt;;&lt;/span&gt;               cap &lt;span class="s2"&gt;"$COOL_W"&lt;/span&gt; &lt;span class="s2"&gt;"$COOL_W"&lt;/span&gt; &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  off&lt;span class="o"&gt;)&lt;/span&gt;    &lt;span class="nb"&gt;echo&lt;/span&gt; 0 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$PSTATE/no_turbo"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; epp balance_performance&lt;span class="o"&gt;;&lt;/span&gt; cap &lt;span class="s2"&gt;"$PL1_W"&lt;/span&gt; &lt;span class="s2"&gt;"$PL2_W"&lt;/span&gt; &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  status&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  *&lt;span class="o"&gt;)&lt;/span&gt;      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"usage: slm-cool on|off|status"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;exit&lt;/span&gt; 2 &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'turbo %s | epp %s | PL1 %sW PL2 %sW\n'&lt;/span&gt; \
  &lt;span class="s2"&gt;"$([ "&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;cat &lt;span class="s2"&gt;"$PSTATE/no_turbo"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;" = 1 ] &amp;amp;&amp;amp; echo off || echo on)"&lt;/span&gt; \
  &lt;span class="s2"&gt;"$(cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference)"&lt;/span&gt; \
  &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;cat &lt;span class="s2"&gt;"$RAPL/constraint_0_power_limit_uw"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; / 1000000 &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; \
  &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;cat &lt;span class="s2"&gt;"$RAPL/constraint_1_power_limit_uw"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; / 1000000 &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The whole script is writes to sysfs. There's nothing to compile and no dependencies.&lt;/p&gt;

&lt;h4&gt;
  
  
  The settings file
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;/etc/slm-cool.conf&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;COOL_W=12   # cap while a model runs (slm-cool on)
PL1_W=15    # everyday long-term cap
PL2_W=18    # everyday short-term boost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Applying the everyday level at boot
&lt;/h4&gt;

&lt;p&gt;Because RAPL values reset on reboot, a oneshot service reapplies them. &lt;code&gt;/usr/local/sbin/cpu-powercap&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail
&lt;span class="nv"&gt;RAPL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sys/class/powercap/intel-rapl/intel-rapl:0
&lt;span class="nv"&gt;PL1_W&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;15&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;PL2_W&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;18
&lt;span class="o"&gt;[&lt;/span&gt; -r /etc/slm-cool.conf &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; . /etc/slm-cool.conf
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; PL1_W * 1000000 &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$RAPL/constraint_0_power_limit_uw"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; PL2_W * 1000000 &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$RAPL/constraint_1_power_limit_uw"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/etc/systemd/system/cpu-powercap.service&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;CPU&lt;/span&gt; &lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;power&lt;/span&gt; &lt;span class="nb"&gt;cap&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;RAPL&lt;/span&gt; &lt;span class="no"&gt;PL1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;PL2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="na"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;multi&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;

&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;oneshot&lt;/span&gt;
&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;usr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sbin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cpu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;powercap&lt;/span&gt;
&lt;span class="na"&gt;RemainAfterExit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yes&lt;/span&gt;

&lt;span class="k"&gt;[Install]&lt;/span&gt;
&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;multi&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo systemctl daemon-reload
sudo systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; --now cpu-powercap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Letting the launcher switch modes without a password
&lt;/h4&gt;

&lt;p&gt;Writing to these files needs root. I wanted the model launcher to switch cool mode on and off by itself, so I added a sudoers rule that allows that one script and nothing else. Create it with &lt;code&gt;sudo visudo -f /etc/sudoers.d/slm-cool&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ben ALL=(root) NOPASSWD: /usr/local/sbin/slm-cool on, /usr/local/sbin/slm-cool off, /usr/local/sbin/slm-cool status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  The launcher: cool mode on at start, off at exit
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;~/bin/lunaris&lt;/code&gt; is a short wrapper around &lt;code&gt;llama-cli&lt;/code&gt;. The important part is the &lt;strong&gt;trap&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail
&lt;span class="nv"&gt;MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${MODEL:-$HOME/.llama/models/L3-8B-Lunaris-v1-Q4_K_M.gguf}"&lt;/span&gt;
&lt;span class="nv"&gt;THREADS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${THREADS:-3}"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;COOL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${COOL:-1}"&lt;/span&gt;
&lt;span class="nv"&gt;COOLER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/sbin/slm-cool

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$COOL"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 1 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; sudo -n &lt;span class="s2"&gt;"$COOLER"&lt;/span&gt; on &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s1"&gt;'sudo -n "$COOLER" off &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || true'&lt;/span&gt; EXIT
    &lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s1"&gt;'exit 130'&lt;/span&gt; INT TERM HUP
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"WARNING: cool mode not available - running hot"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# not exec: the EXIT trap has to run after llama-cli quits&lt;/span&gt;
llama-cli -m &lt;span class="s2"&gt;"$MODEL"&lt;/span&gt; -ngl 0 -t &lt;span class="s2"&gt;"$THREADS"&lt;/span&gt; -tb &lt;span class="s2"&gt;"$THREADS"&lt;/span&gt; \
  -c 8192 -fa on -ctk q8_0 -ctv q8_0 -n 1536 \
  --temp 0.9 --min-p 0.05 --repeat-penalty 1.05 &lt;span class="s2"&gt;"$@"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sudo -n&lt;/code&gt; means "fail instead of asking for a password", so if the rule is missing the model still runs and you get a warning. The trap means that when &lt;code&gt;llama-cli&lt;/code&gt; ends, whether through &lt;code&gt;/exit&lt;/code&gt;, Ctrl+C, a closed terminal or an error, cool mode is switched off and the everyday level comes back. The script deliberately doesn't &lt;code&gt;exec&lt;/code&gt; llama-cli, because exec would replace the script and the trap could never run.&lt;/p&gt;

&lt;p&gt;Now I type &lt;code&gt;lunaris&lt;/code&gt; and the cooling takes care of itself.&lt;/p&gt;

&lt;h4&gt;
  
  
  A few llama.cpp flags that help a little
&lt;/h4&gt;

&lt;p&gt;RAPL does the real work. These flags help a bit on top of it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;-ngl 0&lt;/code&gt;: everything runs on the CPU.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;-t 3 -tb 3&lt;/code&gt;: three threads. Since the job is memory-bound, a fourth core adds heat and almost no speed.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;-fa on -ctk q8_0 -ctv q8_0&lt;/code&gt;: flash attention plus an 8-bit KV cache, which halves the cache's memory traffic. The 8-bit cache needs flash attention.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;-n&lt;/code&gt;: a cap on reply length, because a shorter reply means less time at full load.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  The results
&lt;/h3&gt;

&lt;p&gt;These are one-shot runs of the same kind of prompt, logged once a second. Temperatures are the CPU package (&lt;code&gt;Package id 0&lt;/code&gt; in &lt;code&gt;sensors&lt;/code&gt;).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Run&lt;/th&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;th&gt;Peak °C&lt;/th&gt;
&lt;th&gt;Avg °C&lt;/th&gt;
&lt;th&gt;Speed&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Story, ~410 words&lt;/td&gt;
&lt;td&gt;Lunaris, stock&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;94&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;82&lt;/td&gt;
&lt;td&gt;6.1 tok/s&lt;/td&gt;
&lt;td&gt;throttled ~13 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Story, ~410 words&lt;/td&gt;
&lt;td&gt;Lunaris, cool mode&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;70&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;62&lt;/td&gt;
&lt;td&gt;4.2 tok/s&lt;/td&gt;
&lt;td&gt;no throttling&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Cool mode cost me about 30% of the generation speed and &lt;strong&gt;nothing in quality&lt;/strong&gt;, because the model does exactly the same maths, only more slowly. Prompt processing stayed at about 14 tok/s either way. The temperature also levels off instead of climbing, so long sessions settle around 65–75 °C.&lt;/p&gt;

&lt;p&gt;For comparison, a pure stress test (&lt;code&gt;stress-ng --matrixprod&lt;/code&gt; on all 8 threads for 60 s) at the everyday 15/18 W level peaked at 81 °C with no throttling. That tells me the laptop's cooling hardware is fine, and the 94 °C was simply what happens when a CPU-only SLM is allowed unlimited power.&lt;/p&gt;

&lt;p&gt;Checking the state at any time:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo slm-cool status          # while Lunaris runs
turbo off | epp power | PL1 12W PL2 12W

$ sudo slm-cool status          # after quitting
turbo on | epp balance_performance | PL1 15W PL2 18W
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  Tuning it for your machine
&lt;/h3&gt;

&lt;p&gt;Every laptop cools differently, so treat 12 / 15 / 18 W as a starting point. Change &lt;strong&gt;one value at a time&lt;/strong&gt; in &lt;code&gt;/etc/slm-cool.conf&lt;/code&gt;, run the same prompt, and compare two numbers: the peak temperature from &lt;code&gt;sensors&lt;/code&gt;, and the &lt;code&gt;Generation: x t/s&lt;/code&gt; line that llama.cpp prints at the end. Lower watts give a cooler, slower run. Because everything resets on reboot, a bad value can't do lasting harm.&lt;/p&gt;

&lt;p&gt;A few things to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;This is Intel-specific.&lt;/strong&gt; AMD CPUs have RAPL-style energy reporting too, but the power-limit controls are different, and this setup doesn't cover them.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Other power tools can override you.&lt;/strong&gt; If you run TLP, thermald or power-profiles-daemon, check what they set so you aren't fighting them.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;This isn't only for SLMs.&lt;/strong&gt; &lt;code&gt;sudo slm-cool on&lt;/code&gt; before a long render or a big compile works the same way.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  The takeaway
&lt;/h3&gt;

&lt;p&gt;If you run models CPU-only on an Intel laptop, look in &lt;code&gt;/sys/class/powercap/&lt;/code&gt; - the limiter is already there.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://coderlegion.com/36282/run-a-local-slm-without-overheating-using-rapl-on-linux" rel="noopener noreferrer"&gt;Coder Legion&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ben Santora - November 2026&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>linux</category>
      <category>ai</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
