diff --git a/PARAMETERS.md b/PARAMETERS.md index 0141b5a..8b12667 100644 --- a/PARAMETERS.md +++ b/PARAMETERS.md @@ -96,6 +96,7 @@ N/A : No default value is set. | `--blocks` | ✅ | N/A | Set occupancy blocks. | `--blocks=128` | | `--occupancy` | ✅ | false | System will define the best occupancy for kernel. | `--occupancy=` | | `--internal_loop` | ✅ | 1 | Set internal loop for kernel. | `--internal_loop=1` | +| `--internal_kernel_count` | ✅ | 1 | Set internal loop for kernel. This defines the minimum number of times the kernel must be called to display statistics | `--internal_kernel_count=1` | | `--cuda_context` | ✅ | auto | Set CUDA context. | `--cuda_context=` | ## Smart Mining diff --git a/POOLS.md b/POOLS.md index fc729f1..4c6c75b 100644 --- a/POOLS.md +++ b/POOLS.md @@ -29,4 +29,4 @@ progpow-z `miner --stratum="ethproxy" --host=zano.luckypool.io --port=8866 --alg kawpow `miner --host=de.quai.herominers.com --port=1185 --algo="kawpow" --wallet=YOUR_WALLET --workername="YOUR_WORKERNAME"` ## Mining Stratum X -kawpow `miner --host=mining.stratumx.org --port=3335 --algo="kawpow" --wallet=YOUR_WALLET --workername="YOUR_WORKERNAME"` +kawpow `miner --internal_loop=1000 --internal_kernel_count=10 --host=mining.stratumx.org --port=3335 --algo="kawpow" --wallet=YOUR_WALLET --workername="YOUR_WORKERNAME"` diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index 499d874..7873f20 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -6,16 +6,20 @@ if (BUILD_NVIDIA AND (BUILD_EXE_MINER OR BUILD_EXE_UNIT_TEST)) algo/autolykos/cuda/autolykos_v2.cu algo/blake3/cuda/blake3.cu algo/ethash/cuda/ethash.cu - algo/progpow/cuda/progpow.cu) + algo/progpow/cuda/progpow.cu + ) - target_compile_definitions(${LIB_CRYPTO_NVIDIA} PRIVATE __LIB_CUDA CUDA_ENABLE) + target_compile_definitions(${LIB_CRYPTO_NVIDIA} PRIVATE + __LIB_CUDA + CUDA_ENABLE + ) target_include_directories(${LIB_CRYPTO_NVIDIA} PUBLIC ${Boost_INCLUDE_DIR} ${CUDA_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ) - + endif() ################################################################################ @@ -103,8 +107,8 @@ if (BUILD_EXE_UNIT_TEST) # Google Test include(FetchContent) FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip + googletest + URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip ) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) @@ -240,11 +244,13 @@ if (BUILD_EXE_MINER) ) target_include_directories(${MINER_EXE} PRIVATE + ${OPENSSL_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) target_link_libraries(${MINER_EXE} PRIVATE + ${OPEN_SSL_LIBRARIES} ${Boost_LIBRARIES} ) @@ -252,6 +258,7 @@ if (BUILD_EXE_MINER) target_include_directories(${MINER_EXE} PRIVATE ${OpenCL_INCLUDE_DIRS} ) + target_link_libraries(${MINER_EXE} PRIVATE ${OpenCL_LIBRARIES} ) @@ -261,6 +268,7 @@ if (BUILD_EXE_MINER) target_include_directories(${MINER_EXE} PRIVATE ${CUDA_INCLUDE_DIRS} ) + target_link_libraries(${MINER_EXE} PRIVATE ${CUDA_LIBRARY} ${CUDA_LIBRARIES} @@ -282,11 +290,13 @@ if (BUILD_EXE_BENCHMARK) ) target_include_directories(${BENCH_EXE} PRIVATE + ${OPENSSL_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) target_link_libraries(${BENCH_EXE} PRIVATE + ${OPEN_SSL_LIBRARIES} ${Boost_LIBRARIES} ) @@ -294,6 +304,7 @@ if (BUILD_EXE_BENCHMARK) target_include_directories(${BENCH_EXE} PRIVATE ${OpenCL_INCLUDE_DIRS} ) + target_link_libraries(${BENCH_EXE} PRIVATE ${OpenCL_LIBRARIES} ) @@ -303,6 +314,7 @@ if (BUILD_EXE_BENCHMARK) target_include_directories(${BENCH_EXE} PRIVATE ${CUDA_INCLUDE_DIRS} ) + target_link_libraries(${BENCH_EXE} PRIVATE ${CUDA_LIBRARY} ${CUDA_LIBRARIES} @@ -328,12 +340,17 @@ if (BUILD_EXE_UNIT_TEST) ${CMAKE_CURRENT_SOURCE_DIR} ) - target_link_libraries(${UNIT_TEST_EXE} PRIVATE gtest_main ${Boost_LIBRARIES}) + target_link_libraries(${UNIT_TEST_EXE} PRIVATE + gtest_main + ${OPEN_SSL_LIBRARIES} + ${Boost_LIBRARIES} + ) if (BUILD_AMD) target_include_directories(${UNIT_TEST_EXE} PRIVATE ${OpenCL_INCLUDE_DIRS} ) + target_link_libraries(${UNIT_TEST_EXE} PRIVATE ${OpenCL_LIBRARIES} ) @@ -343,6 +360,7 @@ if (BUILD_EXE_UNIT_TEST) target_include_directories(${UNIT_TEST_EXE} PRIVATE ${CUDA_INCLUDE_DIRS} ) + target_link_libraries(${UNIT_TEST_EXE} PRIVATE ${CUDA_LIBRARY} ${CUDA_LIBRARIES} @@ -357,19 +375,19 @@ endif() if (UNIX) if (BUILD_EXE_MINER) - target_link_libraries(${MINER_EXE} + target_link_libraries(${MINER_EXE} PRIVATE ${GNUTLS_LIBRARIES} "stdc++fs" ) endif() if (BUILD_EXE_BENCHMARK) - target_link_libraries(${BENCH_EXE} + target_link_libraries(${BENCH_EXE} PRIVATE ${GNUTLS_LIBRARIES} "stdc++fs" ) endif() if (BUILD_EXE_UNIT_TEST) - target_link_libraries(${UNIT_TEST_EXE} + target_link_libraries(${UNIT_TEST_EXE} PRIVATE ${GNUTLS_LIBRARIES} "stdc++fs" ) diff --git a/sources/common/cli/cli.cpp b/sources/common/cli/cli.cpp index 9ae0785..4070392 100644 --- a/sources/common/cli/cli.cpp +++ b/sources/common/cli/cli.cpp @@ -349,6 +349,13 @@ common::Cli::Cli() "Default is value is 1.\n" "--internal_loop=1" ) + ( + "internal_kernel_count", + value(), + "[OPTIONAL] Set internal loop for kernel. This defines the minimum number of times the kernel must be called to display statistics.\n" + "Default is value is 100.\n" + "--internal_kernel_count=100" + ) ( "cuda_context", value(), diff --git a/sources/common/cli/cli.hpp b/sources/common/cli/cli.hpp index c7a6547..5c2adda 100644 --- a/sources/common/cli/cli.hpp +++ b/sources/common/cli/cli.hpp @@ -114,6 +114,7 @@ namespace common uint32_t getOccupancyBlocks() const; bool isAutoOccupancy() const; uint32_t getInternalLoop() const; + uint32_t getMinimunKernelExecuted() const; std::string getCudaContext() const; // Algorithm diff --git a/sources/common/cli/cli_kernel.cpp b/sources/common/cli/cli_kernel.cpp index 19d2cd3..8c48366 100644 --- a/sources/common/cli/cli_kernel.cpp +++ b/sources/common/cli/cli_kernel.cpp @@ -48,6 +48,22 @@ uint32_t common::Cli::getInternalLoop() const } +uint32_t common::Cli::getMinimunKernelExecuted() const +{ + uint32_t kernelMinimunExecuteNeeded{ 100u }; + if (true == contains("internal_kernel_count")) + { + kernelMinimunExecuteNeeded = params["internal_kernel_count"].as(); + if (0u == kernelMinimunExecuteNeeded) + { + logErr() << "--internal_kernel_count must be greater than 0, reset to default value: 100"; + kernelMinimunExecuteNeeded = 100u; + } + } + return kernelMinimunExecuteNeeded; +} + + std::string common::Cli::getCudaContext() const { std::string context{ "auto" }; diff --git a/sources/common/config.cpp b/sources/common/config.cpp index 978c360..6e7001b 100644 --- a/sources/common/config.cpp +++ b/sources/common/config.cpp @@ -404,10 +404,12 @@ bool common::Config::loadCli(int argc, char** argv) auto const occupancyThreads{ cli.getOccupancyThreads() }; auto const occupancyBlocks{ cli.getOccupancyBlocks() }; auto const internalLoop{ cli.getInternalLoop() }; + auto const kernelMinimunExecuteNeeded{ cli.getMinimunKernelExecuted() }; auto const cudaContext{ cli.getCudaContext() }; occupancy.isAuto = isAutoOccupancy; occupancy.internalLoop = internalLoop; occupancy.cudaContext = cudaContext; + occupancy.kernelMinimunExecuteNeeded = kernelMinimunExecuteNeeded; if ( 0u != occupancyThreads || 0u != occupancyBlocks) { diff --git a/sources/common/config.hpp b/sources/common/config.hpp index 4addf13..e70f2cc 100644 --- a/sources/common/config.hpp +++ b/sources/common/config.hpp @@ -51,6 +51,7 @@ namespace common std::optional threads{}; std::optional blocks{}; std::optional internalLoop{}; + std::optional kernelMinimunExecuteNeeded{}; std::optional cudaContext{}; }; diff --git a/sources/device/device.cpp b/sources/device/device.cpp index 237e4c1..7ad6ff0 100644 --- a/sources/device/device.cpp +++ b/sources/device/device.cpp @@ -492,8 +492,9 @@ void device::Device::increaseShare( double device::Device::getHashrate() { uint32_t const executeCount { miningStats.getKernelExecutedCount() }; + common::Config& config{ common::Config::instance() }; - if (kernelMinimunExecuteNeeded <= executeCount) + if (config.occupancy.kernelMinimunExecuteNeeded <= executeCount) { miningStats.stop(); miningStats.updateHashrate(); diff --git a/sources/device/device.hpp b/sources/device/device.hpp index 84fbdcf..9d0e743 100644 --- a/sources/device/device.hpp +++ b/sources/device/device.hpp @@ -90,7 +90,6 @@ namespace device }; device::Device::AtomicSynchronizer synchronizer{}; - uint32_t kernelMinimunExecuteNeeded{ 100u }; boost::atomic_bool alive{ false }; boost::atomic_bool computing{ false }; boost::thread threadDoWork{}; diff --git a/sources/resolver/nvidia/ethash.cpp b/sources/resolver/nvidia/ethash.cpp index d14b679..49ad852 100644 --- a/sources/resolver/nvidia/ethash.cpp +++ b/sources/resolver/nvidia/ethash.cpp @@ -89,7 +89,7 @@ bool resolver::ResolverNvidiaEthash::updateMemory( if (false == config.deviceAlgorithm.ethashBuildLightCacheCPU) { resolverInfo() << "Building light cache on GPU"; - common::ChronoGuard chrono{ "Built light cache", common::CHRONO_UNIT::MS }; + common::ChronoGuard chronoCPU{ "Built light cache", common::CHRONO_UNIT::MS }; if (false == ethashBuildLightCache(cuStream[currentIndexStream], parameters.seedCache)) { diff --git a/sources/statistical/statistical.cpp b/sources/statistical/statistical.cpp index b5c7c04..f29c372 100644 --- a/sources/statistical/statistical.cpp +++ b/sources/statistical/statistical.cpp @@ -79,11 +79,13 @@ uint64_t statistical::Statistical::getBatchNonce() const void statistical::Statistical::updateHashrate() { + /////////////////////////////////////////////////////////////////////////// elapsed = chrono.elapsed(chronoUnit); double const diffTime{ chronoTime / elapsed }; uint64_t const totalNonce{ batchNonce * kernelExecuted }; double const values{ totalNonce * diffTime }; + /////////////////////////////////////////////////////////////////////////// if (values > 0.0) { hashrates = values; diff --git a/sources/statistical/statistical.hpp b/sources/statistical/statistical.hpp index d223b4f..fcd74d2 100644 --- a/sources/statistical/statistical.hpp +++ b/sources/statistical/statistical.hpp @@ -34,7 +34,7 @@ namespace statistical private: common::CHRONO_UNIT chronoUnit{ common::CHRONO_UNIT::US }; - common::Chrono chrono; + common::Chrono chrono{}; double chronoTime{ common::SEC_TO_US }; ShareInfo shares{}; uint64_t batchNonce{ 0ull };