Skip to content

Commit

Permalink
Merge pull request #1900 from fireice-uk/dev
Browse files Browse the repository at this point in the history
Version 2.5.0
  • Loading branch information
psychocrypt authored Oct 11, 2018
2 parents c5f0505 + 9fe30b2 commit 9012512
Show file tree
Hide file tree
Showing 65 changed files with 3,786 additions and 1,437 deletions.
46 changes: 40 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,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 @@ -186,7 +191,10 @@ if(CUDA_ENABLE)
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)
(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 @@ -435,6 +443,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
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
if(CMAKE_LINK_STATIC)
set(BUILD_SHARED_LIBRARIES OFF)
Expand All @@ -445,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 @@ -456,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 @@ -472,7 +506,7 @@ 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)
Expand All @@ -499,7 +533,7 @@ 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
Expand All @@ -512,7 +546,7 @@ if(OpenCL_FOUND)
${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
Expand All @@ -528,7 +562,7 @@ endif()
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
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###### fireice-uk's and psychocrypt's
# XMR-Stak - Cryptonight All-in-One Mining Software

XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NVIDIA gpus and can be used to mine the crypto currencys Monero, Aeon and many more Cryptonight coins.
XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NVIDIA GPUs and can be used to mine the crypto currencies Monero, Aeon and many more Cryptonight coins.

## HTML reports
<img src="https://gist.githubusercontent.com/fireice-uk/2da301131ac01695ff79539a27b81d68/raw/4c09cdeee86f94df2e9dd86b927e64aded6184f5/xmr-stak-cpu-hashrate.png" width="260"> <img src="https://gist.githubusercontent.com/fireice-uk/2da301131ac01695ff79539a27b81d68/raw/4c09cdeee86f94df2e9dd86b927e64aded6184f5/xmr-stak-cpu-results.png" width="260"> <img src="https://gist.githubusercontent.com/fireice-uk/2da301131ac01695ff79539a27b81d68/raw/4c09cdeee86f94df2e9dd86b927e64aded6184f5/xmr-stak-cpu-connection.png" width="260">
Expand All @@ -28,7 +28,7 @@ XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NV
- supports algorithm cryptonight for Monero (XMR) and cryptonight-light (AEON)
- easy to use
- guided start (no need to edit a config file for the first start)
- auto configuration for each backend
- auto-configuration for each backend
- open source software (GPLv3)
- TLS support
- [HTML statistics](doc/usage.md#html-and-json-api-report-configuraton)
Expand All @@ -45,10 +45,14 @@ Besides [Monero](https://getmonero.org), following coins can be mined using this
- [Haven](https://havenprotocol.com)
- [Intense](https://intensecoin.com)
- [Masari](https://getmasari.org)
- [Ryo](https://ryo-currency.com)
- [QRL](https://theqrl.org)
- **[Ryo](https://ryo-currency.com) - Upcoming xmr-stak-gui is sponsored by Ryo**
- [TurtleCoin](https://turtlecoin.lol)

If your prefered coin is not listed, you can chose one of the following algorithms:
Ryo currency is a way for us to implement the ideas that we were unable to in
Monero. See [here](https://github.com/fireice-uk/cryptonote-speedup-demo/) for details.

If your prefered coin is not listed, you can choose one of the following algorithms:

- 1MiB scratchpad memory
- cryptonight_lite
Expand All @@ -59,19 +63,20 @@ If your prefered coin is not listed, you can chose one of the following algorith
- cryptonight_masari
- cryptonight_v7
- cryptonight_v7_stellite
- cryptonight_v8
- 4MiB scratchpad memory
- cryptonight_haven
- cryptonight_heavy

Please note, this list is not complete, and is not an endorsement.
Please note, this list is not complete and is not an endorsement.

## Download

You can find the latest releases and precompiled binaries on GitHub under [Releases](https://github.com/fireice-uk/xmr-stak/releases).

## Default Developer Donation

By default the miner will donate 2% of the hashpower (2 minute in 100 minutes) to my pool. If you want to change that, edit [donate-level.hpp](xmrstak/donate-level.hpp) before you build the binaries.
By default, the miner will donate 2% of the hashpower (2 minutes in 100 minutes) to my pool. If you want to change that, edit [donate-level.hpp](xmrstak/donate-level.hpp) before you build the binaries.

If you want to donate directly to support further development, here is my wallet

Expand Down
41 changes: 28 additions & 13 deletions doc/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* [Virus Protection Alert](#virus-protection-alert)
* [Change Currency to Mine](#change-currency-to-mine)
* [How can I mine Monero](#how-can-i-mine-monero)
* [Why is Monero named monero7](#why-is-monero-named-monero7)
* [Which currency must be chosen if my fork coin is not listed](#which-currency-must-be-chosen-if-my-fork-coin-is-not-listed)
* [Internal compiler error: Killed (program cc1plus)](#internal-compiler-error)

## "Obtaining SeLockMemoryPrivilege failed."

Expand Down Expand Up @@ -44,20 +44,35 @@ Download and install this [runtime package](https://go.microsoft.com/fwlink/?Lin

## Error: MEMORY ALLOC FAILED: mmap failed

On Linux you will need to configure large page support and increase your ulimit -l.
On Linux you will need to configure large page support and increase your memlock limit (`ulimit -l`).

To set large page support, add the following lines to `/etc/sysctl.conf` (`/etc/sysctl.d/xmr-stak.conf` for [Arch Linux](https://www.archlinux.org/news/deprecation-of-etcsysctlconf/) and its derivatives):
Never put settings directly into `/etc/sysctl.conf` or `/etc/security/limits.conf` as those are system defaults and can be replaced in upgrades, and custom settings in that file are deprecated in all distros since at least wheezy/trusty (has been illegal in RedHat based distros for longer than that), and will be even more deprecated with systemd (it no longer even reads sysctl.conf, ONLY sysctl.d files, for example - there is a link to the old `/etc/sysctl.conf` for backward compatibility but that can go away at any time). Also adding to `/etc/rc.local` is extra incorrect, systemd does not even use that file anymore (once the sysvinit compatibility layer is gone, rc.local will no longer work).

To check current settings, run `/sbin/sysctl vm.nr_hugepages ; ulimit -l` as whatever user you will run `xmr-stak` as (example shows bad/low sample defaults):

$ /sbin/sysctl vm.nr_hugepages ; ulimit -l
vm.nr_hugepages = 0
16

To set large page support, add the following lines to `/etc/sysctl.d/60-hugepages.conf`:

vm.nr_hugepages=128

To increase the ulimit, add following lines to `/etc/security/limits.conf`:
You WILL need to run `sudo sysctl --system` for these settings to take effect on your system (or reboot). In some cases (many threads, very large CPU, etc) you may need more than 128 (try 256 if there are still complaints from thread inits)

* soft memlock 262144
* hard memlock 262144
To increase the memlock (ulimit -l), add following lines to `/etc/security/limits.d/60-memlock.conf`:

* - memlock 262144
root - memlock 262144

You WILL need to log out and log back in for these settings to take effect on your user (no need to reboot, just relogin in your session).
Recheck after completing these steps to validate:

$ /sbin/sysctl vm.nr_hugepages ; ulimit -l
vm.nr_hugepages = 128
262144

You can also do it Windows-style and simply run-as-root, but this is NOT recommended for security reasons.
You can also do it Windows-style and simply run-as-root, but this is NOT recommended for security reasons. Also running as root does not properly get around the `ulimit -l` being large enough (and limits `*` does not apply to `root` either, it must be specified explicitly).

## Illegal Instruction

Expand All @@ -72,18 +87,18 @@ If your antivirus software flags **xmr-stak**, it will likely move it to its qua

If the miner is compiled for Monero and Aeon than you can change
- the value `currency` in the config *or*
- start the miner with the [command line option](usage.md) `--currency monero7` or `--currency aeon7`
- start the miner with the [command line option](usage.md) `--currency monero` or `--currency aeon7`
- run `xmr-stak --help` to see all supported currencies and algorithms

## How can I mine Monero

Set the value `currency` in `pools.txt` to `monero7`.

## Why is Monero named monero7

To avoid configuration conflicts after the hard fork of Monero to the new POW with our old naming schema where all cryptonight currencies was selected by choosing `monero` as currency we decided to switch to the name `monero7`.
Set the value `currency` in `pools.txt` to `monero`.

## Which currency must be chosen if my fork coin is not listed

If your coin you want to mine is not listed please check the documentation of the coin and try to find out if `cryptonight` or `cryptonight-lite` is the used algorithm.
Select one of these generic coin algorithms.

## Internal compiler error

Seeing `g++: internal compiler error: Killed (program cc1plus)` is probably related to not enough RAM to compile. 1 Gb RAM should be enough (it is on clean Ubuntu 16.04).
4 changes: 3 additions & 1 deletion doc/compile_Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### AMD APP SDK 3.0 (only needed to use AMD GPUs)

- download and install the latest version from https://www.dropbox.com/sh/mpg882ekirnsfa7/AADWz5X-TgVdsmWt0QwMgTWLa/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2?dl=0
- download and install the latest version from http://debian.nullivex.com/amd/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2 (see https://github.com/fireice-uk/xmr-stak/issues/1511#issuecomment-385120692)
(do not wonder why it is a link to a dropbox but AMD has removed the SDK downloads, see https://community.amd.com/thread/228059)

### Cuda 8.0+ (only needed to use NVIDIA GPUs)
Expand Down Expand Up @@ -105,6 +105,8 @@ In that case you can force CUDA to use an older compiler in the following way:
cmake -DCUDA_HOST_COMPILER=/usr/bin/gcc-5 ..
```

- You need 1 Gb RAM to compile (a bit less might be enough, 512 Mb isn't).

### To do a generic and static build for a system without gcc 5.1+
```
cmake -DCMAKE_LINK_STATIC=ON -DXMR-STAK_COMPILE=generic .
Expand Down
4 changes: 2 additions & 2 deletions doc/compile_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

### AMD APP SDK 3.0 (only needed for AMD GPUs)

- Download and install the latest version from https://www.dropbox.com/s/gq8vqhelq0m6gj4/AMD-APP-SDKInstaller-v3.0.130.135-GA-windows-F-x64.exe
(do not wonder why it is a link to a dropbox but AMD has removed the SDK downloads, see https://community.amd.com/thread/222855)
- Download and install the latest version from http://amd-dev.wpengine.netdna-cdn.com/app-sdk/installers/APPSDKInstaller/3.0.130.135-GA/full/AMD-APP-SDKInstaller-v3.0.130.135-GA-windows-F-x64.exe
(do not wonder why it is a link to a netdna-cdn.com but AMD has removed the SDK downloads, see https://community.amd.com/thread/222855)

### Dependencies OpenSSL/Hwloc and Microhttpd
- For CUDA 8*:
Expand Down
39 changes: 33 additions & 6 deletions doc/tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [AMD Backend](#amd-backend)
* [Choose `intensity` and `worksize`](#choose-intensity-and-worksize)
* [Add more GPUs](#add-more-gpus)
* [Two Threads per GPU](two-threads-per-gpu)
* [disable comp_mode](#disable-comp_mode)
* [change the scratchpad memory pattern](change-the-scratchpad-memory-pattern)
* [Increase Memory Pool](#increase-memory-pool)
Expand Down Expand Up @@ -55,10 +56,10 @@ To add a new GPU you need to add a new config set to `gpu_threads_conf`.
"gpu_threads_conf" :
[
{ "index" : 0, "threads" : 17, "blocks" : 60, "bfactor" : 0, "bsleep" : 0,
"affine_to_cpu" : false, "sync_mode" : 3,
"affine_to_cpu" : false, "sync_mode" : 3, "mem_mode" : 1,
},
{ "index" : 1, "threads" : 17, "blocks" : 60, "bfactor" : 0, "bsleep" : 0,
"affine_to_cpu" : false, "sync_mode" : 3,
"affine_to_cpu" : false, "sync_mode" : 3, "mem_mode" : 1,
},
],
```
Expand All @@ -82,11 +83,37 @@ If you are unsure of either GPU or platform index value, you can use `clinfo` to
```
"gpu_threads_conf" :
[
{ "index" : 0, "intensity" : 1000, "worksize" : 8, "affine_to_cpu" : false,
"strided_index" : true, "mem_chunk" : 2, "comp_mode" : true
{
"index" : 0, "intensity" : 1000, "worksize" : 8, "affine_to_cpu" : false,
"strided_index" : true, "mem_chunk" : 2, "unroll" : 8, "comp_mode" : true
},
{ "index" : 1, "intensity" : 1000, "worksize" : 8, "affine_to_cpu" : false,
"strided_index" : true, "mem_chunk" : 2, "comp_mode" : true
{
"index" : 1, "intensity" : 1000, "worksize" : 8, "affine_to_cpu" : false,
"strided_index" : true, "mem_chunk" : 2, "unroll" : 8, "comp_mode" : true
},
],
"platform_index" : 0,
```

### Two Threads per GPU

Some GPUs like AMD Vega can mine faster if two threads are using the same GPU.
Use the auto generated config as base and repeat the config entry for a GPU.
If the attribute `index` is used twice than two threads will use one GPU.
Take care that the required memory usage on the GPU will also double.
Therefore adjust your intensity by hand.

```
"gpu_threads_conf" :
[
{
"index" : 0, "intensity" : 768, "worksize" : 8, "affine_to_cpu" : false,
"strided_index" : true, "mem_chunk" : 2, "unroll" : 8, "comp_mode" : true
},
{
"index" : 0, "intensity" : 768, "worksize" : 8, "affine_to_cpu" : false,
"strided_index" : true, "mem_chunk" : 2, "unroll" : 8, "comp_mode" : true
},
],
Expand Down
28 changes: 28 additions & 0 deletions doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [Usage on Windows](#usage-on-windows)
* [Usage on Linux](#usage-on-linux)
* [Command Line Options](#command-line-options)
* [Use different backends](#use-different-backends)
* [HTML and JSON API report configuraton](#html-and-json-api-report-configuraton)

## Configurations
Expand Down Expand Up @@ -34,6 +35,33 @@ Note: If the pool is ignoring the option `rig_id` in `pools.txt` to name your wo
The miner allow to overwrite some of the settings via command line options.
Run `xmr-stak --help` to show all available command line options.

## Use Different Backends

On linux and OSX please add `./` before the binary name `xmr-stak`.

### CPU Only:
```
xmr-stak --noAMD --noNVIDIA
```

### NVIDIA/AMD Only:

The miner will automatically detect if CUDA (for NVIDIA GPUs) or OpenCL (for AMD GPUs) is available.

```
xmr-stak --noCPU
```
**CUDA** is currently not supported. I am currently try to get some performance out it.

### NVIDIA via OpenCL

It is possible to use the OpenCl backend which is originally created for AMD GPUs with NVIDIA GPus.
Some NVIDIA GPUs can reach better performance with this backend.

```
xmr-stak --openCLVendor NVIDIA --noNVIDIA
```

## Docker image usage

You can run the Docker image the following way:
Expand Down
Loading

0 comments on commit 9012512

Please sign in to comment.