From: Chris Duncan Date: Fri, 17 Jan 2025 19:12:26 +0000 (-0800) Subject: Adjust how effort is set. Log search parameters when debugging. X-Git-Tag: v2.0.0~26 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=4417945bd619fbe3d3ca18cc6d3659ffcdbfb219;p=nano-pow.git Adjust how effort is set. Log search parameters when debugging. --- diff --git a/src/classes/gpu.ts b/src/classes/gpu.ts index d0a699e..bc7348a 100644 --- a/src/classes/gpu.ts +++ b/src/classes/gpu.ts @@ -216,8 +216,8 @@ export class NanoPowGpu { ? 0xfffffff8 : options.threshold const effort = (typeof options?.effort !== 'number' || options.effort < 0x1 || options.effort > 0x10) - ? 0x8 - : options.effort + ? 0x800 + : options.effort * 0x100 const debug = !!(options?.debug) // Ensure WebGPU is initialized before calculating @@ -236,12 +236,15 @@ export class NanoPowGpu { start = performance.now() const random = Math.floor(Math.random() * 0xffffffff) const seed = (BigInt(random) << 32n) | BigInt(random) - const data = await this.#dispatch(this.#searchPipeline, seed, hash, threshold, effort * 0x100) + const data = await this.#dispatch(this.#searchPipeline, seed, hash, threshold, effort) nonce = data.getBigUint64(0, true) this.#busy = !data.getUint32(8) times.push(performance.now() - start) } while (this.#busy) - if (debug) this.#logAverages(times) + if (debug) { + console.log(`%cNanoPow (WebGPU) | Dispatch: ${effort ** 2} | Threads: ${8 * 8 * (effort ** 2)}`) + this.#logAverages(times) + } return nonce.toString(16).padStart(16, '0') } diff --git a/test.html b/test.html index 3d03b1e..0e28576 100644 --- a/test.html +++ b/test.html @@ -89,7 +89,6 @@ SPDX-License-Identifier: GPL-3.0-or-later console.log(`%cNanoPow (${type})`, 'color:green', `Calculate proof-of-work for ${size} unique send block hashes`) const times = [] - document.getElementById('output').innerHTML += `Now testing: NanoPow (${type}) | Dispatch: ${(effort * 0x100) ** 2} | Threads/Dispatch: ${8 * 8 * ((effort * 0x100) ** 2)}
` for (let i = 0; i < size; i++) { document.getElementById('status').innerHTML = `TESTING IN PROGRESS ${i}/${size}
` const hash = random() @@ -108,8 +107,8 @@ SPDX-License-Identifier: GPL-3.0-or-later // console.log(msg) if (isOutputShown) document.getElementById('output').innerHTML += `${msg}
` } - document.getElementById('output').innerHTML += `-----
` - document.getElementById('summary').innerHTML += `NanoPow (${type})
${JSON.stringify(average(times), null, '\t')}
` + document.getElementById('output').innerHTML += `
` + document.getElementById('summary').innerHTML += `${JSON.stringify(average(times), null, '\t')}
` print(times) document.getElementById('status').innerHTML = `TESTING COMPLETE
` console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold') @@ -142,7 +141,7 @@ SPDX-License-Identifier: GPL-3.0-or-later run(+size.value, +effort.value, isOutputShown.checked, isGlForced.checked, isDebug.checked) }) - + @@ -165,12 +164,18 @@ SPDX-License-Identifier: GPL-3.0-or-later - - - - - - + + + + + + + + + + + +

WAITING