1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 14:58:01 +00:00

ztex: if we had only errors in one round we do not count the errors

to detect a totally non working fpga we only do that if the last
round had some valid nonces.

if we would count the errors the automatic megahertz adaption
would drop and never recover.
This commit is contained in:
Denis Ahrens 2012-12-22 01:22:42 +01:00
parent ccee686aee
commit f553c50b7b
3 changed files with 23 additions and 1 deletions

View File

@ -223,6 +223,8 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
overflow = false; overflow = false;
int count = 0; int count = 0;
int validNonces = 0;
double errorCount = 0;
applog(LOG_DEBUG, "%s: entering poll loop", ztex->repr); applog(LOG_DEBUG, "%s: entering poll loop", ztex->repr);
while (!(overflow || thr->work_restart)) { while (!(overflow || thr->work_restart)) {
@ -274,10 +276,13 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
// do not count errors in the first 500ms after sendHashData (2x250 wait time) // do not count errors in the first 500ms after sendHashData (2x250 wait time)
if (count > 2) { if (count > 2) {
ztex->errorCount[ztex->freqM] += 1.0 / ztex->numNonces;
thr->cgpu->hw_errors++; thr->cgpu->hw_errors++;
errorCount += (1.0 / ztex->numNonces);
} }
} }
else
validNonces++;
for (j=0; j<=ztex->extraSolutions; j++) { for (j=0; j<=ztex->extraSolutions; j++) {
nonce = hdata[i].goldenNonce[j]; nonce = hdata[i].goldenNonce[j];
@ -313,6 +318,18 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
} }
} }
// only add the errorCount if we had at least some valid nonces or
// had no valid nonces in the last round
if (ztex->nonceCheckValid > 0 && validNonces == 0) {
applog(LOG_ERR, "%s: resetting %.1f errors", ztex->repr, errorCount);
}
else {
ztex->errorCount[ztex->freqM] += errorCount;
}
// remember the number of valid nonces for the check in the next round
ztex->nonceCheckValid = validNonces;
ztex->errorRate[ztex->freqM] = ztex->errorCount[ztex->freqM] / ztex->errorWeight[ztex->freqM] * (ztex->errorWeight[ztex->freqM] < 100? ztex->errorWeight[ztex->freqM] * 0.01: 1.0); ztex->errorRate[ztex->freqM] = ztex->errorCount[ztex->freqM] / ztex->errorWeight[ztex->freqM] * (ztex->errorWeight[ztex->freqM] < 100? ztex->errorWeight[ztex->freqM] * 0.01: 1.0);
if (ztex->errorRate[ztex->freqM] > ztex->maxErrorRate[ztex->freqM]) if (ztex->errorRate[ztex->freqM] > ztex->maxErrorRate[ztex->freqM])
ztex->maxErrorRate[ztex->freqM] = ztex->errorRate[ztex->freqM]; ztex->maxErrorRate[ztex->freqM] = ztex->errorRate[ztex->freqM];

View File

@ -701,6 +701,9 @@ int libztex_prepare_device(struct libusb_device *dev, struct libztex_device** zt
newdev->maxErrorRate[cnt] = 0; newdev->maxErrorRate[cnt] = 0;
} }
// fake that the last round found something valid
newdev->nonceCheckValid = 1;
newdev->usbbus = libusb_get_bus_number(dev); newdev->usbbus = libusb_get_bus_number(dev);
newdev->usbaddress = libusb_get_device_address(dev); newdev->usbaddress = libusb_get_device_address(dev);
sprintf(newdev->repr, "ZTEX %s-1", newdev->snString); sprintf(newdev->repr, "ZTEX %s-1", newdev->snString);

View File

@ -73,6 +73,8 @@ struct libztex_device {
double errorRate[256]; double errorRate[256];
double maxErrorRate[256]; double maxErrorRate[256];
int16_t nonceCheckValid;
int16_t numberOfFpgas; int16_t numberOfFpgas;
int selectedFpga; int selectedFpga;
bool parallelConfigSupport; bool parallelConfigSupport;