diff --git a/README.md b/README.md index eca50611f..2e2eb61fa 100644 --- a/README.md +++ b/README.md @@ -1,116 +1,10 @@ -###### fireice-uk's and psychocrypt's -# XMR-Stak: Cryptonight All-in-One Mining Software - -XMR-Stak is a universal open source stratum pool miner. This miner supports x86-64 CPUs, AMD and NVIDIA GPUs and can be used various crypto currencies: Ryo, Monero, Turtlecoin, Graft, Bittube, Loki, Aeon and many more Cryptonight coins. - - - -## Video guides -[](https://www.youtube.com/playlist?list=PLAhUkom29iGMFoN8pk91JA-oqvxlmJ5H8) -###### Video by Crypto Sewer - -## Overview -* [Features](#features) -* [Supported coins and algorithms](#supported-coins-and-algorithms) -* [Download](#download) -* [FAQ](doc/FAQ.md) -* [Developer Donation](#default-developer-donation) -* [Developer PGP Key's](doc/pgp_keys.md) - -## Guides and FAQ -To improve our support we created [Xmr-Stak forum](https://www.reddit.com/r/XmrStak). Check it out if you have a problem, or you are looking for most up to date config for your card and [guides](https://www.reddit.com/r/XmrStak/wiki/index). -* [Usage](doc/usage.md) -* [How to compile](doc/compile/compile.md) -* [Fine tuning](doc/tuning.md) -* [FAQ](doc/FAQ.md) -* [Troubleshooting](doc/troubleshooting.md) (Fixing common problems) - -## Features - -- Supports all common backends (CPU/x86, AMD/NVIDIA GPU). -- Supports all common OS (Linux, Windows and macOS). -- Supports 15 cryptonight-variant mining algorithms + Cryptonight-GPU. -- Easy to use and flexible in setup: - - guided start with easy/advanced setup option (no need to edit a config file for the first start) - - auto-configuration and config file creation for each backend. -- Open source software (GPLv3) -- TLS support. -- [HTML statistics](doc/usage.md#html-and-json-api-report-configuraton) -- [JSON API for monitoring](doc/usage.md#html-and-json-api-report-configuraton) - -## HTML reports - - -## Supported coins and algorithms - -Following coins can be mined using this miner: - - -- [Aeon](http://www.aeon.cash) -- [BitTube](https://coin.bit.tube/) -- [Conceal](https://conceal.network) -- [Graft](https://www.graft.network) -- [Haven](https://havenprotocol.com) -- [Lethean](https://lethean.io) -- [Masari](https://getmasari.org) -- [Monero](https://getmonero.org) -- [Plenteum](https://www.plenteum.com/) -- [QRL](https://theqrl.org) -- **[Ryo](https://ryo-currency.com) - Upcoming xmr-stak-gui is sponsored by Ryo Currency** -- [Torque](https://torque.cash/) -- [Zelerius](https://zelerius.org/) - -**[Ryo Currency](https://ryo-currency.com)** - 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 preferred coin is not listed, you can choose one of the following mining algorithms: -- 256Kib scratchpad memory - - cryptonight_turtle - - -- 1MiB scratchpad memory - - cryptonight_lite - - cryptonight_lite_v7 - - cryptonight_lite_v7_xor (algorithm used by ipbc) - - -- 2MiB scratchpad memory - - cryptonight - - cryptonight_gpu (for Ryo's 14th of Feb fork) - - cryptonight_r - - cryptonight_masari (used in 2018) - - cryptonight_conceal - - cryptonight_v7 - - cryptonight_v7_stellite - - cryptonight_v8 - - cryptonight_v8_double (used by X-CASH) - - cryptonight_v8_half (used by masari and torque) - - cryptonight_v8_reversewaltz (used by graft) - - cryptonight_v8_zelerius - - -- 4MiB scratchpad memory - - cryptonight_haven - - cryptonight_heavy - -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 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 - -fireice-uk: -``` -4581HhZkQHgZrZjKeCfCJxZff9E3xCgHGF25zABZz7oR71TnbbgiS7sK9jveE6Dx6uMs2LwszDuvQJgRZQotdpHt1fTdDhk -``` - -psychocrypt: -``` -45tcqnJMgd3VqeTznNotiNj4G9PQoK67TGRiHyj6EYSZ31NUbAfs9XdiU5squmZb717iHJLxZv3KfEw8jCYGL5wa19yrVCn -``` + + + +

+

+ + + + +
\ No newline at end of file diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 000000000..fef37ddd3 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,132 @@ + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + +
+ +## Introduction +XMR-Stak is a universal open source stratum pool miner. This miner supports CPUs, AMD and NVIDIA GPUs and can be used for mining various crypto currencies: Ryo, Graft, Bittube, Conceal, Haven and many more Cryptonight coins. + +## Features overview +[](#) + +## Supported coins and algorithms +Xmr-Stak supports various variants of Cryptonight algorithm. Use one of the following options (type this coin alias in either `pool.txt` config file or on startup configuration under `"currency"` parameter and miner will pick it's variant of Cryptonight algorithm for mining): + +| | | | +| --- | --- | --- | +| [BitTube](https://coin.bit.tube/) | [Plenteum](https://www.plenteum.com/) | | +| [Conceal](https://conceal.network) | [QRL](https://theqrl.org) | | +| [Graft](https://www.graft.network) | [Ryo](https://ryo-currency.com) | **Atom Wallet Solo mining mode is sponsored by [RYO](https://ryo-currency.com/)** | +| [Haven](https://havenprotocol.com) | [X-CASH](https://x-network.io/) | | +| [Lethean](https://lethean.io) | [Zelerius](https://zelerius.org/) | | +| [Masari](https://getmasari.org) | | | + + +**[Ryo Currency](https://ryo-currency.com)** - 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 preferred coin is not listed, you can choose one of the following mining algorithms: + +| 256 KiB scratchpad memory | 1 MiB scratchpad memory | 2 MiB scratchpad memory | 4 MiB scratchpad memory | +| --- | --- | --- | --- | +| cryptonight_turtle | cryptonight_lite | cryptonight | cryptonight_bittube2 | +| --- | cryptonight_lite_v7 | cryptonight_gpu | cryptonight_haven | +| --- | --- | cryptonight_conceal | cryptonight_heavy | +| --- | --- | cryptonight_r | --- | +| --- | --- | cryptonight_masari (used in 2018) | --- | +| --- | --- | cryptonight_v8_reversewaltz | --- | +| --- | --- | cryptonight_v7 | --- | +| --- | --- | cryptonight_v8 | --- | +| --- | --- | cryptonight_v8_half (used by masari) | --- | +| --- | --- | cryptonight_v8_double (used by X-CASH) | --- | +| --- | --- | cryptonight_v8_zelerius | --- | + +Please note, this list is not complete and is not an endorsement. + + +## Get Miner +Please note that code is developed on the [dev branch](https://github.com/fireice-uk/xmr-stak/commits/dev), 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` + +Also you can find the latest releases and precompiled binaries on GitHub under [releases](https://github.com/fireice-uk/xmr-stak/releases/latest) section. + +If you want to compile the miner from source files, navigate to ["how to compile"](compile/compile.md) section of docs or [xmr-stak forum](https://www.reddit.com/r/XmrStak/wiki/guides/startup) where you will find the latest step-by-step instructions. + + +## Start Mining +Miner has 2 ways of initial configuring: simple and advanced. The simple method will prompt user with minimum information. Required answers are y , (or yes), n , (or no): + +#### Simple setup: +* `Use simple setup method?` y +* `Please enter the currency that you want to mine:` Enter currency or mining algorithm +* `Enter pool address (pool address:port):` Enter pool connection address:port +* `Username (wallet address or pool login):` Enter wallet address +* `Password (mostly empty or x):` press Enter +* `Does this pool port support TLS/SSL? Use no if unknown. (y/N):` press y or n + +#### Advanced setup: +* `Use simple setup method?` n +* `Do you want to use the HTTP interface? Unlike the screen display, browser interface is not affected by the GPU lag. If you don't want to use it, please enter 0, otherwise enter port number that the miner should listen on` 5656 +* `Please enter the currency that you want to mine:` Enter currency or mining algorithm +* `Enter pool address (pool address:port):` Enter pool connection address:port +* `Username (wallet address or pool login):` Enter wallet address +* `Password (mostly empty or x):` press Enter +* `Rig identifier for pool-side statistics (needs pool support). Can be empty:` Enter rig name or press Enter +* `Does this pool port support TLS/SSL? Use no if unknown. (y/N)` Enter y or n +* `Do you want to use nicehash on this pool? (y/N)` n +* `Do you want to use multiple pools? (y/N)` Enter y if you want to se up backup pool or n + + +## Additional Guides and Feedback +[](https://www.youtube.com/playlist?list=PLAhUkom29iGMFoN8pk91JA-oqvxlmJ5H8) +###### Video by Crypto Sewer + +To improve our support we created [Xmr-Stak forum](https://www.reddit.com/r/XmrStak). Check it out if you have a problem, or you are looking for most up to date config for your card and [guides](https://www.reddit.com/r/XmrStak/wiki/index). + + + + + + + + + +
+ +## Default Developer Donation +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 + +fireice-uk: +``` +4581HhZkQHgZrZjKeCfCJxZff9E3xCgHGF25zABZz7oR71TnbbgiS7sK9jveE6Dx6uMs2LwszDuvQJgRZQotdpHt1fTdDhk +``` + +psychocrypt: +``` +45tcqnJMgd3VqeTznNotiNj4G9PQoK67TGRiHyj6EYSZ31NUbAfs9XdiU5squmZb717iHJLxZv3KfEw8jCYGL5wa19yrVCn +``` \ No newline at end of file diff --git a/doc/_img/2ragerx-btn.png b/doc/_img/2ragerx-btn.png new file mode 100644 index 000000000..1c0edd98c Binary files /dev/null and b/doc/_img/2ragerx-btn.png differ diff --git a/doc/_img/2xmr-stak-btn.png b/doc/_img/2xmr-stak-btn.png new file mode 100644 index 000000000..7626e27c1 Binary files /dev/null and b/doc/_img/2xmr-stak-btn.png differ diff --git a/doc/_img/YT.png b/doc/_img/YT.png new file mode 100644 index 000000000..cf7a869a2 Binary files /dev/null and b/doc/_img/YT.png differ diff --git a/doc/_img/cpu.png b/doc/_img/cpu.png new file mode 100644 index 000000000..6a370fbc9 Binary files /dev/null and b/doc/_img/cpu.png differ diff --git a/doc/_img/faq-green.png b/doc/_img/faq-green.png new file mode 100644 index 000000000..440a855b2 Binary files /dev/null and b/doc/_img/faq-green.png differ diff --git a/doc/_img/faq.png b/doc/_img/faq.png new file mode 100644 index 000000000..83167e3c7 Binary files /dev/null and b/doc/_img/faq.png differ diff --git a/doc/_img/features-xmr-stak.png b/doc/_img/features-xmr-stak.png new file mode 100644 index 000000000..ef75a3b14 Binary files /dev/null and b/doc/_img/features-xmr-stak.png differ diff --git a/doc/_img/features.png b/doc/_img/features.png new file mode 100644 index 000000000..37c877291 Binary files /dev/null and b/doc/_img/features.png differ diff --git a/doc/_img/fee.png b/doc/_img/fee.png new file mode 100644 index 000000000..cd3cdaf00 Binary files /dev/null and b/doc/_img/fee.png differ diff --git a/doc/_img/fine-tuning-green.png b/doc/_img/fine-tuning-green.png new file mode 100644 index 000000000..b58184bfa Binary files /dev/null and b/doc/_img/fine-tuning-green.png differ diff --git a/doc/_img/fine-tuning.png b/doc/_img/fine-tuning.png new file mode 100644 index 000000000..6b817cffe Binary files /dev/null and b/doc/_img/fine-tuning.png differ diff --git a/doc/_img/gpu.png b/doc/_img/gpu.png new file mode 100644 index 000000000..4d5578007 Binary files /dev/null and b/doc/_img/gpu.png differ diff --git a/doc/_img/header.png b/doc/_img/header.png new file mode 100644 index 000000000..8c9eeefad Binary files /dev/null and b/doc/_img/header.png differ diff --git a/doc/_img/how-to-compile-green.png b/doc/_img/how-to-compile-green.png new file mode 100644 index 000000000..e82c8b693 Binary files /dev/null and b/doc/_img/how-to-compile-green.png differ diff --git a/doc/_img/how-to-compile.png b/doc/_img/how-to-compile.png new file mode 100644 index 000000000..a54603484 Binary files /dev/null and b/doc/_img/how-to-compile.png differ diff --git a/doc/_img/html_reports.png b/doc/_img/html_reports.png new file mode 100644 index 000000000..2d17bc1bf Binary files /dev/null and b/doc/_img/html_reports.png differ diff --git a/doc/_img/menu-donations-green.png b/doc/_img/menu-donations-green.png new file mode 100644 index 000000000..a299980d3 Binary files /dev/null and b/doc/_img/menu-donations-green.png differ diff --git a/doc/_img/menu-donations.png b/doc/_img/menu-donations.png new file mode 100644 index 000000000..f73facf6f Binary files /dev/null and b/doc/_img/menu-donations.png differ diff --git a/doc/_img/menu-features-green.png b/doc/_img/menu-features-green.png new file mode 100644 index 000000000..527d68d4c Binary files /dev/null and b/doc/_img/menu-features-green.png differ diff --git a/doc/_img/menu-features.png b/doc/_img/menu-features.png new file mode 100644 index 000000000..bcf71064d Binary files /dev/null and b/doc/_img/menu-features.png differ diff --git a/doc/_img/menu-get-miner-green.png b/doc/_img/menu-get-miner-green.png new file mode 100644 index 000000000..9e3bd5753 Binary files /dev/null and b/doc/_img/menu-get-miner-green.png differ diff --git a/doc/_img/menu-get-miner.png b/doc/_img/menu-get-miner.png new file mode 100644 index 000000000..891a35f16 Binary files /dev/null and b/doc/_img/menu-get-miner.png differ diff --git a/doc/_img/menu-support-green.png b/doc/_img/menu-support-green.png new file mode 100644 index 000000000..3db8e76ef Binary files /dev/null and b/doc/_img/menu-support-green.png differ diff --git a/doc/_img/menu-support.png b/doc/_img/menu-support.png new file mode 100644 index 000000000..5cd80e42f Binary files /dev/null and b/doc/_img/menu-support.png differ diff --git a/doc/_img/menu-supported-coins-green.png b/doc/_img/menu-supported-coins-green.png new file mode 100644 index 000000000..8678ea444 Binary files /dev/null and b/doc/_img/menu-supported-coins-green.png differ diff --git a/doc/_img/menu-supported-coins.png b/doc/_img/menu-supported-coins.png new file mode 100644 index 000000000..aabc37283 Binary files /dev/null and b/doc/_img/menu-supported-coins.png differ diff --git a/doc/_img/ragerx-btn.png b/doc/_img/ragerx-btn.png new file mode 100644 index 000000000..d08e245fc Binary files /dev/null and b/doc/_img/ragerx-btn.png differ diff --git a/doc/_img/ragerx.png b/doc/_img/ragerx.png new file mode 100644 index 000000000..bc2453d2a Binary files /dev/null and b/doc/_img/ragerx.png differ diff --git a/doc/_img/rx.png b/doc/_img/rx.png new file mode 100644 index 000000000..d9c4c3dfa Binary files /dev/null and b/doc/_img/rx.png differ diff --git a/doc/_img/split.png b/doc/_img/split.png new file mode 100644 index 000000000..11a8635b9 Binary files /dev/null and b/doc/_img/split.png differ diff --git a/doc/_img/troubleshooting-green.png b/doc/_img/troubleshooting-green.png new file mode 100644 index 000000000..d36cec8b8 Binary files /dev/null and b/doc/_img/troubleshooting-green.png differ diff --git a/doc/_img/troubleshooting.png b/doc/_img/troubleshooting.png new file mode 100644 index 000000000..e57eda740 Binary files /dev/null and b/doc/_img/troubleshooting.png differ diff --git a/doc/_img/usage-green.png b/doc/_img/usage-green.png new file mode 100644 index 000000000..c60b9a432 Binary files /dev/null and b/doc/_img/usage-green.png differ diff --git a/doc/_img/usage.png b/doc/_img/usage.png new file mode 100644 index 000000000..d9421ba66 Binary files /dev/null and b/doc/_img/usage.png differ diff --git a/doc/_img/xmr-stak-btn-active.png b/doc/_img/xmr-stak-btn-active.png new file mode 100644 index 000000000..68520be91 Binary files /dev/null and b/doc/_img/xmr-stak-btn-active.png differ diff --git a/doc/_img/xmr-stak-btn.png b/doc/_img/xmr-stak-btn.png new file mode 100644 index 000000000..0356f41aa Binary files /dev/null and b/doc/_img/xmr-stak-btn.png differ diff --git a/doc/_img/xmr-stak-cpu-connection.png b/doc/_img/xmr-stak-cpu-connection.png new file mode 100644 index 000000000..d07a8d0a9 Binary files /dev/null and b/doc/_img/xmr-stak-cpu-connection.png differ diff --git a/doc/_img/xmr-stak-cpu-hashrate.png b/doc/_img/xmr-stak-cpu-hashrate.png new file mode 100644 index 000000000..488a34825 Binary files /dev/null and b/doc/_img/xmr-stak-cpu-hashrate.png differ diff --git a/doc/_img/xmr-stak-cpu-results.png b/doc/_img/xmr-stak-cpu-results.png new file mode 100644 index 000000000..7244f9579 Binary files /dev/null and b/doc/_img/xmr-stak-cpu-results.png differ diff --git a/doc/_img/xmr-stak-rx-btn-inactive.png b/doc/_img/xmr-stak-rx-btn-inactive.png new file mode 100644 index 000000000..1644a9505 Binary files /dev/null and b/doc/_img/xmr-stak-rx-btn-inactive.png differ diff --git a/doc/_img/xmr-stak-rx-btn.png b/doc/_img/xmr-stak-rx-btn.png new file mode 100644 index 000000000..39f0c87f7 Binary files /dev/null and b/doc/_img/xmr-stak-rx-btn.png differ diff --git a/doc/_img/xmrig.png b/doc/_img/xmrig.png new file mode 100644 index 000000000..cdeaa4501 Binary files /dev/null and b/doc/_img/xmrig.png differ diff --git a/doc/compile/compile_Windows.md b/doc/compile/compile_Windows.md index 64d68bab1..37925576a 100644 --- a/doc/compile/compile_Windows.md +++ b/doc/compile/compile_Windows.md @@ -111,6 +111,15 @@ Do not follow old information that you need the AMD APP SDK. AMD has removed the cd bin\Release + copy C:\xmr-stak-dep\openssl\bin\* . + ``` +- For Exclude some of dependence you can follow the command below to set the ENABLE to OFF + ``` + make -G "Visual Studio 15 2017 Win64" -T v141,host=x64 -DCMAKE_BUILD_TYPE=Release -DMICROHTTPD_ENABLE=OFF -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF .. + cmake --build . --config Release --target clean + cmake --build . --config Release --target install + cd bin\Release + copy C:\xmr-stak-dep\openssl\bin\* . ``` - Miner is by default compiled for NVIDIA GPUs (if CUDA is installed), AMD GPUs (if the AMD OCL-SDK_light is installed) and CPUs. diff --git a/xmrstak/backend/amd/autoAdjust.hpp b/xmrstak/backend/amd/autoAdjust.hpp index 858c03844..075acbd49 100644 --- a/xmrstak/backend/amd/autoAdjust.hpp +++ b/xmrstak/backend/amd/autoAdjust.hpp @@ -138,7 +138,10 @@ class autoAdjust // UNKNOWN ctx.name.compare("gfx900") == 0 || ctx.name.compare("gfx903") == 0 || - ctx.name.compare("gfx905") == 0) + ctx.name.compare("gfx905") == 0 || + // Radeon VII + ctx.name.compare("gfx906") == 0 || + ctx.name.compare("Fiji") == 0) { /* Increase the number of threads for AMD VEGA gpus. * Limit the number of threads based on the issue: https://github.com/fireice-uk/xmr-stak/issues/5#issuecomment-339425089 @@ -181,6 +184,7 @@ class autoAdjust } uint32_t numUnroll = 8; + uint32_t numThreads = 1u; if(useCryptonight_gpu) { @@ -188,7 +192,11 @@ class autoAdjust // @todo check again after all optimizations maxThreads = ctx.computeUnits * 6 * 8; ctx.stridedIndex = 0; - numUnroll = 1; + // do not change unroll for AMD RX5700 but set 2 threads per gpu + if(ctx.name.compare("gfx1010") == 0) + numThreads = 2; + else + numUnroll = 1; } // keep 128MiB memory free (value is randomly chosen) from the max available memory @@ -196,7 +204,6 @@ class autoAdjust size_t memPerThread = std::min(ctx.maxMemPerAlloc, maxAvailableFreeMem); - uint32_t numThreads = 1u; if(ctx.isAMD && !useCryptonight_gpu) { numThreads = 2; @@ -210,8 +217,11 @@ class autoAdjust size_t possibleIntensity = std::min(maxThreads, maxIntensity); // map intensity to a multiple of the compute unit count, default_workSize is the number of threads per work group size_t intensity = (possibleIntensity / (default_workSize * ctx.computeUnits)) * ctx.computeUnits * default_workSize; - // in the case we use two threads per gpu we can be relax and need no multiple of the number of compute units - if(numThreads == 2) + + size_t computeUnitUtilization = ((possibleIntensity * 100) / (default_workSize * ctx.computeUnits)) % 100; + // in the case we use two threads per gpu or if we can utilize over 75% of the compute units + // we can be relax and need no multiple of the number of compute units + if(numThreads == 2 || computeUnitUtilization >= 75) intensity = (possibleIntensity / default_workSize) * default_workSize; //If the intensity is 0, then it's because the multiple of the unit count is greater than intensity diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 3a23e8624..3a65de8e2 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -170,7 +170,7 @@ void minethd::work_main() order_fix.set_value(); std::unique_lock lck(thd_aff_set); - lck.release(); + lck.unlock(); std::this_thread::yield(); cryptonight_ctx* cpu_ctx; diff --git a/xmrstak/backend/cpu/crypto/cryptonight.h b/xmrstak/backend/cpu/crypto/cryptonight.h index c8b8320b0..2a91269f8 100644 --- a/xmrstak/backend/cpu/crypto/cryptonight.h +++ b/xmrstak/backend/cpu/crypto/cryptonight.h @@ -39,6 +39,7 @@ struct cryptonight_ctx union { extra_ctx_r cn_r_ctx; }; + }; struct alloc_msg diff --git a/xmrstak/backend/cpu/hwlocMemory.cpp b/xmrstak/backend/cpu/hwlocMemory.cpp index 804edc55d..067f27975 100644 --- a/xmrstak/backend/cpu/hwlocMemory.cpp +++ b/xmrstak/backend/cpu/hwlocMemory.cpp @@ -6,6 +6,24 @@ #include +static __hwloc_inline int +xmrstak_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) +{ +#if HWLOC_API_VERSION >= 0x20000 + return hwloc_set_membind( + topology, + nodeset, + policy, + flags| HWLOC_MEMBIND_BYNODESET); +#else + return hwloc_set_membind_nodeset( + topology, + nodeset, + policy, + flags); +#endif +} + /** pin memory to NUMA node * * Set the default memory policy for the current thread to bind memory to the @@ -37,7 +55,7 @@ void bindMemoryToNUMANode(size_t puId) hwloc_obj_t pu = hwloc_get_obj_by_depth(topology, depth, i); if(pu->os_index == puId) { - if(0 > hwloc_set_membind_nodeset( + if(0 > xmrstak_set_membind_nodeset( topology, pu->nodeset, HWLOC_MEMBIND_BIND, diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index 72570e96a..43759776f 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -843,7 +843,7 @@ void minethd::multiway_work_main() order_fix.set_value(); std::unique_lock lck(thd_aff_set); - lck.release(); + lck.unlock(); std::this_thread::yield(); cryptonight_ctx* ctx[MAX_N]; diff --git a/xmrstak/backend/globalStates.hpp b/xmrstak/backend/globalStates.hpp index a3ff30eea..a67580166 100644 --- a/xmrstak/backend/globalStates.hpp +++ b/xmrstak/backend/globalStates.hpp @@ -17,7 +17,11 @@ struct globalStates { auto& env = environment::inst(); if(env.pglobalStates == nullptr) - env.pglobalStates = new globalStates; + { + std::unique_lock lck(env.update); + if(env.pglobalStates == nullptr) + env.pglobalStates = new globalStates; + } return *env.pglobalStates; } diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp index 86c860153..c65bba162 100644 --- a/xmrstak/backend/nvidia/minethd.cpp +++ b/xmrstak/backend/nvidia/minethd.cpp @@ -82,6 +82,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg) ctx.memMode = cfg.memMode; this->affinity = cfg.cpu_aff; + std::unique_lock lck(thd_aff_set); std::future numa_guard = numa_promise.get_future(); thread_work_guard = thread_work_promise.get_future(); @@ -92,14 +93,15 @@ minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg) * without concurrent threads (CUDA driver is less occupied). */ numa_guard.wait(); + + if(this->affinity >= 0) //-1 means no affinity + if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity)) + printer::inst()->print_msg(L1, "WARNING setting affinity failed."); } void minethd::start_mining() { thread_work_promise.set_value(); - if(this->affinity >= 0) //-1 means no affinity - if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity)) - printer::inst()->print_msg(L1, "WARNING setting affinity failed."); } bool minethd::self_test() @@ -194,7 +196,8 @@ void minethd::work_main() // numa memory bind and gpu memory is initialized numa_promise.set_value(); - + std::unique_lock lck(thd_aff_set); + lck.unlock(); std::this_thread::yield(); // wait until all NVIDIA devices are initialized thread_work_guard.wait(); diff --git a/xmrstak/backend/nvidia/minethd.hpp b/xmrstak/backend/nvidia/minethd.hpp index 66c49bb1f..bbbc7b6ee 100644 --- a/xmrstak/backend/nvidia/minethd.hpp +++ b/xmrstak/backend/nvidia/minethd.hpp @@ -42,6 +42,7 @@ class minethd : public iBackend std::promise numa_promise; std::promise thread_work_promise; + std::mutex thd_aff_set; // block thread until all NVIDIA GPUs are initialized std::future thread_work_guard; diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu index 8c1bb8b5d..d5b292cb4 100644 --- a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu +++ b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu @@ -634,6 +634,10 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) if(props.multiProcessorCount <= 6) ctx->device_bfactor += 2; } + + // for the most algorithms we are using 8 threads per hash + uint32_t threadsPerHash = 8; + if(ctx->device_threads == -1) { /* sm_20 devices can only run 512 threads per cuda block @@ -642,9 +646,6 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) */ const uint32_t maxThreadsPerBlock = props.major < 3 ? 512 : 1024; - // for the most algorithms we are using 8 threads per hash - uint32_t threadsPerHash = 8; - // phase2_gpu uses 16 threads per hash if(useCryptonight_gpu) threadsPerHash = 16; @@ -789,6 +790,8 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) // 8 is chosen by checking the occupancy calculator size_t blockOptimal = 8 * ctx->device_mpcount; + if(gpuArch == 30) + blockOptimal = 8 * ctx->device_mpcount; // the following values are calculated with CUDA10 and the occupancy calculator if(gpuArch == 35 || gpuArch / 10 == 5 || gpuArch / 10 == 6) blockOptimal = 7 * ctx->device_mpcount; @@ -798,26 +801,17 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) blockOptimal = 6 * ctx->device_mpcount; if(blockOptimal * threads * hashMemSize < limitedMemory) - { - ctx->device_threads = threads; ctx->device_blocks = blockOptimal; - } + else + ctx->device_blocks = limitedMemory / hashMemSize / threads; // round to a memory fitting value + ctx->device_threads = threads; } } - if(useCryptonight_gpu) - { - // cryptonight_gpu used 16 threads per share - if(ctx->device_threads * 16 > ctx->device_maxThreadsPerBlock) - { - ctx->device_threads = ctx->device_maxThreadsPerBlock / 16; - printf("WARNING: 'threads' configuration to large, value adjusted to %i\n", ctx->device_threads); - } - } - else if(ctx->device_threads * 8 > ctx->device_maxThreadsPerBlock) + if(ctx->device_threads * threadsPerHash > ctx->device_maxThreadsPerBlock) { // by default cryptonight CUDA implementations uses 8 threads per thread for some kernel - ctx->device_threads = ctx->device_maxThreadsPerBlock / 8; + ctx->device_threads = ctx->device_maxThreadsPerBlock / threadsPerHash; printf("WARNING: 'threads' configuration to large, value adjusted to %i\n", ctx->device_threads); } printf("device init succeeded\n"); diff --git a/xmrstak/backend/plugin.hpp b/xmrstak/backend/plugin.hpp index 902a66230..560507691 100644 --- a/xmrstak/backend/plugin.hpp +++ b/xmrstak/backend/plugin.hpp @@ -47,13 +47,13 @@ struct plugin fileExtension = ".dylib"; #endif // search library in working directory - libBackend = dlopen(("./lib" + libName + fileExtension).c_str(), RTLD_LAZY); + libBackend = dlopen(("./lib" + libName + fileExtension).c_str(), RTLD_NOW | RTLD_LAZY | RTLD_GLOBAL); // fallback to binary directory if(!libBackend) - libBackend = dlopen((params::inst().executablePrefix + "lib" + libName + fileExtension).c_str(), RTLD_LAZY); + libBackend = dlopen((params::inst().executablePrefix + "lib" + libName + fileExtension).c_str(), RTLD_NOW | RTLD_LAZY | RTLD_GLOBAL); // try use LD_LIBRARY_PATH if(!libBackend) - libBackend = dlopen(("lib" + libName + fileExtension).c_str(), RTLD_LAZY); + libBackend = dlopen(("lib" + libName + fileExtension).c_str(), RTLD_NOW | RTLD_LAZY | RTLD_GLOBAL); if(!libBackend) { std::cerr << "WARNING: " << m_backendName << " cannot load backend library: " << dlerror() << std::endl; diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 7d358edb3..607e863e1 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -219,7 +219,7 @@ void do_guided_pool_config() configTpl.set(std::string(tpl)); bool prompted = false; - auto& currency = params::inst().currency; + auto currency = params::inst().currency; if(currency.empty() || !jconf::IsOnAlgoList(currency)) { prompt_once(prompted); @@ -236,7 +236,7 @@ void do_guided_pool_config() currency = tmp; } - auto& pool = params::inst().poolURL; + auto pool = params::inst().poolURL; bool userSetPool = true; if(pool.empty()) { @@ -247,7 +247,7 @@ void do_guided_pool_config() std::cin >> pool; } - auto& userName = params::inst().poolUsername; + auto userName = params::inst().poolUsername; if(userName.empty()) { prompt_once(prompted); @@ -257,7 +257,7 @@ void do_guided_pool_config() } bool stdin_flushed = false; - auto& passwd = params::inst().poolPasswd; + auto passwd = params::inst().poolPasswd; if(passwd.empty() && !params::inst().userSetPwd) { prompt_once(prompted); @@ -271,7 +271,7 @@ void do_guided_pool_config() getline(std::cin, passwd); } - auto& rigid = params::inst().poolRigid; + auto rigid = params::inst().poolRigid; if(rigid.empty() && !params::inst().userSetRigid) { if(!use_simple_start()) @@ -366,7 +366,7 @@ void do_guided_config() configTpl.set(std::string(tpl)); bool prompted = false; - auto& http_port = params::inst().httpd_port; + auto http_port = params::inst().httpd_port; if(http_port == params::httpd_port_unset) { http_port = params::httpd_port_disabled; @@ -937,6 +937,12 @@ int do_benchmark(int block_version, int wait_sec, int work_sec) printer::inst()->print_msg(L0, "Prepare benchmark for block version %d", block_version); + if(block_version <= 0) + { + printer::inst()->print_msg(L0, "Block version must be >0, current value is %u.", block_version); + return 1; + } + uint8_t work[128]; memset(work, 0, 128); work[0] = static_cast(block_version); diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp index bf76d34f3..c50211d1e 100644 --- a/xmrstak/jconf.cpp +++ b/xmrstak/jconf.cpp @@ -101,7 +101,6 @@ constexpr size_t iConfigCnt = (sizeof(oConfigValues) / sizeof(oConfigValues[0])) xmrstak::coin_selection coins[] = { // name, userpool, devpool, default_pool_suggestion - {"aeon7", {POW(cryptonight_aeon)}, {POW(cryptonight_aeon)}, "mine.aeon-pool.com:5555"}, {"bbscoin", {POW(cryptonight_aeon)}, {POW(cryptonight_aeon)}, nullptr}, {"bittube", {POW(cryptonight_bittube2)}, {POW(cryptonight_gpu)}, "mining.bit.tube:13333"}, {"cryptonight", {POW(cryptonight)}, {POW(cryptonight_gpu)}, nullptr}, @@ -128,7 +127,6 @@ xmrstak::coin_selection coins[] = { {"haven", {POW(cryptonight_haven)}, {POW(cryptonight_gpu)}, nullptr}, {"lethean", {POW(cryptonight_r)}, {POW(cryptonight_r)}, nullptr}, {"masari", {POW(cryptonight_v8_half)}, {POW(cryptonight_gpu)}, nullptr}, - {"monero", {POW(cryptonight_r)}, {POW(cryptonight_r)}, "monero.miner.rocks:5551"}, {"qrl", {POW(cryptonight_monero)}, {POW(cryptonight_gpu)}, nullptr}, {"ryo", {POW(cryptonight_gpu)}, {POW(cryptonight_gpu)}, "pool.ryo-currency.com:3333"}, {"torque", {POW(cryptonight_v8_half)}, {POW(cryptonight_gpu)}, nullptr}, diff --git a/xmrstak/jconf.hpp b/xmrstak/jconf.hpp index 5597bf23e..17cbf5b9a 100644 --- a/xmrstak/jconf.hpp +++ b/xmrstak/jconf.hpp @@ -14,7 +14,11 @@ class jconf { auto& env = xmrstak::environment::inst(); if(env.pJconfConfig == nullptr) - env.pJconfConfig = new jconf; + { + std::unique_lock lck(env.update); + if(env.pJconfConfig == nullptr) + env.pJconfConfig = new jconf; + } return env.pJconfConfig; }; diff --git a/xmrstak/misc/console.hpp b/xmrstak/misc/console.hpp index 3c27ee86b..12efef6c7 100644 --- a/xmrstak/misc/console.hpp +++ b/xmrstak/misc/console.hpp @@ -48,7 +48,11 @@ class printer { auto& env = xmrstak::environment::inst(); if(env.pPrinter == nullptr) - env.pPrinter = new printer; + { + std::unique_lock lck(env.update); + if(env.pPrinter == nullptr) + env.pPrinter = new printer; + } return env.pPrinter; }; diff --git a/xmrstak/misc/environment.cpp b/xmrstak/misc/environment.cpp new file mode 100644 index 000000000..9f1be511d --- /dev/null +++ b/xmrstak/misc/environment.cpp @@ -0,0 +1,19 @@ +#include "environment.hpp" + +#include "xmrstak/misc/console.hpp" +#include "xmrstak/backend/cpu/crypto/cryptonight.h" +#include "xmrstak/params.hpp" +#include "xmrstak/misc/executor.hpp" +#include "xmrstak/jconf.hpp" + +namespace xmrstak +{ +void environment::init_singeltons() +{ + printer::inst(); + globalStates::inst(); + jconf::inst(); + executor::inst(); + params::inst(); +} +} diff --git a/xmrstak/misc/environment.hpp b/xmrstak/misc/environment.hpp index b67c85874..f37aedd61 100644 --- a/xmrstak/misc/environment.hpp +++ b/xmrstak/misc/environment.hpp @@ -1,5 +1,7 @@ #pragma once +#include + class printer; class jconf; class executor; @@ -19,7 +21,10 @@ struct environment if(env == nullptr) { if(init == nullptr) + { env = new environment; + env->init_singeltons(); + } else env = init; } @@ -36,6 +41,11 @@ struct environment jconf* pJconfConfig = nullptr; executor* pExecutor = nullptr; params* pParams = nullptr; + + std::mutex update; + +private: + void init_singeltons(); }; } // namespace xmrstak diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index 455ba9119..0266312d1 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -551,8 +551,9 @@ void executor::ex_main() const char* rigid = params.userSetRigid ? params.poolRigid.c_str() : cfg.sRigId; const char* pwd = params.userSetPwd ? params.poolPasswd.c_str() : cfg.sPasswd; bool nicehash = cfg.nicehash || params.nicehashMode; + bool tls = params.poolUseTls; - pools.emplace_back(i + 1, cfg.sPoolAddr, wallet, rigid, pwd, 9.9, false, params.poolUseTls, cfg.tls_fingerprint, nicehash); + pools.emplace_back(i + 1, cfg.sPoolAddr, wallet, rigid, pwd, 9.9, false, tls, cfg.tls_fingerprint, nicehash); } else pools.emplace_back(i + 1, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sRigId, cfg.sPasswd, cfg.weight, false, cfg.tls, cfg.tls_fingerprint, cfg.nicehash); @@ -783,7 +784,7 @@ void executor::hashrate_report(std::string& out) std::string motd; for(jpsock& pool : pools) { - motd.empty(); + motd.clear(); if(pool.get_pool_motd(motd) && motd_filter_console(motd)) { out.append("Message from ").append(pool.get_pool_addr()).append(":\n"); @@ -1040,7 +1041,7 @@ void executor::http_hashrate_report(std::string& out) std::string motd; for(jpsock& pool : pools) { - motd.empty(); + motd.clear(); if(pool.get_pool_motd(motd) && motd_filter_web(motd)) { if(!have_motd) diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index 47359afc2..385b2f4e3 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -32,7 +32,11 @@ class executor { auto& env = xmrstak::environment::inst(); if(env.pExecutor == nullptr) - env.pExecutor = new executor; + { + std::unique_lock lck(env.update); + if(env.pExecutor == nullptr) + env.pExecutor = new executor; + } return env.pExecutor; }; diff --git a/xmrstak/misc/telemetry.cpp b/xmrstak/misc/telemetry.cpp index 75fb4f434..ea73e6281 100644 --- a/xmrstak/misc/telemetry.cpp +++ b/xmrstak/misc/telemetry.cpp @@ -23,7 +23,6 @@ #include "telemetry.hpp" #include "xmrstak/net/msgstruct.hpp" -#include "xmrstak/cpputil/read_write_lock.h" #include #include @@ -37,7 +36,6 @@ telemetry::telemetry(size_t iThd) ppHashCounts = new uint64_t*[iThd]; ppTimestamps = new uint64_t*[iThd]; iBucketTop = new uint32_t[iThd]; - mtx = new ::cpputil::RWLock[iThd]; for(size_t i = 0; i < iThd; i++) { @@ -58,7 +56,6 @@ double telemetry::calc_telemetry_data(size_t iLastMillisec, size_t iThread) uint64_t iLatestHashCnt = 0; bool bHaveFullSet = false; - mtx[iThread].ReadLock(); uint64_t iTimeNow = get_timestamp_ms(); //Start at 1, buckettop points to next empty @@ -84,7 +81,6 @@ double telemetry::calc_telemetry_data(size_t iLastMillisec, size_t iThread) iEarliestStamp = ppTimestamps[iThread][idx]; iEarliestHashCnt = ppHashCounts[iThread][idx]; } - mtx[iThread].UnLock(); if(!bHaveFullSet || iEarliestStamp == 0 || iLatestStamp == 0) return nan(""); @@ -103,13 +99,11 @@ double telemetry::calc_telemetry_data(size_t iLastMillisec, size_t iThread) void telemetry::push_perf_value(size_t iThd, uint64_t iHashCount, uint64_t iTimestamp) { - mtx[iThd].WriteLock(); size_t iTop = iBucketTop[iThd]; ppHashCounts[iThd][iTop] = iHashCount; ppTimestamps[iThd][iTop] = iTimestamp; iBucketTop[iThd] = (iTop + 1) & iBucketMask; - mtx[iThd].UnLock(); } } // namespace xmrstak diff --git a/xmrstak/misc/telemetry.hpp b/xmrstak/misc/telemetry.hpp index a7b77c287..fb87bcd32 100644 --- a/xmrstak/misc/telemetry.hpp +++ b/xmrstak/misc/telemetry.hpp @@ -1,10 +1,7 @@ #pragma once -#include "xmrstak/cpputil/read_write_lock.h" - #include #include -#include namespace xmrstak { @@ -17,7 +14,6 @@ class telemetry double calc_telemetry_data(size_t iLastMillisec, size_t iThread); private: - ::cpputil::RWLock* mtx; constexpr static size_t iBucketSize = 2 << 11; //Power of 2 to simplify calculations constexpr static size_t iBucketMask = iBucketSize - 1; uint32_t* iBucketTop; diff --git a/xmrstak/params.hpp b/xmrstak/params.hpp index 9f958f937..5bfbac381 100644 --- a/xmrstak/params.hpp +++ b/xmrstak/params.hpp @@ -15,7 +15,11 @@ struct params { auto& env = environment::inst(); if(env.pParams == nullptr) - env.pParams = new params; + { + std::unique_lock lck(env.update); + if(env.pParams == nullptr) + env.pParams = new params; + } return *env.pParams; } diff --git a/xmrstak/pools.tpl b/xmrstak/pools.tpl index a7a1cba43..eb57a3f04 100644 --- a/xmrstak/pools.tpl +++ b/xmrstak/pools.tpl @@ -19,14 +19,12 @@ POOLCONF], /* * Currency to mine. Supported values: * - * aeon7 (use this for Aeon's new PoW) * bbscoin (automatic switch with block version 3 to cryptonight_v7) * bittube (uses cryptonight_bittube2 algorithm) * graft * haven (automatic switch with block version 3 to cryptonight_haven) * lethean * masari - * monero (use this to support Monero's Oct 2018 fork) * qrl - Quantum Resistant Ledger * ryo * turtlecoin diff --git a/xmrstak/version.cpp b/xmrstak/version.cpp index bbf5a84c8..51c4e4e63 100644 --- a/xmrstak/version.cpp +++ b/xmrstak/version.cpp @@ -20,7 +20,7 @@ #endif #define XMR_STAK_NAME "xmr-stak" -#define XMR_STAK_VERSION "2.10.7" +#define XMR_STAK_VERSION "2.10.8" #if defined(_WIN32) #define OS_TYPE "win"