<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>Jaryl Chng&apos;s Knowledge Base</title>
  <language>en-us</language>
  <generator>microfeed.org</generator>
  <itunes:type>episodic</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://kb-jarylchng-com.pages.dev/rss/" type="application/rss+xml"/>
  <link>https://kb.jarylchng.com</link>
  <description>
    <![CDATA[<p>Welcome to the index page of my knowledge base, if you haven't done so, do visit my website at <a href="https://jarylchng.com" rel="noopener noreferrer" target="_blank">https://jarylchng.com</a>.</p><p>I will mainly use this site to document stuff, most of which will likely be in the public domain.</p>]]>
  </description>
  <itunes:author>Jaryl Chng</itunes:author>
  <itunes:image href="https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png"/>
  <image>
    <title>Jaryl Chng&apos;s Knowledge Base</title>
    <url>https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png</url>
    <link>https://kb.jarylchng.com</link>
  </image>
  <copyright>©2024</copyright>
  <itunes:category text="Technology"/>
  <item>
    <title>Linux - Overclocking Multiple Headless Nvidia GPU for CUDA Cryptocurrency Mining</title>
    <guid>lp-s3OrdZuR</guid>
    <pubDate>Sat, 06 Apr 2024 16:14:44 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<h2>Setup</h2><pre class="ql-syntax" spellcheck="false">lspci | grep VGA
  01:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
  02:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
  03:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
  04:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
  06:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
  07:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
</pre><p>6x Gigabyte GTX 1070 G1 Gaming (7.93 GB VRAM) pool mining Ethereum.</p><h2>Steps</h2><p>Firstly we will have to one-time initialize /etc/X11/xorg.conf by using Nvidia's xconfig tool including a <a href="https://wiki.archlinux.org/index.php/NVIDIA/Tips_and_tricks#Enabling_overclocking" rel="noopener noreferrer" target="_blank">cool-bits</a> value of 28.</p><pre class="ql-syntax" spellcheck="false">nvidia-xconfig --allow-empty-initial-configuration --enable-all-gpus --cool-bits=28
</pre><p>Afterwards, we can start a Xorg server headlessly as Nvidia's setting tool requires it to be up.</p><pre class="ql-syntax" spellcheck="false">X :0 &amp; # display :0
</pre><p>Since I am running multiple cards, I would require a loop to go through all of it. Currently these values works best for the cards I used.</p><ul><li>-200 core clock</li><li>+1200 memory clock</li></ul><pre class="ql-syntax" spellcheck="false"># export DISPLAY=:0
# IFS=$'\n'
# for gpu in $(nvidia-smi -L); do
    id=$(echo ${gpu} | sed -e 's/GPU //g' -e 's/:.*//g')
    nvidia-settings -a [gpu:${id}]/GPUPowerMizerMode=1 -a [gpu:${id}]/GPUGraphicsClockOffset[3]=-200 -a [gpu:${id}]/GPUMemoryTransferRateOffset[3]=1200
done
</pre><p>As a final step, I would apply a -40 max watts undervolt as root.</p><pre class="ql-syntax" spellcheck="false">nvidia-smi -pl 140
</pre><p>Optionally, since we do not need the Xorg server to be running anymore, we can kill it</p><pre class="ql-syntax" spellcheck="false">killall Xorg
</pre><p>These configuration alone increased ~5MH/s per card, resulting in a 25-30MH/s overall increase!</p><h2>Automated bash script</h2><pre class="ql-syntax" spellcheck="false">#!/usr/bin/env bash
sudo nvidia-smi -pl 140
sudo X :0 &amp;
sleep 5
export DISPLAY=:0
IFS=$'\n'
for gpu in $(nvidia-smi -L); do
    id=$(echo ${gpu} | sed -e 's/GPU //g' -e 's/:.*//g')
    sudo nvidia-settings -a [gpu:${id}]/GPUPowerMizerMode=1 -a [gpu:${id}]/GPUGraphicsClockOffset[3]=-200 -a [gpu:${id}]/GPUMemoryTransferRateOffset[3]=1200
done
sudo killall Xorg
sudo systemctl start ethminer # or your own command to start your own miner
</pre>]]>
    </description>
    <link>https://kb.jarylchng.com/i/linux-overclocking-multiple-headless-nvidia-gpu-lp-s3OrdZuR/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
</channel>
</rss>