Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cryptonight_r #2268

Merged
merged 6 commits into from
Mar 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install:
- curl -sL https://github.com/fireice-uk/xmr-stak-dep/releases/download/v1/xmr-stak-dep.zip -o xmr-stak-dep.zip
- 7z x xmr-stak-dep.zip -o"c:\xmr-stak-dep" -y > nul
- appveyor DownloadFile https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_windows-exe -FileName cuda_8.0.44_windows.exe
- cuda_8.0.44_windows.exe -s compiler_8.0 cudart_8.0
- cuda_8.0.44_windows.exe -s compiler_8.0 cudart_8.0 nvrtc_8.0 nvrtc_dev_8.0
- set PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;%PATH%
- nvcc -V

Expand Down
53 changes: 43 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,42 @@ if(CUDA_ENABLE)
find_package(CUDA 7.5)

if(CUDA_FOUND)
# required for monero's cryptonight_r
# libcuda
find_library(CUDA_LIB
NAMES
libcuda
cuda
cuda.lib
HINTS
${CUDA_TOOLKIT_ROOT_DIR}
${LIBCUDA_LIBRARY_DIR}
${CUDA_TOOLKIT_ROOT_DIR}
/usr
/usr/local/cuda
PATH_SUFFIXES
lib64
lib/x64
lib/Win32
lib64/stubs)

#nvrtc
find_library(CUDA_NVRTC_LIB
NAMES
libnvrtc
nvrtc
nvrtc.lib
HINTS
${CUDA_TOOLKIT_ROOT_DIR}
${LIBNVRTC_LIBRARY_DIR}
${CUDA_TOOLKIT_ROOT_DIR}
/usr
/usr/local/cuda
PATH_SUFFIXES
lib64
lib/x64
lib/Win32)

list(APPEND BACKEND_TYPES "nvidia")
option(XMR-STAK_LARGEGRID "Support large CUDA block count > 128" ON)
if(XMR-STAK_LARGEGRID)
Expand Down Expand Up @@ -200,16 +236,11 @@ if(CUDA_ENABLE)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" "-D_MWAITXINTRIN_H_INCLUDED")
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND
(CUDA_VERSION VERSION_EQUAL 9.0 OR
CUDA_VERSION VERSION_EQUAL 9.1 OR
CUDA_VERSION VERSION_EQUAL 9.2 OR
CUDA_VERSION VERSION_EQUAL 10.0)
)
# workaround find_package(CUDA) is using the wrong path to the CXX host compiler
# overwrite the CUDA host compiler variable with the used CXX MSVC
set(CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH "Host side compiler used by NVCC" FORCE)
endif()
# workaround find_package(CUDA) is using the wrong path to the CXX host compiler
# overwrite the CUDA host compiler variable with the used CXX MSVC
# in linux where clang and gcc is installed it also helps to select the correct host compiler
set(CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH "Host side compiler used by NVCC" FORCE)

else()
message(FATAL_ERROR "selected CUDA compiler '${CUDA_COMPILER}' is not supported")
endif()
Expand Down Expand Up @@ -547,6 +578,8 @@ if(CUDA_FOUND)
${CUDASRCFILES}
)
endif()

set(CUDA_LIBRARIES ${CUDA_LIB} ${CUDA_NVRTC_LIB} ${CUDA_LIBRARIES})
target_link_libraries(xmrstak_cuda_backend ${CUDA_LIBRARIES})
target_link_libraries(xmrstak_cuda_backend xmr-stak-backend xmr-stak-asm)
endif()
Expand Down
Loading