ethereum-mining / ethminer

Ethereum miner with OpenCL, CUDA and stratum support
GNU General Public License v3.0
5.98k stars 2.29k forks source link

0.19.0 - How to make use of the new feature: "Extend the life of 4GB AMD cards" #2305

Open jmsjr opened 3 years ago

jmsjr commented 3 years ago

Version: ethminer-0.19.0 compiled from source OS: Ubuntu 20.04.2 LTS Kernel: 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux AMD CPU card: Radeon RX 580 Series AMD GPU Pro driver: amdgpu-pro-21.10-1247438-ubuntu-20.04 ( https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-10 )

I have a few AMD Radeon 4GB cards ( Radeon RX 580 Series ) that I have not used for a long time but would like to use them again for mining ( Note I also have a few nvidia 8GB cards that works quite well with ethminer-0.19.0 but is irrelevant for this issue ).

I noticed the following commit for 0.19.0 :

https://github.com/ethereum-mining/ethminer/commit/83ebd320885d8db97d4a3793836487d6a5f41624?branch=83ebd320885d8db97d4a3793836487d6a5f41624&diff=unified

... from @jean-m-cyr , and I was wondering, after having built 0.19.0 from source, is there anything else that I need to do ( e.g. a new command-line switch ? ) to enable this feature for 4GB AMD cards ?

I get a SIGSEGV below :

bin/ethminer --farm-recheck 2000 -G  -P stratumss://xxxxx@asia1.ethermine.org:5555  -P stratumss://xxxxx@eu1.ethermine.org:5555  --cl-devices 2  --report-hr --verbosity 9  --HWMON 2 --report-hashrate

ethminer 0.19.0
Build: linux/release/gnu

 i 17:09:59 ethminer Configured pool asia1.ethermine.org:5555
 i 17:09:59 ethminer Configured pool eu1.ethermine.org:5555
 i 17:09:59 ethminer Selected pool asia1.ethermine.org:5555
 i 17:09:59 ethminer  >> {"id":1,"method":"mining.hello","params":{"agent":"ethminer-0.19.0","host":"asia1.ethermine.org","port":"15b3","proto":"EthereumStratum/2.0.0"}}
 i 17:09:59 ethminer  << {"id":999,"jsonrpc": "2.0","result": false,"error": "Invalid JSON request"}
 i 17:09:59 ethminer Negotiation of EthereumStratum/2.0.0 failed. Trying another ...
 i 17:09:59 ethminer  >> {"id":1,"method":"mining.subscribe","params":["ethminer-0.19.0","EthereumStratum/1.0.0"]}
 i 17:10:00 ethminer  << {"id":1,"result":[["mining.notify","9936","EthereumStratum/1.0.0"],"9936"],"error": null}
 i 17:10:00 ethminer Stratum mode : EthereumStratum/1.0.0 (NiceHash)
 i 17:10:00 ethminer Established connection to asia1.ethermine.org [172.65.231.156:5555]
 i 17:10:00 ethminer Spinning up miners...
 i 17:10:00 ethminer  >> {"id":2,"method":"mining.extranonce.subscribe","params":[]}
cl 17:10:00 cl-0     Using Device : 0d:00.0 Ellesmere OpenCL 1.2 AMD-APP (3224.4) Memory : 3.97 GB (4259880960 B)
 i 17:10:00 ethminer Extranonce set to 9936
 i 17:10:00 ethminer  >> {"id":3,"method":"mining.authorize","params":["0xec57eb1c9e3af038b5ac3351e6be36c20d3c772f.rig01-opencl","X"]}
 i 17:10:00 ethminer  << {"id":null,"method":"mining.set_difficulty","params":[1]}
 i 17:10:00 ethminer  << {"id":2,"jsonrpc":"2.0","result":true}
 i 17:10:00 ethminer  << {"id":3,"result":true,"error":null}
 i 17:10:00 ethminer Authorized worker 0xec57eb1c9e3af038b5ac3351e6be36c20d3c772f.rig01-opencl
 i 17:10:00 ethminer  << {"id":null,"method":"mining.notify","params":["8f4859","c57b49f1a72c107689bf82dc84a90a391527434dc641d05b9ef255554a647e1b","8f48598b6e6b7b0135427603588370029e7bf6782a7cf61ae30ebc60eb7b8336",true]}
 i 17:10:00 ethminer Epoch : 414 Difficulty : 4.29 Gh
 i 17:10:00 ethminer Job: 8f48598b… asia1.ethermine.org [172.65.231.156:5555]
cl 17:10:02 cl-0     Epoch 414 requires 4.23 GB memory. Only 3.97 GB available on device.
SIGSEGV encountered ...
stack trace:
backtrace() returned 7 addresses
bin/ethminer(+0xa7b68) [0x56272a6e7b68]
/lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fe4846f8210]
bin/ethminer(+0x378d22) [0x56272a9b8d22]
bin/ethminer(+0x14a2d2) [0x56272a78a2d2]
bin/ethminer(+0x483d64) [0x56272aac3d64]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7fe484a17609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fe4847d4293]
SIGSEGV encountered ...
stack trace:
backtrace() returned 8 addresses
bin/ethminer(+0xa7b68) [0x56272a6e7b68]
/lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fe4846f8210]
bin/ethminer(+0x9d7b8) [0x56272a6dd7b8]
bin/ethminer(+0x9dd83) [0x56272a6ddd83]
bin/ethminer(+0xafd8d) [0x56272a6efd8d]
bin/ethminer(+0x483d64) [0x56272aac3d64]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7fe484a17609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fe4847d4293]
jsalvo@rig01:~/ethminer-0.19.0$ 

Benchmark has no errors / issues :

$ bin/ethminer -G -M 9 --cl-devices 2

ethminer 0.19.0
Build: linux/release/gnu

 i 17:07:58 ethminer Selected pool localhost:0
 i 17:07:58 ethminer Established connection to localhost:0
 i 17:07:58 ethminer Spinning up miners...
cl 17:07:58 cl-0     Using Device : 0d:00.0 Ellesmere OpenCL 1.2 AMD-APP (3224.4) Memory : 3.97 GB (4259880960 B)
 i 17:07:58 sim      Epoch : 0 Difficulty : 4.29 Gh
 i 17:07:58 sim      Job: df938b14… block 9 localhost:0
cl 17:07:58 cl-0     Generating split DAG + Light (total): 1024.00 MB
cl 17:07:59 cl-0     OpenCL kernel
cl 17:07:59 cl-0     Loading binary kernel /home/xxxxx/ethminer-0.19.0/bin/kernels/ethash_ellesmere_lws128_exit.bin
 X 17:07:59 cl-0     Failed to load binary kernel: /home/xxxxx/ethminer-0.19.0/bin/kernels/ethash_ellesmere_lws128_exit.bin
 X 17:07:59 cl-0     Falling back to OpenCL kernel...
cl 17:07:59 cl-0     Creating DAG buffer, size: 1024.00 MB, free: 2.97 GB
cl 17:07:59 cl-0     Creating light cache buffer, size: 16.00 MB
cl 17:07:59 cl-0     Loading kernels
cl 17:07:59 cl-0     Creating buffer for header.
cl 17:07:59 cl-0     Creating mining buffer
cl 17:08:01 cl-0     1024.00 MB of DAG data generated in 2,810 ms.
 m 17:08:03 ethminer 0:00 A0 0.00 h - cl0 0.00
 m 17:08:08 ethminer 0:00 A0 9.63 Mh - cl0 9.63
 m 17:08:13 ethminer 0:00 A0 27.63 Mh - cl0 27.63
 m 17:08:18 ethminer 0:00 A0 27.63 Mh - cl0 27.63
 m 17:08:23 ethminer 0:00 A0 27.65 Mh - cl0 27.65
 m 17:08:28 ethminer 0:00 A0 27.64 Mh - cl0 27.64
 m 17:08:33 ethminer 0:00 A0 27.63 Mh - cl0 27.63
cl 17:08:33 cl-0     Job: df938b14… Sol: 0xef9ad515e005d20e
 i 17:08:33 ethminer **Accepted   1 ms. localhost:0
 m 17:08:38 ethminer 0:00 A1 27.57 Mh - cl0 27.57
 m 17:08:43 ethminer 0:00 A1 27.62 Mh - cl0 27.62
 m 17:08:48 ethminer 0:00 A1 27.63 Mh - cl0 27.63
 m 17:08:53 ethminer 0:00 A1 27.63 Mh - cl0 27.63
 m 17:08:58 ethminer 0:01 A1 27.62 Mh - cl0 27.62
 m 17:09:03 ethminer 0:01 A1 27.64 Mh - cl0 27.64
^C i 17:09:04 main     Got interrupt ...
 i 17:09:04 main     Simulation results : Max 27.645048 Mh Mean 27.638388 Mh
 i 17:09:04 main     Disconnected from localhost:0
 i 17:09:04 main     Shutting down miners...
 i 17:09:05 main     Terminated!

Simulation has no errors / issues as well :

$ bin/ethminer -G -Z 9 --cl-devices 2

ethminer 0.19.0
Build: linux/release/gnu

 i 17:14:54 ethminer Selected pool localhost:0
 i 17:14:54 ethminer Established connection to localhost:0
 i 17:14:54 ethminer Spinning up miners...
cl 17:14:54 cl-0     Using Device : 0d:00.0 Ellesmere OpenCL 1.2 AMD-APP (3224.4) Memory : 3.97 GB (4259880960 B)
 i 17:14:54 sim      Epoch : 0 Difficulty : 4.29 Gh
 i 17:14:54 sim      Job: 0a2fd700… block 9 localhost:0
cl 17:14:54 cl-0     Generating split DAG + Light (total): 1024.00 MB
cl 17:14:54 cl-0     OpenCL kernel
cl 17:14:55 cl-0     Loading binary kernel /home/xxxxx/ethminer-0.19.0/bin/kernels/ethash_ellesmere_lws128_exit.bin
 X 17:14:55 cl-0     Failed to load binary kernel: /home/xxxxx/ethminer-0.19.0/bin/kernels/ethash_ellesmere_lws128_exit.bin
 X 17:14:55 cl-0     Falling back to OpenCL kernel...
cl 17:14:55 cl-0     Creating DAG buffer, size: 1024.00 MB, free: 2.97 GB
cl 17:14:55 cl-0     Creating light cache buffer, size: 16.00 MB
cl 17:14:55 cl-0     Loading kernels
cl 17:14:55 cl-0     Creating buffer for header.
cl 17:14:55 cl-0     Creating mining buffer
cl 17:14:57 cl-0     1024.00 MB of DAG data generated in 2,808 ms.
 m 17:14:59 ethminer 0:00 A0 0.00 h - cl0 0.00
 m 17:15:04 ethminer 0:00 A0 9.64 Mh - cl0 9.64
 m 17:15:09 ethminer 0:00 A0 27.64 Mh - cl0 27.64
 m 17:15:14 ethminer 0:00 A0 27.63 Mh - cl0 27.63
 m 17:15:19 ethminer 0:00 A0 27.61 Mh - cl0 27.61
 m 17:15:24 ethminer 0:00 A0 27.63 Mh - cl0 27.63
 m 17:15:29 ethminer 0:00 A0 27.64 Mh - cl0 27.64
 m 17:15:34 ethminer 0:00 A0 27.64 Mh - cl0 27.64
^C i 17:15:34 main     Got interrupt ...
 i 17:15:34 main     Simulation results : Max 27.642884 Mh Mean 27.637906 Mh
 i 17:15:34 main     Disconnected from localhost:0
 i 17:15:34 main     Shutting down miners...
 i 17:15:35 main     Terminated!

I noticed that when running either the benchmark or the simulation, it shows:

cl 17:07:58 cl-0     Generating split DAG + Light (total): 1024.00 MB

... but when actually mining, that kind of output is not shown.

jmsjr commented 3 years ago

Looking at CLMiner.cpp, the check that is happening above, quoted in here :

    // Check whether the current device has sufficient memory every time we recreate the dag
    if (m_deviceDescriptor.totalMemory < RequiredMemory)
    {
        cllog << "Epoch " << m_epochContext.epochNumber << " requires "
              << dev::getFormattedMemory((double)RequiredMemory) << " memory. Only "
              << dev::getFormattedMemory((double)m_deviceDescriptor.totalMemory)
              << " available on device.";
        pause(MinerPauseEnum::PauseDueToInsufficientMemory);
        return true;  // This will prevent to exit the thread and
                      // Eventually resume mining when changing coin or epoch (NiceHash)
    }

... happens earlier than the changes in that commit hash that I indicated earlier, so it could not possibly allow AMD cards with 4GB to work / "extend their life".

So maybe I misunderstood that commit about "Extend the life of 4GB AMD cards" ??