Skip to content

Commit

Permalink
Upgrade to 2.5.1-hide-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rapid821 committed Oct 19, 2018
1 parent c4400d1 commit d55fa27
Show file tree
Hide file tree
Showing 154 changed files with 8,331 additions and 2,796 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ config-debug.txt
# KDevelop files
.kdev4/
xmr-stak.kdev4

# Idea/Clion project files
cmake-build-release/
cmake-build-debug/
\.idea/

# MacOS files
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*
19 changes: 17 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ matrix:
- CMAKE_C_COMPILER=gcc-6
- XMRSTAK_CMAKE_FLAGS="-DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF"

# test with disabled HWLOC, MICROHTTPD, OpenSSL and no accelerators
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *default_packages
- gcc-6
- g++-6
env:
- CMAKE_CXX_COMPILER=g++-6
- CMAKE_C_COMPILER=gcc-6
- XMRSTAK_CMAKE_FLAGS="-DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DHWLOC_ENABLE=OFF -DOpenSSL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF"

- os: linux
compiler: gcc
addons:
Expand All @@ -77,9 +93,8 @@ matrix:

before_install:
- . CI/checkPRBranch
- if [ $TRAVIS_OS_NAME = osx ]; then
- if [ $TRAVIS_OS_NAME = osx ] ; then
brew update;
brew tap homebrew/science;
fi
- export PATH=$CUDA_ROOT/bin:$PATH

Expand Down
114 changes: 73 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(xmr-stak)

cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.4.0)

# enforce C++11
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -36,10 +36,6 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${BUILD_TYPE}")

set(XMR-STAK_CURRENCY "all" CACHE STRING "select miner currency")
set_property(CACHE XMR-STAK_CURRENCY PROPERTY STRINGS "all;monero;aeon")


set(XMR-STAK_COMPILE "native" CACHE STRING "select CPU compute architecture")
set_property(CACHE XMR-STAK_COMPILE PROPERTY STRINGS "native;generic")
if(XMR-STAK_COMPILE STREQUAL "native")
Expand All @@ -53,16 +49,6 @@ else()
message(FATAL_ERROR "XMR-STAK_COMPILE is set to an unknown value '${XMR-STAK_COMPILE}'")
endif()

if(XMR-STAK_CURRENCY STREQUAL "all")
message(STATUS "Set miner currency to 'monero' and 'aeon'")
elseif(XMR-STAK_CURRENCY STREQUAL "aeon")
message(STATUS "Set miner currency to 'aeon'")
add_definitions("-DCONF_NO_MONERO=1")
elseif(XMR-STAK_CURRENCY STREQUAL "monero")
message(STATUS "Set miner currency to 'monero'")
add_definitions("-DCONF_NO_AEON=1")
endif()

# option to add static libgcc and libstdc++
option(CMAKE_LINK_STATIC "link as much as possible libraries static" OFF)

Expand Down Expand Up @@ -114,6 +100,11 @@ if(CUDA_ENABLE)
list(APPEND DEFAULT_CUDA_ARCH "70")
endif()
endif()
# add Turing support for CUDA >= 10.0
if(NOT CUDA_VERSION VERSION_LESS 10.0)
list(APPEND DEFAULT_CUDA_ARCH "75")
endif()

set(CUDA_ARCH "${DEFAULT_CUDA_ARCH}" CACHE STRING "Set GPU architecture (semicolon separated list, e.g. '-DCUDA_ARCH=20;35;60')")

# generate comma separated list with architectures
Expand Down Expand Up @@ -155,13 +146,17 @@ if(CUDA_ENABLE)
# set flags to create device code for the given architectures
set(CLANG_BUILD_FLAGS "${CLANG_BUILD_FLAGS} --cuda-gpu-arch=sm_${CUDA_ARCH_ELEM}")
endforeach()

elseif(CUDA_COMPILER STREQUAL "nvcc")
# add c++11 for cuda
if(NOT CMAKE_CXX_FLAGS MATCHES "-std=c\\+\\+11")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11")
endif()

# avoid that nvcc in CUDA 8 complains about sm_20 pending removal
if(CUDA_VERSION VERSION_EQUAL 8.0)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Wno-deprecated-gpu-targets")
endif()

# avoid that nvcc in CUDA < 8 tries to use libc `memcpy` within the kernel
if(CUDA_VERSION VERSION_LESS 8.0)
add_definitions(-D_FORCE_INLINES)
Expand Down Expand Up @@ -189,14 +184,17 @@ if(CUDA_ENABLE)
if(CUDA_KEEP_FILES)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --keep --keep-dir "${PROJECT_BINARY_DIR}")
endif(CUDA_KEEP_FILES)

if(CUDA_VERSION VERSION_LESS 8.0)
# for CUDA 7.5 fix compile error: https://github.com/fireice-uk/xmr-stak/issues/34
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)
(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
Expand Down Expand Up @@ -241,7 +239,7 @@ if(OpenCL_ENABLE)
"AMD APP/include")

find_library(OpenCL_LIBRARY
NAMES
NAMES
OpenCL
OpenCL.lib
NO_DEFAULT_PATH
Expand Down Expand Up @@ -293,7 +291,7 @@ endif()
# Find microhttpd
################################################################################

option(MICROHTTPD_ENABLE "Enable or disable the requirement of microhttp (http deamon)" ON)
option(MICROHTTPD_ENABLE "Enable or disable the requirement of microhttp (http daemon)" ON)
if(MICROHTTPD_ENABLE)
find_path(MTHD_INCLUDE_DIR
NAMES
Expand All @@ -316,7 +314,7 @@ if(MICROHTTPD_ENABLE)
PATH_SUFFIXES
lib)
if(MHTD STREQUAL "MHTD-NOTFOUND")
message(FATAL_ERROR "microhttpd NOT found: use `-DMICROHTTPD_ENABLE=OFF` to build without http deamon support")
message(FATAL_ERROR "microhttpd NOT found: use `-DMICROHTTPD_ENABLE=OFF` to build without http daemon support")
else()
set(LIBS ${LIBS} ${MHTD})
include_directories(AFTER ${MTHD_INCLUDE_DIR})
Expand Down Expand Up @@ -408,10 +406,10 @@ execute_process(
)

if(NOT GIT_COMMIT_HASH STREQUAL "")
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
endif()
if(NOT GIT_BRANCH STREQUAL "")
add_definitions("-DGIT_BRANCH=${GIT_BRANCH}")
add_definitions("-DGIT_BRANCH=${GIT_BRANCH}")
endif()

# generate backend string
Expand All @@ -435,7 +433,19 @@ else()
# activate sse2 and aes-ni
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -maes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -maes")
endif()

# add -Wall for debug builds with gcc
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()
endif()

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "-Wl,-z,noexecstack ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "-Wl,-z,noexecstack ${CMAKE_C_FLAGS}")
endif()

# activate static libgcc and libstdc++ linking
Expand All @@ -448,6 +458,27 @@ if(CMAKE_LINK_STATIC)
endif()
endif()

if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
# asm optimized monero v8 code
enable_language(ASM_MASM)
set_property(SOURCE "xmrstak/backend/cpu/crypto/asm/cryptonight_v8_main_loop.asm" PROPERTY ASM_MASM)
add_library(xmr-stak-asm
STATIC
"xmrstak/backend/cpu/crypto/asm/cryptonight_v8_main_loop.asm"
)
else()
# asm optimized monero v8 code
enable_language(ASM)
set_property(SOURCE "xmrstak/backend/cpu/crypto/asm/cryptonight_v8_main_loop.S" PROPERTY CPP)
set_source_files_properties("xmrstak/backend/cpu/crypto/asm/cryptonight_v8_main_loop.S" PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
add_library(xmr-stak-asm
STATIC
"xmrstak/backend/cpu/crypto/asm/cryptonight_v8_main_loop.S"
)
endif()

set_property(TARGET xmr-stak-asm PROPERTY LINKER_LANGUAGE C)

# compile C files
file(GLOB SRCFILES_C "xmrstak/backend/cpu/crypto/*.c")

Expand All @@ -459,7 +490,7 @@ set_property(TARGET xmr-stak-c PROPERTY C_STANDARD 99)
if(MICROHTTPD_ENABLE)
target_link_libraries(xmr-stak-c ${MHTD})
endif()
target_link_libraries(xmr-stak-c ${LIBS})
target_link_libraries(xmr-stak-c ${LIBS} xmr-stak-asm)

# compile generic backend files
file(GLOB BACKEND_CPP
Expand All @@ -475,11 +506,11 @@ add_library(xmr-stak-backend
STATIC
${BACKEND_CPP}
)
target_link_libraries(xmr-stak-backend xmr-stak-c ${CMAKE_DL_LIBS})
target_link_libraries(xmr-stak-backend xmr-stak-c ${CMAKE_DL_LIBS} xmr-stak-asm)

# compile CUDA backend
if(CUDA_FOUND)
file(GLOB CUDASRCFILES
file(GLOB CUDASRCFILES
"xmrstak/backend/nvidia/nvcc_code/*.cu"
"xmrstak/backend/nvidia/*.cpp")

Expand All @@ -502,60 +533,61 @@ if(CUDA_FOUND)
)
endif()
target_link_libraries(xmrstak_cuda_backend ${CUDA_LIBRARIES})
target_link_libraries(xmrstak_cuda_backend xmr-stak-backend)
target_link_libraries(xmrstak_cuda_backend xmr-stak-backend xmr-stak-asm)
endif()

# compile AMD backend
if(OpenCL_FOUND)
file(GLOB OPENCLSRCFILES
file(GLOB OPENCLSRCFILES
"xmrstak/backend/amd/amd_gpu/*.cpp"
"xmrstak/backend/amd/*.cpp")
add_library(xmrstak_opencl_backend
SHARED
${OPENCLSRCFILES}
)
target_link_libraries(xmrstak_opencl_backend ${OpenCL_LIBRARY} )
target_link_libraries(xmrstak_opencl_backend xmr-stak-backend)
target_link_libraries(xmrstak_opencl_backend xmr-stak-backend xmr-stak-asm)
endif()

# compile final binary
file(GLOB SRCFILES_CPP "xmrstak/cli/*.cpp")
set_source_files_properties(${SRCFILES_CPP} PROPERTIES LANGUAGE CXX)

add_executable(xmr-stak
${SRCFILES_CPP}
)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_executable(xmr-stak ${SRCFILES_CPP} xmrstak/cli/xmr-stak.manifest)
else()
add_executable(xmr-stak ${SRCFILES_CPP})
endif()

set(EXECUTABLE_OUTPUT_PATH "bin")
set(LIBRARY_OUTPUT_PATH "bin")
set(EXECUTABLE_OUTPUT_PATH "bin" CACHE STRING "Path to place executables relative to ${CMAKE_INSTALL_PREFIX}")
set(LIBRARY_OUTPUT_PATH "bin" CACHE STRING "Path to place libraries relative to ${CMAKE_INSTALL_PREFIX}")

target_link_libraries(xmr-stak ${LIBS} xmr-stak-c xmr-stak-backend)
target_link_libraries(xmr-stak ${LIBS} xmr-stak-c xmr-stak-backend xmr-stak-asm)

################################################################################
# Install
################################################################################


# do not install the binary if the project and install are equal
if( NOT CMAKE_INSTALL_PREFIX STREQUAL PROJECT_BINARY_DIR )
install(TARGETS xmr-stak
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/${EXECUTABLE_OUTPUT_PATH}")
if(CUDA_FOUND)
if(WIN32)
install(TARGETS xmrstak_cuda_backend
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIBRARY_OUTPUT_PATH}")
else()
install(TARGETS xmrstak_cuda_backend
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIBRARY_OUTPUT_PATH}")
endif()
endif()
if(OpenCL_FOUND)
if(WIN32)
install(TARGETS xmrstak_opencl_backend
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIBRARY_OUTPUT_PATH}")
else()
install(TARGETS xmrstak_opencl_backend
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIBRARY_OUTPUT_PATH}")
endif()
endif()
else()
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ ENV XMRSTAK_CMAKE_FLAGS -DXMR-STAK_COMPILE=generic -DCUDA_ENABLE=ON -DOpenCL_ENA
# Innstall packages
RUN apt-get update \
&& set -x \
&& apt-get install -qq --no-install-recommends -y ca-certificates cmake cuda-core-9-0 git cuda-cudart-dev-9-0 libhwloc-dev libmicrohttpd-dev libssl-dev \
&& apt-get install -qq --no-install-recommends -y build-essential ca-certificates cmake cuda-core-9-0 git cuda-cudart-dev-9-0 libhwloc-dev libmicrohttpd-dev libssl-dev \
&& git clone $GIT_REPOSITORY \
&& cd /xmr-stak \
&& cmake ${XMRSTAK_CMAKE_FLAGS} . \
&& make \
&& cd - \
&& mv /xmr-stak/bin/* /usr/local/bin/ \
&& rm -rf /xmr-stak \
&& apt-get purge -y -qq cmake cuda-core-9-0 git cuda-cudart-dev-9-0 libhwloc-dev libmicrohttpd-dev libssl-dev \
&& apt-get purge -y -qq build-essential cmake cuda-core-9-0 git cuda-cudart-dev-9-0 libhwloc-dev libmicrohttpd-dev libssl-dev \
&& apt-get clean -qq

VOLUME /mnt
Expand Down
Loading

0 comments on commit d55fa27

Please sign in to comment.