diff --git a/BUILD.md b/BUILD.md index 22aa6b9..5eb2e18 100644 --- a/BUILD.md +++ b/BUILD.md @@ -121,6 +121,13 @@ cd boost_1_86_0 ./b2 debug release sudo ./b2 install ``` + +gpu performance api: +```sh +wget https://github.com/GPUOpen-Tools/gpu_performance_api/releases/download/v4.3-tag/GPUPerfAPI-Linux-4.3.0.2.tgz +tar -xvf GPUPerfAPI-Linux-4.3.0.2.tgz +mv 4_4 gpu_performance_api +``` # Platforms diff --git a/sources/algo/ethash/CMakeLists.txt b/sources/algo/ethash/CMakeLists.txt index 39c9f34..42fc9a7 100644 --- a/sources/algo/ethash/CMakeLists.txt +++ b/sources/algo/ethash/CMakeLists.txt @@ -15,7 +15,7 @@ if (BUILD_EXE_UNIT_TEST) ) endif() -if (BUILD_EXE_MINER) +if (BUILD_EXE_BENCHMARK) target_sources(${BENCH_EXE} PUBLIC ${HEADERS} ${SOURCES} diff --git a/sources/benchmark/amd/kawpow.cpp b/sources/benchmark/amd/kawpow.cpp index 5ac9e76..1499485 100644 --- a/sources/benchmark/amd/kawpow.cpp +++ b/sources/benchmark/amd/kawpow.cpp @@ -10,8 +10,9 @@ #include #include #include -#include #include +#include +#include bool benchmark::BenchmarkWorkflow::runAmdKawpow() @@ -19,6 +20,17 @@ bool benchmark::BenchmarkWorkflow::runAmdKawpow() //////////////////////////////////////////////////////////////////////////// using namespace std::string_literals; + //////////////////////////////////////////////////////////////////////////// + + common::Dashboard dashboard{}; + dashboard.setTitle("[AMD] KAWPOW"); + dashboard.addColumn("Kernel"); + dashboard.addColumn("Blocks"); + dashboard.addColumn("Threads"); + dashboard.addColumn("Hashrate"); + dashboard.addColumn("Time"); + dashboard.setDate(common::getDate()); + //////////////////////////////////////////////////////////////////////////// bool dagInitialized{ false }; algo::hash256 const headerHash @@ -189,7 +201,7 @@ bool benchmark::BenchmarkWorkflow::runAmdKawpow() ) ); OPENCL_ER(propertiesAmd.clQueue.finish()); - stopChrono(i); + stopChrono(i, dashboard); } return true; @@ -212,6 +224,9 @@ bool benchmark::BenchmarkWorkflow::runAmdKawpow() headerCache.free(); resultCache.free(); + //////////////////////////////////////////////////////////////////////////// + dashboards.emplace_back(dashboard); + //////////////////////////////////////////////////////////////////////////// return true; } diff --git a/sources/benchmark/workflow.cpp b/sources/benchmark/workflow.cpp index a776c0e..b1b5e87 100644 --- a/sources/benchmark/workflow.cpp +++ b/sources/benchmark/workflow.cpp @@ -80,6 +80,10 @@ void benchmark::BenchmarkWorkflow::run() runAmd(); } #endif + for (auto dashboard : dashboards) + { + dashboard.show(); + } writeReport(); } @@ -142,6 +146,42 @@ void benchmark::BenchmarkWorkflow::stopChrono(uint32_t const index) } +void benchmark::BenchmarkWorkflow::stopChrono( + uint32_t const index, + common::Dashboard& dashboard) +{ + //////////////////////////////////////////////////////////////////////////// + stats.increaseKernelExecuted(); + stats.stop(); + stats.updateHashrate(); + double const hashrate{ (stats.getHashrate() * multiplicator) / divisor }; + logInfo() << currentBenchName << ": " << common::hashrateToString(hashrate); + + //////////////////////////////////////////////////////////////////////////// + benchmark::Snapshot snapshot{}; + snapshot.deviceType = currentdeviceType; + snapshot.name = currentBenchName; + snapshot.threads = threads; + snapshot.blocks = blocks; + snapshot.perform = hashrate; + + //////////////////////////////////////////////////////////////////////////// + snapshots.emplace_back(snapshot); + + //////////////////////////////////////////////////////////////////////////// + dashboard.addLine + ( + { + currentBenchName, + std::to_string(blocks), + std::to_string(threads), + common::hashrateToString(hashrate), + std::to_string(stats.getElapsed()) + } + ); +} + + void benchmark::BenchmarkWorkflow::writeReport() { boost::json::object root{}; @@ -329,6 +369,5 @@ void benchmark::BenchmarkWorkflow::runAmd() { logErr() << "AMD kawpow failed"; } - } #endif diff --git a/sources/benchmark/workflow.hpp b/sources/benchmark/workflow.hpp index d83651d..1496ab8 100644 --- a/sources/benchmark/workflow.hpp +++ b/sources/benchmark/workflow.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -83,6 +84,7 @@ namespace benchmark uint32_t divisor{ 1u }; statistical::Statistical stats{}; std::vector snapshots{}; + std::vector dashboards{}; void writeReport(); @@ -91,6 +93,7 @@ namespace benchmark void setGrid(uint32_t const _threads, uint32_t _blocks); void startChrono(std::string const& benchName); void stopChrono(uint32_t const index); + void stopChrono(uint32_t const index, common::Dashboard& dashboard); bool initCleanResult(t_result** result); bool initCleanResult32(t_result_32** result); diff --git a/sources/common/dashboard.cpp b/sources/common/dashboard.cpp index ded0955..58e9124 100644 --- a/sources/common/dashboard.cpp +++ b/sources/common/dashboard.cpp @@ -40,17 +40,18 @@ void common::Dashboard::setFooter( void common::Dashboard::addColumn(std::string const& name) { - Column col{ name, name.size() }; + common::Dashboard::Column col{ name, name.size() }; columns.emplace_back(col); } void common::Dashboard::addLine(std::vector const& line) { - std::vector data; + std::vector data; for (auto const& value : line) { - Line l{ value, value.size() }; + common::Dashboard::Line l{ value, value.size() }; + logInfo() << "line: " << l.value; data.emplace_back(std::move(l)); } lines.emplace_back(data); diff --git a/sources/device/type.hpp b/sources/device/type.hpp index 20ab38f..6af71db 100644 --- a/sources/device/type.hpp +++ b/sources/device/type.hpp @@ -16,4 +16,6 @@ namespace device #endif UNKNOWN }; + + constexpr uint8_t MAX_DEVICE_TYPE{ 2 }; }