ProgPOW
ProgPOW copied to clipboard
Build instructions
There are https://github.com/ethereum-mining/ethminer/blob/master/docs/BUILD.md and https://github.com/AndreaLanfranchi/ethminer/blob/master/docs/BUILD.md in those related repos, but apparently no equivalent in this one. Their instructions are almost usable for this repo, but not quite. Perhaps proper build instructions should be added right in here and maintained in here?
FWIW, here's what worked for me (on Scientific Linux 6.10 with CUDA 10.0 and AMDGPU-PRO 18.50, after scl enable devtoolset-6 bash
to gain newer gcc and using cmake3
- I omitted these two tricks from the commands below to make them readily reusable on more common and recent distros):
git clone https://github.com/ifdefelse/ProgPOW
cd ProgPOW
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DETHASHCUDA=ON
make -sj8
This produced an OpenCL+CUDA build. (Why isn't CUDA enabled by default? It is in default build of current ethminer on this same system.)
Then there was this runtime error:
Fatal GPU error: CUDA error in func ethash_generate_dag at line 173 calling cudaGetLastError() failed with error no kernel image is available for execution on the device
which I solved by adding builds for all of this machine's GPUs' compute capabilities to libethash-cuda/CMakeLists.txt
:
diff --git a/libethash-cuda/CMakeLists.txt b/libethash-cuda/CMakeLists.txt
index 89fa461..ebd079b 100644
--- a/libethash-cuda/CMakeLists.txt
+++ b/libethash-cuda/CMakeLists.txt
@@ -31,6 +31,8 @@ else()
set(
CUDA_NVCC_FLAGS
${CUDA_NVCC_FLAGS}
+ "-gencode arch=compute_35,code=sm_35"
+ "-gencode arch=compute_52,code=sm_52"
"-gencode arch=compute_61,code=sm_61"
"-gencode arch=compute_75,code=sm_75"
)
and re-running just the final make
command. As I understand, someone on CUDA older than 10.0 would also need to remove or comment out the line with sm_75
on it or the build would fail. Ideally, all of this would be auto-detected and wouldn't require manual edits, but meanwhile it'd be helpful to include this in the proposed build instructions as well.
Until such instructions are added, perhaps keep this issue open so that at least what's included in this comment is easy to find by those who need the instructions.
git clone https://github.com/ifdefelse/ProgPOW
cd ProgPOW
git submodule update --init --recursive
mkdir build
cd build
cmake -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0 .. -DETHASHCUDA=ON
libethash-cuda/CMakeLists.txt:
# A custom command and target to turn the CUDA kernel into a byte array header
# The normal build depends on it properly and if the kernel file is changed, then
# a rebuild of libethash-cuda should be triggered
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/CUDAMiner_kernel.h
COMMAND ${CMAKE_COMMAND} ARGS
-DBIN2H_SOURCE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/CUDAMiner_kernel.cu"
-DBIN2H_VARIABLE_NAME=CUDAMiner_kernel
-DBIN2H_HEADER_FILE="${CMAKE_CURRENT_BINARY_DIR}/CUDAMiner_kernel.h"
-P "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/bin2h.cmake"
COMMENT "Generating CUDA Kernel Byte Array"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CUDAMiner_kernel.cu
)
add_custom_target(cuda_kernel DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/CUDAMiner_kernel.h ${CMAKE_CURRENT_SOURCE_DIR}/CUDAMiner_kernel.cu)
find_package(CUDA REQUIRED)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--ptxas-options=-v;-lineinfo)
if (NOT MSVC)
list(APPEND CUDA_NVCC_FLAGS "--disable-warnings")
endif()
list(APPEND CUDA_NVCC_FLAGS_RELEASE -O3)
list(APPEND CUDA_NVCC_FLAGS_DEBUG -G)
if(COMPUTE AND (COMPUTE GREATER 0))
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_${COMPUTE},code=sm_${COMPUTE}")
else()
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_35,code=sm_35")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_50,code=sm_50")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_52,code=sm_52")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_53,code=sm_53")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_60,code=sm_60")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_61,code=sm_61")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_62,code=sm_62")
if(NOT CUDA_VERSION VERSION_LESS 9.0)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_70,code=sm_70")
endif()
if(NOT CUDA_VERSION VERSION_LESS 10.0)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_75,code=sm_75")
endif()
endif()
file(GLOB sources CUDAMiner.cpp CUDAMiner_cuda.cu)
file(GLOB headers CUDAMiner.h CUDAMiner_cuda.h ${CMAKE_CURRENT_BINARY_DIR}/CUDAMiner_kernel.h)
# Cmake doesn't handle nvrtc automatically
find_library(CUDA_nvrtc_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64")
find_library(CUDA_cuda_LIBRARY cuda "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64")
CUDA_ADD_LIBRARY(ethash-cuda STATIC ${sources} ${headers})
add_dependencies(ethash-cuda cuda_kernel)
target_link_libraries(ethash-cuda ethcore ethash progpow)
target_link_libraries(ethash-cuda ${CUDA_nvrtc_LIBRARY} ${CUDA_cuda_LIBRARY})
target_include_directories(ethash-cuda PRIVATE .. ${CMAKE_CURRENT_BINARY_DIR})
To build with Cuda-10.0 toolkit. For 9.2, use:
cmake -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2 .. -DETHASHCUDA=ON
for me cuda is found but it still throws this error
-- Found CUDA: /usr/local/cuda-9.0 (found version "9.0")
-- [hunter] OPENSSL_ROOT: /root/.hunter/_Base/2f04d1b/b4bd535/1bc9ed8/Install (ver.: 1.1.0h)
-- [hunter] Cache HIT: OpenSSL
-- [hunter] Cache info: /root/.hunter/_Base/Cache/meta/b4bd535/OpenSSL/1.1.0h/2168c88/da39a3e/d41f56c/91032ad/da39a3e/cache.sha1
-- Found OpenSSL: /root/.hunter/_Base/2f04d1b/b4bd535/1bc9ed8/Install/lib/libssl.a;/root/.hunter/_Base/2f04d1b/b4bd535/1bc9ed8/Install/lib/libcrypto.a;dl (found version "1.1.0h")
-- [hunter] OPENCL_ROOT: /root/.hunter/_Base/2f04d1b/b4bd535/1bc9ed8/Install (ver.: 2.1-p3)
-- [hunter] Cache HIT: OpenCL
-- [hunter] Cache info: /root/.hunter/_Base/Cache/meta/b4bd535/OpenCL/2.1-p3/be6a6c5/894a80c/d41f56c/da39a3e/da39a3e/cache.sha1
-- Configuring incomplete, errors occurred!
See also "/ProgPOW/build/CMakeFiles/CMakeOutput.log".
See also "/ProgPOW/build/CMakeFiles/CMakeError.log".
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cuda_LIBRARY
linked by target "ethash-cuda" in directory /ProgPOW/libethash-cuda
all build related issues already has been fixed(or known)
-
reference based, (manually) rebased + build fixes + misc fixes with the ethminer master version by me https://github.com/hackmod/ethminer/tree/v0.9.2-progpow-20190202 and it's binaries https://github.com/hackmod/ethminer/releases (outdated)
-
ProgPoW + ethash integration by @AndreaLanfranchi https://github.com/AndreaLanfranchi/ethminer + build fixs + merged with the ethminer master. https://github.com/EthersocialNetwork/ethminer/tree/v0.9.2-progpow-merge-0204 and it's binaries https://github.com/EthersocialNetwork/ethminer/releases (all binaries are built with travis/appveyor)
-
and the Progminer fork - https://github.com/gangnamtestnet/progminer
Here is a docker environment that can build many open source miners on ubuntu 16 with cuda 10. https://github.com/cynixx3/docker-ethos-open-source-miner-builder There are many ways to build it but just uncommenting the ethminer lines in Dockerfile and running docker build -t miner . && docker run -v $(pwd):/host -it miner
will get it compiled and extracted in the directory you ran the command in.
Or you can extrapolate the packages from the first part of the Dockerfile to suit your needs.
@Perfect-Web
CUDA_cuda_LIBRARY
is the error for
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Somewhere you are adding and extra 'cuda' to library path.
Thanks for the pointers everyone. This repository is only intended for initial research and development. With the spec in a settled state there are a handful of nearly-production-ready repositories as hackmod has pointed out. I would suggest most people make use of those.