From 5499cae91d763831ac9798c933c892ecd11f3699 Mon Sep 17 00:00:00 2001 From: jr Date: Mon, 3 May 2021 12:47:02 +0800 Subject: [PATCH] add --cuda-usleep flag to optionally usleep between search iterations --- ethminer/main.cpp | 3 +++ libethash-cuda/CUDAMiner.cpp | 5 +++++ libethcore/Miner.h | 1 + 3 files changed, 9 insertions(+) diff --git a/ethminer/main.cpp b/ethminer/main.cpp index f1aec3d5b5..9d59810546 100644 --- a/ethminer/main.cpp +++ b/ethminer/main.cpp @@ -344,6 +344,9 @@ class MinerCLI app.add_option("--cuda-streams,--cu-streams", m_CUSettings.streams, "", true) ->check(CLI::Range(1, 99)); + app.add_option("--cuda-usleep,--cu-usleep", m_CUSettings.usleep, "", true) + ->check(CLI::Range(-1, 1000000)); + #endif #if ETH_ETHASHCPU diff --git a/libethash-cuda/CUDAMiner.cpp b/libethash-cuda/CUDAMiner.cpp index b47d689b4f..07fbe569b6 100644 --- a/libethash-cuda/CUDAMiner.cpp +++ b/libethash-cuda/CUDAMiner.cpp @@ -402,8 +402,13 @@ void CUDAMiner::search( // restart the stream on the next batch of nonces // unless we are done for this round. if (!done) + { + if (m_settings.usleep >= 0) { + usleep(m_settings.usleep); + } run_ethash_search( m_settings.gridSize, m_settings.blockSize, stream, &buffer, start_nonce); + } if (found_count) { diff --git a/libethcore/Miner.h b/libethcore/Miner.h index 2f3b98f212..4f5820dc77 100644 --- a/libethcore/Miner.h +++ b/libethcore/Miner.h @@ -101,6 +101,7 @@ struct CUSettings : public MinerSettings unsigned schedule = 4; unsigned gridSize = 8192; unsigned blockSize = 128; + int usleep = -1; }; // Holds settings for OpenCL Miner