Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xmrig committed Oct 18, 2020
2 parents 43dca99 + e3cbb61 commit 129e3c7
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 225 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v6.4.0
- [#70](https://github.com/xmrig/xmrig-cuda/pull/70) RandomX: removed `rx/loki` algorithm.

# v6.3.2
- [#65](https://github.com/xmrig/xmrig-cuda/pull/65) Fixed broken AstroBWT.

Expand Down
17 changes: 6 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
project(xmrig-cuda)


option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
option(WITH_DRIVER_API "Enable CUDA Driver API and NVRTC, required for cn/r and kawpow algorithms" ON)


include_directories(src)
Expand All @@ -16,28 +16,23 @@ include(cmake/CUDA.cmake)

set(SOURCES
src/crypto/cn/c_blake256.c
src/crypto/common/Algorithm.h
src/crypto/common/Algorithm.cpp
src/CudaCryptonightR_gen.cpp
src/crypto/common/Algorithm.h
src/version.h
src/xmrig-cuda.cpp
src/xmrig-cuda.h
)


if (WIN32)
set(SOURCES_OS
res/app.rc
)
else()
set(SOURCES_OS "")
if (WITH_DRIVER_API)
list(APPEND SOURCES src/CudaCryptonightR_gen.cpp)
endif()


add_library(${CMAKE_PROJECT_NAME} SHARED ${SOURCES} ${SOURCES_OS})
add_library(${CMAKE_PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${CMAKE_PROJECT_NAME} xmrig-cu ${LIBS})

if (WIN32)
if (WITH_DRIVER_API AND WIN32)
file(GLOB NVRTCDLL "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvrtc64*.dll")
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NVRTCDLL}" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
Expand Down
80 changes: 44 additions & 36 deletions cmake/CUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ list(APPEND CMAKE_PREFIX_PATH "$ENV{CUDA_ROOT}")
list(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")

set(CUDA_STATIC ON)
find_package(CUDA 8.0 REQUIRED)
find_package(CUDA 9.0 REQUIRED)

find_library(CUDA_LIB libcuda cuda HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBCUDA_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64)
find_library(CUDA_NVRTC_LIB libnvrtc nvrtc HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBNVRTC_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64)
if (WITH_DRIVER_API)
find_library(CUDA_LIB libcuda cuda HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBCUDA_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64)
find_library(CUDA_NVRTC_LIB libnvrtc nvrtc HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBNVRTC_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64)

set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_LIB} ${CUDA_NVRTC_LIB})
set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_LIB} ${CUDA_NVRTC_LIB})

add_definitions(-DXMRIG_DRIVER_API)
else()
set(LIBS ${LIBS} ${CUDA_LIBRARIES})

remove_definitions(-DXMRIG_DRIVER_API)
endif()

set(DEFAULT_CUDA_ARCH "50")

Expand Down Expand Up @@ -64,6 +72,7 @@ foreach(CUDA_ARCH_ELEM ${CUDA_ARCH})
"Use '20' (for compute architecture 2.0) or higher.")
endif()
endforeach()

list(SORT CUDA_ARCH)

option(CUDA_SHOW_REGISTER "Show registers used for each kernel and compute architecture" OFF)
Expand Down Expand Up @@ -102,8 +111,7 @@ elseif("${CUDA_COMPILER}" STREQUAL "nvcc")
if("${CUDA_ARCH_ELEM}" STREQUAL "21")
# "2.1" actually does run faster when compiled as itself, versus in "2.0" compatible mode
# strange virtual code type on top of compute_20, with no compute_21 (so the normal rule fails)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
"--generate-code arch=compute_20,code=sm_21")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--generate-code arch=compute_20,code=sm_21")
else()
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
"--generate-code arch=compute_${CUDA_ARCH_ELEM},code=sm_${CUDA_ARCH_ELEM} --generate-code arch=compute_${CUDA_ARCH_ELEM},code=compute_${CUDA_ARCH_ELEM}")
Expand All @@ -119,21 +127,36 @@ elseif("${CUDA_COMPILER}" STREQUAL "nvcc")
if (CUDA_SHOW_CODELINES)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --source-in-ptx -lineinfo)
set(CUDA_KEEP_FILES ON CACHE BOOL "activate keep files" FORCE)
endif(CUDA_SHOW_CODELINES)
endif()

if (CUDA_SHOW_REGISTER)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -Xptxas=-v)
endif(CUDA_SHOW_REGISTER)
endif()

if (CUDA_KEEP_FILES)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --keep --keep-dir "${PROJECT_BINARY_DIR}")
endif(CUDA_KEEP_FILES)
endif()

else()
message(FATAL_ERROR "selected CUDA compiler '${CUDA_COMPILER}' is not supported")
endif()

set(CUDA_RANDOMX_SOURCES
set(CUDA_SOURCES
src/cryptonight.h
src/cuda_aes.hpp
src/cuda_blake.hpp
src/cuda_core.cu
src/cuda_device.hpp
src/cuda_extra.cu
src/cuda_extra.h
src/cuda_fast_int_math_v2.hpp
src/cuda_groestl.hpp
src/cuda_jh.hpp
src/cuda_keccak.hpp
src/cuda_skein.hpp
)

list(APPEND CUDA_SOURCES
src/RandomX/aes_cuda.hpp
src/RandomX/arqma/configuration.h
src/RandomX/arqma/randomx_arqma.cu
Expand All @@ -142,8 +165,6 @@ set(CUDA_RANDOMX_SOURCES
src/RandomX/hash.hpp
src/RandomX/keva/configuration.h
src/RandomX/keva/randomx_keva.cu
src/RandomX/loki/configuration.h
src/RandomX/loki/randomx_loki.cu
src/RandomX/monero/configuration.h
src/RandomX/monero/randomx_monero.cu
src/RandomX/randomx_cuda.hpp
Expand All @@ -152,40 +173,27 @@ set(CUDA_RANDOMX_SOURCES
src/RandomX/wownero/randomx_wownero.cu
)

set(CUDA_ASTROBWT_SOURCES
list(APPEND CUDA_SOURCES
src/AstroBWT/dero/AstroBWT.cu
src/AstroBWT/dero/BWT.h
src/AstroBWT/dero/salsa20.h
src/AstroBWT/dero/sha3.h
)

set(CUDA_KAWPOW_SOURCES
src/KawPow/raven/KawPow.cu
src/KawPow/raven/CudaKawPow_gen.cpp
src/KawPow/raven/CudaKawPow_gen.h
)

set(CUDA_SOURCES
src/cryptonight.h
src/cuda_aes.hpp
src/cuda_blake.hpp
src/cuda_core.cu
src/cuda_device.hpp
src/cuda_extra.cu
src/cuda_extra.h
src/cuda_fast_int_math_v2.hpp
src/cuda_groestl.hpp
src/cuda_jh.hpp
src/cuda_keccak.hpp
src/cuda_skein.hpp
)
if (WITH_DRIVER_API)
list(APPEND CUDA_SOURCES
src/KawPow/raven/CudaKawPow_gen.cpp
src/KawPow/raven/CudaKawPow_gen.h
src/KawPow/raven/KawPow.cu
)
endif()

if("${CUDA_COMPILER}" STREQUAL "clang")
add_library(xmrig-cu STATIC ${CUDA_SOURCES} ${CUDA_RANDOMX_SOURCES} ${CUDA_ASTROBWT_SOURCES} ${CUDA_KAWPOW_SOURCES})
add_library(xmrig-cu STATIC ${CUDA_SOURCES})

set_target_properties(xmrig-cu PROPERTIES COMPILE_FLAGS ${CLANG_BUILD_FLAGS})
set_target_properties(xmrig-cu PROPERTIES LINKER_LANGUAGE CXX)
set_source_files_properties(${CUDA_SOURCES} ${CUDA_RANDOMX_SOURCES} PROPERTIES LANGUAGE CXX)
set_source_files_properties(${CUDA_SOURCES} PROPERTIES LANGUAGE CXX)
else()
cuda_add_library(xmrig-cu STATIC ${CUDA_SOURCES} ${CUDA_RANDOMX_SOURCES} ${CUDA_ASTROBWT_SOURCES} ${CUDA_KAWPOW_SOURCES})
cuda_add_library(xmrig-cu STATIC ${CUDA_SOURCES})
endif()
125 changes: 0 additions & 125 deletions src/RandomX/loki/configuration.h

This file was deleted.

33 changes: 0 additions & 33 deletions src/RandomX/loki/randomx_loki.cu

This file was deleted.

5 changes: 3 additions & 2 deletions src/crypto/common/Algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,12 @@ struct AlgoName
static AlgoName const algorithm_names[] = {
{ "rx/0", Algorithm::RX_0 },
{ "rx/wow", Algorithm::RX_WOW },
{ "rx/loki", Algorithm::RX_LOKI },
{ "rx/arq", Algorithm::RX_ARQ },
{ "rx/sfx", Algorithm::RX_SFX },
{ "rx/keva", Algorithm::RX_KEVA },
{ "cn/0", Algorithm::CN_0 },
{ "cn/1", Algorithm::CN_1 },
{ "cn/2", Algorithm::CN_2 },
{ "cn/r", Algorithm::CN_R },
{ "cn/fast", Algorithm::CN_FAST },
{ "cn/half", Algorithm::CN_HALF },
{ "cn/xao", Algorithm::CN_XAO },
Expand All @@ -76,7 +74,10 @@ static AlgoName const algorithm_names[] = {
{ "cn-pico/tlo", Algorithm::CN_PICO_TLO },
{ "cn/ccx", Algorithm::CN_CCX },
{ "astrobwt", Algorithm::ASTROBWT_DERO },
# ifdef XMRIG_DRIVER_API
{ "kawpow", Algorithm::KAWPOW_RVN },
{ "cn/r", Algorithm::CN_R },
# endif
};


Expand Down
Loading

0 comments on commit 129e3c7

Please sign in to comment.