From 1e4e1bfd73965bc2deb8704afe7af5e0fc17586c Mon Sep 17 00:00:00 2001 From: guojx1998 <61349415+guojx1998@users.noreply.github.com> Date: Mon, 4 Oct 2021 16:15:27 +0800 Subject: [PATCH 1/5] Update CUDAMiner.cpp Return false and throw error when dag generation failed. --- libethash-cuda/CUDAMiner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libethash-cuda/CUDAMiner.cpp b/libethash-cuda/CUDAMiner.cpp index b47d689b4f..7bb63c2a34 100644 --- a/libethash-cuda/CUDAMiner.cpp +++ b/libethash-cuda/CUDAMiner.cpp @@ -179,7 +179,9 @@ bool CUDAMiner::initEpoch_internal() << m_deviceDescriptor.uniqueId; cudalog << "Mining suspended ..."; pause(MinerPauseEnum::PauseDueToInitEpochError); - retVar = true; + string _what = "GPU error when generating DAG!"; + throw std::runtime_error(_what); + retVar = false; } return retVar; From 446169cca4963b94a045a5d8ac27ff52394d2ec7 Mon Sep 17 00:00:00 2001 From: guojx1998 <61349415+guojx1998@users.noreply.github.com> Date: Mon, 4 Oct 2021 16:22:55 +0800 Subject: [PATCH 2/5] Update appveyor.yml for cuda 11 --- appveyor.yml | 61 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8adf82d591..904c5a2f7e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,8 +11,13 @@ os: "Visual Studio 2017" environment: matrix: - CUDA_VER: "8.0" + CUVER: 8 - CUDA_VER: "9.1" + CUVER: 9 - CUDA_VER: "10.0" + CUVER: 10 + - CUDA_VER: "11.1.0" + CUVER: 11 HUNTER_CACHE_TOKEN: secure: VnpF1MH5MEFvUI5MiMMMFlmbDdst+bfom5ZFVgalYPp/SYDhbejjXJm9Dla/IgpC @@ -20,29 +25,53 @@ cache: - C:\CUDA\v8.0 -> appveyor.yml - C:\CUDA\v9.1 -> appveyor.yml - C:\CUDA\v10.0 -> appveyor.yml + - C:\CUDA\v11.0.3 -> appveyor.yml + - C:\CUDA\v11.1.0 -> appveyor.yml + - C:\CUDA\v11.2.0 -> appveyor.yml # Download CUDA Windows installer (local) and extract /compiler/* to /CUDA/vX.0/ zip archive. -install: | - git submodule update --init --recursive - if "%CUDA_VER%" == "8.0" set CUDA_ARCHIVE=cuda_8.0.61_windows-exe - if "%CUDA_VER%" == "9.1" set CUDA_ARCHIVE=cuda_9.1.85_windows - if "%CUDA_VER%" == "10.0" set CUDA_ARCHIVE=cuda_10.0.130_411.31_windows - if NOT EXIST C:\CUDA\v%CUDA_VER% (if "%CUDA_VER%" NEQ "8.0" curl -L https://developer.nvidia.com/compute/cuda/%CUDA_VER%/Prod/local_installers/%CUDA_ARCHIVE% -o %CUDA_ARCHIVE%.exe) - if NOT EXIST C:\CUDA\v%CUDA_VER% (if "%CUDA_VER%" == "8.0" curl -L https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_windows-exe -o %CUDA_ARCHIVE%.exe) - if NOT EXIST C:\CUDA mkdir C:\CUDA - if NOT EXIST C:\CUDA\v%CUDA_VER% (if "%CUDA_VER%" NEQ "8.0" 7z x %CUDA_ARCHIVE%.exe -oC:\CUDA nvcc/* nvrtc*/*) - if NOT EXIST C:\CUDA\v%CUDA_VER% (if "%CUDA_VER%" == "8.0" 7z x %CUDA_ARCHIVE%.exe -oC:\CUDA compiler/* nvrtc*/*) - if NOT EXIST C:\CUDA\v%CUDA_VER% (if "%CUDA_VER%" NEQ "8.0" rename C:\CUDA\nvcc v%CUDA_VER%) - if NOT EXIST C:\CUDA\v%CUDA_VER% (if "%CUDA_VER%" == "8.0" rename C:\CUDA\compiler v%CUDA_VER%) +install: + - git submodule update --init --recursive + - if "%CUDA_VER%" == "8.0" set CUDA_ARCHIVE=cuda_8.0.61_windows-exe + - if "%CUDA_VER%" == "9.1" set CUDA_ARCHIVE=cuda_9.1.85_windows + - if "%CUDA_VER%" == "10.0" set CUDA_ARCHIVE=cuda_10.0.130_411.31_windows + - if "%CUDA_VER%" == "11.0.3" set CUDA_ARCHIVE=cuda_11.0.3_451.82_win10 + - if "%CUDA_VER%" == "11.1.0" set CUDA_ARCHIVE=cuda_11.1.0_456.43_win10 + - if "%CUDA_VER%" == "11.2.0" set CUDA_ARCHIVE=cuda_11.2.0_460.89_win10 + - if NOT EXIST C:\CUDA\v%CUDA_VER% ( + if "%CUDA_VER%" == "8.0" ( + curl -L https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_windows-exe -o %CUDA_ARCHIVE%.exe + ) else if %CUVER% GEQ 11 ( + curl -L https://developer.download.nvidia.com/compute/cuda/%CUDA_VER%/local_installers/%CUDA_ARCHIVE%.exe -o %CUDA_ARCHIVE%.exe + ) else ( + curl -L https://developer.nvidia.com/compute/cuda/%CUDA_VER%/Prod/local_installers/%CUDA_ARCHIVE% -o %CUDA_ARCHIVE%.exe + ) + ) - set PATH=C:\Python36-x64;C:\Python36-x64\Scripts;%PATH%;C:\CUDA\v%CUDA_VER%\bin - pip install requests gitpython - nvcc -V + - if NOT EXIST C:\CUDA mkdir C:\CUDA + - if NOT EXIST C:\CUDA\v%CUDA_VER% ( + if "%CUDA_VER%" == "8.0" (7z x %CUDA_ARCHIVE%.exe -oC:\CUDA compiler/* nvrtc*/*) + else if %CUVER% GEQ 11 (7z x %CUDA_ARCHIVE%.exe -oC:\CUDA cuda_nvcc/nvcc/* cuda_cudart/* cuda_nvrtc/nvrtc*/*) + else (7z x %CUDA_ARCHIVE%.exe -oC:\CUDA nvcc/* nvrtc*/*) + ) + - if NOT EXIST C:\CUDA\v%CUDA_VER% ( + if "%CUDA_VER%" == "8.0" (rename C:\CUDA\compiler v%CUDA_VER%) + else if %CUVER% GEQ 11 (move C:\CUDA\cuda_nvcc\nvcc C:\CUDA\v%CUDA_VER% && move C:\CUDA\cuda_cudart\cudart C:\CUDA\v%CUDA_VER%\ ) + else (rename C:\CUDA\nvcc v%CUDA_VER%) + ) + - if EXIST C:\CUDA\v%CUDA_VER%\cudart ( + xcopy C:\CUDA\v%CUDA_VER%\cudart\* C:\CUDA\v%CUDA_VER%\ /S /Y + ) + + - set PATH=C:\Python36-x64;C:\Python36-x64\Scripts;%PATH%;C:\CUDA\v%CUDA_VER%\bin + - pip install requests gitpython + - nvcc -V build_script: - call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat" - set CMAKE_ARGS=-G "Visual Studio 15 2017 Win64" -H. -Bbuild -DETHASHCUDA=ON -DAPICORE=ON -DHUNTER_JOBS_NUMBER=%NUMBER_OF_PROCESSORS% - - if "%CUDA_VER%" NEQ "10.0" set CMAKE_ARGS=%CMAKE_ARGS% -T v140 + - if "%CUDA_VER%" == "8.0" set CMAKE_ARGS=%CMAKE_ARGS% -T v140 + - if "%CUDA_VER%" == "9.1" set CMAKE_ARGS=%CMAKE_ARGS% -T v140 - cmake %CMAKE_ARGS% - cmake --build build --config Release --target package - ps: | From 239b539e05bc3dc29873a620d497a6c42698405c Mon Sep 17 00:00:00 2001 From: guojx1998 <61349415+guojx1998@users.noreply.github.com> Date: Mon, 4 Oct 2021 16:47:59 +0800 Subject: [PATCH 3/5] Remove cuda 8 and 9 in appveyor --- appveyor.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 904c5a2f7e..b93087e3e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,10 +10,6 @@ clone_depth: 100 os: "Visual Studio 2017" environment: matrix: - - CUDA_VER: "8.0" - CUVER: 8 - - CUDA_VER: "9.1" - CUVER: 9 - CUDA_VER: "10.0" CUVER: 10 - CUDA_VER: "11.1.0" @@ -22,8 +18,6 @@ environment: secure: VnpF1MH5MEFvUI5MiMMMFlmbDdst+bfom5ZFVgalYPp/SYDhbejjXJm9Dla/IgpC cache: - - C:\CUDA\v8.0 -> appveyor.yml - - C:\CUDA\v9.1 -> appveyor.yml - C:\CUDA\v10.0 -> appveyor.yml - C:\CUDA\v11.0.3 -> appveyor.yml - C:\CUDA\v11.1.0 -> appveyor.yml @@ -32,8 +26,6 @@ cache: # Download CUDA Windows installer (local) and extract /compiler/* to /CUDA/vX.0/ zip archive. install: - git submodule update --init --recursive - - if "%CUDA_VER%" == "8.0" set CUDA_ARCHIVE=cuda_8.0.61_windows-exe - - if "%CUDA_VER%" == "9.1" set CUDA_ARCHIVE=cuda_9.1.85_windows - if "%CUDA_VER%" == "10.0" set CUDA_ARCHIVE=cuda_10.0.130_411.31_windows - if "%CUDA_VER%" == "11.0.3" set CUDA_ARCHIVE=cuda_11.0.3_451.82_win10 - if "%CUDA_VER%" == "11.1.0" set CUDA_ARCHIVE=cuda_11.1.0_456.43_win10 From e178f84e1b2bf079f1c3eb6adf45fcbf3fd4d988 Mon Sep 17 00:00:00 2001 From: guojx1998 <61349415+guojx1998@users.noreply.github.com> Date: Mon, 4 Oct 2021 16:49:09 +0800 Subject: [PATCH 4/5] Add --exit-new-epoch in main.cpp --- ethminer/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ethminer/main.cpp b/ethminer/main.cpp index f1aec3d5b5..bbc9d3fce6 100644 --- a/ethminer/main.cpp +++ b/ethminer/main.cpp @@ -55,6 +55,7 @@ using namespace dev::eth; // Global vars bool g_running = false; bool g_exitOnError = false; // Whether or not ethminer should exit on mining threads errors +bool g_exitOnNewEpoch = false; // Exit on new epoch condition_variable g_shouldstop; boost::asio::io_service g_io_service; // The IO service itself @@ -271,6 +272,8 @@ class MinerCLI app.add_option("--HWMON", m_FarmSettings.hwMon, "", true)->check(CLI::Range(0, 2)); app.add_flag("--exit", g_exitOnError, ""); + + app.add_flag("--exit-new-epoch", g_exitOnNewEpoch, ""); vector pools; app.add_option("-P,--pool", pools, ""); @@ -1009,6 +1012,8 @@ class MinerCLI << " 2 As 1 plus monitor power drain" << endl << " --exit FLAG Stop ethminer whenever an error is encountered" << endl + << " --exit-new-epoch FLAG Stop ethminer when epoch changes" + << endl << " --ergodicity INT[0 .. 2] Default = 0" << endl << " Sets how ethminer chooses the nonces segments to" << endl From 5a4ecba8e886e8a2ef2b11bbcb6c0cadd3460f90 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Oct 2021 17:21:53 +0800 Subject: [PATCH 5/5] Add --exit-new-epoch --- libethash-cuda/CUDAMiner.cpp | 5 +++++ libethash-cuda/CUDAMiner.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libethash-cuda/CUDAMiner.cpp b/libethash-cuda/CUDAMiner.cpp index 7bb63c2a34..be8f4721cc 100644 --- a/libethash-cuda/CUDAMiner.cpp +++ b/libethash-cuda/CUDAMiner.cpp @@ -216,6 +216,11 @@ void CUDAMiner::workLoop() // Epoch change ? if (current.epoch != w.epoch) { + if (current.epoch != -1 && g_exitOnNewEpoch) + { + std::cerr << "Epoch change, miner exit!" << std::endl; + raise(SIGTERM); + } if (!initEpoch()) break; // This will simply exit the thread diff --git a/libethash-cuda/CUDAMiner.h b/libethash-cuda/CUDAMiner.h index f7dc04e7ed..0abcf43b2d 100644 --- a/libethash-cuda/CUDAMiner.h +++ b/libethash-cuda/CUDAMiner.h @@ -25,6 +25,8 @@ along with ethminer. If not, see . #include +extern bool g_exitOnNewEpoch; + namespace dev { namespace eth