Bitcoin Forum
November 17, 2024, 12:21:12 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [GUIDE][NVIDIA] How to setup a headless Ubuntu 16 Server with Overclocking  (Read 603 times)
slazarov (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
November 20, 2017, 06:28:31 PM
Last edit: November 20, 2017, 08:09:10 PM by slazarov
 #1

This guide will help you setup multiple NVIDIA GPUs (proprietary drivers) on Ubuntu 16.04.03 headless* server, enabling overclock and fan control.
*Headless means without a monitor connected to the rig

Prerequisites:
  • Clean Ubuntu 16.04.03 headless server installation
  • SSH enabled

Steps
1. Since it's a freshly installed OS, SSH into the system and update:
Quote
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y

2. Install a lightweight X server
Quote
sudo apt-get install --no-install-recommends xorg lightdm

3. Disable the X server from auto starting on boot. Otherwise it would cause conflicts when you try to overclock the cards later on.
Quote
sudo systemctl disable lightdm.service

4. Install GCC and MAKE in order to be able to install the NVIDIA proprietary drivers
Quote
sudo apt-get install gcc make -y

5. Install GTK in order to be able to use nvidia-settings
Quote
sudo apt-get install libgtk-3-dev -y

6. Download the latest NVIDIA proprietary drivers. Right now they are 384.98, so check for updates from NVIDIA's website
Quote

7. Reboot
Quote
sudo reboot

8. Make the file executable and start the installation:
Quote
chmod +x NVIDIA-Linux-x86_64-384.98.run
sudo ./NVIDIA-Linux-x86_64-384.98.run

8.1 At a certain point you will be greeted by the following error.
Code:
WARNING: Unable to find a suitable destination to install 32-bit compatibility libraries. Your system may not be set up for 32-bit
compatibility. 32-bit compatibility files will not be installed; if you wish to install them, re-run the installation and
set a valid directory with the --compat32-libdir option.
Error Screenshot
Ignore it, it's all ok.

8.2 At the end of the installation you will be asked:
Code:
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X?  Any pre-existing X configuration file will be backed up.
Click NO.

8.3 Generate xorg.conf
Quote
sudo nvidia-xconfig -a --allow-empty-initial-configuration --cool-bits=31 --use-display-device="DFP-0" --connected-monitor="DFP-0"
cool-bits enables overclocking; the rest tricks the rig that there is a monitor connected to it.

You will get this message:
Code:
Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found
Don't worry, ignore it.

8.4 Reboot
Quote
sudo reboot

9. Boot up and check if all the GPUs are shown
Quote
nvidia-smi
You should get something like this:
Code:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.98                 Driver Version: 384.98                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:01:00.0 Off |                  N/A |
|  0%   24C    P0    30W / 151W |      0MiB /  8114MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 1070    Off  | 00000000:02:00.0 Off |                  N/A |
|  0%   23C    P0    34W / 180W |      0MiB /  8114MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

10. We are nearly done. Let's add some additional stuff and setup overclocking. We are going to make them boot together with Ubuntu, so we don't have to do them manually every single time.
Quote
sudo nano /etc/rc.local
Sample file:
Code:
# Add some error logging, you can disable it after when you are certain everything is working:
exec 2> /tmp/rc.local.log
exec 1>&2
set -x

# Enabling persistence mode makes sure that the driver doesn't get unloaded.
sudo nvidia-smi -pm ENABLED

# Adjust the power limit. In Afterburner you set a % but here you must specify value. You can get base power limit through nvidia-dmi
# In my case, the value for GPU0 is 151W, so 70% power limit is 151*0.70~106
# You specify the card through the parameter -i, so GPU is -i 0
sudo nvidia-dmi -i 0 -pl 110

# You must start the X Server for overclocking and fan control to work
sudo X :0 &
sleep 10
export DISPLAY=:0
sleep 2

# Set GPU0 fan speed to 50%, Clock Offset to +100 and Memory Offset to +300
# For more cards, just copy paste the line and change [gpu:x] and [fan:x]
sudo nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=50" -a "[gpu:0]/GPUGraphicsClockOffset[3]=100" -a "[gpu:0]/GPUMemoryTransferRateOffset[3]=300"

exit 0

Reboot:
Quote
sudo reboot

Check for error
Quote
cat /tmp/rc.local.log
If the file ends with +exit 0 then you have successfully managed to overclock and set the fan speed.

11. Let's try some mining:
11.1 Download EWBF from the official bitcointalk thread on your main computer
https://bitcointalk.org/index.php?topic=1707546.0

11.2 Upload miner, unarchive and create a run script

From your computer
Quote
scp /Users/xxxx/Downloads/Zec\ Miner\ 0.3.4b\ Linux\ Bin.tar.gz your_user_name@ip_of_rig:/home/your_user_name

From the rig
Quote
tar xvf Zec\ Miner\ 0.3.4b\ Linux\ Bin.tar.gz
cd 0.3.4b
echo "./miner --server eu.zenmine.pro --user znWvyc22usByJRRjijeFeD2D7yNF9P11MAG.rig1 --pass x --port 9009 --log 2 --api 0.0.0.0:3333" > run.sh
chmod +x run.sh

11.3 Run the script
Quote
./run.sh &

Don't forget the prefix &. It makes sure that the miner keeps running after you exit the session.

12. CTRL+D out of the SSH session and enjoy.

Note
If you get an error message regarding the drivers at any point in time, redo STEP 8 and all of its subsets.


If you want I will add additional watchdog scripts.

If you find this guide helpful, you could buy me a beer Wink.
[ BTC ] 18n4eKg8PB1USs5f95MK34JA4KmaV1YhT2
[ ETH ] 0xf5a6431ac4acd8b1e5c8b56b9b45e04cdea20e6e
[ LTC ] LZT8o523jwa8ZmgMjPLNMJeVeBnLuAvRvc
NameTaken
Hero Member
*****
Offline Offline

Activity: 630
Merit: 502


View Profile
November 20, 2017, 06:48:24 PM
 #2

Install Nvidia driver from repo instead of .run.
No need to install build packages.

Coolbits 1 and 2 are unnecessary.

Quote
1 (bit 0) - Enables overclocking of older (pre-Fermi) cores on the Clock Frequencies page in nvidia-settings.
2 (bit 1) - When this bit is set, the driver will "attempt to initialize SLI when using GPUs with different amounts of video memory".
Code:
systemctl disable lightdm
or
Code:
systemctl set-default multi-user.target 
to prevent lightdm from auto starting.
All major distros have adopted systemd for process management and logging so take advantage of that instead of using antiquated rc.local, screen, cron, &, >, etc.
slazarov (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
November 20, 2017, 08:11:22 PM
 #3

Lightdm disable fixed - wrong copy pasta.
Agree with the rest.
The drivers in the repo are not the most recent tho.
NameTaken
Hero Member
*****
Offline Offline

Activity: 630
Merit: 502


View Profile
November 20, 2017, 08:19:11 PM
 #4

Lightdm disable fixed - wrong copy pasta.
Agree with the rest.
The drivers in the repo are not the most recent tho.
nvidia-384 is in default 16.04 repo.

https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
If you want 387.
slazarov (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
November 20, 2017, 08:32:43 PM
 #5

Note taken.
Will edit it later.
Leaving the OC part as it is for now.
huglester
Jr. Member
*
Offline Offline

Activity: 49
Merit: 1


View Profile
October 18, 2018, 08:32:07 PM
Merited by Vectorium (1)
 #6

any updates to this script?
Rabinovitch
Legendary
*
Offline Offline

Activity: 2030
Merit: 1076


A humble Siberian miner


View Profile
March 06, 2019, 08:55:48 AM
 #7


Coolbits 1 and 2 are unnecessary.

Quote
1 (bit 0) - Enables overclocking of older (pre-Fermi) cores on the Clock Frequencies page in nvidia-settings.
2 (bit 1) - When this bit is set, the driver will "attempt to initialize SLI when using GPUs with different amounts of video memory".

So what value should we use for 'coolbits'?

any updates to this script?

I highly doubt there will ever be any...

From Siberia with love!
Fundraising for BOINC Farm
Rabinovitch
Legendary
*
Offline Offline

Activity: 2030
Merit: 1076


A humble Siberian miner


View Profile
March 06, 2019, 09:01:34 AM
Last edit: March 06, 2019, 05:50:28 PM by Rabinovitch
 #8

This guide will help you setup multiple NVIDIA GPUs (proprietary drivers) on Ubuntu 16.04.03 headless* server, enabling overclock and fan control.

Sample file:
Code:
...
# For more cards, just copy paste the line and change [gpu:x] and [fan:x]
sudo nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=90"
...
exit 0


Excellent, thank you so much!

But for some reason I can't see 90% of fan speed on one of my GPUs:



But all commands has been accepted by OS!



How to fix it?

p.s. actually this trick is working only for GPU0 and GPU1. On GPU2 and GPU3 it looks that the fan speed remains the same as without all those commands.

From Siberia with love!
Fundraising for BOINC Farm
jintruder
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
March 12, 2019, 10:14:20 PM
 #9

Guys, check this out : https://bitcointalk.org/index.php?topic=1854250.0

Also would be great to have such a tutorial for AMD gpus
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!