Skip to content

Commit

Permalink
Merge pull request #78 from RavenCommunity/fdov-fixes
Browse files Browse the repository at this point in the history
Nvidia fixes and SHA3 overflow.
  • Loading branch information
traysi authored May 18, 2021
2 parents d46045e + 60d6a7e commit 4c7ac99
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version =1.2.3
current_version =1.2.4
commit = True
message = kawpowminer {new_version}

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ HunterGate(
)

project(kawpowminer)
set(PROJECT_VERSION 1.2.3)
set(PROJECT_VERSION 1.2.4)

cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Release RelWithDebInfo)

Expand Down
4 changes: 2 additions & 2 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-Wno-dev --warn-unused-vars -DDEVBUILD=ON -DCOMPUTE=61",
"cmakeCommandArgs": "-Wno-dev --warn-unused-vars -DDEVBUILD=ON -DCOMPUTE=86",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": []
}
]
}
}
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: nvidia/cuda:9.2-devel-ubuntu18.04
- image: nvidia/cuda:11-devel-ubuntu20.04
steps:
- run: apt-get update && apt-get install -qy git cmake mesa-common-dev libidn11-dev python3-requests python3-git

Expand Down
22 changes: 20 additions & 2 deletions libethash-cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,24 @@ endif()
list(APPEND CUDA_NVCC_FLAGS_RELEASE -O3)
list(APPEND CUDA_NVCC_FLAGS_DEBUG -G)

message("")
message("----------------------------------------------------------------------------")
message("-- Detected CUDA Version: ${CUDA_VERSION}")
if(COMPUTE)
message("-- Compute Version: ${COMPUTE}")
endif()
message("----------------------------------------------------------------------------")
message("")

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")
if(CUDA_VERSION VERSION_LESS 11.0)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_32,code=sm_32")
endif()
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_35,code=sm_35")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_37,code=sm_37")
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")
Expand All @@ -38,10 +51,15 @@ else()
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")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_72,code=sm_72")
endif()
if(NOT CUDA_VERSION VERSION_LESS 10.0)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_75,code=sm_75")
endif()
if(NOT CUDA_VERSION VERSION_LESS 11.0)
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_80,code=sm_80")
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_86,code=sm_86")
endif()
endif()

file(GLOB sources CUDAMiner.cpp CUDAMiner_cuda.cu)
Expand All @@ -55,4 +73,4 @@ find_library(CUDA_cuda_LIBRARY NAMES cuda PATHS ${CUDA_TOOLKIT_ROOT_DIR} PATH_SU
target_link_libraries(ethash-cuda ethcore ethash::ethash progpow Boost::thread)
target_link_libraries(ethash-cuda ${CUDA_nvrtc_LIBRARY} ${CUDA_cuda_LIBRARY})
target_include_directories(ethash-cuda PUBLIC ${CUDA_INCLUDE_DIRS})
target_include_directories(ethash-cuda PRIVATE .. ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(ethash-cuda PRIVATE .. ${CMAKE_CURRENT_BINARY_DIR})
11 changes: 10 additions & 1 deletion libethash-cuda/CUDAMiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,16 @@ bool CUDAMiner::initDevice()
try
{
CU_SAFE_CALL(cuDeviceGet(&m_device, m_deviceDescriptor.cuDeviceIndex));
CU_SAFE_CALL(cuDevicePrimaryCtxRelease(m_device));

try
{
CU_SAFE_CALL(cuDevicePrimaryCtxRelease(m_device));
}
catch(const cuda_runtime_error& ec)
{
cudalog << "Releasing a primary context that has not been previously retained will fail with CUDA_ERROR_INVALID_CONTEXT, this is normal";
// cudalog << " Error : " << ec.what();
}
CU_SAFE_CALL(cuDevicePrimaryCtxSetFlags(m_device, m_settings.schedule));
CU_SAFE_CALL(cuDevicePrimaryCtxRetain(&m_context, m_device));
CU_SAFE_CALL(cuCtxSetCurrent(m_context));
Expand Down

0 comments on commit 4c7ac99

Please sign in to comment.