CryptoGraphics / lyclMiner

OpenCL Lyra2REv2/v3 miner for AMD GCN GPUs
GNU General Public License v3.0
44 stars 19 forks source link

Requests: Devices selection using Device Index instead of PCIeBusId + automatic Asm selection + API #4

Open yuzi-co opened 6 years ago

yuzi-co commented 6 years ago

Great work on the miner, I see a significant improvement on RX480 (with Uber3.1 memory timings) compared to current best miner (MkxMiner), from ~30Mh/s to ~36Mh/s

I would very much like to integrate the miner in https://github.com/yuzi-co/Forager/ but the first 2 issues are kind of blockers for the integration. For the 3rd one I have a solution, but it's sub optimal since it basically reads the miner output to detect current HashRate

  1. Device selection using Device Index would be more consistent with the way all other miners works and would allow integration with algo switching multi-miners
  2. Automatic Asm selection would also ease the integration with multi-miners
  3. API for monitoring - self explanatory

edit

  1. Command line selection of pool / device list (especially if there will be automatic Asm selection)
CryptoGraphics commented 6 years ago

Hello.

From Windows only perspective it may look pretty straightforward. There is only 1 platform, where you can tweak and rely on some undefined befaviour. However my implementation also works on Linux.

  1. The order in which devices are listed is platform implementation defined. PCIeBusId is a solution to this problem. It is a bridge between a logical OpenCL device and real physical device. However, sometimes even this is not 100% reliable solution. It is possible to generate a configuration file with raw device list and select device/platform combination by index. lyclMiner -gr lyclMiner.conf

  2. Miner already autodetects them during the config generation. It is possible to implement this in future, as "auto" value both for BinaryFormat and AsmProgram. Configuration option is still required in case automatic detection fails.

  3. This was never on my roadmap. lyclMiner runs on cpuminer-multi codebase, so it will be relatively easy to port API from it with minimal changes and add some options inside a configuration file.

  4. Black box approach is not a good idea in this case. e.g. WorkSize parameter requies tweaking for each GPU and platform to get the best performance. Even if you find the best value using benchmark, it doesn't mean that it will remain stable. There are no gains from using this approach except for simplicity at the cost of stability, performance and flexibility.

yuzi-co commented 6 years ago
  1. On Windows you can have multiple platforms. For example AMD and Intel iGPU will be 0 and 1 (but also might be the other way. No idea how they get the order, and it can also change with drivers upgrades). So the ideal way on windows would be Platform Id + Device Id (under each platform it starts from 0). It's easy to poll OpenCL devices/platforms and configure them in the config file. I am not sure how it is on Linux, so I can only see half of your picture

Currently with raw devices, I am guessing it would be something like that: If we have 4 nvidia devices on opencl platform 0, and 4 amd devices on platform 1, amd devices indexes will be 4-7?

With PCIbus, for some reason Windows may return incorrect data. I am detecting it using PowerShell Get-PnpDevice/Get-PnpDeviceProperty.

  1. Allowing "auto" as value would be perfect.
  2. Thank you
  3. I understand that due to large amount of possible parameters it is, of course, not really viable to put them all in the command line, but still, having the option would be nice )
CryptoGraphics commented 6 years ago
  1. I mean Windows has only 1 AMD platform. On Linux you may have multiple, e.g two RX 580s can be listed as: Ellesmere, Ellesmere and gfx803. PCIeBusId is required to group them up. 1 device as 2 workers is possible, but it will add some overhead. So a difference between PCIeBusId and Raw list version will be 2 devices vs 3. PCIeBusId is detected using a vendor specific extension CL_DEVICE_TOPOLOGY_AMD.

Raw device list: No. Nvidia and Intel devices will be completely ignored. All platforms are listed just for reference. Currently, if platform is not "Advanced Micro Devices", it will be skipped. Miner detects only AMD GPUs, so in your case indices will start from 0, not 4.

Adding other vendors at current stage will introduce an additional complexity. For PCIeBusId version it will require CL_DEVICE_PCI_BUS_ID_NV support, and i am unable to test this case properly to provide a reliable solution, so it is hardcoded to AMD.

yuzi-co commented 6 years ago

Excellent, this simplifies my work with AMD devices. I will just use the raw devices to configure it