m4rkw / minotaur

MIT License
7 stars 4 forks source link

Move from using a calibration point to using a full calibration grid #13

Open gordan-bobic opened 6 years ago

gordan-bobic commented 6 years ago

Currently, the way calibration works is we have a 99th percentile hash rate and the minimum power limit at which the 99th percentile performance is achievable.

We could improve on that by facilitating picking the optimal mining power / hash rate relative to the user's electricity cost. As electricity becomes more and more dominant in the cost of mining, this will allow people to mine at a different point on the profit curve.

Basics: What we want to work with is a power/hash rate grid in 1W resolution between a device's minimum settable power and it's maximum settable power. We can then assess profitability of each point and pick the optimal one for the set electricity cost.

Advanced: Calibrating between minimum and maximum power in 1W increments will take a very long time. While this will inevitably yield best results, we don't actually have to do that to achieve results that are 99% as good, and make the rest auto-tune itself during runtime. Instead of calibrating in 1W increments, we calibrate in 10W increments (or some other settable interval, >= 1W). So if we have a card where the minimum and maximum power limit are 100W and 200W respectively, we would end up with a set of 11 points in the calibration file. We achieve a full 101 point calibration map using linear interpolation between the existing points. From there on, runtime auto-recalibration can take over and adjust the intermediate points for the power limits picked. For example, say the optimal point is deemed to be 186W (between calibrated 180W and 190W points). Minotaur sets power to 186W, and gets on with mining. If the observed calibration is more than calibration_update_threshold_min_pc % out, it will wait for hashrate_stabilisation_consecutive_readings_required readings that are within hashrate_stabilisation_tolerance of each other, capture the 186W hash rate and add it to the calibration file. So now in addition to 180W and 190W calibration points in the file, we will also have 186W. Reload the calibration configuration and re-interpolate in memory accordingly. Eventually, the points on the grid around the optimum will get run-time calibrated and produce optimal calibration for the user without having to spend 10x longer up-front calibrating the device.

gordan-bobic commented 6 years ago

It would also be good to be able to leverage this for setting a total overall power budget limit, e.g. if the PSU is good for 1600W, we could get minotaur to set power limits so that the total of all power limits does not exceed 1500W.

Ideally this would be done by lowering the target percentile until all devices fit into the power budget. If however, at the reduced percentile power limit another algorithm is more profitable, then that algorithm should be chosen. For example, daggerhashimoto typically runs at half the power of equihash.