Monero NVIDIA GPU Mining with Docker and nvidia-docker

9
Starter GPU CUDA Desktop Server 2016 GPU View With GTX 1070 ASUS STRIX
Starter GPU CUDA Desktop Server 2016 GPU View With GTX 1070 ASUS STRIX

This is a quick guide to mining Monero, a popular cryptocurrency, on a NVIDIA GPU using nvidia-docker. The benefit of this method is that you can use spare GPU cycles on a machine learning server without having to deal with differing CUDA dependencies. Our CPU mining Docker image has tens of thousands of pulls so we are adding a NVIDIA GPU miner.

Quick NVIDIA GPU Monero Mining Performance

Here are a few quick reference points in terms of performance using ccminer-cryptonight, a popular open source Monero NVIDIA GPU miner:

NVIDIA Monero Performance
NVIDIA Monero Performance

We highlighted the NVIDIA GRID M40 extensively. You can also find the ASUS GTX 1060 6GB Dual-Fan we are using here in Deeplearning01 and the PNY GTX 1050 Ti in Deeplearning02.

These are not the most efficient GPUs to mine Monero on, however, if you are looking for something to run when you are not running AI algorithms, this can be a decent option. They can also run while CPUs are running in the background.

Getting Started with Monero NVIDIA GPU Mining with Docker and nvidia-docker

We are going to assume that you have Docker, NVIDIA drivers and nvidia-docker installed. You will also need a free Minergate account. We are also going to use example@example.com as our account name at Minergate to use in the following examples. You will want to change that to a real address.

If you have a single GPU you can simply use the following one line launch command:

nvidia-docker run -d -e username=example@example.com servethehome/monero_gpu_nv_minergate

This downloads and runs a GPU miner on your NVIDIA GPU.

If you have multiple NVIDIA GPUs you need to target one container per GPU. Luckily, with nvidia-docker it is easy to target different GPUs with a container. Here is the example for a dual GPU system:

NV_GPU=0 nvidia-docker run -d -e username=example@example.com --name GPU0_monero servethehome/monero_gpu_nv_minergate
NV_GPU=1 nvidia-docker run -d -e username=example@example.com --name GPU1_monero servethehome/monero_gpu_nv_minergate
.... and etc.

We have successfully used this method with up to 8 GPUs in a single system. On the same system, we have also used our CPU mining Docker image to run a total of 9 miners.

ASUS GeForce GTX 1060 6GB OC Dual Fa
ASUS GeForce GTX 1060 6GB OC Dual Fan

Again, in the above replace example@example.com with your minergate username. We are tagging each GPU using NV_GPU and naming each of the miners so you can see which miner attaches to which GPU. That is an important trick when you have multiple GPUs in a system. For example, you can have GPU1 running Tensorflow, GPU2 running NVIDIA DIGITS and GPU3 running Monero mining.

Note, there are no fees for using our nvidia-docker mining image. The mining software is open source, however, minergate does have a low 1% fee. That is lower than other pools we had tried so we are using it in our Docker image.

The advantage of using this method is that you can use this to easily launch Monero GPU mining on NVIDIA GPUs without having to worry about CUDA dependencies.

Final Words

NVIDIA GPUs are not well known for excellent cryptocurrency mining. On the other hand, NVIDIA GPUs are the most commonly deployed GPUs for machine learning/ AI. As a result, many GPUs are deployed in servers and underutilized. This is an interesting way to make a few dollars while learning to use nvidia-docker.

While it was relatively straightforward to get this nice setup working for NVIDIA, for AMD GPUs it is *significantly* harder. The AMD GPU compute ecosystem is still a long way from where NVIDIA’s maturity level is. We have been testing a few images and the AMD GPUs are actually faster, but harder to orchestrate.

We did receive comments from an engineer at a large streaming video “flix” service that our NVIDIA GPU setup can be made more Docker Swarm friendly by not using nvidia-docker. We will be providing a Docker Swarm friendly option soon unless NVIDIA’s team can make this work in the meantime.

This is also a great opportunity to join the STH forums. We have a number of members actively using our Docker images and it is a great community to get involved with if you want to start using spare CPU and GPU cycles in your servers.

9 COMMENTS

  1. Dear Patrick, can you share the Dockerfile
    I wanted to test this setup on my PC but I have an issue with CUDA version :)

    nvidia-docker | 2017/03/14 10:19:04 Error: unsupported CUDA version: driver 6.5 < image 8.0

    I would like to remake the image if possible, for cuda and also pools .

    Is it possible to share the Dockerfile ?

    Thank you

  2. Your issue is with the driver version not the CUDA version.

    The Dockerfile is this:
    FROM ubuntu:trusty
    RUN rm /bin/sh && ln -s /bin/bash /bin/sh
    ADD moneroCPU.sh /usr/local/bin/moneroCPU.sh
    RUN chmod +x /usr/local/bin/moneroCPU.sh
    CMD ["/usr/local/bin/moneroCPU.sh"]

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.