diff --git a/.travis.yml b/.travis.yml
index 099d9ee73..59b8635e3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,3 @@
-dist: trusty
-
-osx_image: xcode8.3
-
sudo: false
language: cpp
@@ -25,22 +21,24 @@ env:
matrix:
include:
-# - os: linux
-# compiler: gcc
-# addons:
-# apt:
-# sources:
-# - ubuntu-toolchain-r-test
-# packages:
-# - *default_packages
-# - gcc-5
-# - g++-5
-# env:
-# - CMAKE_CXX_COMPILER=g++-5
-# - CMAKE_C_COMPILER=gcc-5
-# - XMRSTAK_CMAKE_FLAGS="-DCUDA_ARCH=30 -DOpenCL_ENABLE=OFF"
-#
- os: linux
+ dist: bionic
+ compiler: gcc
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - *default_packages
+ - gcc-5
+ - g++-5
+ env:
+ - CMAKE_CXX_COMPILER=g++-5
+ - CMAKE_C_COMPILER=gcc-5
+ - XMRSTAK_CMAKE_FLAGS="-DCUDA_ARCH=30 -DOpenCL_ENABLE=OFF"
+
+ - os: linux
+ dist: bionic
compiler: gcc
addons:
apt:
@@ -57,6 +55,7 @@ matrix:
# test with disabled HWLOC, MICROHTTPD, OpenSSL and no accelerators
- os: linux
+ dist: bionic
compiler: gcc
addons:
apt:
@@ -72,6 +71,7 @@ matrix:
- XMRSTAK_CMAKE_FLAGS="-DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DHWLOC_ENABLE=OFF -DOpenSSL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF"
- os: linux
+ dist: bionic
compiler: gcc
addons:
apt:
@@ -85,8 +85,25 @@ matrix:
- CMAKE_CXX_COMPILER=g++-7
- CMAKE_C_COMPILER=gcc-7
- XMRSTAK_CMAKE_FLAGS="-DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF"
+
+ - os: linux
+ dist: bionic
+ compiler: gcc
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - *default_packages
+ - gcc-8
+ - g++-8
+ env:
+ - CMAKE_CXX_COMPILER=g++-8
+ - CMAKE_C_COMPILER=gcc-8
+ - XMRSTAK_CMAKE_FLAGS="-DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF"
- os: osx
+ osx_image: xcode8.3
compiler: gcc
env:
- XMRSTAK_CMAKE_FLAGS="-DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF"
@@ -109,7 +126,7 @@ install:
travis_retry wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run &&
ls -la &&
chmod u+x *-run &&
- ./cuda_9.0.176_384.81_linux-run --silent --toolkit --toolkitpath=$CUDA_ROOT &&
+ ./cuda_9.0.176_384.81_linux-run --silent --toolkit --override --toolkitpath=$CUDA_ROOT &&
rm -rf ./cuda_9.0.176_384.81_linux-run $CUDA_ROOT/{samples,jre,doc,share} &&
cd -;
fi
@@ -120,6 +137,7 @@ script:
brew install hwloc;
cmake -DMICROHTTPD_ENABLE=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ${XMRSTAK_CMAKE_FLAGS} .;
else
+ export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$CUDA_ROOT;
cmake -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${XMRSTAK_CMAKE_FLAGS} .;
fi;
- make VERBOSE=1 install
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95003034f..f1fb146e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -472,11 +472,11 @@ file(GLOB BACKEND_CPP
"xmrstak/misc/*.cpp"
"xmrstak/net/*.cpp")
-add_library(xmr-stak-backend
+add_library(xmr-stak-rx-backend
STATIC
${BACKEND_CPP}
)
-target_link_libraries(xmr-stak-backend xmr-stak-randomx ${CMAKE_DL_LIBS} ${RANDOMX_LIBRARIES} ${MHTD} ${LIBS})
+target_link_libraries(xmr-stak-rx-backend xmr-stak-randomx ${CMAKE_DL_LIBS} ${RANDOMX_LIBRARIES} ${MHTD} ${LIBS})
# compile CUDA backend
if(CUDA_FOUND)
@@ -507,7 +507,7 @@ if(CUDA_FOUND)
set(CUDA_LIBRARIES ${CUDA_LIBRARIES})
target_link_libraries(xmrstakrx_cuda_backend ${CUDA_LIBRARIES})
- target_link_libraries(xmrstakrx_cuda_backend xmr-stak-backend)
+ target_link_libraries(xmrstakrx_cuda_backend xmr-stak-rx-backend)
endif()
# compile AMD backend
@@ -520,7 +520,7 @@ if(OpenCL_FOUND)
${OPENCLSRCFILES}
)
target_link_libraries(xmrstakrx_opencl_backend ${OpenCL_LIBRARY} )
- target_link_libraries(xmrstakrx_opencl_backend xmr-stak-backend)
+ target_link_libraries(xmrstakrx_opencl_backend xmr-stak-rx-backend)
endif()
# compile final binary
@@ -536,7 +536,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-rx ${MHTD} ${LIBS} xmr-stak-backend)
+target_link_libraries(xmr-stak-rx ${MHTD} ${LIBS} xmr-stak-rx-backend)
################################################################################
# Install
diff --git a/doc/README.md b/doc/README.md
index 34cace0eb..f0bd8ab61 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -35,8 +35,9 @@ Xmr-Stak-RX supports various variants of RandomX algorithm. Use one of the follo
| Coin name | Coin alias in config | POW type |
| --- | --- | --- |
-| Monero | `monero` | RandomX |
+| ArQmA | `Arqma` | RandomARQ |
| Loki Network | `loki` | RandomXL |
+| Monero | `monero` | RandomX |
| Wownero (Monero's testnet) | `wownero` | RandomWOW |
@@ -44,7 +45,7 @@ Xmr-Stak-RX supports various variants of RandomX algorithm. Use one of the follo
[](#)
## Get Miner
-Please note that code is developed on the [dev branch](#), if you want to check out the latest updates, before they are merged on [main branch](#), please refer there. Master branch will always point to a version that we consider stable, so you can download the code by simply typing `git clone https://github.com/fireice-uk/xmr-stak-rx.git`
+Please note that code is developed on the [dev branch](#), if you want to check out the latest updates, before they are merged on [main branch](#), please refer there. Master branch will always point to a version that we consider stable, so you can download the code by simply typing `git clone https://github.com/fireice-uk/xmr-stak.git -b xmr-stak-rx`
Also you can find the latest releases, changelog and precompiled binaries on GitHub under [releases](#) section.
diff --git a/doc/compile/compile_Linux.md b/doc/compile/compile_Linux.md
index 51bae9c96..85bf33bbb 100644
--- a/doc/compile/compile_Linux.md
+++ b/doc/compile/compile_Linux.md
@@ -1,4 +1,4 @@
-# Compile **xmr-stak** for Linux
+# Compile **xmr-stak-rx** for Linux
## Install Dependencies
@@ -23,7 +23,7 @@ ROCm is not supporting old GPUs please check if your GPU is supported https://ro
### GNU Compiler
```
# Ubuntu / Debian
- sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev
+ sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev ocl-icd-opencl-dev
git clone https://github.com/fireice-uk/xmr-stak.git -b xmr-stak-rx
mkdir xmr-stak/build
cd xmr-stak/build
@@ -101,7 +101,6 @@ ROCm is not supporting old GPUs please check if your GPU is supported https://ro
```
- g++ version 5.1 or higher is required for full C++11 support.
-If you want to compile the binary without installing libraries / compiler or just compile binary for some other distribution, please check the [build_xmr-stak_docker.sh script](scripts/build_xmr-stak_docker/build_xmr-stak_docker.sh).
- Some newer gcc versions are not supported by CUDA (e.g. Ubuntu 17.10). It will require installing gcc 5 but you can avoid changing defaults.
diff --git a/doc/compile/compile_Windows.md b/doc/compile/compile_Windows.md
index 64d68bab1..2f3ec3a85 100644
--- a/doc/compile/compile_Windows.md
+++ b/doc/compile/compile_Windows.md
@@ -1,4 +1,4 @@
-# Compile **xmr-stak** for Windows
+# Compile **xmr-stak-x** for Windows
## Install Dependencies
@@ -81,9 +81,9 @@ Do not follow old information that you need the AMD APP SDK. AMD has removed the
## Compile
- Download xmr-stak [Source Code.zip](https://github.com/fireice-uk/xmr-stak/releases) and save to a location in your home folder (C:\Users\USERNAME\)
-- Extract `Source Code.zip` (e.g. to `C:\Users\USERNAME\xmr-stak-`)
+- Extract `Source Code.zip` (e.g. to `C:\Users\USERNAME\xmr-stak-rx-`)
- Open a command line (Windows key + r) and enter `cmd`
-- Go to extracted source code directory (e.g. `cd C:\Users\USERNAME\xmr-stak-`)
+- Go to extracted source code directory (e.g. `cd C:\Users\USERNAME\xmr-stak-rx-`)
- Execute the following commands (NOTE: path to Visual Studio Community 2017 can be different)
```
# Execute next line only if compiling for Cuda 9.x and using Visual Studio 2017 >= 15.5 (released 12/04/17)
@@ -91,7 +91,7 @@ Do not follow old information that you need the AMD APP SDK. AMD has removed the
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
```
-- Sometimes Windows will change the directory to `C:\Users\USERNAME\source\` instead of `C:\Users\USERNAME\xmr-stak-\`. If that's the case execute `cd C:\Users\USERNAME\xmr-stak-` followed by:
+- Sometimes Windows will change the directory to `C:\Users\USERNAME\source\` instead of `C:\Users\USERNAME\xmr-stak-rx-\`. If that's the case execute `cd C:\Users\USERNAME\xmr-stak-rx-` followed by:
```
mkdir build
@@ -102,7 +102,7 @@ Do not follow old information that you need the AMD APP SDK. AMD has removed the
### CMake
-- See [build options](https://github.com/fireice-uk/xmr-stak/blob/master/doc/compile.md#build-system) to enable or disable dependencies.
+- See [build options](https://github.com/fireice-uk/xmr-stak/blob/xmr-stak-rx/doc/compile/compile.md#build-system) to enable or disable dependencies.
- For CUDA 8* execute: `cmake -G "Visual Studio 15 2017 Win64" -T v140,host=x64 ..`
- For CUDA 9* **and/or** AMD GPUs, CPU execute: `cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..`
- Then execute
diff --git a/doc/compile/compile_macOS.md b/doc/compile/compile_macOS.md
index c39f7d10f..dd9b569ff 100644
--- a/doc/compile/compile_macOS.md
+++ b/doc/compile/compile_macOS.md
@@ -1,4 +1,4 @@
-# Compile **xmr-stak-rc** for macOS
+# Compile **xmr-stak-rx** for macOS
## Dependencies
diff --git a/doc/troubleshooting.md b/doc/troubleshooting.md
index 5529f44dc..a6f5b59e7 100644
--- a/doc/troubleshooting.md
+++ b/doc/troubleshooting.md
@@ -47,7 +47,7 @@ Pool has banned your IP, This can be caused by several reasons:
### 7. MEMORY ALLOC FAILED: mmap failed
On Linux you will need to configure large page support and increase your memlock limit (`ulimit -l`).
-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):
+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-rx as (example shows bad/low sample defaults):
$ /sbin/sysctl vm.nr_hugepages ; ulimit -l vm.nr_hugepages = 0 16
diff --git a/doc/tuning.md b/doc/tuning.md
index 98f766fc5..19427b4b2 100644
--- a/doc/tuning.md
+++ b/doc/tuning.md
@@ -2,6 +2,7 @@
## Content Overview
* [Fast Startup](#fast-startup)
+* [Huge Page Support](#huge-page-support)
* [Benchmark](#benchmark)
* [Windows](#windows)
* [Managing GPUs](#managing-GPUs)
@@ -23,6 +24,28 @@
## Fast Startup
You can disable the miner self test performed on each miner start by adding the command line option `--noTest`
+## Huge Page Support
+
+In Linux you can enable 2 MiB huge pages with the following command.
+
+```
+sudo sysctl -w vm.nr_hugepages=1300
+```
+
+In linux there is also the possibility to use 1 GiB pages for the dataset, this can be enabled with.
+
+```
+sudo sh -c ' echo 3 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages'
+# check if the pages are enabled
+cat /sys/kernel/mm/hugepages/hugepages-1048576kB/free_hugepages
+```
+
+If the last must return `3` else the OS was not able to allocate 1 GiB pages.
+Reasons for this can be that the you have to less main memory, you should have at least 8 GiB main memory.
+If the system already runs for a while it could be your memory is already fragmented, a restart could help.
+xmr-stak-rx is always using gigabyte pages when available, if this has a negative effect on your hashrate set the number
+of gigabyte pages back to zero.
+
## Benchmark
You can benchmark the miner in two ways:
- Edit `config.txt` and set `verbose_level` to 4 and `h_print_time` to 30 and start the miner. You will see hash report each 30 seconds.
diff --git a/doc/usage.md b/doc/usage.md
index 4c12610f9..3f9a24faa 100644
--- a/doc/usage.md
+++ b/doc/usage.md
@@ -61,22 +61,6 @@ Some NVIDIA GPUs can reach better performance with this backend.
xmr-stak-rx --openCLVendor NVIDIA --noNVIDIA
```
-## Docker image usage
-
-You can run the Docker image the following way:
-
-```
-docker run --rm -it -u $(id -u):$(id -g) --name fireice-uk/xmr-stak-rx -v "$PWD":/mnt xmr-stak-rx
-docker stop xmr-stak-rx
-docker run --rm -it -u $(id -u):$(id -g) --name fireice-uk/xmr-stak-rx -v "$PWD":/mnt xmr-stak-rx --config config.txt
-```
-
-Debug the docker image by getting inside:
-
-```
-docker run --entrypoint=/bin/bash --rm -it -u $(id -u):$(id -g) --name fireice-uk/xmr-stak-rx -v "$PWD":/mnt xmr-stak-rx
-```
-
## HTML and JSON API report configuration
To configure the reports shown on the [README](../README.md) side you need to edit the httpd_port variable. Then enable wifi on your phone and navigate to [miner ip address]:[httpd_port] in your phone browser. If you want to use the data in scripts, you can get the JSON version of the data at url [miner ip address]:[httpd_port]/api.json
diff --git a/scripts/build_xmr-stak_docker/build_xmr-stak_docker.sh b/scripts/build_xmr-stak_docker/build_xmr-stak_docker.sh
deleted file mode 100755
index 3cabf1d7b..000000000
--- a/scripts/build_xmr-stak_docker/build_xmr-stak_docker.sh
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/bin/bash -uex
-
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root"
- exit 1
-fi
-
-if [ -d xmr-stak ]; then
- git -C xmr-stak clean -fd
-else
- git clone https://github.com/fireice-uk/xmr-stak.git
-fi
-
-wget -c https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
-chmod a+x cuda_*_linux-run
-
-
-########################
-# Fedora 27
-########################
-# CUDA is not going to work on Fedora 27 beacuse it only supports these distributions: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
-docker run --rm -it -v $PWD:/mnt fedora:27 /bin/bash -c "
-set -x ;
-dnf install -y -q cmake gcc-c++ hwloc-devel libmicrohttpd-devel libstdc++-static make openssl-devel;
-cd /mnt/xmr-stak ;
-cmake -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF . ;
-make ;
-"
-
-test -d fedora_27 || mkdir fedora_27
-mv xmr-stak/bin/* fedora_27
-git -C xmr-stak clean -fd
-
-
-########################
-# Ubuntu (17.04)
-########################
-docker run --rm -it -v $PWD:/mnt ubuntu:17.04 /bin/bash -c "
-set -x ;
-apt update -qq ;
-apt install -y -qq libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev ;
-cd /mnt/xmr-stak ;
-/mnt/cuda_*_linux-run --silent --toolkit ;
-cmake -DCUDA_ENABLE=ON -DOpenCL_ENABLE=OFF . ;
-make ;
-"
-
-test -d ubuntu_17.10 || mkdir ubuntu_17.10
-mv xmr-stak/bin/* ubuntu_17.10
-git -C xmr-stak clean -fd
-
-
-########################
-# Ubuntu 16.04
-########################
-docker run --rm -it -v $PWD:/mnt ubuntu:16.04 /bin/bash -c "
-set -x ;
-apt update -qq ;
-apt install -y -qq cmake g++ libmicrohttpd-dev libssl-dev libhwloc-dev ;
-cd /mnt/xmr-stak ;
-/mnt/cuda_*_linux-run --silent --toolkit ;
-cmake -DCUDA_ENABLE=ON -DOpenCL_ENABLE=OFF . ;
-make ;
-"
-
-test -d ubuntu_16.04 || mkdir ubuntu_16.04
-mv xmr-stak/bin/* ubuntu_16.04
-git -C xmr-stak clean -fd
-
-
-########################
-# Ubuntu 14.04
-########################
-docker run --rm -it -v $PWD:/mnt ubuntu:14.04 /bin/bash -c "
-set -x ;
-apt update -qq ;
-apt install -y -qq curl libmicrohttpd-dev libssl-dev libhwloc-dev software-properties-common ;
-add-apt-repository -y ppa:ubuntu-toolchain-r/test ;
-apt update -qq ;
-apt install -y -qq gcc-6 g++-6 make ;
-update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 1 --slave /usr/bin/g++ g++ /usr/bin/g++-6 ;
-curl -L https://cmake.org/files/LatestRelease/cmake-3.10.0.tar.gz | tar -xzf - -C /tmp/ ;
-( cd /tmp/cmake-*/ && ./configure && make && sudo make install && cd - ) > /dev/null
-update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force ;
-cd /mnt/xmr-stak ;
-/mnt/cuda_*_linux-run --silent --toolkit ;
-cmake -DCUDA_ENABLE=ON -DOpenCL_ENABLE=OFF . ;
-make ;
-"
-
-test -d ubuntu_14.04 || mkdir ubuntu_14.04
-mv xmr-stak/bin/* ubuntu_14.04
-git -C xmr-stak clean -fd
-
-
-########################
-# CentOS 7
-########################
-# CUDA is not going to work on CentOS/RHEL beacuse it's only support gcc-4 in these distributions: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
-docker run --rm -it -v $PWD:/mnt centos:7 /bin/bash -c "
-set -x ;
-yum install -y -q centos-release-scl epel-release ;
-yum install -y -q cmake3 devtoolset-7-gcc* hwloc-devel libmicrohttpd-devel make openssl-devel perl ;
-scl enable devtoolset-7 - << EOF
-cd /mnt/xmr-stak ;
-cmake3 -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF . ;
-make ;
-EOF
-"
-
-test -d centos_7 || mkdir centos_7
-mv xmr-stak/bin/* centos_7
-git -C xmr-stak clean -fd
-
-
-########################
-# CentOS 6.x
-########################
-# CUDA is not going to work on CentOS/RHEL beacuse it's only support gcc-4 in these distributions: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
-docker run --rm -it -v $PWD:/mnt centos:6 /bin/bash -c "
-set -x ;
-yum install -y -q centos-release-scl epel-release ;
-yum install -y -q cmake3 devtoolset-7-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make ;
-scl enable devtoolset-7 - << EOF
-cd /mnt/xmr-stak ;
-cmake3 -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF . ;
-make ;
-EOF
-"
-
-test -d centos_6 || mkdir centos_6
-mv xmr-stak/bin/* centos_6
-git -C xmr-stak clean -fd
-
-rm -rf xmr-stak
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp
index 1e6abc990..7d9484999 100644
--- a/xmrstak/backend/amd/amd_gpu/gpu.cpp
+++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp
@@ -865,6 +865,8 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
rx_conf = &RandomX_WowneroConfig;
else if(miner_algo == randomX)
rx_conf = &RandomX_MoneroConfig;
+ else if(miner_algo == randomX_arqma)
+ rx_conf = &RandomX_ArqmaConfig;
const uint32_t rx_parameters =
(PowerOf2(rx_conf->ScratchpadL1_Size) << 0) |
@@ -1189,6 +1191,9 @@ size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx)
const char* randomx_constants_monero_h =
#include "./opencl/RandomX/randomx_constants_monero.h"
;
+ const char* randomx_constants_arqma_h =
+ #include "./opencl/RandomX/randomx_constants_arqma.h"
+ ;
const char* aesCL =
#include "./opencl/RandomX/aes.cl"
;
@@ -1214,6 +1219,8 @@ size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx)
source_code.append(randomx_constants_loki_h);
else if(user_algo == randomX)
source_code.append(randomx_constants_monero_h);
+ else if(user_algo == randomX_arqma)
+ source_code.append(randomx_constants_arqma_h);
source_code.append(std::regex_replace(aesCL, std::regex("#include \"fillAes1Rx4.cl\""), fillAes1Rx4CL));
source_code.append(std::regex_replace(blake2bCL, std::regex("#include \"blake2b_double_block.cl\""), blake2b_double_blockCL));
diff --git a/xmrstak/backend/amd/amd_gpu/opencl/RandomX/randomx_constants_arqma.h b/xmrstak/backend/amd/amd_gpu/opencl/RandomX/randomx_constants_arqma.h
new file mode 100644
index 000000000..deeddc2b9
--- /dev/null
+++ b/xmrstak/backend/amd/amd_gpu/opencl/RandomX/randomx_constants_arqma.h
@@ -0,0 +1,99 @@
+R"===(
+/*
+Copyright (c) 2019 SChernykh
+
+This file is part of RandomX OpenCL.
+
+RandomX OpenCL is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+RandomX OpenCL is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with RandomX OpenCL. If not, see .
+*/
+
+//Dataset base size in bytes. Must be a power of 2.
+#define RANDOMX_DATASET_BASE_SIZE 2147483648
+
+//Dataset extra size. Must be divisible by 64.
+#define RANDOMX_DATASET_EXTRA_SIZE 33554368
+
+//Scratchpad L3 size in bytes. Must be a power of 2.
+#define RANDOMX_SCRATCHPAD_L3 262144
+
+//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
+#define RANDOMX_SCRATCHPAD_L2 131072
+
+//Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2.
+#define RANDOMX_SCRATCHPAD_L1 16384
+
+//Jump condition mask size in bits.
+#define RANDOMX_JUMP_BITS 8
+
+//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16.
+#define RANDOMX_JUMP_OFFSET 8
+
+//Integer instructions
+#define RANDOMX_FREQ_IADD_RS 16
+#define RANDOMX_FREQ_IADD_M 7
+#define RANDOMX_FREQ_ISUB_R 16
+#define RANDOMX_FREQ_ISUB_M 7
+#define RANDOMX_FREQ_IMUL_R 16
+#define RANDOMX_FREQ_IMUL_M 4
+#define RANDOMX_FREQ_IMULH_R 4
+#define RANDOMX_FREQ_IMULH_M 1
+#define RANDOMX_FREQ_ISMULH_R 4
+#define RANDOMX_FREQ_ISMULH_M 1
+#define RANDOMX_FREQ_IMUL_RCP 8
+#define RANDOMX_FREQ_INEG_R 2
+#define RANDOMX_FREQ_IXOR_R 15
+#define RANDOMX_FREQ_IXOR_M 5
+#define RANDOMX_FREQ_IROR_R 8
+#define RANDOMX_FREQ_IROL_R 2
+#define RANDOMX_FREQ_ISWAP_R 4
+
+//Floating point instructions
+#define RANDOMX_FREQ_FSWAP_R 4
+#define RANDOMX_FREQ_FADD_R 16
+#define RANDOMX_FREQ_FADD_M 5
+#define RANDOMX_FREQ_FSUB_R 16
+#define RANDOMX_FREQ_FSUB_M 5
+#define RANDOMX_FREQ_FSCAL_R 6
+#define RANDOMX_FREQ_FMUL_R 32
+#define RANDOMX_FREQ_FDIV_M 4
+#define RANDOMX_FREQ_FSQRT_R 6
+
+//Control instructions
+#define RANDOMX_FREQ_CBRANCH 25
+#define RANDOMX_FREQ_CFROUND 1
+
+//Store instruction
+#define RANDOMX_FREQ_ISTORE 16
+
+//No-op instruction
+#define RANDOMX_FREQ_NOP 0
+
+#define RANDOMX_DATASET_ITEM_SIZE 64
+
+#define RANDOMX_PROGRAM_SIZE 256
+
+#define HASH_SIZE 64
+#define ENTROPY_SIZE (128 + RANDOMX_PROGRAM_SIZE * 8)
+#define REGISTERS_SIZE 256
+#define IMM_BUF_SIZE (RANDOMX_PROGRAM_SIZE * 4 - REGISTERS_SIZE)
+#define IMM_INDEX_COUNT ((IMM_BUF_SIZE / 4) - 2)
+#define VM_STATE_SIZE (REGISTERS_SIZE + IMM_BUF_SIZE + RANDOMX_PROGRAM_SIZE * 4)
+#define ROUNDING_MODE (RANDOMX_FREQ_CFROUND ? -1 : 0)
+
+// Scratchpad L1/L2/L3 bits
+#define LOC_L1 (32 - 14)
+#define LOC_L2 (32 - 17)
+#define LOC_L3 (32 - 18)
+)==="
+
\ No newline at end of file
diff --git a/xmrstak/backend/cpu/crypto/common/VirtualMemory.h b/xmrstak/backend/cpu/crypto/common/VirtualMemory.h
index 0b3f0eadf..49742b654 100644
--- a/xmrstak/backend/cpu/crypto/common/VirtualMemory.h
+++ b/xmrstak/backend/cpu/crypto/common/VirtualMemory.h
@@ -52,7 +52,7 @@ class VirtualMemory
}
static void *allocateExecutableMemory(size_t size);
- static void *allocateLargePagesMemory(size_t size);
+ static void *allocateLargePagesMemory(size_t size, size_t page_size = 2u);
static void flushInstructionCache(void *p, size_t size);
static void freeLargePagesMemory(void *p, size_t size);
static void init(bool hugePages);
diff --git a/xmrstak/backend/cpu/crypto/common/VirtualMemory_unix.cpp b/xmrstak/backend/cpu/crypto/common/VirtualMemory_unix.cpp
index 7fb6a2aa2..68e970839 100644
--- a/xmrstak/backend/cpu/crypto/common/VirtualMemory_unix.cpp
+++ b/xmrstak/backend/cpu/crypto/common/VirtualMemory_unix.cpp
@@ -94,15 +94,24 @@ void *xmrstak::VirtualMemory::allocateExecutableMemory(size_t size)
return mem == MAP_FAILED ? nullptr : mem;
}
-
-void *xmrstak::VirtualMemory::allocateLargePagesMemory(size_t size)
+void *xmrstak::VirtualMemory::allocateLargePagesMemory(size_t size, size_t page_size)
{
# if defined(__APPLE__)
void *mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0);
# elif defined(__FreeBSD__)
void *mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER | MAP_PREFAULT_READ, -1, 0);
# else
- void *mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0);
+ constexpr int MAP_HUGE_2MB = (21 << MAP_HUGE_SHIFT);
+ constexpr int MAP_HUGE_1GB = (30 << MAP_HUGE_SHIFT);
+
+ int page_size_flags = 0;
+ if(page_size == 2u)
+ page_size_flags |= MAP_HUGE_2MB;
+ else if(page_size == 1024u)
+ page_size_flags |= MAP_HUGE_1GB;
+ #define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
+ #define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
+ void *mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE | page_size_flags, 0, 0);
# endif
return mem == MAP_FAILED ? nullptr : mem;
diff --git a/xmrstak/backend/cpu/crypto/common/VirtualMemory_win.cpp b/xmrstak/backend/cpu/crypto/common/VirtualMemory_win.cpp
index a2300ff08..a629475ea 100644
--- a/xmrstak/backend/cpu/crypto/common/VirtualMemory_win.cpp
+++ b/xmrstak/backend/cpu/crypto/common/VirtualMemory_win.cpp
@@ -180,7 +180,7 @@ void *xmrstak::VirtualMemory::allocateExecutableMemory(size_t size)
}
-void *xmrstak::VirtualMemory::allocateLargePagesMemory(size_t size)
+void *xmrstak::VirtualMemory::allocateLargePagesMemory(size_t size, size_t)
{
const size_t min = GetLargePageMinimum();
void *mem = nullptr;
diff --git a/xmrstak/backend/cpu/crypto/cryptonight.h b/xmrstak/backend/cpu/crypto/cryptonight.h
index 8b293a94c..8b9e9e39f 100644
--- a/xmrstak/backend/cpu/crypto/cryptonight.h
+++ b/xmrstak/backend/cpu/crypto/cryptonight.h
@@ -101,10 +101,29 @@ struct randomX_global_ctx
private:
randomX_global_ctx() : m_rx_dataset_init_thread_counter(0u)
{
- randomx_dataset* dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
- if (!dataset) {
- dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT);
+#ifdef __linux__
+ randomx_dataset* dataset = randomx_alloc_dataset(static_cast(RANDOMX_FLAG_LARGE_PAGES | RANDOMX_FLAG_LARGE_PAGES_1G));
+ if (!dataset)
+ {
+ printer::inst()->print_msg(LDEBUG,"Warning: dataset allocation with 1 GiB pages failed");
+#else
+ randomx_dataset* dataset = nullptr;
+#endif
+ dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
+ if (!dataset)
+ {
+ printer::inst()->print_msg(LDEBUG,"Warning: dataset allocation with 2 MiB pages failed");
+ dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT);
+ printer::inst()->print_msg(LDEBUG,"dataset allocated without huge pages");
+ }
+ else
+ printer::inst()->print_msg(LDEBUG,"dataset allocated with 2 MiB pages");
+#ifdef __linux__
}
+ else
+ printer::inst()->print_msg(LDEBUG,"dataset allocated with 1 GiB pages");
+#endif
+
m_rx_cache = randomx_alloc_cache(static_cast(RANDOMX_FLAG_JIT | RANDOMX_FLAG_LARGE_PAGES));
if (!m_rx_cache) {
m_rx_cache = randomx_alloc_cache(RANDOMX_FLAG_JIT);
diff --git a/xmrstak/backend/cpu/crypto/cryptonight_aesni.h b/xmrstak/backend/cpu/crypto/cryptonight_aesni.h
index 795d1c643..984b2c502 100644
--- a/xmrstak/backend/cpu/crypto/cryptonight_aesni.h
+++ b/xmrstak/backend/cpu/crypto/cryptonight_aesni.h
@@ -48,7 +48,7 @@ struct RandomX_hash
static void hash(const void* input, size_t len, void* output, cryptonight_ctx** ctx, const xmrstak_algo& algo)
{
for(size_t i = 0u; i < N; ++i)
- randomx_calculate_hash(ctx[i]->m_rx_vm, input, len, (char*)output + 32 * i);
+ randomx_calculate_hash(ctx[i]->m_rx_vm, (char*)input + len * i, len, (char*)output + 32 * i);
}
};
@@ -186,6 +186,8 @@ struct RandomX_generator
randomx_apply_config(RandomX_LokiConfig);
else if(ALGO == randomX_wow)
randomx_apply_config(RandomX_WowneroConfig);
+ else if(ALGO == randomX_arqma)
+ randomx_apply_config(RandomX_ArqmaConfig);
}
for(size_t i = 0; i < N; i++)
diff --git a/xmrstak/backend/cpu/crypto/randomx/allocator.cpp b/xmrstak/backend/cpu/crypto/randomx/allocator.cpp
index ff708a62c..61f823461 100644
--- a/xmrstak/backend/cpu/crypto/randomx/allocator.cpp
+++ b/xmrstak/backend/cpu/crypto/randomx/allocator.cpp
@@ -49,8 +49,8 @@ namespace randomx {
template struct AlignedAllocator;
- void* LargePageAllocator::allocMemory(size_t count) {
- return allocLargePagesMemory(count);
+ void* LargePageAllocator::allocMemory(size_t count, size_t page_size) {
+ return allocLargePagesMemory(count, page_size);
}
void LargePageAllocator::freeMemory(void* ptr, size_t count) {
diff --git a/xmrstak/backend/cpu/crypto/randomx/allocator.hpp b/xmrstak/backend/cpu/crypto/randomx/allocator.hpp
index d7aa3f95d..df18f73a1 100644
--- a/xmrstak/backend/cpu/crypto/randomx/allocator.hpp
+++ b/xmrstak/backend/cpu/crypto/randomx/allocator.hpp
@@ -39,7 +39,7 @@ namespace randomx {
};
struct LargePageAllocator {
- static void* allocMemory(size_t);
+ static void* allocMemory(size_t, size_t page_size = 2u);
static void freeMemory(void*, size_t);
};
diff --git a/xmrstak/backend/cpu/crypto/randomx/randomx.cpp b/xmrstak/backend/cpu/crypto/randomx/randomx.cpp
index 2ee097fda..2937459c1 100644
--- a/xmrstak/backend/cpu/crypto/randomx/randomx.cpp
+++ b/xmrstak/backend/cpu/crypto/randomx/randomx.cpp
@@ -320,7 +320,12 @@ extern "C" {
dataset = new randomx_dataset();
if (flags & RANDOMX_FLAG_LARGE_PAGES) {
dataset->dealloc = &randomx::deallocDataset;
- dataset->memory = (uint8_t*)randomx::LargePageAllocator::allocMemory(RANDOMX_DATASET_MAX_SIZE);
+ if(flags & RANDOMX_FLAG_LARGE_PAGES_1G) {
+ dataset->memory = (uint8_t*)randomx::LargePageAllocator::allocMemory(RANDOMX_DATASET_MAX_SIZE, 1024u);
+ }
+ else {
+ dataset->memory = (uint8_t*)randomx::LargePageAllocator::allocMemory(RANDOMX_DATASET_MAX_SIZE, 2u);
+ }
}
else {
dataset->dealloc = &randomx::deallocDataset;
diff --git a/xmrstak/backend/cpu/crypto/randomx/randomx.h b/xmrstak/backend/cpu/crypto/randomx/randomx.h
index 51c66334d..6fece9a4f 100644
--- a/xmrstak/backend/cpu/crypto/randomx/randomx.h
+++ b/xmrstak/backend/cpu/crypto/randomx/randomx.h
@@ -48,6 +48,7 @@ enum randomx_flags {
RANDOMX_FLAG_HARD_AES = 2,
RANDOMX_FLAG_FULL_MEM = 4,
RANDOMX_FLAG_JIT = 8,
+ RANDOMX_FLAG_LARGE_PAGES_1G = 16
};
diff --git a/xmrstak/backend/cpu/crypto/randomx/virtual_memory.cpp b/xmrstak/backend/cpu/crypto/randomx/virtual_memory.cpp
index ced3b78c8..42e6af2e3 100644
--- a/xmrstak/backend/cpu/crypto/randomx/virtual_memory.cpp
+++ b/xmrstak/backend/cpu/crypto/randomx/virtual_memory.cpp
@@ -32,6 +32,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "crypto/common/VirtualMemory.h"
#include "crypto/randomx/virtual_memory.hpp"
+#include
+
void* allocExecutableMemory(std::size_t bytes) {
void *mem = xmrstak::VirtualMemory::allocateExecutableMemory(bytes);
@@ -43,10 +45,10 @@ void* allocExecutableMemory(std::size_t bytes) {
}
-void* allocLargePagesMemory(std::size_t bytes) {
- void *mem = xmrstak::VirtualMemory::allocateLargePagesMemory(bytes);
+void* allocLargePagesMemory(std::size_t bytes, size_t page_size) {
+ void *mem = xmrstak::VirtualMemory::allocateLargePagesMemory(bytes, page_size);
if (mem == nullptr) {
- throw std::runtime_error("Failed to allocate large pages memory");
+ throw std::runtime_error(std::string("Failed to allocate large pages memory (page size: " + std::to_string(page_size) + " MiB"));
}
return mem;
diff --git a/xmrstak/backend/cpu/crypto/randomx/virtual_memory.hpp b/xmrstak/backend/cpu/crypto/randomx/virtual_memory.hpp
index d3b31db12..90ade304b 100644
--- a/xmrstak/backend/cpu/crypto/randomx/virtual_memory.hpp
+++ b/xmrstak/backend/cpu/crypto/randomx/virtual_memory.hpp
@@ -31,5 +31,5 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
void* allocExecutableMemory(std::size_t);
-void* allocLargePagesMemory(std::size_t);
+void* allocLargePagesMemory(std::size_t, size_t page_size);
void freePagedMemory(void*, std::size_t);
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index eecdf63f0..5773d472d 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -260,6 +260,12 @@ bool minethd::self_test()
if(res == 0 && fatal)
return false;
+ if(!params::inst().selfTest)
+ {
+ printer::inst()->print_msg(L0, "skip self test: disabled by the command line option '--noTest')");
+ return true;
+ }
+
cryptonight_ctx* ctx[MAX_N] = {0};
for(int i = 0; i < MAX_N; i++)
{
@@ -317,6 +323,18 @@ bool minethd::self_test()
ctx[0]->hash_fn("\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74", 44, out, ctx, algo);
bResult = bResult && memcmp(out, "\xc7\x78\x25\x35\xd8\x11\xda\x56\x32\xb0\xa4\xb8\x9d\x9d\x1a\xdf\x7b\x9\x69\xae\x92\x4f\xd4\xd0\x4c\x6b\x55\x5e\x77\xe9\x8f\x38", 32) == 0;
}
+ else if(algo == POW(randomX_arqma))
+ {
+ printer::inst()->print_msg(L0, "start self test for 'randomx_arqma' (can be disabled with the command line option '--noTest')");
+ minethd::cn_on_new_job set_job;
+ func_multi_selector<1>(ctx, set_job, ::jconf::inst()->HaveHardwareAes(), algo);
+ miner_work work;
+ work.iBlockHeight = 1806260;
+ work.seed_hash[0] = 1;
+ set_job(work, ctx);
+ ctx[0]->hash_fn("\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74", 44, out, ctx, algo);
+ bResult = bResult && memcmp(out, "\x96\xd5\x33\x16\x7f\x33\xeb\x37\xc7\xc5\x44\xae\xc8\x55\x96\x62\x09\x59\xc1\xfe\xb8\xca\x5c\x40\x37\x06\x07\x64\x60\xab\x86\xec", 32) == 0;
+ }
else
{
printer::inst()->print_msg(L0,
@@ -440,6 +458,9 @@ void minethd::func_multi_selector(cryptonight_ctx** ctx, minethd::cn_on_new_job&
case randomX_wow:
algv = 2;
break;
+ case randomX_arqma:
+ algv = 3;
+ break;
default:
algv = 0;
break;
@@ -456,7 +477,11 @@ void minethd::func_multi_selector(cryptonight_ctx** ctx, minethd::cn_on_new_job&
//wow
RandomX_hash::template hash,
- RandomX_hash::template hash
+ RandomX_hash::template hash,
+
+ //arqma
+ RandomX_hash::template hash,
+ RandomX_hash::template hash
};
std::bitset<1> digit;
@@ -470,7 +495,8 @@ void minethd::func_multi_selector(cryptonight_ctx** ctx, minethd::cn_on_new_job&
static const std::unordered_map on_new_job_map = {
{randomX, RandomX_generator::template cn_on_new_job},
{randomX_loki, RandomX_generator::template cn_on_new_job},
- {randomX_wow, RandomX_generator::template cn_on_new_job}
+ {randomX_wow, RandomX_generator::template cn_on_new_job},
+ {randomX_arqma, RandomX_generator::template cn_on_new_job}
};
auto it = on_new_job_map.find(algo.Id());
@@ -579,9 +605,6 @@ void minethd::multiway_work_main()
continue;
}
- constexpr uint32_t nonce_chunk = 4096;
- int64_t nonce_ctr = 0;
-
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
if(oWork.bNiceHash)
@@ -608,6 +631,13 @@ void minethd::multiway_work_main()
if(on_new_job != nullptr)
on_new_job(oWork, ctx);
+ uint64_t tempHash[N][8];
+ uint32_t current_nonces[N];
+ // always use a multiple of N
+ constexpr uint32_t nonce_chunk = 4096 * N;
+ int64_t nonce_ctr = 0;
+ bool first = true;
+
constexpr uint64_t update_stat_each = 128;
// only check each 128 hash if the job has changed
while((iCount % update_stat_each) != 0 || globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
@@ -622,20 +652,41 @@ void minethd::multiway_work_main()
break;
}
+ if(first)
+ {
+ first = false;
+ for(size_t i = 0u; i < N; ++i)
+ {
+ *piNonce[i] = iNonce;
+ current_nonces[i] = iNonce;
+ ++iNonce;
+ randomx_calculate_hash_first(ctx[i]->m_rx_vm, tempHash[i], bWorkBlob + oWork.iWorkSize * i, oWork.iWorkSize);
+ }
+ };
+
+ // prepare nonce for next round
for(size_t i = 0; i < N; i++)
- *piNonce[i] = iNonce++;
+ {
+ *piNonce[i] = iNonce;
+ ++iNonce;
+ }
- ctx[0]->hash_fn(bWorkBlob, oWork.iWorkSize, bHashOut, ctx, miner_algo);
+ for(size_t i = 0u; i < N; ++i)
+ randomx_calculate_hash_next(ctx[i]->m_rx_vm, tempHash[i], bWorkBlob + oWork.iWorkSize * i, oWork.iWorkSize, (char*)bHashOut + 32 * i);
- for(size_t i = 0; i < N; i++)
+ for(size_t i = 0u; i < N; i++)
{
if(*piHashVal[i] < oWork.iTarget)
{
executor::inst()->push_event(
- ex_event(job_result(oWork.sJobID, iNonce - N + i, bHashOut + 32 * i, iThreadNo, miner_algo),
+ ex_event(job_result(oWork.sJobID, current_nonces[i], bHashOut + 32 * i, iThreadNo, miner_algo),
oWork.iPoolId));
}
}
+
+ for(size_t i = 0; i < N; i++)
+ current_nonces[i] = iNonce - N + i;
+
if((iCount++ % update_stat_each) == 0) //Store stats every 8*N hashes
{
updateStats((iCount - iLastCount) * N, oWork.iPoolId);
diff --git a/xmrstak/backend/cryptonight.hpp b/xmrstak/backend/cryptonight.hpp
index 7ee76de7a..0559601aa 100644
--- a/xmrstak/backend/cryptonight.hpp
+++ b/xmrstak/backend/cryptonight.hpp
@@ -13,6 +13,7 @@ enum xmrstak_algo_id
randomX = 1,
randomX_loki = 2,
randomX_wow = 3,
+ randomX_arqma = 4
//cryptonight_turtle = start_derived_algo_id,
// please add the algorithm name to get_algo_name()
@@ -24,12 +25,13 @@ enum xmrstak_algo_id
*/
inline std::string get_algo_name(xmrstak_algo_id algo_id)
{
- static std::array base_algo_names =
+ static std::array base_algo_names =
{{
"invalid_algo",
"randomx",
"randomx_loki",
- "randomx_wow"
+ "randomx_wow",
+ "randomx_arqma"
}};
static std::array derived_algo_names =
@@ -156,25 +158,15 @@ constexpr size_t CN_MEMORY = 2 * 1024 * 1024;
constexpr uint32_t CN_ITER = 0x80000;
constexpr uint32_t CN_MASK = ((CN_MEMORY - 1) / 16) * 16;
-// crptonight gpu
-constexpr uint32_t CN_GPU_MASK = 0x1FFFC0;
-constexpr uint32_t CN_GPU_ITER = 0xC000;
-
-// cryptonight turtle (the mask is not using the full 256kib scratchpad)
-constexpr uint32_t CN_TURTLE_MASK = 0x1FFF0;
-
-constexpr uint32_t CN_ZELERIUS_ITER = 0x60000;
-
-constexpr uint32_t CN_WALTZ_ITER = 0x60000;
-
-constexpr uint32_t CN_DOUBLE_ITER = 0x100000;
+constexpr uint32_t RX_ARQMA_ITER = 0x10000;
inline xmrstak_algo POW(xmrstak_algo_id algo_id)
{
- static std::array pow = {{{invalid_algo, invalid_algo},
+ static std::array pow = {{{invalid_algo, invalid_algo},
{randomX, randomX, CN_ITER, CN_MEMORY},
{randomX_loki, randomX_loki, CN_ITER, CN_MEMORY},
- {randomX_wow, randomX_wow, CN_ITER, CN_MEMORY/2}
+ {randomX_wow, randomX_wow, CN_ITER, CN_MEMORY/2},
+ {randomX_arqma, randomX_arqma, RX_ARQMA_ITER, CN_MEMORY/8}
}};
return pow[algo_id];
diff --git a/xmrstak/backend/nvidia/RandomX_Arqma/configuration.h b/xmrstak/backend/nvidia/RandomX_Arqma/configuration.h
new file mode 100644
index 000000000..1c4dec2db
--- /dev/null
+++ b/xmrstak/backend/nvidia/RandomX_Arqma/configuration.h
@@ -0,0 +1,126 @@
+/*
+Copyright (c) 2018-2019, tevador
+Copyright (c) 2019, Wownero Inc., a Monero Enterprise Alliance partner company
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+//Cache size in KiB. Must be a power of 2.
+#define RANDOMX_ARGON_MEMORY 262144
+
+//Number of Argon2d iterations for Cache initialization.
+#define RANDOMX_ARGON_ITERATIONS 1
+
+//Number of parallel lanes for Cache initialization.
+#define RANDOMX_ARGON_LANES 1
+
+//Argon2d salt
+#define RANDOMX_ARGON_SALT "RandomARQ\x01"
+
+//Number of random Cache accesses per Dataset item. Minimum is 2.
+#define RANDOMX_CACHE_ACCESSES 8
+
+//Target latency for SuperscalarHash (in cycles of the reference CPU).
+#define RANDOMX_SUPERSCALAR_LATENCY 170
+
+//Dataset base size in bytes. Must be a power of 2.
+#define RANDOMX_DATASET_BASE_SIZE 2147483648
+
+//Dataset extra size. Must be divisible by 64.
+#define RANDOMX_DATASET_EXTRA_SIZE 33554368
+
+//Number of instructions in a RandomX program. Must be divisible by 8.
+#define RANDOMX_PROGRAM_SIZE 256
+
+//Number of iterations during VM execution.
+#define RANDOMX_PROGRAM_ITERATIONS 1024
+
+//Number of chained VM executions per hash.
+#define RANDOMX_PROGRAM_COUNT 4
+
+//Scratchpad L3 size in bytes. Must be a power of 2.
+#define RANDOMX_SCRATCHPAD_L3 262144
+
+//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
+#define RANDOMX_SCRATCHPAD_L2 131072
+
+//Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2.
+#define RANDOMX_SCRATCHPAD_L1 16384
+
+//Jump condition mask size in bits.
+#define RANDOMX_JUMP_BITS 8
+
+//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16.
+#define RANDOMX_JUMP_OFFSET 8
+
+/*
+Instruction frequencies (per 256 opcodes)
+Total sum of frequencies must be 256
+*/
+
+//Integer instructions
+#define RANDOMX_FREQ_IADD_RS 16
+#define RANDOMX_FREQ_IADD_M 7
+#define RANDOMX_FREQ_ISUB_R 16
+#define RANDOMX_FREQ_ISUB_M 7
+#define RANDOMX_FREQ_IMUL_R 16
+#define RANDOMX_FREQ_IMUL_M 4
+#define RANDOMX_FREQ_IMULH_R 4
+#define RANDOMX_FREQ_IMULH_M 1
+#define RANDOMX_FREQ_ISMULH_R 4
+#define RANDOMX_FREQ_ISMULH_M 1
+#define RANDOMX_FREQ_IMUL_RCP 8
+#define RANDOMX_FREQ_INEG_R 2
+#define RANDOMX_FREQ_IXOR_R 15
+#define RANDOMX_FREQ_IXOR_M 5
+#define RANDOMX_FREQ_IROR_R 8
+#define RANDOMX_FREQ_IROL_R 2
+#define RANDOMX_FREQ_ISWAP_R 4
+
+//Floating point instructions
+#define RANDOMX_FREQ_FSWAP_R 4
+#define RANDOMX_FREQ_FADD_R 16
+#define RANDOMX_FREQ_FADD_M 5
+#define RANDOMX_FREQ_FSUB_R 16
+#define RANDOMX_FREQ_FSUB_M 5
+#define RANDOMX_FREQ_FSCAL_R 6
+#define RANDOMX_FREQ_FMUL_R 32
+#define RANDOMX_FREQ_FDIV_M 4
+#define RANDOMX_FREQ_FSQRT_R 6
+
+//Control instructions
+#define RANDOMX_FREQ_CBRANCH 25
+#define RANDOMX_FREQ_CFROUND 1
+
+//Store instruction
+#define RANDOMX_FREQ_ISTORE 16
+
+//No-op instruction
+#define RANDOMX_FREQ_NOP 0
+/* ------
+ 256
+*/
diff --git a/xmrstak/backend/nvidia/RandomX_Arqma/randomx_arqma.cu b/xmrstak/backend/nvidia/RandomX_Arqma/randomx_arqma.cu
new file mode 100644
index 000000000..3a248e27c
--- /dev/null
+++ b/xmrstak/backend/nvidia/RandomX_Arqma/randomx_arqma.cu
@@ -0,0 +1,33 @@
+/*
+Copyright (c) 2019 SChernykh
+
+This file is part of RandomX CUDA.
+
+RandomX CUDA is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+RandomX CUDA is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with RandomX CUDA. If not, see.
+*/
+
+#include
+#include
+#include
+#include
+#include
+//#include "xmrstak/backend/cpu/crypto/randomx/randomx.h"
+#include "xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp"
+#include "../nvcc_code/cuda_device.hpp"
+
+namespace RandomX_Arqma {
+ #include "configuration.h"
+ #define fillAes4Rx4 fillAes4Rx4_v104
+ #include "../RandomX/common.hpp"
+}
diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp
index d762d1851..f585c9933 100644
--- a/xmrstak/backend/nvidia/minethd.cpp
+++ b/xmrstak/backend/nvidia/minethd.cpp
@@ -294,6 +294,10 @@ void minethd::work_main()
{
RandomX_Loki::hash(&ctx, iNonce, oWork.iTarget, &foundCount, foundNonce, h_per_round);
}
+ else if(miner_algo == randomX_arqma)
+ {
+ RandomX_Arqma::hash(&ctx, iNonce, oWork.iTarget, &foundCount, foundNonce, h_per_round);
+ }
diff --git a/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp b/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp
index 9729d6800..985054310 100644
--- a/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp
+++ b/xmrstak/backend/nvidia/nvcc_code/cryptonight.hpp
@@ -63,4 +63,5 @@ void randomx_prepare(nvid_ctx *ctx, const uint8_t* seed_hash, const xmrstak_algo
namespace RandomX_Monero { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); }
namespace RandomX_Wownero { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); }
namespace RandomX_Loki { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); }
+namespace RandomX_Arqma { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); }
diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp
index bc45b875e..bf7c858b5 100644
--- a/xmrstak/cli/cli-miner.cpp
+++ b/xmrstak/cli/cli-miner.cpp
@@ -848,14 +848,11 @@ int main(int argc, char* argv[])
if(strlen(jconf::inst()->GetOutputFile()) != 0)
printer::inst()->open_logfile(jconf::inst()->GetOutputFile());
- if(params::inst().selfTest)
+ if(!BackendConnector::self_test())
{
- if(!BackendConnector::self_test())
- {
- printer::inst()->print_msg(L0, "Self test not passed!");
- win_exit();
- return 1;
- }
+ printer::inst()->print_msg(L0, "Self test not passed!");
+ win_exit();
+ return 1;
}
if(jconf::inst()->GetHttpdPort() != uint16_t(params::httpd_port_disabled))
diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp
index 43ec81702..c4ef358fb 100644
--- a/xmrstak/jconf.cpp
+++ b/xmrstak/jconf.cpp
@@ -101,9 +101,11 @@ constexpr size_t iConfigCnt = (sizeof(oConfigValues) / sizeof(oConfigValues[0]))
xmrstak::coin_selection coins[] = {
// name, userpool, default_pool_suggestion
+ {"arqma", {POW(randomX_arqma)}, {POW(randomX_arqma)}, nullptr},
{"loki", {POW(randomX_loki)}, {POW(randomX_loki)}, nullptr},
{"monero", {POW(randomX)}, {POW(randomX)}, nullptr},
{"randomx", {POW(randomX)}, {POW(randomX)}, nullptr},
+ {"randomx_arqma", {POW(randomX_arqma)}, {POW(randomX_arqma)}, nullptr},
{"randomx_loki", {POW(randomX_loki)}, {POW(randomX_loki)}, nullptr},
{"randomx_wow", {POW(randomX_wow)}, {POW(randomX_wow)}, nullptr},
{"wownero", {POW(randomX_wow)}, {POW(randomX_wow)}, nullptr}
diff --git a/xmrstak/pools.tpl b/xmrstak/pools.tpl
index d28cddd7a..caa7395b7 100644
--- a/xmrstak/pools.tpl
+++ b/xmrstak/pools.tpl
@@ -19,12 +19,15 @@ POOLCONF],
/*
* Currency to mine. Supported values:
*
+ * arqma
* loki
* monero
* wownero
*
* Native algorithms which do not depend on any block versions:
*
+ * # 256KiB scratchpad memory
+ * randomx_arqma
* # 1MiB scratchpad memory
* randomx_wow
* # 2MiB scratchpad memory
diff --git a/xmrstak/version.cpp b/xmrstak/version.cpp
index 6930bcb9e..761ebed58 100644
--- a/xmrstak/version.cpp
+++ b/xmrstak/version.cpp
@@ -20,7 +20,7 @@
#endif
#define XMR_STAK_NAME "xmr-stak-rx"
-#define XMR_STAK_VERSION "1.0.2-rx"
+#define XMR_STAK_VERSION "1.0.3-rx"
#if defined(_WIN32)
#define OS_TYPE "win"