GPU mining


Hardware

The algorithm is memory hard and in order to fit the DAG into memory, it needs 1-2GB of RAM on each GPU. If you get Error GPU mining. GPU memory fragmentation? you havent got enough memory.

The GPU miner is implemented in OpenCL, so AMD GPUs will be 'faster' than same-category NVIDIA GPUs.

ASICs and FPGAs are relatively inefficient and therefore discouraged.

To get openCL for your chipset and platform, try:

On Ubuntu

AMD

download: ADL_SDK8.zip and AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh

./AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh
ln -s /opt/AMDAPPSDK-2.9-1 /opt/AMDAPP
ln -s /opt/AMDAPP/include/CL /usr/include
ln -s /opt/AMDAPP/lib/x86_64/* /usr/lib/
ldconfig
reboot
apt-get install fglrx-updates
// wget, tar, opencl
sudo aticonfig --adapter=all --initial
sudo aticonfig --list-adapters
* 0. 01:00.0 AMD Radeon R9 200 Series

* - Default adapter

Nvidia

The following instructions are, for the most part, relevant to any system with Ubuntu 14.04 and a Nvidia GPU. Setting up an EC2 instance for mining

On MacOSx

wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.29_mac.pkg
sudo installer -pkg ~/Desktop/cuda_7.0.29_mac.pkg -target /
brew update
brew tap ethereum/ethereum
brew reinstall cpp-ethereum --with-gpu-mining --devel --headless --build-from-source

You check your cooling status:

aticonfig --adapter=0 --od-gettemperature

Mining Software

The official Frontier release of geth only supports a CPU miner natively. We are working on a GPU miner, but it may not be available for the Frontier release. Geth however can be used in conjunction with ethminer, using the standalone miner as workers and geth as scheduler communicating via JSON-RPC.

The C++ implementation of Ethereum (not officially released) however has a GPU miner. It can be used from eth, AlethZero (GUI) and ethMiner (the standalone miner).

You can install this via ppa on linux, brew tap on MacOS or from source.

On MacOS:

brew install cpp-ethereum --with-gpu-mining --devel --build-from-source

On Linux:

apt-get install cpp-ethereum

On Windows: https://github.com/ethereum/cpp-ethereum/wiki/Building-on-Windows

GPU mining with ethminer

To mine with eth:

eth -m on -G -a <coinbase> -i -v 8 //

To install ethminer from source:

cd cpp-ethereum
cmake -DETHASHCL=1 -DGUI=0
make -j4
make install

To set up GPU mining you need a coinbase account. It can be an account created locally or remotely.

Using ethminer with geth

geth account new
geth --rpc --rpccorsdomain localhost 2>> geth.log &
ethminer -G  // -G for GPU, -M for benchmark
tail -f geth.log

ethminer communicates with geth on port 8545 (the default RPC port in geth). You can change this by giving the --rpcport option to geth. Ethminer will find get on any port. Note that you need to set the CORS header with --rpccorsdomain localhost. You can also set port on ethminer with -F http://127.0.0.1:3301. Setting the ports is necessary if you want several instances mining on the same computer, although this is somewhat pointless. If you are testing on a private cluster, we recommend you use CPU mining instead.

Also note that you do not need to give geth the --mine option or start the miner in the console unless you want to do CPU mining on TOP of GPU mining.

If the default for ethminer does not work try to specify the OpenCL device with: --opencl-device X where X is 0, 1, 2, etc. When running ethminer with -M (benchmark), you should see something like:

Benchmarking on platform: { "platform": "NVIDIA CUDA", "device": "GeForce GTX 750 Ti", "version": "OpenCL 1.1 CUDA" }


Benchmarking on platform: { "platform": "Apple", "device": "Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz", "version": "OpenCL 1.2 " }

To debug geth:

geth  --rpccorsdomain "localhost" --verbosity 6 2>> geth.log

To debug the miner:

make -DCMAKE_BUILD_TYPE=Debug -DETHASHCL=1 -DGUI=0
gdb --args ethminer -G -M

Note hashrate info is not available in geth when GPU mining. Check your hashrate with ethminer, miner.hashrate will always report 0.

ethminer and eth

ethminer can be used in conjunction with eth via rpc

eth -i -v 8 -j // -j for rpc
ethminer -G -M // -G for GPU, -M for benchmark
tail -f geth.log

or you can use eth to GPU mine by itself:

eth -m on -G -a <coinbase> -i -v 8 //