This page is a semi-organized collection of my notes on setting up background Monero miner on an old'ish desktop computer. By background I mean I can have it running and still watch 1080p video fullscreen with dual monitors and have no desktop lag. This is not about achieving absolutely max performance for a dedicated GPU miner.
More specifically this page is about the details of compiling and running the AMD GPU miner wolf-xmr-miner. This page assumes you have it's source, you're familiar with linux compiling basics, and OpenCl 2.0 already installed and working.
If you're reading this you've probably already ran 'make' and received one or more error messages which you then searched for. Here are your answers all in one place with all the keywords to get you here.
gpu.c:6:19: fatal error: CL/cl.h: No such file or directory
Find out where you put your OpenCl libs and edit the makefile to point to them manually. If you don't remember you can do a "locate opencl" and look around a bit. I had them in /opt/AMDAPP/lib/x86_64/ ... so, open 'Makefile' and see where it differs from my example below. Substitute your paths for mine at the changes.
CC = gcc LD = gcc OPT = -O0 -ggdb3 CFLAGS = -I/opt/AMDAPP/include -L/opt/AMDAPP/lib/x86_64/ -D_POSIX_SOURCE -D_GNU_SOURCE $(OPT) -pthread -c -std=c11 LDFLAGS = -pthread $(OPT) LIBS = -ljansson -lOpenCL -ldl -L/opt/AMDAPP/lib/x86_64/ all: $(CC) $(CFLAGS) crypto/aesb.c -o crypto/aesb.o $(CC) $(CFLAGS) crypto/aesb-x86-impl.c -o crypto/aesb-x86-impl.o $(CC) $(CFLAGS) crypto/c_blake256.c -o crypto/c_blake256.o $(CC) $(CFLAGS) crypto/c_groestl.c -o crypto/c_groestl.o $(CC) $(CFLAGS) crypto/c_keccak.c -o crypto/c_keccak.o $(CC) $(CFLAGS) crypto/c_jh.c -o crypto/c_jh.o $(CC) $(CFLAGS) crypto/c_skein.c -o crypto/c_skein.o $(CC) $(CFLAGS) crypto/oaes_lib.c -o crypto/oaes_lib.o $(CC) $(CFLAGS) -maes cryptonight.c -o cryptonight.o $(CC) $(CFLAGS) log.c -o log.o $(CC) $(CFLAGS) net.c -o net.o $(CC) $(CFLAGS) minerutils.c -o minerutils.o $(CC) $(CFLAGS) gpu.c -o gpu.o $(CC) $(CFLAGS) main.c -o main.o $(LD) $(LDFLAGS) crypto/aesb.o crypto/aesb-x86-impl.o crypto/c_blake256.o crypto/c_groestl.o crypto/c_keccak.o crypto/c_jh.o crypto/c_skein.o crypto/oaes_lib.o cryptonight.o log.o net.o minerutils.o gpu.o main.o $(LIBS) -o miner clean: rm -f *.o crypto/*.o miner
miner.h:5:21: fatal error: jansson.h: No such file or directory
Install lib jannson and dev sources. Pretty simple.
sudo apt-get install libjansson-dev
main.c:9:23: fatal error: stdatomic.h: No such file or directory
Oh no. gcc 4.8 and below don't have atomic operators. I guess every minor gcc revision breaks backwards compatibility now. The work around is to use a portable version of stdatomic.h extracted from the FreeBSD libc, for Clang 3.1+ and GCC 4.7+. Just put stdatomic.h in the wolf-xmr-miner directory.
stdatomic.h (https://gist.github.com/nhatminhle/5181506) (local backup copy)
Now we have to edit the files which use stdatomic.h to point to our standalone version (fuck gcc 4.9, etc, etc). So open up main.c, comment out the existing include and put in yours like this,
#include <stdio.h> #include <stdint.h> #include <string.h> #include <signal.h> #include <pthread.h> #include <stdbool.h> #include <jansson.h> //#include <stdatomic.h> #include </home/superkuh/app_installs/monero/wolfxmrminer/wolf-xmr-miner/stdatomic.h> #include <cpuid.h>
gcc -pthread -O0 -ggdb3 crypto/aesb.o crypto/aesb-x86-impl.o crypto/c_blake256.o crypto/c_groestl.o crypto/c_keccak.o crypto/c_jh.o crypto/c_skein.o crypto/oaes_lib.o cryptonight.o log.o net.o minerutils.o gpu.o main.o -ljansson -lOpenCL -ldl -L/opt/AMDAPP/lib/ -o miner /usr/bin/ld: cannot find -lOpenCL collect2: error: ld returned 1 exit status
Make sure to set your environmental variables to your OpenCl 2.0 lib directories so ldd can find that shit. But that's not really how to fix this one. It should already be fixed if you followed the Makefile edits at the top of this page, ie: -L/opt/AMDAPP/lib/x86_64/
LIBRARY_PATH=:/opt/AMDAPP/lib/x86_64/ LD_LIBRARY_PATH=:/opt/AMDAPP/lib/x86_64/
So now it's compiled. Lets try to run it.
./miner [08:34:29] Usage: ./miner <config file>
There's an example config file called xmr.conf. It'd be like, ./miner xmr.conf. Of course this will never just work. You'll probably get one of these errors below.
[08:56:56] Setting up GPU(s). [08:56:56] Error -61 when calling clCreateBuffer to create hash scratchpads buffer. [08:56:56] Successfully connected to pool's stratum. [08:56:57] New job at diff 5000 Segmentation fault (core dumped)
The clCreateBuffer error is because the "rawintensity" value in the .conf file is too high. This is likely to happen if you're also using the GPU to display your desktop on one or more monitors. You can try turning this down by trial and error from the example config. The example below works well with a 7950 running two 1080p desktops.
Bump threads up to 2, turn rawintensity down to 384, and worksize down to 8. It'll get about 400 H/s. This example config also includes CPU mining,
{ "Algorithms": [ { "name": "CryptoNight", "devices": [ { "index": 0, "corefreq": 500, "memfreq": 1200, "fanspeed": 65, "powertune": 20, "threads": 2, "rawintensity": 384, "worksize": 8 }, { "index": -1, "threads": 2, "rawintensity": 16, "worksize": 16 } ], "pools": [ { "url": "stratum+tcp://monerohash.com:3333", "user": "4yourmoneroaddressss444444444444444444444444444444444444444444444444444444444444444444444444444", "pass": "x" } ] } ] }
Unfortunately it's still not going to work. Instead you're going to get an error like,
./miner xmr-superkuh.conf [09:41:20] Setting up GPU(s). [09:41:20] Error -11 when calling clBuildProgram. [09:41:20] Build Log: "./wolf-skein.cl", line 33: error: function "amd_bitalign" declared implicitly if(y < 32) return(as_ulong(amd_bitalign(x, x.s10, 32 - y))); ^ "./wolf-skein.cl", line 33: error: bad argument type to opencl as_* function: expected src and dst have the same size if(y < 32) return(as_ulong(amd_bitalign(x, x.s10, 32 - y))); ^ "./wolf-skein.cl", line 34: error: function "amd_bitalign" declared implicitly else return(as_ulong(amd_bitalign(x.s10, x, 32 - (y - 32)))); < ^ "./wolf-skein.cl", line 34: error: bad argument type to opencl as_* function: expected src and dst have the same size else return(as_ulong(amd_bitalign(x.s10, x, 32 - (y - 32)))); ^ 4 errors detected in the compilation of "/tmp/OCLCZlPgq.cl". Frontend phase failed compilation. [09:41:20] Successfully connected to pool's stratum. [09:41:21] New job at diff 5000 Segmentation fault (core dumped)
Figuring out this one took a lot of patience. Eventually I found claudioandre's post in a github thread about johntheripper, https://github.com/magnumripper/JohnTheRipper/issues/1834, "Just for the record: the solution is: #pragma OPENCL EXTENSION cl_amd_media_ops : enable". The thread's OpenCl error sounded a lot like my error. My problem was in wolf-skein.cl so I figured I'd apply his solution in there. Basically just add in,
#pragma OPENCL EXTENSION cl_amd_media_ops : enable
near the top of wolf-skein.cl so it looks like,
#ifndef WOLF_SKEIN_CL #define WOLF_SKEIN_CL #pragma OPENCL EXTENSION cl_amd_media_ops : enable // Vectorized Skein implementation macros and functions by Wolf #define SKEIN_KS_PARITY 0x1BD11BDAA9FC1A22
Once done it will finally run and the world is saved and everyone is happy, etc, etc. I assume amd_bitalign() is provided as a part of cl_amd_media_ops which isn't "enabled" by default for some reason.
./miner xmr-superkuh.conf [10:03:19] Setting up GPU(s). [10:03:31] Successfully connected to pool's stratum. [10:03:31] New job at diff 5000 [10:03:38] Thread 1, GPU ID 0, GPU Type: Tahiti: 198.58H/s [10:03:38] Thread 0, GPU ID 0, GPU Type: Tahiti: 191.11H/s [10:03:42] Share accepted: 1/1 (100.00%) ... [11:11:06] New job at diff 55850.6 [11:11:06] Thread 2, (CPU): 38.96H/s [11:11:06] Thread 3, (CPU): 39.21H/s ... [11:12:06] Thread 0, GPU ID 0, GPU Type: Tahiti: 200.72H/s [11:12:07] Thread 1, GPU ID 0, GPU Type: Tahiti: 191.82H/s [11:12:12] Thread 0, GPU ID 0, GPU Type: Tahiti: 198.29H/s [11:12:13] Thread 1, GPU ID 0, GPU Type: Tahiti: 193.27H/s [11:12:18] Thread 0, GPU ID 0, GPU Type: Tahiti: 195.93H/s [11:12:19] Thread 1, GPU ID 0, GPU Type: Tahiti: 193.26H/s [11:12:23] Share accepted: 34/34 (100.00%) [11:12:23] Total Hashrate: 467.37H/s
Here's the performance with two 1080p videos playing in vlc on 2 monitors at the same time as mining,
[06:48:15] Thread 1, GPU ID 0, GPU Type: Tahiti: 194.36H/s [06:48:20] Thread 0, GPU ID 0, GPU Type: Tahiti: 193.59H/s [06:48:21] Thread 1, GPU ID 0, GPU Type: Tahiti: 193.54H/s [06:48:25] Share accepted: 494/494 (100.00%) [06:48:25] Total Hashrate: 452.16H/s
Now you might want to care about GPU temp, fanspeed, etc.
# show core temp aticonfig --od-gettemperature # shows fan speed aticonfig --pplib-cmd "get fanspeed 0" # sets fan speed to 100% aticonfig --pplib-cmd "set fanspeed 0 100" # show current clockspeeds aticonfig --odgc # overclock core to 900Mhz, memory at 1200Mhz aticonfig --odsc=900,1200
To leave a comment just append "/@say/Whatever you have to say" to the end of the URL.
If you found this useful and are feeling generous donations can be sent to,
XMR: 45jEp31mt4JZaf7UxhZruD38miLv8ZvAc9zbjfW4BwTzSS1CL38Xfo9TEhD78u5Wfudt13h7m3F47SEKkVJ57J8fEzdaTGb BTC: 18bctM9KQG3e5hHP8r1w5NQPd8CCByiNAf
Type, "/@say/Your message here." after the end of any URL on my site and hit enter to leave a comment. You can view them here. An example would be, http://superkuh.com/rtlsdr.html/@say/Your message here.
You may not access or use the site superkuh.com if you are under 90 years of age. If you do not agree then you must leave now.
The US Dept. of Justice has determined that violating a website's terms of service is a felony under CFAA 1030(a)2(c). Under this same law I can declare that you may only use one IP address to access this site; circumvention is a felony. Absurd, isn't it?
It is my policy to regularly delete server logs. I don't log at all for the tor onion service.
search. (via google)
I enjoy recursion, dissipating local energy gradients, lipid bilayers, particle acceleration, heliophysics instrumentation and generally anything with a high rate of change in electrical current. This site is a combination of my efforts to archive what I find interesting and my shoddy attempts to implement it as cheap as possible.
I get all email sent to @superkuh.com
Make-up any address *@superkuh.com
If I don't respond check your "spam" folder. Megacorps like google used to mark me as spam.