Skip to content

Instantly share code, notes, and snippets.

@mmitech
Forked from gboddin/00-MINING.md
Created February 6, 2020 13:11
Show Gist options
  • Save mmitech/2244f5fa1abb241fb0ba55d0001bdbd0 to your computer and use it in GitHub Desktop.
Save mmitech/2244f5fa1abb241fb0ba55d0001bdbd0 to your computer and use it in GitHub Desktop.
Mining optimisation under Linux

Mining under linux

Disclaimer

I'm in no case responsible for fried hardware, erased software or burning down houses. Make sure your miners are always well cooled.

General recommendation

Don't mix nVidia and AMD in the same rig. sgminer doesn't play nice, and you might want to use a different distro depending on the hardware. More on this later.

nVidia

OS

I recommend using Ubuntu. The advantage is this little PPA over there : https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa that will allow easy installation of latest nVidia drivers.

Driver installation

add-apt-repository ppa:graphics-drivers/ppa
apt-get update
apt-get install -y linux-headers-generic nvidia-387 libcuda1-387 xorg --no-install-recommend

Enabling XORG on all GPU

If you don't enable XORG, you won't be able to use nvidia-settings to overclock your card(s), so yes, and X server is needed.

nvidia-xconfig --enable-all-gpus --coolbits=28 --allow-empty-initial-configuration

Create a systemd service file ( see mining.service )

vim /mining.service
<read and paste content from mining.service below>

Create your mining start-up script (see start-mining.sh)

vim /start-mining.sh
<read and paste content from start-mining.sh below>
chmod +x /start-mining.sh

In the script a value of 100 is used for GPUMemoryTransferRateOffset. The max memory overclock you can achieve depends on your card. Start from 100 and increase slowly to find a safe spot ( running stable for more than 30 minutes ).

Enable the service at start-up

systemctl enable /mining.service
[Unit]
Description=Mining service
[Service]
User=root
Group=root
GuessMainPID=no
ExecStart=/usr/bin/xinit /start-mining.sh
[Install]
WantedBy=multi-user.target
#!/bin/bash
export GPU_FORCE_64BIT_PTR=1
export GPU_MAX_HEAP_SIZE=100
export GPU_MAX_ALLOC_PERCENT=100
export GPU_SINGLE_ALLOC_PERCENT=100
# Configure your card fan and memory OC :
# Here a value of 1400 is choosen.
# Start from lower and increase by step of 100
# Let it run for 10 minutes, if no crash -> increment again
/usr/bin/nvidia-settings -c :0 -a "[gpu:0]/GPUFanControlState=1" -a "[gpu:0]/GPUTargetFanSpeed=100" -a "[gpu:0]/GPUMemoryTransferRateOffset[3]=100"
# Repeat for the next GPU :
#/usr/bin/nvidia-settings -c :0 -a "[gpu:1]/GPUFanControlState=1" -a "[gpu:1]/GPUTargetFanSpeed=100" -a "[gpu:1]/GPUMemoryTransferRateOffset[3]=100"
# Launch your miner, here xmr-stak
cd /xmrstak
xterm -geometry 80x40+620+0 -e ./bin/xmr-stak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment