[Pkg-bitcoin-devel] BFGminer and OpenCL/GPU/CPU mining

Raphaël Halimi raphael.halimi at gmail.com
Tue May 10 13:26:29 UTC 2016


Le 07/05/2016 12:02, Dmitry Smirnov a écrit :
> On Thursday, 28 April 2016 4:47:16 PM AEST Raphaël Halimi wrote:
>> So, theoretically, I should be able to mine through OpenCL either with
>> the GPU (with mesa-opencl-icd) or with the CPU (with amd-opencl-icd);
> 
> Bfgminer-5.4.2 appears to work on Mesa with "mesa-opencl-icd" but only after
> 
>     sudo apt-get purge amd-opencl-icd
> 
> I have only "mesa.icd" in "/etc/OpenCL/vendors".

Hi,

Thanks for not giving up on me. In fact I didn't give up either and I
finally managed to get BFGMiner to work a couple of days before you sent
message, but I wanted to make further tests before writing a complete
report.

According to my findings, the package that allowed BFGMiner to recognize
my GPU through Mesa was "ocl-icd-opencl-dev", "mesa-opencl-icd" on its
own was not sufficient. Also note that it will pull in a lot of
recommended *-dev packages which are not necessary for mining purposes.

So, to mine with a GPU on a fresh Sid:

apt-get install --no-install-recommends bfgminer mesa-opencl-icd
ocl-icd-opencl-dev

...should work.

To minimize bfgminer package's dependencies, I would suggest to
completely drop ocl-icd-libopencl1 and opencl-icd from recommends (the
former would be pulled by ocl-icd-opencl-dev, and the latter is a
virtual package which by default pulls in the whole non-free nVidia
stack), and add as suggests mesa-opencl-icd (which you already did in
your latest upload) and ocl-icd-opencl-dev.

Also, despite a lot of work (downgrading all Xorg packages, thanks to
snapshot.d.o, to install fglrx, and trying a lot of ocl packages
combinations), I couldn't make either clinfo or BFGMiner recognize my
GPU with the proprietary drivers. It appears that amd-opencl-{icd,dev}
only recognizes CPUs as OpenCL devices (as per clinfo), although
according to the documentation it should see AMD GPUs as well.

Anyway, I saw a post on debian-devel where the fglrx maintainer
announced his intention of dropping the package, mainly due to lack of
support from upstream. Indeed, During my tests I could see a lot of
problems with fglrx over the free drivers (KMS not working, VNC not
working...). Also, the hashrate I get with the free drivers are on par
with what I could find on various forums from people who did it on
Windows, so I guess the free drivers are now mature enough and their
performance has more or less reached what Catalyst can/could do. So I
gave up on fglrx.

As a side note, a nice trick I did is that I re-enabled the IGP on my
motherboard and made it my primary adapter, because although I can't
mine with it (OpenCL is not supported by 4290), it allowed me to use it
for my desktop so I could dedicate the 6570 to BFGMiner and push
intensity to 13 (14 is supposed to be the max according to the docs, but
the GPU crashes with "ring X stalled for more than Y msec" errors if I
push it this far), to get about 72 Mh/s and still have a responsive
desktop. For the record, when the 6570 was handling the desktop AND
mining, pushing the intensity to 9 (the recommended value for a
"dedicated" miner) was enough to make the desktop choppy, and values
above that would make it seem frozen (the default setting - dynamic -
seems to settle at intensity 2, for a hashrate of about 60 Mh/s).

Next target: find suitables values for scrypt mining, because the
default ones make my GPU crash (same errors than with SHA256 on
intensity 14). It will be a lot easier since Xorg won't crash anymore if
the GPU does, since the desktop is now handled by the IGP.

Also, I tried mining with one of my old ThinkPads (an X200), but it
seems that its IGP (an Intel GM45) is just too old and not
opencl-compatible at all, since neither mesa-opencl-icd nor
beignet-opencl-icd could detect it (with clinfo).

And, last but not the least, contrary to what I asserted before, CPU
mining works perfectly after recompiling BFGMiner. What fooled me was
that the "-n" option is not documented anywhere, so when I saw it
mentioned in the README.GPU I thought it was supposed to list all
hardware, whereas it appears to do this only for GPUs (and maybe
hardware miners too, I can't know since I don't own any), but definitely
not for CPUs.

After modifying debian/{control,rules} and recompiling BFGMiner,
"bfgminer -S cpu:auto" works perfectly, although with predictably
ridiculous hashrates compared to the 6570 card (about 5 Mh/s on my
ThinkPad's Core2 Duo P8600 @ 2.40GHz, and about 10 Mh/s on my desktop's
Phenom X4 965 BE @ 3.4 Gz).

Note: those various tests didn't involve any overclocking.

These hashrates are still ridiculous but the whole experience was very
enriching nevertheless, because I achieved my goal which was to setup
the whole software chain, including a mining pool (Eligius), so if in
the future I decide to buy mining hardware, I know what to expect.

> Even though Bfgminer recognised "OCL 0" when started with "-S opencl:auto",
> "bfgminer -n" printed "0 GPU devices max detected" which looks like upstream 
> bug...

It's because OpenCL is disabled by default; even with "-n", "-S
opencl:auto" is still needed:

raph at arche:~$ bfgminer -S opencl:auto -n

 [2016-05-10 14:19:34] CL Platform 0 vendor: Mesa
 [2016-05-10 14:19:34] CL Platform 0 name: Clover
 [2016-05-10 14:19:34] CL Platform 0 version: OpenCL 1.1 MESA 11.2.1
 [2016-05-10 14:19:34] Platform 0 devices: 1
 [2016-05-10 14:19:34] 	0	AMD TURKS (DRM 2.43.0, LLVM 3.8.0)
 [2016-05-10 14:19:34] Unable to load ati adl library
 [2016-05-10 14:19:34] 1 GPU devices max detected

Regards,

-- 
Raphaël Halimi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-bitcoin-devel/attachments/20160510/ea9b2d3e/attachment.sig>


More information about the Pkg-bitcoin-devel mailing list