Skip to content

Commit 26d9fd6

Browse files
Merge pull request #107 from luminousmining/fix/prompt_dashboard
New parameter --internal_kernel_count
2 parents d5b25d8 + ce025d1 commit 26d9fd6

13 files changed

Lines changed: 62 additions & 14 deletions

File tree

PARAMETERS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ N/A : No default value is set.
9696
| `--blocks` || N/A | Set occupancy blocks. | `--blocks=128` |
9797
| `--occupancy` || false | System will define the best occupancy for kernel. | `--occupancy=<true\|false>` |
9898
| `--internal_loop` || 1 | Set internal loop for kernel. | `--internal_loop=1` |
99+
| `--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` |
99100
| `--cuda_context` || auto | Set CUDA context. | `--cuda_context=<auto\|blocking\|yield\|spin>` |
100101

101102
## Smart Mining

POOLS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ progpow-z `miner --stratum="ethproxy" --host=zano.luckypool.io --port=8866 --alg
2929
kawpow `miner --host=de.quai.herominers.com --port=1185 --algo="kawpow" --wallet=YOUR_WALLET --workername="YOUR_WORKERNAME"`
3030

3131
## Mining Stratum X
32-
kawpow `miner --host=mining.stratumx.org --port=3335 --algo="kawpow" --wallet=YOUR_WALLET --workername="YOUR_WORKERNAME"`
32+
kawpow `miner --internal_loop=1000 --internal_kernel_count=10 --host=mining.stratumx.org --port=3335 --algo="kawpow" --wallet=YOUR_WALLET --workername="YOUR_WORKERNAME"`

sources/CMakeLists.txt

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ if (BUILD_NVIDIA AND (BUILD_EXE_MINER OR BUILD_EXE_UNIT_TEST))
66
algo/autolykos/cuda/autolykos_v2.cu
77
algo/blake3/cuda/blake3.cu
88
algo/ethash/cuda/ethash.cu
9-
algo/progpow/cuda/progpow.cu)
9+
algo/progpow/cuda/progpow.cu
10+
)
1011

11-
target_compile_definitions(${LIB_CRYPTO_NVIDIA} PRIVATE __LIB_CUDA CUDA_ENABLE)
12+
target_compile_definitions(${LIB_CRYPTO_NVIDIA} PRIVATE
13+
__LIB_CUDA
14+
CUDA_ENABLE
15+
)
1216

1317
target_include_directories(${LIB_CRYPTO_NVIDIA} PUBLIC
1418
${Boost_INCLUDE_DIR}
1519
${CUDA_INCLUDE_DIRS}
1620
${CMAKE_CURRENT_SOURCE_DIR}
1721
)
18-
22+
1923
endif()
2024

2125
################################################################################
@@ -103,8 +107,8 @@ if (BUILD_EXE_UNIT_TEST)
103107
# Google Test
104108
include(FetchContent)
105109
FetchContent_Declare(
106-
googletest
107-
URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip
110+
googletest
111+
URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip
108112
)
109113
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
110114
FetchContent_MakeAvailable(googletest)
@@ -240,18 +244,21 @@ if (BUILD_EXE_MINER)
240244
)
241245

242246
target_include_directories(${MINER_EXE} PRIVATE
247+
${OPENSSL_INCLUDE_DIR}
243248
${Boost_INCLUDE_DIR}
244249
${CMAKE_CURRENT_SOURCE_DIR}
245250
)
246251

247252
target_link_libraries(${MINER_EXE} PRIVATE
253+
${OPEN_SSL_LIBRARIES}
248254
${Boost_LIBRARIES}
249255
)
250256

251257
if (BUILD_AMD)
252258
target_include_directories(${MINER_EXE} PRIVATE
253259
${OpenCL_INCLUDE_DIRS}
254260
)
261+
255262
target_link_libraries(${MINER_EXE} PRIVATE
256263
${OpenCL_LIBRARIES}
257264
)
@@ -261,6 +268,7 @@ if (BUILD_EXE_MINER)
261268
target_include_directories(${MINER_EXE} PRIVATE
262269
${CUDA_INCLUDE_DIRS}
263270
)
271+
264272
target_link_libraries(${MINER_EXE} PRIVATE
265273
${CUDA_LIBRARY}
266274
${CUDA_LIBRARIES}
@@ -282,18 +290,21 @@ if (BUILD_EXE_BENCHMARK)
282290
)
283291

284292
target_include_directories(${BENCH_EXE} PRIVATE
293+
${OPENSSL_INCLUDE_DIR}
285294
${Boost_INCLUDE_DIR}
286295
${CMAKE_CURRENT_SOURCE_DIR}
287296
)
288297

289298
target_link_libraries(${BENCH_EXE} PRIVATE
299+
${OPEN_SSL_LIBRARIES}
290300
${Boost_LIBRARIES}
291301
)
292302

293303
if (BUILD_AMD)
294304
target_include_directories(${BENCH_EXE} PRIVATE
295305
${OpenCL_INCLUDE_DIRS}
296306
)
307+
297308
target_link_libraries(${BENCH_EXE} PRIVATE
298309
${OpenCL_LIBRARIES}
299310
)
@@ -303,6 +314,7 @@ if (BUILD_EXE_BENCHMARK)
303314
target_include_directories(${BENCH_EXE} PRIVATE
304315
${CUDA_INCLUDE_DIRS}
305316
)
317+
306318
target_link_libraries(${BENCH_EXE} PRIVATE
307319
${CUDA_LIBRARY}
308320
${CUDA_LIBRARIES}
@@ -328,12 +340,17 @@ if (BUILD_EXE_UNIT_TEST)
328340
${CMAKE_CURRENT_SOURCE_DIR}
329341
)
330342

331-
target_link_libraries(${UNIT_TEST_EXE} PRIVATE gtest_main ${Boost_LIBRARIES})
343+
target_link_libraries(${UNIT_TEST_EXE} PRIVATE
344+
gtest_main
345+
${OPEN_SSL_LIBRARIES}
346+
${Boost_LIBRARIES}
347+
)
332348

333349
if (BUILD_AMD)
334350
target_include_directories(${UNIT_TEST_EXE} PRIVATE
335351
${OpenCL_INCLUDE_DIRS}
336352
)
353+
337354
target_link_libraries(${UNIT_TEST_EXE} PRIVATE
338355
${OpenCL_LIBRARIES}
339356
)
@@ -343,6 +360,7 @@ if (BUILD_EXE_UNIT_TEST)
343360
target_include_directories(${UNIT_TEST_EXE} PRIVATE
344361
${CUDA_INCLUDE_DIRS}
345362
)
363+
346364
target_link_libraries(${UNIT_TEST_EXE} PRIVATE
347365
${CUDA_LIBRARY}
348366
${CUDA_LIBRARIES}
@@ -357,19 +375,19 @@ endif()
357375

358376
if (UNIX)
359377
if (BUILD_EXE_MINER)
360-
target_link_libraries(${MINER_EXE}
378+
target_link_libraries(${MINER_EXE} PRIVATE
361379
${GNUTLS_LIBRARIES}
362380
"stdc++fs"
363381
)
364382
endif()
365383
if (BUILD_EXE_BENCHMARK)
366-
target_link_libraries(${BENCH_EXE}
384+
target_link_libraries(${BENCH_EXE} PRIVATE
367385
${GNUTLS_LIBRARIES}
368386
"stdc++fs"
369387
)
370388
endif()
371389
if (BUILD_EXE_UNIT_TEST)
372-
target_link_libraries(${UNIT_TEST_EXE}
390+
target_link_libraries(${UNIT_TEST_EXE} PRIVATE
373391
${GNUTLS_LIBRARIES}
374392
"stdc++fs"
375393
)

sources/common/cli/cli.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ common::Cli::Cli()
349349
"Default is value is 1.\n"
350350
"--internal_loop=1"
351351
)
352+
(
353+
"internal_kernel_count",
354+
value<uint32_t>(),
355+
"[OPTIONAL] Set internal loop for kernel. This defines the minimum number of times the kernel must be called to display statistics.\n"
356+
"Default is value is 100.\n"
357+
"--internal_kernel_count=100"
358+
)
352359
(
353360
"cuda_context",
354361
value<std::string>(),

sources/common/cli/cli.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ namespace common
114114
uint32_t getOccupancyBlocks() const;
115115
bool isAutoOccupancy() const;
116116
uint32_t getInternalLoop() const;
117+
uint32_t getMinimunKernelExecuted() const;
117118
std::string getCudaContext() const;
118119

119120
// Algorithm

sources/common/cli/cli_kernel.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ uint32_t common::Cli::getInternalLoop() const
4848
}
4949

5050

51+
uint32_t common::Cli::getMinimunKernelExecuted() const
52+
{
53+
uint32_t kernelMinimunExecuteNeeded{ 100u };
54+
if (true == contains("internal_kernel_count"))
55+
{
56+
kernelMinimunExecuteNeeded = params["internal_kernel_count"].as<uint32_t>();
57+
if (0u == kernelMinimunExecuteNeeded)
58+
{
59+
logErr() << "--internal_kernel_count must be greater than 0, reset to default value: 100";
60+
kernelMinimunExecuteNeeded = 100u;
61+
}
62+
}
63+
return kernelMinimunExecuteNeeded;
64+
}
65+
66+
5167
std::string common::Cli::getCudaContext() const
5268
{
5369
std::string context{ "auto" };

sources/common/config.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,12 @@ bool common::Config::loadCli(int argc, char** argv)
404404
auto const occupancyThreads{ cli.getOccupancyThreads() };
405405
auto const occupancyBlocks{ cli.getOccupancyBlocks() };
406406
auto const internalLoop{ cli.getInternalLoop() };
407+
auto const kernelMinimunExecuteNeeded{ cli.getMinimunKernelExecuted() };
407408
auto const cudaContext{ cli.getCudaContext() };
408409
occupancy.isAuto = isAutoOccupancy;
409410
occupancy.internalLoop = internalLoop;
410411
occupancy.cudaContext = cudaContext;
412+
occupancy.kernelMinimunExecuteNeeded = kernelMinimunExecuteNeeded;
411413
if ( 0u != occupancyThreads
412414
|| 0u != occupancyBlocks)
413415
{

sources/common/config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace common
5151
std::optional<uint32_t> threads{};
5252
std::optional<uint32_t> blocks{};
5353
std::optional<uint32_t> internalLoop{};
54+
std::optional<uint32_t> kernelMinimunExecuteNeeded{};
5455
std::optional<std::string> cudaContext{};
5556
};
5657

sources/device/device.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,9 @@ void device::Device::increaseShare(
492492
double device::Device::getHashrate()
493493
{
494494
uint32_t const executeCount { miningStats.getKernelExecutedCount() };
495+
common::Config& config{ common::Config::instance() };
495496

496-
if (kernelMinimunExecuteNeeded <= executeCount)
497+
if (config.occupancy.kernelMinimunExecuteNeeded <= executeCount)
497498
{
498499
miningStats.stop();
499500
miningStats.updateHashrate();

sources/device/device.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ namespace device
9090
};
9191
device::Device::AtomicSynchronizer synchronizer{};
9292

93-
uint32_t kernelMinimunExecuteNeeded{ 100u };
9493
boost::atomic_bool alive{ false };
9594
boost::atomic_bool computing{ false };
9695
boost::thread threadDoWork{};

0 commit comments

Comments
 (0)