Skip to content

Commit

Permalink
XMR-STAK 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IndeedMiners committed Dec 23, 2017
1 parent 4622fe0 commit 8a4ea57
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 104 deletions.
3 changes: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ test_script:
- cd c:\xmr-stak\build\bin\Release
- dir
- copy C:\xmr-stak-dep\openssl\bin\* .
# - xmr-stak.exe --help
- set XMRSTAK_NOWAIT=1
- xmr-stak.exe --help --noUAC
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ if(CUDA_ENABLE)
endif()
# add Volta support for CUDA >= 9.0
if(NOT CUDA_VERSION VERSION_LESS 9.0)
list(APPEND DEFAULT_CUDA_ARCH "70")
# Volta GPUs are currently not supported on MACOSX
# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-general-known-issues
if(NOT APPLE)
list(APPEND DEFAULT_CUDA_ARCH "70")
endif()
endif()
set(CUDA_ARCH "${DEFAULT_CUDA_ARCH}" CACHE STRING "Set GPU architecture (semicolon separated list, e.g. '-DCUDA_ARCH=20;35;60')")

Expand Down Expand Up @@ -191,7 +195,9 @@ 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)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND
(CUDA_VERSION VERSION_EQUAL 9.0 OR CUDA_VERSION VERSION_EQUAL 9.1)
)
# 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)
Expand Down Expand Up @@ -228,6 +234,7 @@ if(OpenCL_ENABLE)
ENV AMDAPPSDKROOT
ENV ATISTREAMSDKROOT
ENV "PROGRAMFILES(X86)"
/usr
PATH_SUFFIXES
include
OpenCL/common/inc
Expand All @@ -246,6 +253,7 @@ if(OpenCL_ENABLE)
PATH_SUFFIXES
"AMD APP/lib/x86_64"
lib/x86_64
lib/x86_64-linux-gnu
lib/x64
OpenCL/common/lib/x64)
# find package will use the previews searched path variables
Expand Down Expand Up @@ -435,7 +443,9 @@ if(CMAKE_LINK_STATIC)
set(BUILD_SHARED_LIBRARIES OFF)
set(DL_LIB ${CMAKE_DL_LIBS})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(LIBS "-static-libgcc -static-libstdc++ ${LIBS}")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
set(LIBS "-static-libgcc -static-libstdc++ ${LIBS}")
endif()
endif()

# compile C files
Expand Down
63 changes: 41 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NV

## Overview
* [Features](#features)
* [Supported altcoins](#supported-altcoins)
* [Download](#download)
* [Linux Portable Binary](doc/Linux_deployment.md)
* [Usage](doc/usage.md)
Expand All @@ -30,6 +31,19 @@ XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NV
- HTML statistics
- JSON API for monitoring

## Supported altcoins

Besides Monero, following coins can be mined using this miner:

- [Aeon](http://www.aeon.cash/)
- [Electroneum](https://electroneum.com)
- [Intense](https://intensecoin.com)
- [Sumokoin](https://www.sumokoin.org)

For all coins, except Aeon, you can use Monero settings.

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).
Expand All @@ -52,38 +66,43 @@ psychocrypt:
```

## Release Checksums

Please use the [Developer PGP Key's](doc/pgp_keys.md) to verify the integrity of the precompiled binaries.

```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
XMR-Stak 2.0.0 Windows Build Checksums
XMR-Stak 2.2.0 Windows Build Checksums
compiled by: psychocrypt
$ sha1sum *
316aafce7e9e9b9ac76a3c559d2df2ce0d8e0f0e libeay32.dll
fd5251b1b9a44be590eed18fd6563661c662e095 ssleay32.dll
9c81da9334db8ade7255bf201a2f90c571f09969 xmrstak_cuda_backend.dll
b41b1baea01189c6acfdb03b66b332ae615519b0 xmr-stak.exe
0d90f03886af567100cd0ab780f7a50557e3dafa xmrstak_opencl_backend.dll
3f1634244ccd336f7df581e3c82e1c6ca38ce714 libeay32.dll
538f3bd9dfcafc379e912562bcf343333f5375c7 ssleay32.dll
302e5be7c97fcd4922bf99b3533c0523ead5d109 xmrstak_cuda_backend.dll
ad6b9e62a7ea132e1bec0efd8d9e5f8a2ae531ca xmr-stak.exe
393bc5deb7e59e61cc7f4ccc0f4438402422f3b0 xmrstak_opencl_backend.dll
$ sha3sum *
627b5f8c7b67e45b1ff1e344ba841ee45cbab78d03f35bc572a53e77 libeay32.dll
1f587006e26d0a6e0969d0f562ebf622783e3898a0239e4bc08d129f ssleay32.dll
e9cd4a682a208a68c012635924dc320d4da1b222d358ca21e326f30d xmrstak_cuda_backend.dll
37b4891b43694548ee3ba83174985b8300a30808fd5e469f6273c0b7 xmr-stak.exe
b574a18d3f729123dfc4efe857021e0d3b48e428562d340acc5de426 xmrstak_opencl_backend.dll
$ date
Sun 19 Nov 16:54:14 GMT 2017
5aeefca7278be1b2706d99bf89fa23646931f881aff8bbca33654eb1 libeay32.dll
6b696caa620b0c6372881b11e503313152b5191c2d5497b26f81ab79 ssleay32.dll
038de57a707664c7c3ab3a74c8bdb3ed4e22000a74d8b7c359c7c4b5 xmrstak_cuda_backend.dll
19ab61049051178a362dc0d1c17af06f5ca1eb0a75182c0388e5aa22 xmr-stak.exe
cc7ba0fbde50d72df2a530ce52a831578cfa19999841eb954554a022 xmrstak_opencl_backend.dll
date
Fri Dec 22 22:09:59 CET 2017
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJaEberAAoJEPsk95p+1Bw012QH/A+c1M1+Jt4tHvSrgYDgMt/g
i/r4ZaCUj8Q43Q/PRo1V5ZwGAjPQp23qMp1b2PX+B9nRZD61uXN4+LX6BJuK8Cvp
eDS3weWHYP0OJHXdSr/2u1VbL09u3att7BhXj8N5Y1k/DnyXtxIFafDZb6rOwOyu
r0iUMMjFNrQBJe3RdrGLeGTc1atxVTnLsa5TmBT8NZTIVk9tfpEzCcyvvfwKuK5T
fjzzOR4m0HcbzOxIqydOLWXkX1oOTHjq1TSCuZ+W1vcp8drCtlY5zM5ckYDD4818
cvX6gTCsFYfLw/p+sz+DN7kh7zJlCvIFga3HaFByxCSuyMY08qerXS/0862ZMdo=
=Gf/1
iQEcBAEBCAAGBQJaPXYSAAoJEAUWOMCIZelDQpAH/As2BD6qDZvbKH5NPHjjDv6T
KBJ6/0h+x2k4Iy3GelrtaogB4LvUDzci4MRfaTXr23Xr+rhwsx3J2xvVdWKZgPXh
bQm5pTJFhiao6Dh+Orway6TLmuaEBLNtknatSkjPUPKmkVd/A7kxxkdelDB//yb+
7k5HGb84T+HU8HBlB00pDITyXv/414egpZGMqWeBXsYDeEYa8KHZlEIO3YI4JrEz
pNW44Q1YcWZ+zxqTDrvMgjW8KJZcXg6ijJ3fEhGBo+hcnF+WuUB3Yd3Frf0ps5J5
MjnWXl/uOobML6K70g2UQcHcEDbPk8f9LUxX1++/I0aHsRMGMYhRj0ad5KYE1IY=
=VCEv
-----END PGP SIGNATURE-----
```
2 changes: 1 addition & 1 deletion doc/compile_Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# CentOS
sudo yum install centos-release-scl epel-release
sudo yum install cmake3 devtoolset-4-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make
sudo scl enable devtoolset-4 bash
scl enable devtoolset-4 bash
git clone https://github.com/fireice-uk/xmr-stak.git
mkdir xmr-stak/build
cd xmr-stak/build
Expand Down
2 changes: 1 addition & 1 deletion doc/tuning.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tuning Guide

## Content Overview
* [Windows](windows)
* [Windows](#windows)
* [NVIDIA Backend](#nvidia-backend)
* [Choose Value for `threads` and `blocks`](#choose-value-for-threads-and-blocks)
* [Add more GPUs](#add-more-gpus)
Expand Down
3 changes: 1 addition & 2 deletions xmrstak/backend/amd/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ void minethd::work_main()
}

iCount += pGpuCtx->rawIntensity;
using namespace std::chrono;
uint64_t iStamp = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
std::this_thread::yield();
Expand Down
6 changes: 2 additions & 4 deletions xmrstak/backend/cpu/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,7 @@ void minethd::work_main()
{
if ((iCount++ & 0xF) == 0) //Store stats every 16 hashes
{
using namespace std::chrono;
uint64_t iStamp = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
}
Expand Down Expand Up @@ -614,8 +613,7 @@ void minethd::multiway_work_main(cn_hash_fun_multi hash_fun_multi)
{
if ((iCount++ & 0x7) == 0) //Store stats every 8*N hashes
{
using namespace std::chrono;
uint64_t iStamp = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount * N, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
}
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/backend/nvidia/minethd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void minethd::work_main()
iNonce += h_per_round;

using namespace std::chrono;
uint64_t iStamp = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
uint64_t iStamp = get_timestamp_ms();
iHashCount.store(iCount, std::memory_order_relaxed);
iTimestamp.store(iStamp, std::memory_order_relaxed);
std::this_thread::yield();
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/backend/nvidia/nvcc_code/cuda_core.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extern "C" void compat_usleep(uint64_t waitTime)
HANDLE timer;
LARGE_INTEGER ft;

ft.QuadPart = -(10*waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time
ft.QuadPart = -10ll * int64_t(waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time

timer = CreateWaitableTimer(NULL, TRUE, NULL);
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
Expand Down
32 changes: 22 additions & 10 deletions xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <vector>
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_functions.hpp>
#include <algorithm>
#include "xmrstak/jconf.hpp"

Expand Down Expand Up @@ -188,24 +187,24 @@ extern "C" int cryptonight_extra_cpu_init(nvid_ctx* ctx)
return 0;
}

cudaDeviceReset();
CUDA_CHECK(ctx->device_id, cudaDeviceReset());
switch(ctx->syncMode)
{
case 0:
cudaSetDeviceFlags(cudaDeviceScheduleAuto);
CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleAuto));
break;
case 1:
cudaSetDeviceFlags(cudaDeviceScheduleSpin);
CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleSpin));
break;
case 2:
cudaSetDeviceFlags(cudaDeviceScheduleYield);
CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleYield));
break;
case 3:
cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync);
CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync));
break;

};
cudaDeviceSetCacheConfig(cudaFuncCachePreferL1);
CUDA_CHECK(ctx->device_id, cudaDeviceSetCacheConfig(cudaFuncCachePreferL1));

size_t hashMemSize;
if(::jconf::inst()->IsCurrencyMonero())
Expand Down Expand Up @@ -404,7 +403,7 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx)
( props.major < 3 ? 2 : 3 );

// increase bfactor for low end devices to avoid that the miner is killed by the OS
if(props.multiProcessorCount < 6)
if(props.multiProcessorCount <= 6)
ctx->device_bfactor += 2;
}
if(ctx->device_threads == -1)
Expand All @@ -418,6 +417,19 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx)

// no limit by default 1TiB
size_t maxMemUsage = byteToMiB * byteToMiB;
if(props.major == 6)
{
if(props.multiProcessorCount < 15)
{
// limit memory usage for GPUs for pascal < GTX1070
maxMemUsage = size_t(2048u) * byteToMiB;
}
else if(props.multiProcessorCount <= 20)
{
// limit memory usage for GPUs for pascal GTX1070, GTX1080
maxMemUsage = size_t(4096u) * byteToMiB;
}
}
if(props.major < 6)
{
// limit memory usage for GPUs before pascal
Expand Down Expand Up @@ -451,9 +463,9 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx)
size_t totalMemory = 0;
CUDA_CHECK(ctx->device_id, cudaMemGetInfo(&freeMemory, &totalMemory));

cudaFree(tmp);
CUDA_CHECK(ctx->device_id, cudaFree(tmp));
// delete created context on the gpu
cudaDeviceReset();
CUDA_CHECK(ctx->device_id, cudaDeviceReset());

ctx->total_device_memory = totalMemory;
ctx->free_device_memory = freeMemory;
Expand Down
49 changes: 7 additions & 42 deletions xmrstak/cli/cli-miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

#ifdef _WIN32
# define strcasecmp _stricmp
# include <windows.h>
# include "xmrstak/misc/uac.hpp"
#endif // _WIN32

void do_benchmark();
Expand Down Expand Up @@ -308,41 +310,6 @@ void do_guided_config()
std::cout<<"Configuration stored in file '"<<params::inst().configFile<<"'"<<std::endl;
}

#ifdef _WIN32
/** start the miner as administrator
*
* This function based on the stackoverflow post
* - source: https://stackoverflow.com/a/4893508
* - author: Cody Gray
* - date: Feb 4 '11
*/
void UACDialog(const std::string& binaryName, std::string& args)
{
args += " --noUAC";
SHELLEXECUTEINFO shExInfo = {0};
shExInfo.cbSize = sizeof(shExInfo);
shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shExInfo.hwnd = 0;
shExInfo.lpVerb = "runas";
shExInfo.lpFile = binaryName.c_str();
// disable UAC dialog (else the miner will go into a infinite loop)
shExInfo.lpParameters = args.c_str();
shExInfo.lpDirectory = 0;
shExInfo.nShow = SW_SHOW;
shExInfo.hInstApp = 0;

if(ShellExecuteEx(&shExInfo))
{
printer::inst()->print_msg(L0,
"This window has been opened because xmr-stak needed to run as administrator. It can be safely closed now.");
WaitForSingleObject(shExInfo.hProcess, INFINITE);
CloseHandle(shExInfo.hProcess);
// do not start the miner twice
std::exit(0);
}
}
#endif

int main(int argc, char *argv[])
{
#ifndef CONF_NO_TLS
Expand Down Expand Up @@ -550,7 +517,7 @@ int main(int argc, char *argv[])
}

#ifdef _WIN32
if(uacDialog)
if(uacDialog && !IsElevated())
{
std::string minerArgs;
for(int i = 1; i < argc; i++)
Expand All @@ -559,7 +526,7 @@ int main(int argc, char *argv[])
minerArgs += argv[i];
}

UACDialog(argv[0], minerArgs);
SelfElevate(argv[0], minerArgs);
}
#endif

Expand Down Expand Up @@ -624,9 +591,7 @@ int main(int argc, char *argv[])

executor::inst()->ex_start(jconf::inst()->DaemonMode());

using namespace std::chrono;
uint64_t lastTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();

uint64_t lastTime = get_timestamp_ms();
int key;
while(true)
{
Expand All @@ -647,7 +612,7 @@ int main(int argc, char *argv[])
break;
}

uint64_t currentTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
uint64_t currentTime = get_timestamp_ms();

/* Hard guard to make sure we never get called more than twice per second */
if( currentTime - lastTime < 500)
Expand All @@ -669,7 +634,7 @@ void do_benchmark()
xmrstak::miner_work oWork = xmrstak::miner_work("", work, sizeof(work), 0, false, 0);
pvThreads = xmrstak::BackendConnector::thread_starter(oWork);

uint64_t iStartStamp = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
uint64_t iStartStamp = get_timestamp_ms();

std::this_thread::sleep_for(std::chrono::seconds(60));

Expand Down
Loading

0 comments on commit 8a4ea57

Please sign in to comment.