It was quite a hassle to find something that will compile and work under LMDE2 as its still based on Debian 8.10
with an old version of cmake and gcc. After a bunch of failures, I was able to make it running.
REQUIREMENTS
What you need to have is NVIDIA device with installed drivers (mine were installed via Hardware manager) CUDA toolkit and a bunch of packages.
Here is the exact list:
- GeForce GTX 1060 3GB
- Nvidia drivers - using driver version: 390.25
- CUDA Toolkit - using latest 9.1 (to download select
Linux > x86_64 > Ubuntu > 16.04 > runfile(local)
) - build libs and tools - gcc, g++, cmake
Install CUDA Toolkit
NVIDIA created a Toolkit that provides a development environment for creating high-performance GPU-accelerated applications. All available mining software is using CUDA.
Download the toolkit (using this tip from requirements) and execute the cuda_9.1.85_387.26_linux file installing only CUDA toolkit (code examples are optional and not needed by the mining software)
desk ~ # chmod +x cuda_9.1.85_387.26_linux
desk ~ # ./cuda_9.1.85_387.26_linux
Logging to /tmp/cuda_install_4974.log
Using more to view the EULA.
End User License Agreement
...
Do you accept the previously read EULA?
accept/decline/quit:
accept
You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: yes
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 387.26?
(y)es/(n)o/(q)uit: n
Install the CUDA 9.1 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-9.1 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 9.1 Samples?
(y)es/(n)o/(q)uit: n
Installing the CUDA Toolkit in /usr/local/cuda-9.1 ...
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-9.1
Samples: Not Selected
Please make sure that
- PATH includes /usr/local/cuda-9.1/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-9.1/lib64, or, add /usr/local/cuda-9.1/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.1/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.1/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.1 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run -silent -driver
The toolkit is installed and as mentioned in requirements I'm skipping driver installation as I have it already.
Select mining software
There are several mining apps out there that can work with different algorithms and coins on different OS. We will focus on Monero (cyroptonight algo) so my choice is either xmrig or xmr-stak.
Remember that we are going to compile on an older Debian jessie
so old packages as for gcc (4.9) and cmake (3.0.2). These versions will exclude xmr-stak
at the start as it requires gcc to be at last 5.1 (I didn't find any clean and fast way to install it without the upgrade to Debian 9).
xmrig doesn't need newest gcc and there is a dedicated Nvidia version xmrig-nvidia
Install dependencies
There will be a small problem with cmake in our setup and we will need to upgrade to something newer than 3.0.2. Gladly there is debian backports having cmake==3.6.2
desk ~ # apt-get install -t jessie-backports cmake
...
desk ~ # dpkg -l |grep cmake
ii cmake 3.6.2-2~bpo8+1 amd64 cross-platform, open-source make system
To build we will also need:
desk ~ # apt-get install libssl-dev libhwloc-dev git build-essential libuv1-dev libmicrohttpd-dev
BUILD
Following the instructions of xmrig
download the source create a build directory.
desk ~ # git clone https://github.com/xmrig/xmrig-nvidia.git
Cloning into 'xmrig-nvidia'...
remote: Counting objects: 1206, done.
remote: Total 1206 (delta 0), reused 0 (delta 0), pack-reused 1206
Receiving objects: 100% (1206/1206), 546.32 KiB | 822.00 KiB/s, done.
Resolving deltas: 100% (863/863), done.
Checking connectivity... done.
desk ~ # cd xmrig-nvidia
desk xmrig-nvidia # mkdir build
desk xmrig-nvidia # cd build
Launch cmake in it. -DCUDA_ARCH
will set the GPU architecture (semicolon separated list). HERE you can find a list! My GeForce GTX 1060 is compatible with 6.1 (CUDA 8).
desk build # cmake .. -DCUDA_ARCH="61"
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found UV: /usr/lib/x86_64-linux-gnu/libuv.a
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found suitable version "9.1", minimum required is "7.5")
-- Found NVML: /usr/local/cuda/include
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Found MHD: /usr/lib/x86_64-linux-gnu/libmicrohttpd.so
-- Configuring done
-- Generating done
-- Build files have been written to: /root/xmrig-nvidia/build
Now just make it and after couple of warnings it should compile like so
desk build # make -j 8
-- Configuring done
-- Generating done
-- Build files have been written to: /root/xmrig-nvidia/build
[ 4%] Building NVCC (Device) object CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_extra.cu.o
[ 4%] Building NVCC (Device) object CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_core.cu.o
...
[100%] Linking CXX executable xmrig-nvidia
[100%] Built target xmrig-nvidia
desk build #
RUN
Now just copy over you xmrig config.json
and launch the copiled binary to check if its running smoothly
desk build # ./xmrig-nvidia
* VERSIONS: XMRig/2.6.1 libuv/1.9.0 CUDA/9.10 gcc/4.9.2
* CPU: Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz x64 AES-NI
* GPU #0: GeForce GTX 1060 3GB @ 1771/4004 MHz 36x27 0x0 arch:61 SMX:9
* ALGO: cryptonight, donate=5%
* POOL #1: xmr-usa.dwarfpool.com:8005
* COMMANDS: hashrate, health, pause, resume
[2018-04-26 13:01:39] use pool xmr-usa.dwarfpool.com:8005 66.70.234.210
[2018-04-26 13:01:39] new job from xmr-usa.dwarfpool.com:8005 diff 20000
[2018-04-26 13:01:57] accepted (1/0) diff 20000 (141 ms)
[2018-04-26 13:02:01] accepted (2/0) diff 20000 (139 ms)
[2018-04-26 13:02:13] GPU 0 10s/60s/15m 442.5 n/a n/a H/s
[2018-04-26 13:02:13] speed 10s/60s/15m 442.5 n/a n/a H/s max: 442.5 H/s
...
As you can see its up and running doing around 440 H/s so its not that bad :)
Wait a while and check the power consupction and temperature.
desk build # nvidia-smi dmon -s p -c 5
# gpu pwr temp
# Idx W C
0 61 62
0 61 62
0 61 62
0 74 62
0 61 62
It looks stable and ready for some long term run!