Git Product home page Git Product logo

gominer's Introduction

gominer

gominer is an application for performing Proof-of-Work (PoW) mining on the Decred network after the activation of DCP0011 using BLAKE3. It supports solo and stratum/pool mining using OpenCL and CUDA devices.

User Reported Hashrates

Downloading

Binaries are not currently available. See the Building (Windows, Linux) section for details on how to build gominer from source.

Configuring gominer

gominer needs to acquire work in order to have something to solve. Currently, the only supported method is solo mining via a dcrd RPC server. There are plans to support dcrpool for pooled mining in the future.

In order to communicate with the dcrd RPC server, gominer must be configured with dcrd's RPC server credentials.

  • Obtain the RPC username and password by finding the rpcuser and rpcpass entries in the dcrd.conf file
    • Windows: %LOCALAPPDATA%\Dcrd\dcrd.conf
    • Linux: ~/.dcrd/dcrd.conf
    • MacOs: ~/Library/Application Support/Dcrd/dcrd.conf
  • Create a gominer.conf file at the platform-specific path that contains the exact same rpcuser= and rpcpass= lines you obtained from the dcrd.conf file in the previous step
    • Windows: %LOCALAPPDATA%\Gominer\gominer.conf
    • Linux: ~/.gominer/gominer.conf
    • MacOS: ~/Library/Application Support/Gominer/gominer.conf
    • The gominer.conf config file should have at least the following lines:
    rpcuser=<same rpcuser from dcrd.conf>
    rpcpass=<same rpcpass from dcrd.conf>
    

Next, dcrd must be configured with a mining address to send the payment for mined blocks. That is accomplished by either launching dcrd with the --miningaddr=Ds... CLI flag or adding a miningaddr=Ds... to the aforementioned dcrd.conf file and restarting dcrd.

Running

Benchmark mode

gominer provides a benchmark mode where no work is submitted in order to test your setup.

gominer -B

Solo Mining on Mainnet

Ensure you have configured gominer with dcrd's RPC credentials as well as dcrd with a miningaddr. Once the credentials and mining address have been configured, simply run gominer to begin mining.

gominer

Stratum/pool Mining on Mainnet

Mining with a Pool Based on Dcrpool

The username for pools running dcrpool is the payment address for receiving rewards and a unique name identifying the client formatted as address.name.

Run the following command replacing the pooldomain:port with the appropriate domain name and port of the desired pool to connect to and the address.name as previously described:

gominer --pool stratum+tcp://pooldomain:port --pooluser address.name

General Pool Mining

There is no other known pool software aside from dcrpool, that supports the latest Decred consensus rules at the current time. However, as long as the pool software supports the stratum protocol with the same semantics implemented by dcrpool, the following command should serve as a starting point:

gominer --pool stratum+tcp://pooldomain:port --pooluser username --poolpass password

Status API

There is a built-in status API to report miner information. You can set an address and port with --apilisten. There are configuration examples on sample-gominer.conf. If no port is specified, then it will listen by default on 3333.

Example usage:

$ gominer --apilisten="localhost"

Example output:

$ curl http://localhost:3333/
> {
    "validShares": 0,
    "staleShares": 0,
    "invalidShares": 0,
    "totalShares": 0,
    "sharesPerMinute": 0,
    "started": 1504453881,
    "uptime": 6,
    "devices": [{
        "index": 2,
        "deviceName": "GeForce GT 750M",
        "deviceType": "GPU",
        "hashRate": 110127366.53846154,
        "hashRateFormatted": "110MH/s",
        "fanPercent": 0,
        "temperature": 0,
        "started": 1504453880
    }],
    "pool": {
        "started": 1504453881,
        "uptime": 6
    }
}

Building

Linux

Preliminaries

Gominer works with OpenCL (both AMD and NVIDIA) and CUDA (NVIDIA only). At the current time, most users have reported that OpenCL gives them higher hashrates on NVIDIA.

Once you decide on OpenCL or CUDA, you will need to install the graphics driver for your GPU as well as the headers for OpenCL or CUDA depending on your choice.

The exact packages are dependent on the specific Linux distribution, but, generally speaking, you will need the latest AMDGPU-PRO display drivers for AMD cards and the latest NVIDIA graphics display drivers for NVIDIA cards. Then, depending on whether you will build the OpenCL or CUDA version, the specific set of toolsets, headers and libraries will have to be installed.

For OpenCL, the packages are typically named something similar to mesa-opencl-dev (for AMD) or nvidia-opencl-dev (for NVIDIA).

If you're using OpenCL, it is also recommended to install your distribution's equivalent of the clinfo package if you have any issues to ensure your device can be detected by OpenCL. When clinfo is unable to detect your device, gominer will not be able to either.

For CUDA, on distributions where it is available via the standard package manager, the required files are usually found as nvidia-cuda-toolkit. NVIDIA also provides its own CUDA Toolkit downloads.

The following sections provide instructions for building various combinations of gominer:

NVIDIA on Ubuntu 23.04

This section provides instructions for building gominer on a computer with an NVIDIA graphics card running Ubuntu 23.04. Both OpenCL and CUDA build instructions are provided.

Prerequisites

The following steps are applicable for both OpenCL and CUDA builds of gominer:

  • Detect the model of your NVIDIA GPU and the recommended driver
    • ubuntu-drivers devices
  • Install the NVIDIA graphics driver
    • If you agree with the recommended drivers
      • sudo ubuntu-drivers autoinstall
    • Alternatively, install a specific driver (for example)
      • sudo apt install nvidia-driver-525-server
  • Install the basic development tools git and go
    • sudo apt install git golang
  • Reboot to allow the graphics driver to load
    • sudo reboot
  • Obtain the gominer source code
    • git clone https://github.com/decred/gominer
  • Jump to the appropriate section for either OpenCL or CUDA depending on which GPU library you want to build gominer for
OpenCL on Ubuntu
  • Install the OpenCL headers
    • sudo apt install nvidia-opencl-dev
  • Build gominer
    • cd gominer
    • go build -tags opencl
  • Test gominer detects your GPU(s)
    • ./gominer -l
  • You may now configure and run gominer
CUDA on Ubuntu
  • Install the NVIDIA CUDA Toolkit:
    • sudo apt install nvidia-cuda-toolkit
  • Build gominer:
    • cd gominer
    • go generate -tags cuda .
  • Test gominer detects your GPU(s):
    • ./gominer -l
  • You may now configure and run gominer

Debian Bookworm

This section provides instructions for building gominer on a computer running Debian bookworm. Both OpenCL (using either AMD or NVIDIA graphics cards) and CUDA (NVIDIA graphics cards only) build instructions are provided.

Prerequisites
  • Enable the non-free (closed source) repository by using your favorite editor to modify /etc/apt/sources.list and appending contrib non-free to the deb repository
    • $EDITOR /etc/apt/sources.list
      • It should look similar to the following
        deb http://ftp.us.debian.org/debian bookworm-updates main contrib non-free
        deb http://security.debian.org bookworm-security main contrib non-free
        
  • Update the Apt package manager with the new sources
    • sudo apt update
  • Install the basic development tools git and go:
    • sudo apt install git golang
  • Obtain the gominer source code
    • git clone https://github.com/decred/gominer

Proceed to install the appropriate graphics card driver and supporting firmware, based on the hardware available on the computer:

  • For AMD GPUs: Install the AMD graphics driver and supporting firmware
    • sudo apt install firmware-linux firmware-linux-nonfree libdrm-amdgpu1 xserver-xorg-video-amdgpu
  • For NVIDIA GPUs: Install the NVIDIA graphics driver:
    • sudo apt install nvidia-driver
  • Restart the computer to ensure the driver is loaded
  • Jump to the appropriate section for either OpenCL or CUDA depending on which GPU library you want to build gominer for
OpenCL on Debian

This build mode supports both AMD and NVIDIA graphics cards.

  • Install the OpenCL headers, OpenCL Installable Client driver and OpenCL lib
    • sudo apt install opencl-headers mesa-opencl-icd ocl-icd-libopencl1
  • Help the loader find the OpenCL library by creating a symbolic link to it:
    • ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/libOpenCL.so
  • Build gominer
    • cd gominer
    • go build -tags opencl
  • Test gominer detects your GPU(s)
    • ./gominer -l
  • You may now configure and run gominer
CUDA on Debian

Note that this requires having an NVIDIA graphics card installed on the computer.

  • Install the NVIDIA CUDA Toolkit:
    • sudo apt install nvidia-cuda-toolkit
  • Build gominer:
    • cd gominer
    • go generate -tags cuda .
  • Test gominer detects your GPU(s):
    • ./gominer -l
  • You may now configure and run gominer

Windows

Windows Preliminaries

Gominer works with OpenCL (both AMD and NVIDIA) and CUDA (NVIDIA only).

At the current time, most users have reported that OpenCL gives them higher hashrates on NVIDIA. Additionally, building the CUDA-enabled version of gominer on Windows is a much more involved process. For these reasons, unless you really want to run the CUDA version for a specific reason, it is recommended to use OpenCL.

Windows Prerequisites

The following steps are applicable for both OpenCL and CUDA builds of gominer:

  • Download and install MSYS2
    • Make sure you uncheck Run MSYS2 now.
  • Launch the MSYS2 MINGW64 shell from the start menu
    • NOTE: The MSYS2 installer will launch the UCRT64 shell by default if you didn't uncheck Run MSYS2 now as instructed. That shell will not work, so close it if you forgot to uncheck it in the installer.
  • From within the MSYS2 MINGW64 shell enter the following commands to install gcc, git, go, unzip:
    • pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-tools mingw-w64-x86_64-go git unzip
    • git clone https://github.com/decred/gominer
  • Close the MSYS2 MINGW64 shell and relaunch it
    • NOTE: This is necessary to ensure all of the new environment variables are set properly
  • Jump to the appropriate section for either OpenCL or CUDA depending on which GPU library you want to build gominer for
OpenCL Prerequisites on Windows

The following is needed when performing an OpenCL build:

  • Still in the MSYS2 MINGW64 shell enter the following commands to install the light OpenCL SDK:
    • wget https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/files/1406216/lightOCLSDK.zip
    • unzip -d /c/appsdk lightOCLSDK.zip
  • Jump to the appropriate section for either OpenCL with AMD or OpenCL with NVIDIA depending on which type of GPU you have
OpenCL with AMD
  • Change to the library directory C:\appsdk\lib\x86_64
    • cd /c/appsdk/lib/x86_64
  • Copy and prepare the AMD Display Library (ADL) for linking
    • cp /c/Windows/SysWOW64/atiadlxx.dll .
    • gendef atiadlxx.dll
    • dlltool --output-lib libatiadlxx.a --input-def atiadlxx.def
  • Build gominer
    • cd ~/gominer
    • go build -tags opencl
  • Test gominer detects your GPU(s)
    • ./gominer -l
  • You may now configure and run gominer
OpenCL with NVIDIA
  • Build gominer
    • cd ~/gominer
    • go build -tags opencl
  • Test gominer detects your GPU(s)
    • ./gominer -l
  • You may now configure and run gominer

CUDA with NVIDIA

Building the CUDA-enabled gominer on a Windows platform is tricky, requires several GB worth of downloads and while we have made attempts at detecting the necessary tools and automating the building process, it is not guaranteed to work, in particular as newer or older versions of the various tools are installed.

This guide has been tested on a Windows 10 machine, with an NVIDIA graphics card installed, using Microsoft Visual Studio Community Edition 2022 and NVIDIA CUDA Toolkit version 12.2. If the automatic builder for gominer does not work on your system, you many need to manually setup the various tools.

After fulfilling the Windows prerequisites, follow the following instructions:

User Reported Hashrates

OpenCL

GPU Hashrate
NVIDIA GTX 1060 3.0 Gh/s
AMD RX 580 3.7 Gh/s
NVIDIA 1660 Super 5.0 Gh/s
AMD Vega 56 7.0 Gh/s
NVIDIA RTX 3060 Ti 8.7 Gh/s
NVIDIA GTX 3080 Mobile 9.4 Gh/s
NVIDIA RTX 3070 10.1 Gh/s
NVIDIA RTX 2080 10.4 Gh/s
NVIDIA Tesla V100 13.9 Gh/s
NVIDIA Tesla V100S 14.6 Gh/s
NVIDIA RTX 4070 14.9 Gh/s
NVIDIA RTX 3080 15.2 Gh/s
NVIDIA RTX 3090 17.6 Gh/s
AMD 7900 XTX 23.8 Gh/s

gominer's People

Contributors

baggins800 avatar chappjc avatar cjepson avatar dajohi avatar davecgh avatar dirbaio avatar gabrielboliveira avatar jcvernaleo avatar jholdstock avatar jolan avatar jrick avatar marcopeereboom avatar matheusd avatar teknico avatar timthomascode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gominer's Issues

CUDA support

gominer currently only supports opencl. To get the best performance on more gpus, CUDA support should be added.
Mostly this would involve the cgo bindings in gominer/cl and the actual calls in device.go (maybe device_cuda, device_cl or something like that with the main device being totally generic but that needs a little thought).

go lintify

This will bring the API to proper Go syntax.

Improve new work handling

We can probably handle new work from a pool better (when does code notice, when do we start on the new work, etc.).

Unit tests needed.

gominer needs unit tests (run with go test).

Since we have broken things up into packages this shouldn't be as hard as it would have been for the initial code base.

There is already test data for foundCandidate in an unused test function in the code. That is probably one of the first that should be hit.

Remove vestigal code

There are a number of functions and definitions (both in cuda and in device.go) that are no longer used or were copied from ccminer and were never used. These should be removed.

log output

The log output (particularly DEBUG and TRACE) have very little order to them. We need to put most useful things in DEBIUG (like json messages) and any of the other stuff only interesting to devs in TRACE or something similar to that. There might also be some duplicate logging.
INFO and ERROR log levels should be in pretty good shape.

do performance testing/comparisons

Have done some performance comparisons in the past but not long enough to have a high degree of accuracy.

Will perform 24h pool/testnet solo-mining tests and add the results to the README.

Requested by @behindtext

Panic when miner can't start

If mining can't start due (for example no permission to use the GPU) gominer panics. It should error gracefully with some sort of message:

20:03:59 2016-08-02 [WRN] MAIN: open /home/jcv/.gominer/gominer.conf: no such file or directory
20:03:59 2016-08-02 [INF] MAIN: Version 0.2.0-beta
No protocol specified
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
No protocol specified
No protocol specified
Error: No root privilege. Please check with the system-admin.
Error: No root privilege. Please check with the system-admin.
20:03:59 2016-08-02 [INF] POOL: Using pool: stratum+tcp://yiimp.ccminer.org:4252
No protocol specified
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x7fe8381172fb]

runtime stack:
runtime.throw(0xcaca60, 0x2a)
    /home/jcv/code/golang/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
    /home/jcv/code/golang/src/runtime/sigpanic_unix.go:12 +0x5a

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0xa0e160, 0xc8203f5aa0, 0x0)
    /home/jcv/code/golang/src/runtime/cgocall.go:123 +0xc2 fp=0xc8203f5a50 sp=0xc8203f5a28
github.com/decred/gominer/cl._Cfunc_clGetPlatformIDs(0xc800000000, 0x0, 0xc820462490, 0xc800000000)
    ??:0 +0x61 fp=0xc8203f5aa0 sp=0xc8203f5a50
github.com/decred/gominer/cl.CLGetPlatformIDs(0x0, 0x0, 0x0, 0x0, 0xc8203f5b94, 0xc82044a000)
    /home/jcv/code/go/src/github.com/decred/gominer/cl/platform.go:34 +0xce fp=0xc8203f5b60 sp=0xc8203f5aa0
main.getCLPlatforms(0x0, 0x0, 0x0, 0x0, 0x0)
    /home/jcv/code/go/src/github.com/decred/gominer/miner.go:19 +0x77 fp=0xc8203f5bc8 sp=0xc8203f5b60
main.NewMiner(0xc82007bda8, 0x0, 0x0)
    /home/jcv/code/go/src/github.com/decred/gominer/miner.go:78 +0x520 fp=0xc8203f5e08 sp=0xc8203f5bc8
main.gominerMain(0x0, 0x0)
    /home/jcv/code/go/src/github.com/decred/gominer/main.go:75 +0x7c0 fp=0xc8203f5f20 sp=0xc8203f5e08
main.main()
    /home/jcv/code/go/src/github.com/decred/gominer/main.go:99 +0x38 fp=0xc8203f5f48 sp=0xc8203f5f20
runtime.main()
    /home/jcv/code/golang/src/runtime/proc.go:188 +0x247 fp=0xc8203f5f90 sp=0xc8203f5f48
runtime.goexit()
    /home/jcv/code/golang/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8203f5f98 sp=0xc8203f5f90

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /home/jcv/code/golang/src/runtime/asm_amd64.s:1998 +0x1

goroutine 20 [semacquire]:
sync.runtime_Syncsemacquire(0xc8200716d0)
    /home/jcv/code/golang/src/runtime/sema.go:241 +0x201
sync.(*Cond).Wait(0xc8200716c0)
    /home/jcv/code/golang/src/sync/cond.go:63 +0xb3
github.com/decred/gominer/vendor/github.com/btcsuite/seelog.(*asyncLoopLogger).processItem(0xc82006e7e0, 0x0)
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_asynclooplogger.go:50 +0x179
github.com/decred/gominer/vendor/github.com/btcsuite/seelog.(*asyncLoopLogger).processQueue(0xc82006e7e0)
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_asynclooplogger.go:63 +0x4b
created by github.com/decred/gominer/vendor/github.com/btcsuite/seelog.newAsyncLoopLogger
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_asynclooplogger.go:40 +0xd7

goroutine 21 [semacquire]:
sync.runtime_Syncsemacquire(0xc820071850)
    /home/jcv/code/golang/src/runtime/sema.go:241 +0x201
sync.(*Cond).Wait(0xc820071840)
    /home/jcv/code/golang/src/sync/cond.go:63 +0xb3
github.com/decred/gominer/vendor/github.com/btcsuite/seelog.(*asyncLoopLogger).processItem(0xc82006e900, 0x0)
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_asynclooplogger.go:50 +0x179
github.com/decred/gominer/vendor/github.com/btcsuite/seelog.(*asyncLoopLogger).processQueue(0xc82006e900)
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_asynclooplogger.go:63 +0x4b
created by github.com/decred/gominer/vendor/github.com/btcsuite/seelog.newAsyncLoopLogger
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_asynclooplogger.go:40 +0xd7

goroutine 22 [syscall]:
os/signal.signal_recv(0x48c481)
    /home/jcv/code/golang/src/runtime/sigqueue.go:116 +0x132
os/signal.loop()
    /home/jcv/code/golang/src/os/signal/signal_unix.go:22 +0x26
created by os/signal.init.1
    /home/jcv/code/golang/src/os/signal/signal_unix.go:28 +0x45

goroutine 4 [chan receive]:
github.com/decred/gominer/vendor/github.com/btcsuite/seelog.(*asyncAdaptiveLogger).processQueue(0xc8200a2180)
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_adaptivelogger.go:127 +0xac
created by github.com/decred/gominer/vendor/github.com/btcsuite/seelog.newAsyncAdaptiveLogger
    /home/jcv/code/go/src/github.com/decred/gominer/vendor/github.com/btcsuite/seelog/behavior_adaptivelogger.go:84 +0x6a9

goroutine 25 [IO wait]:
net.runtime_pollWait(0x7fe838b3a828, 0x72, 0x43e0c9)
    /home/jcv/code/golang/src/runtime/netpoll.go:160 +0x63
net.(*pollDesc).Wait(0xc820478140, 0x72, 0x0, 0x0)
    /home/jcv/code/golang/src/net/fd_poll_runtime.go:73 +0x56
net.(*pollDesc).WaitRead(0xc820478140, 0x0, 0x0)
    /home/jcv/code/golang/src/net/fd_poll_runtime.go:78 +0x44
net.(*netFD).Read(0xc8204780e0, 0xc8204b4000, 0x1000, 0x1000, 0x0, 0x7fe83ce48000, 0xc820074000)
    /home/jcv/code/golang/src/net/fd_unix.go:250 +0x27b
net.(*conn).Read(0xc82044a000, 0xc8204b4000, 0x1000, 0x1000, 0xc82002d000, 0x0, 0x0)
    /home/jcv/code/golang/src/net/net.go:172 +0x121
net.(*TCPConn).Read(0xc82044a000, 0xc8204b4000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    <autogenerated>:68 +0x7d
bufio.(*Reader).fill(0xc8204b2000)
    /home/jcv/code/golang/src/bufio/bufio.go:97 +0x365
bufio.(*Reader).ReadSlice(0xc8204b2000, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/jcv/code/golang/src/bufio/bufio.go:328 +0x5a9
bufio.(*Reader).ReadBytes(0xc8204b2000, 0xc820074f0a, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/jcv/code/golang/src/bufio/bufio.go:406 +0xc0
bufio.(*Reader).ReadString(0xc8204b2000, 0xc820074f0a, 0x0, 0x0, 0x0, 0x0)
    /home/jcv/code/golang/src/bufio/bufio.go:446 +0x5b
github.com/decred/gominer/stratum.(*Stratum).Listen(0xc82007a000)
    /home/jcv/code/go/src/github.com/decred/gominer/stratum/stratum.go:255 +0x1c2
created by github.com/decred/gominer/stratum.StratumConn
    /home/jcv/code/go/src/github.com/decred/gominer/stratum/stratum.go:201 +0xa51

Performance numbers

ccminer vs gominer using both opencl & cuda.

We need to know where we are at on these. Please provide a matrix of soft- and hardware and run several tests to obtain an average value. Obviously we don't have cuda on gominer yet so that can be skipped for now.

Make stratum code into a package

The stratum code (all in stratum.go) should be moved into a package of its own. This will be cleaner and make it easier to add other pools.
The one issue is the code depends on the Work type from main which forces them to be in the main package. We could put Work in a package of its own but it seems odd to have a package for one type. Might be other things that could reasonably go there. This is not needed for things to work but will be needed before adding other pool types. Very easy but requires a decision.

high CPU usage while solo mining

pool/stratum mining CPU usage is steady at ~1-2% for both CUDA and OpenCL.

However, CPU usage while solo mining on testnet is:

~8% for OpenCL
~45% for CUDA

For OpenCL, I think this is in part due to how it works. It returns any diff 1 shares and then the difficulty is checked on the CPU. With lots of false positives per second, this is kind of to be expected.

Not sure about CUDA since I'm not very familiar with that yet.

Need to see if mainnet reveals similar results.

Occasional negative WaitGroup counter on CTRL+C

Occasionally, when CTRL+C is hit, you get the following panic:

14:21:15 2016-08-09 [WRN] MAIN: Got Control+C, exiting...
panic: sync: negative WaitGroup counter

goroutine 11 [running]:
panic(0x89ca20, 0xc082454250)
        C:/Go/src/runtime/panic.go:481 +0x3f4
sync.(*WaitGroup).Add(0xc082010f80, 0xffffffffffffffff)
        C:/Go/src/sync/waitgroup.go:71 +0xd7
sync.(*WaitGroup).Done(0xc082010f80)
        C:/Go/src/sync/waitgroup.go:96 +0x31
main.(*Miner).workRefreshThread(0xc082010f50)
        C:/building/go/src/github.com/decred/gominer/miner.go:255 +0x270
created by main.(*Miner).Run
        C:/building/go/src/github.com/decred/gominer/miner.go:318 +0x3fa

starting up: invalid memory address or nil pointer dereference

Dual AMD GPU: R9 290x and R9 280x.
Started with -B to benchmark. Crashes as regular user or root.
sgminer runs fine.

01:02:59 2016-08-03 [INF] MAIN: Version 0.2.0-beta
01:03:02 2016-08-03 [INF] MINR: GPU #0: Work size set to 666430208 ('intensity' 29.31187855587688)
01:03:03 2016-08-03 [INF] MINR: GPU #1: Work size set to 910539008 ('intensity' 29.762145583486816)
01:03:03 2016-08-03 [WRN] MINR: Running in BENCHMARK mode! No real mining taking place!
01:03:03 2016-08-03 [INF] MINR: Global stats: Accepted: 0, Rejected: 0, Stale: 0
01:03:03 2016-08-03 [INF] MINR: GPU #0 (Tahiti) reporting average hash rate 0H/s, 0/0 valid work
01:03:03 2016-08-03 [INF] MINR: GPU #1 (Hawaii) reporting average hash rate 0H/s, 0/0 valid work
01:03:03 2016-08-03 [INF] MINR: Started GPU #0: Tahiti
01:03:03 2016-08-03 [INF] MINR: Started GPU #1: Hawaii
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x56d674]

goroutine 53 [running]:
panic(0x96abe0, 0xc82000e110)
    /usr/lib/go/src/runtime/panic.go:481 +0x3e6
math/big.(*Int).Cmp(0xc8203c0f80, 0x0, 0xffffffffffffffff)
    /usr/lib/go/src/math/big/int.go:314 +0x24
main.(*Device).foundCandidate(0xc82042a000, 0x4022c800000000, 0x3000000)
    /home/jon/go/src/github.com/decred/gominer/device.go:483 +0x652
main.(*Device).runDevice(0xc82042a000, 0x0, 0x0)
    /home/jon/go/src/github.com/decred/gominer/device.go:451 +0xdb5
main.(*Device).Run(0xc82042a000)
    /home/jon/go/src/github.com/decred/gominer/device.go:305 +0x28
main.(*Miner).Run.func1(0xc82042a000, 0xc820428cb0)
    /home/jon/go/src/github.com/decred/gominer/miner.go:272 +0x21
created by main.(*Miner).Run
    /home/jon/go/src/github.com/decred/gominer/miner.go:275 +0xc1

go generate

There is a makefile to build some of the cuda code. This can probably be done with go generate instead.

Use glide for deps

We should use glide for our deps (at least the go ones) the way all the other dcr projects do.

implement device selection

It's pretty common to have a weak GPU for desktop use and more powerful cards for mining use.

This is also a feature universally provided by every other miner.

solo mining on CUDA triggers hardware error warnings

Noticed that while solo mining on testnet, I see a fairly steady stream of hardware error warnings.

I've never seen this while pool/stratum mining. This definitely doesn't seem to be a legitimate hardware error since if I change the pool mining card to stratum mining and vice versa, it only happens on whatever GPU is doing solo mining.

Need to check if this happens on mainnet too.

Not very familiar with the CUDA code but might be a regression from #108 or #116 since I don't remember seeing it when initial CUDA support landed. Could also possibly be related to #121.

Seperate builds

Currently, to build, one needs both opencl and cuda libs installed. We should split this up (most of the code is already separate) and use go build flags to only include what is needed.

implement amdgpu support

Catalyst+ADL on Linux is deprecated in favor of amdgpu's sysfs interface.

So ADL support in #62 won't complete fan control for AMD cards.

add windows build instructions to README

For AMD using TDM from @cjepson

  1. install app sdk
  2. install newest golang
  3. install tdm gcc
  4. surf to the gominer directory in the tdm gcc cmd
  5. change directories and run:
    set CGO_CFLAGS=-IC:/appsdk/include && set CGO_LDFLAGS=-LC:/appsdk/lib/x86_64 && go build -x -v

Probably want to add an Nvidia example too.

Output line is very long

The normal (INFO) log output from gominer is very long. Can at least remove the word reporting so terminal doesn't have to be a wide.

some shares go unaccounted

[INF] MINR: Global stats: Accepted: 8504, Rejected: 23, Stale: 163
[INF] MINR: Global utility (accepted shares/min): 1.4644604853407575
[INF] MINR: DEV #1 (Hawaii) reporting average hash rate 1.722GH/s, 8735/8735 valid work

8735 - 8504 - 23 - 163 = 45 or .52%

I haven't caught this with trace on but I did notice:

[INF] POOL: Unhandled message: {"id":8732,"result":true,"error":null}

I think this only happens when you find and submit shares in short order. Probably something like:

Share 1 is submitted
Share 2 is submitted
Share 1 reply received (unhandled and unaccounted)
Share 2 reply received

So I think we just need to save the previous submit as well as the current submit.

reject counter not incremented

14:29:05 2016-07-27 [ERR] POOL: Share rejected: job not found
14:29:07 2016-07-27 [INF] MINR: Global stats: Accepted: 4602, Rejected: 0, Stale: 111

investigate memory leak in OpenCL code

gominer has a small memory leak under normal usage that grows over time.

With a tiny worksize where it runs through the OpenCL loop hundreds of times per second, it will leak a few MB in seconds.

Need to add some debug code to find the size of the leak and then pinpoint where exactly it's occurring.

Add to cuda LDFLAGS

Additional LDFLAGS are needed for building on things other than archlinux.
We need the default flags: -L/opt/cuda/lib64 -L/usr/local/cuda/lib64
Ubuntu ones
Windows ones.

Stratum and work updates are super racy

Updates and retrieval of the data in both stratum struct fields and work struct fields should be subject to a mutex to prevent racing, which may occasionally cause rejects of valid work or the GPU to work on corrupted work.

gominer crashes when an invalid target is recieved

The code correctly catches invalid targets but doesn't stop the rest of the code from trying to work on it (leading to a panic when it tries to access the target).
This is only likely to be hit on very slow cards.

div by zero panic

After about 1 hour of running I hit this pretty consistently:

23:02:18 2016-07-26 [INF] MINR: GPU #0 (Intel(R) HD Graphics Haswell GT2 Desktop) reporting average hash rate 24MH/s, 20/20 valid work
panic: division by zero

goroutine 38 [running]:
panic(0x8c7020, 0xc820473930)
        /home/jcv/code/golang/src/runtime/panic.go:481 +0x3e6
math/big.nat.div(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc8200163c0, 0x4, 0x8, 0x0, ...)
        /home/jcv/code/golang/src/math/big/nat.go:522 +0xc0
math/big.(*Int).QuoRem(0xc8203980e0, 0xc820012740, 0xc8204bf528, 0xc8204bf4c8, 0x0, 0x0)
        /home/jcv/code/golang/src/math/big/int.go:227 +0xe6
math/big.(*Int).Div(0xc8203980e0, 0xc820012740, 0xc8204bf528, 0xc820473920)
        /home/jcv/code/golang/src/math/big/int.go:238 +0x60
main.diffToTarget(0x3fe0000000000000, 0x8c0320)
        /home/jcv/code/go/src/github.com/decred/gominer/stratum.go:968 +0x9b
main.(*Stratum).Unmarshal(0xc82043a000, 0xc8203e9f80, 0x3e, 0x40, 0x0, 0x0, 0x0, 0x0)
        /home/jcv/code/go/src/github.com/decred/gominer/stratum.go:670 +0x42f6
main.(*Stratum).Listen(0xc82043a000)
        /home/jcv/code/go/src/github.com/decred/gominer/stratum.go:254 +0x89b
created by main.StratumConn
        /home/jcv/code/go/src/github.com/decred/gominer/stratum.go:181 +0x5df

gominer speed

Currently gominer (opencl) performs 20% or so slower than the other miners on the same hardware.

@jolan at some point could you provide real numbers for this.

Clearly, we should get this much closer. Since the heavy lifting is not done in go, go vs c/c++ speed should not really matter here.

remove code duplication/improve build system

A lot of code is duplicated between cladldevice.go/cldevice.go/cudevice.go to work around having hard run-time dependencies on libraries. Should be able to reduce this somehow.

GPU errors

I've only hit this on Intel GPUs (so nothing production worthy) so it isn't super important but still worth considering.
If there is an error on the GPU, gominer will stop working on that GPU and just keep chugging along. If only one GPU is in use, the program will not stop but will not do any useful work.
I'm not sure if it should try to recover and restart, but at the very least if there are no active GPUs it should exit. The only thing stopping this is that the list of GPUs ends up numbered wrong if we remove bad ones and the work thread lacks a way to tell the main thread that it is done.
Again, this is very not vital unless we see things on more powerful GPUs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.