User Tools

Site Tools


cudanminig

GTX 1080 Ti, CUDA 8, and Crypto Mining on Mint 18.1 / Ubuntu 16.04

  • Forword: I think crypto mining at home isn't terribly useful, even if you have cheap power (unless you're in it for the space heater effect)
  • That said, do read about cryptocurrencies!
  • Also read about CUDA in general.
    • Genga (if you like astrophysics) is a great start!
    • Deep Learning using Neural Networks are pretty fast to train on GPUs.

I daresay learning how to program CUDA and/or dealing with Deep Learning is gonna net you much better ROI than cryptomining.

Anyway, let's march on.

CUDA, NVIDIA Driver

  • This is for Linux Mint 18.1 (based on Ubuntu 16.04) w/ GTX 1080 Ti
  • This combo is a bit tricky becase we'd like CUDA 8 to make use of our card (which has Compute Capability 6.1), but the repos (Ubuntu repo as well as the NVIDIA CUDA repo) ship with NVIDA drivers that are too old (375.66 is available, 381.22 is what we need).
  • So, we need to get the new drivers from the Graphics-Drivers PPA and then install CUDA 8 manually. If we installed CUDA 8 through the NVIDIA repo, the drivers would get out of whack.
  • Also, in general, more control if you just drop CUDA into /usr/local/cuda-x.y and do not let the package manager mess with it (as it tends to).
  • If you want a more complicated setup (e.g., want multiple CUDA installations, that's fine, but you might want to look into using modules (to do module list, module avail, module load cuda, etc); see http://modules.sourceforge.net/ and http://lmod.readthedocs.io/en/latest/

Anyway, installing of NVIDIA drivers and CUDA 8 goes as follows:

1. Add graphics-drivers PPA from https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa

$ apt-add-repository ppa:graphics-drivers/ppa

2. Get CUDA 8 runfile from https://developer.nvidia.com/cuda-downloads

$ wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run

3. Install NVIDIA drivers; might need to reboot

$ apt-get install nvidia-381

(Or go via “Driver Manager”)

4. Install CUDA 8 runfile, make sure to only install the CUDA toolkit. You can ignore the warnings pertaining the GL stuff if you want to use only CUDA.

$ cd /whereever/you/downloaded/cuda
$ ./cuda_8.0.61_375.26_linux.run

Or, if you know what you are doing,

$ ./cuda_8.0.61_375.26_linux.run --toolkit --silent

The tail of the CUDA installer log should look like:

...

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /home/volker, but missing recommended libraries

Please make sure that
 -   PATH includes /usr/local/cuda-8.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/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 361.00 is required for CUDA 8.0 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

Logfile is /tmp/cuda_install_30008.log

5. Observe the needed adjustments to PATH and LD_LIBRARY_PATH

6. To see if it works, compile the deviceQuery program, i.e.

$ cd /usr/local/cuda/samples/1_Utilities/
$ make
$ ./deviceQuery

Should do something like this:

./deviceQuery 
./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 1080 Ti"
  CUDA Driver Version / Runtime Version          8.0 / 8.0
  CUDA Capability Major/Minor version number:    6.1
  Total amount of global memory:                 11171 MBytes (11713708032 bytes)
  (28) Multiprocessors, (128) CUDA Cores/MP:     3584 CUDA Cores
  GPU Max Clock rate:                            1683 MHz (1.68 GHz)
  Memory Clock rate:                             5505 Mhz
  Memory Bus Width:                              352-bit
  L2 Cache Size:                                 2883584 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 1080 Ti
Result = PASS

Mining

For crypto mining, we illustrate xmrMiner (Monero) and ethminer (Ethereum).

xmrMiner

  • xmrMiner is pretty straightforward to build (

RTFM)

0. Install some deps

$ apt-get install libssl-dev cmake cmake-curses-gui libcurl4-gnutls-dev git libjansson-dev

1. Download

$ git clone https://github.com/xmrMiner/xmrMiner/

2. Build (CUDA_ARCH=61 is for Compute Capability 6.1; You may need different; cf. https://developer.nvidia.com/cuda-gpus)

$ cd xmrMiner
$ mkdir build
$ cd build
$ cmake -DCUDA_ARCH=61 ..
$ make

3. Play around with the launch config.

You can use this for benchmarking

$ ./xmrMiner --launch=82x56 --benchmark

Or something like this for production use

./xmrMiner --launch=82x56 --url=stratum+tcp://pool.supportxmr.com --user=MONERO_ADDRESS --pass=WORKER_ID:you@mail.com

See https://www.reddit.com/r/Monero/comments/5xciun/xmrminer_a_new_high_optimized_nvidia_gpu_miner/ for some –launch parameter hints. There are also some in the README, which you've surely read.

ethminer

  • ethminer isn't terribly tricky to get running either; except that you should disable OpenCL which isn't installed with our somewhat precarious configuration

0. Reqs

???

1. Download

$ https://github.com/ethereum-mining/ethminer.git

2. Compile

$ cd ethminer
$ cd build
$ cmake -DETHASHCL=OFF -DETHASHCUDA=ON -DCOMPUTE=61 ..
$ cmake --build .

3. Benchmark

$ cd ethminer
$ ./ethminer -U -M

4. Run with a random pool; make sure to adjust your address

$ ./ethminer --farm-recheck 200 -U -S eu1.ethermine.org:4444 -FS us1.ethermine.org:4444 -O 0x06f1F736c6D1d5F360A304e0B86ff6874bF18b59.m18

cudanminig.txt · Last modified: 2017/09/04 09:23 by Volker