Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<true\|false>` |
| `--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=<auto\|blocking\|yield\|spin>` |

## Smart Mining
Expand Down
2 changes: 1 addition & 1 deletion POOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
36 changes: 27 additions & 9 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

################################################################################
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -240,18 +244,21 @@ 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}
)

if (BUILD_AMD)
target_include_directories(${MINER_EXE} PRIVATE
${OpenCL_INCLUDE_DIRS}
)

target_link_libraries(${MINER_EXE} PRIVATE
${OpenCL_LIBRARIES}
)
Expand All @@ -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}
Expand All @@ -282,18 +290,21 @@ 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}
)

if (BUILD_AMD)
target_include_directories(${BENCH_EXE} PRIVATE
${OpenCL_INCLUDE_DIRS}
)

target_link_libraries(${BENCH_EXE} PRIVATE
${OpenCL_LIBRARIES}
)
Expand All @@ -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}
Expand All @@ -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}
)
Expand All @@ -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}
Expand All @@ -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"
)
Expand Down
7 changes: 7 additions & 0 deletions sources/common/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ common::Cli::Cli()
"Default is value is 1.\n"
"--internal_loop=1"
)
(
"internal_kernel_count",
value<uint32_t>(),
"[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<std::string>(),
Expand Down
1 change: 1 addition & 0 deletions sources/common/cli/cli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions sources/common/cli/cli_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>();
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" };
Expand Down
2 changes: 2 additions & 0 deletions sources/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions sources/common/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace common
std::optional<uint32_t> threads{};
std::optional<uint32_t> blocks{};
std::optional<uint32_t> internalLoop{};
std::optional<uint32_t> kernelMinimunExecuteNeeded{};
std::optional<std::string> cudaContext{};
};

Expand Down
3 changes: 2 additions & 1 deletion sources/device/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion sources/device/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{};
Expand Down
2 changes: 1 addition & 1 deletion sources/resolver/nvidia/ethash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
2 changes: 2 additions & 0 deletions sources/statistical/statistical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sources/statistical/statistical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Loading