mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-07 07:55:04 -05:00
Compare commits
262 Commits
v4.0.0-bet
...
v5.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa18a75177 | ||
|
|
0e7c0e2903 | ||
|
|
f3c1435b01 | ||
|
|
fb28b931cc | ||
|
|
dd980fde49 | ||
|
|
ca77fda511 | ||
|
|
e3f726796b | ||
|
|
3953568a0e | ||
|
|
f9bc3fb09b | ||
|
|
0497ab072b | ||
|
|
5431601cef | ||
|
|
aeb2c6e8ec | ||
|
|
79f4685d9a | ||
|
|
5fa7a743f5 | ||
|
|
9124ed9348 | ||
|
|
55133d03cf | ||
|
|
77eb79ced5 | ||
|
|
9d24d181d7 | ||
|
|
b011b935b4 | ||
|
|
d807ba27a6 | ||
|
|
2847c814d2 | ||
|
|
f77c4c67f2 | ||
|
|
13d256e737 | ||
|
|
ed4cfd55ac | ||
|
|
f965fd5a8c | ||
|
|
472ec1a0e6 | ||
|
|
74d62c92cd | ||
|
|
7e47b04676 | ||
|
|
d19c152d9a | ||
|
|
2abea46a87 | ||
|
|
e450e62b40 | ||
|
|
e6afd12d4f | ||
|
|
2ba19c9827 | ||
|
|
426bc8f0c4 | ||
|
|
f9f7567b17 | ||
|
|
d2b3ffc710 | ||
|
|
ed2f2c5a60 | ||
|
|
c235145121 | ||
|
|
f8d1488e33 | ||
|
|
0013e610d5 | ||
|
|
2c9b034c08 | ||
|
|
455cdf96f0 | ||
|
|
5519e97e6e | ||
|
|
4c4a674a4b | ||
|
|
239aecb0bb | ||
|
|
b1e23b46dd | ||
|
|
9d679462ed | ||
|
|
be31811920 | ||
|
|
26ed6254dc | ||
|
|
1cb4d73fe3 | ||
|
|
f110b5000b | ||
|
|
83f437f979 | ||
|
|
175a7b06b7 | ||
|
|
9d580693db | ||
|
|
3bdf7111ce | ||
|
|
23ebcfb2db | ||
|
|
b1eac17d60 | ||
|
|
9dfa38f1e7 | ||
|
|
80fd0f9fab | ||
|
|
58174e5e91 | ||
|
|
ab7f0cb4cc | ||
|
|
f6f480264e | ||
|
|
8cd265c38c | ||
|
|
99fe304c1f | ||
|
|
7889634b40 | ||
|
|
0e224abb0a | ||
|
|
c9f7cbae09 | ||
|
|
2e537013a2 | ||
|
|
7cb9b92347 | ||
|
|
bb2cc0deb7 | ||
|
|
d4a3024996 | ||
|
|
77d5b73724 | ||
|
|
ec717f27b5 | ||
|
|
0fc215c457 | ||
|
|
534a764023 | ||
|
|
dc705d88ab | ||
|
|
6e9fd5a430 | ||
|
|
e3f37bc2f9 | ||
|
|
f6d58c7d46 | ||
|
|
48545c5916 | ||
|
|
f7dcfffdb1 | ||
|
|
52281906c6 | ||
|
|
487b2a3655 | ||
|
|
71ee145f70 | ||
|
|
da20d74145 | ||
|
|
c29fa62260 | ||
|
|
5613912ec4 | ||
|
|
b77c5428f9 | ||
|
|
2012ce384e | ||
|
|
6b40ede2bc | ||
|
|
128c5f67ad | ||
|
|
578bebb04d | ||
|
|
5611249af7 | ||
|
|
a56febcd13 | ||
|
|
0ad992985c | ||
|
|
1a66c3f1a1 | ||
|
|
a2ef2fd9d9 | ||
|
|
5c02cb50da | ||
|
|
998c55030a | ||
|
|
079de97fab | ||
|
|
432addab33 | ||
|
|
10d292092a | ||
|
|
a02ee96651 | ||
|
|
d783febad6 | ||
|
|
ea6d9073b7 | ||
|
|
83a5923568 | ||
|
|
9e2b63890c | ||
|
|
ed08895d4a | ||
|
|
5b4026694d | ||
|
|
c9798ba2e9 | ||
|
|
3752551e53 | ||
|
|
a62f6f9552 | ||
|
|
e9d2e194f3 | ||
|
|
6009fffa7b | ||
|
|
fad1e5fb3c | ||
|
|
228f02c361 | ||
|
|
72c45d882b | ||
|
|
4dc7a8103b | ||
|
|
71108e1bde | ||
|
|
72b7d934f6 | ||
|
|
08e9e834b9 | ||
|
|
c26c4ce714 | ||
|
|
61ab47cc95 | ||
|
|
7db7b3727d | ||
|
|
1d03b942a5 | ||
|
|
ee87f73d5e | ||
|
|
bb7bff9115 | ||
|
|
1e5fdde9ba | ||
|
|
2b29a4c20f | ||
|
|
119e7ea7bf | ||
|
|
58c81be1f1 | ||
|
|
d3b137c817 | ||
|
|
9dce868fb9 | ||
|
|
c4170fbb86 | ||
|
|
2dc4ceae29 | ||
|
|
0e0a26f644 | ||
|
|
68d77b02d7 | ||
|
|
c13c83b902 | ||
|
|
72c9d94390 | ||
|
|
9101469308 | ||
|
|
759573ace3 | ||
|
|
0a1836e5a8 | ||
|
|
8af1075c98 | ||
|
|
91498ec690 | ||
|
|
59b62dcb77 | ||
|
|
10f9b29e03 | ||
|
|
d5af5cf8f8 | ||
|
|
05928ccc25 | ||
|
|
ad6dc876b3 | ||
|
|
207dae418d | ||
|
|
7508411faf | ||
|
|
f34031a984 | ||
|
|
d1aadc2e3b | ||
|
|
6d8cf91568 | ||
|
|
96b2560f79 | ||
|
|
923d47fff0 | ||
|
|
542a27a032 | ||
|
|
a7e8ac6cf8 | ||
|
|
42fd146c2b | ||
|
|
34468782cd | ||
|
|
3badeb56a0 | ||
|
|
bc18b5d0be | ||
|
|
158d2e4302 | ||
|
|
f60118ee79 | ||
|
|
6bc217e985 | ||
|
|
3560b6a3c2 | ||
|
|
77eecdd2c2 | ||
|
|
f4943b77f3 | ||
|
|
c908ef2489 | ||
|
|
d21155f3c6 | ||
|
|
da39ed2ce0 | ||
|
|
06500761fb | ||
|
|
919a6c0cc4 | ||
|
|
467e5115b0 | ||
|
|
c495802f64 | ||
|
|
66e48ed2d7 | ||
|
|
ac4cd3eb9b | ||
|
|
5d73402651 | ||
|
|
427b6516e0 | ||
|
|
eae9009b98 | ||
|
|
166d8dd53c | ||
|
|
680081b93b | ||
|
|
e66eeefb14 | ||
|
|
8e9e8cd169 | ||
|
|
f96538dfba | ||
|
|
9ad174c129 | ||
|
|
17b40ac4ad | ||
|
|
4453727754 | ||
|
|
d086318f4e | ||
|
|
5b7f1fe853 | ||
|
|
4c357d2d60 | ||
|
|
0eb5588454 | ||
|
|
5ba8b43fb8 | ||
|
|
0eb754d76e | ||
|
|
7c463849cc | ||
|
|
daed23422e | ||
|
|
550e332909 | ||
|
|
43f26dcd76 | ||
|
|
e1d1a5226c | ||
|
|
82aaa89ab6 | ||
|
|
aac384f54f | ||
|
|
ffccaa8817 | ||
|
|
bd488a6182 | ||
|
|
41ec1b4cb2 | ||
|
|
18bf9d3d95 | ||
|
|
56e070b3d1 | ||
|
|
88a9f8d892 | ||
|
|
0f367ab117 | ||
|
|
838f078fa5 | ||
|
|
d6f0555771 | ||
|
|
3ee3d13f0f | ||
|
|
6267ecc3dc | ||
|
|
1487a037ed | ||
|
|
1bba25e080 | ||
|
|
c6096c3c34 | ||
|
|
2604705bab | ||
|
|
5f948d0d96 | ||
|
|
3e42fa28df | ||
|
|
d9dc6a396f | ||
|
|
bdb72684b0 | ||
|
|
0f05936e63 | ||
|
|
290493e485 | ||
|
|
637301d340 | ||
|
|
c7e4815d79 | ||
|
|
54d73b7ac5 | ||
|
|
cbdf1e6c09 | ||
|
|
2e49930b94 | ||
|
|
9da0cb2ad1 | ||
|
|
cf6bd0e772 | ||
|
|
dc686bd1bf | ||
|
|
e002dbf57e | ||
|
|
38f4f4f695 | ||
|
|
a4bc548fe5 | ||
|
|
e57798360f | ||
|
|
3cbbc94249 | ||
|
|
cbc08e696f | ||
|
|
6e45ab599e | ||
|
|
e55fb68a29 | ||
|
|
7a1ff6bfed | ||
|
|
18809ddf0b | ||
|
|
7158514d48 | ||
|
|
3445f47482 | ||
|
|
5b33443607 | ||
|
|
05b2c66aaf | ||
|
|
50038516cb | ||
|
|
f6752310b4 | ||
|
|
e5c75fa2f7 | ||
|
|
40e8bfe443 | ||
|
|
ed11c0a6da | ||
|
|
365667ee0a | ||
|
|
1cfd5f0735 | ||
|
|
e8ee091e5a | ||
|
|
133cd30b2e | ||
|
|
e3fcb99d84 | ||
|
|
e8acb8a2a9 | ||
|
|
2a107cc463 | ||
|
|
1cd1f13fee | ||
|
|
7af3e4e340 | ||
|
|
d8b07570a3 | ||
|
|
95c960574a | ||
|
|
171762d1aa | ||
|
|
78fd2fd0ac |
70
CHANGELOG.md
70
CHANGELOG.md
@@ -1,51 +1,31 @@
|
||||
# v4.0.0-beta
|
||||
# v5.0.1
|
||||
- [#1234](https://github.com/xmrig/xmrig/issues/1234) Fixed compatibility with some AMD GPUs.
|
||||
- [#1284](https://github.com/xmrig/xmrig/issues/1284) Fixed build without RandomX.
|
||||
- [#1285](https://github.com/xmrig/xmrig/issues/1285) Added command line options `--cuda-bfactor-hint` and `--cuda-bsleep-hint`.
|
||||
- [#1290](https://github.com/xmrig/xmrig/pull/1290) Fixed 32-bit ARM compilation.
|
||||
|
||||
# v5.0.0
|
||||
This version is first stable unified 3 in 1 GPU+CPU release, OpenCL support built in in miner and not require additional external dependencies on compile time, NVIDIA CUDA available as external [CUDA plugin](https://github.com/xmrig/xmrig-cuda), for convenient, 3 in 1 downloads with recent CUDA version also provided.
|
||||
|
||||
This release based on 4.x.x series and include all features from v4.6.2-beta, changelog below include only the most important changes, [full changelog](doc/CHANGELOG_OLD.md) available separately.
|
||||
|
||||
- [#1272](https://github.com/xmrig/xmrig/pull/1272) Optimized hashrate calculation.
|
||||
- [#1263](https://github.com/xmrig/xmrig/pull/1263) Added new option `dataset_host` for NVIDIA GPUs with less than 4 GB memory (RandomX only).
|
||||
- [#1068](https://github.com/xmrig/xmrig/pull/1068) Added support for `self-select` stratum protocol extension.
|
||||
- [#1227](https://github.com/xmrig/xmrig/pull/1227) Added new algorithm `rx/arq`, RandomX variant for upcoming ArQmA fork.
|
||||
- [#808](https://github.com/xmrig/xmrig/issues/808#issuecomment-539297156) Added experimental support for persistent memory for CPU mining threads.
|
||||
- [#1221](https://github.com/xmrig/xmrig/issues/1221) Improved RandomX dataset memory usage and initialization speed for NUMA machines.
|
||||
- [#1175](https://github.com/xmrig/xmrig/issues/1175) Fixed support for systems where total count of NUMA nodes not equal usable nodes count.
|
||||
- Added config option `cpu/max-threads-hint` and command line option `--cpu-max-threads-hint`.
|
||||
- [#1185](https://github.com/xmrig/xmrig/pull/1185) Added JIT compiler for RandomX on ARMv8.
|
||||
- Improved API endpoint `GET /2/backends` and added support for this endpoint to [workers.xmrig.info](http://workers.xmrig.info).
|
||||
- Added command line option `--no-cpu` to disable CPU backend.
|
||||
- Added OpenCL specific command line options: `--opencl`, `--opencl-devices`, `--opencl-platform`, `--opencl-loader` and `--opencl-no-cache`.
|
||||
- Added CUDA specific command line options: `--cuda`, `--cuda-loader` and `--no-nvml`.
|
||||
- Removed command line option `--http-enabled`, HTTP API enabled automatically if any other `--http-*` option provided.
|
||||
- [#1172](https://github.com/xmrig/xmrig/issues/1172) **Added OpenCL mining backend.**
|
||||
- [#268](https://github.com/xmrig/xmrig-amd/pull/268) [#270](https://github.com/xmrig/xmrig-amd/pull/270) [#271](https://github.com/xmrig/xmrig-amd/pull/271) [#273](https://github.com/xmrig/xmrig-amd/pull/273) [#274](https://github.com/xmrig/xmrig-amd/pull/274) [#1171](https://github.com/xmrig/xmrig/pull/1171) Added RandomX support for OpenCL, thanks [@SChernykh](https://github.com/SChernykh).
|
||||
- Algorithm `cn/wow` removed, as no longer alive.
|
||||
|
||||
# v3.1.2
|
||||
- Many RandomX optimizations and fixes.
|
||||
- [#1132](https://github.com/xmrig/xmrig/issues/1132) Fixed build on CentOS 7.
|
||||
- [#1163](https://github.com/xmrig/xmrig/pull/1163) Optimized soft AES code, up to +30% hashrate on CPU without AES support and other optimizations.
|
||||
- [#1166](https://github.com/xmrig/xmrig/pull/1166) Fixed crash when initialize dataset with big threads count (eg 272).
|
||||
- [#1168](https://github.com/xmrig/xmrig/pull/1168) Optimized loading from scratchpad.
|
||||
- [#1128](https://github.com/xmrig/xmrig/issues/1128) Fixed CMake 2.8 compatibility.
|
||||
|
||||
# v3.1.1
|
||||
- [#1133](https://github.com/xmrig/xmrig/issues/1133) Fixed syslog regression.
|
||||
- [#1138](https://github.com/xmrig/xmrig/issues/1138) Fixed multiple network bugs.
|
||||
- [#1141](https://github.com/xmrig/xmrig/issues/1141) Fixed log in background mode.
|
||||
- [#1142](https://github.com/xmrig/xmrig/pull/1142) RandomX hashrate improved by 0.5-1.5% depending on variant and CPU.
|
||||
- [#1146](https://github.com/xmrig/xmrig/pull/1146) Fixed race condition in RandomX thread init.
|
||||
- [#1148](https://github.com/xmrig/xmrig/pull/1148) Fixed, on Linux linker marking entire executable as having an executable stack.
|
||||
- Fixed, for Argon2 algorithms command line options like `--threads` was ignored.
|
||||
- Fixed command line options for single pool, free order allowed again.
|
||||
|
||||
# v3.1.0
|
||||
- [#1107](https://github.com/xmrig/xmrig/issues/1107#issuecomment-522235892) Added Argon2 algorithm family: `argon2/chukwa` and `argon2/wrkz`.
|
||||
|
||||
# v3.0.0
|
||||
- **[#1111](https://github.com/xmrig/xmrig/pull/1111) Added RandomX (`rx/test`) algorithm for testing and benchmarking.**
|
||||
- **[#1036](https://github.com/xmrig/xmrig/pull/1036) Added RandomWOW (`rx/wow`) algorithm for [Wownero](http://wownero.org/).**
|
||||
- **[#1050](https://github.com/xmrig/xmrig/pull/1050) Added RandomXL (`rx/loki`) algorithm for [Loki](https://loki.network/).**
|
||||
- **[#1077](https://github.com/xmrig/xmrig/issues/1077) Added NUMA support via hwloc**.
|
||||
- **Added flexible [multi algorithm](doc/CPU.md) configuration.**
|
||||
- **Added unlimited switching between incompatible algorithms, all mining options can be changed in runtime.**
|
||||
- [#257](https://github.com/xmrig/xmrig-nvidia/pull/257) New logging subsystem, file and syslog now always without colors.
|
||||
- [#314](https://github.com/xmrig/xmrig-proxy/issues/314) Added donate over proxy feature.
|
||||
- [#1007](https://github.com/xmrig/xmrig/issues/1007) Old HTTP API backend based on libmicrohttpd, replaced to custom HTTP server (libuv + http_parser).
|
||||
- [#1010](https://github.com/xmrig/xmrig/pull/1010#issuecomment-482632107) Added daemon support (solo mining).
|
||||
- [#1066](https://github.com/xmrig/xmrig/issues/1066#issuecomment-518080529) Added error message if pool not ready for RandomX.
|
||||
- [#1105](https://github.com/xmrig/xmrig/issues/1105) Improved auto configuration for `cn-pico` algorithm.
|
||||
- Added commands `pause` and `resume` via JSON RPC 2.0 API (`POST /json_rpc`).
|
||||
- Added command line option `--export-topology` for export hwloc topology to a XML file.
|
||||
- Breaked backward compatibility with previous configs and command line, `variant` option replaced to `algo`, global option `algo` removed, all CPU related settings moved to `cpu` object.
|
||||
- Options `av`, `safe` and `max-cpu-usage` removed.
|
||||
- Algorithm `cn/msr` renamed to `cn/fast`.
|
||||
- Algorithm `cn/xtl` removed.
|
||||
- API endpoint `GET /1/threads` replaced to `GET /2/backends`.
|
||||
- Added global uptime and extended connection information in API.
|
||||
- API now return current algorithm.
|
||||
|
||||
# Previous versions
|
||||
[doc/CHANGELOG_OLD.md](doc/CHANGELOG_OLD.md)
|
||||
|
||||
@@ -15,6 +15,8 @@ option(WITH_TLS "Enable OpenSSL support" ON)
|
||||
option(WITH_ASM "Enable ASM PoW implementations" ON)
|
||||
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
||||
option(WITH_OPENCL "Enable OpenCL backend" ON)
|
||||
option(WITH_CUDA "Enable CUDA backend" ON)
|
||||
option(WITH_NVML "Enable NVML (NVIDIA Management Library) support (only if CUDA backend enabled)" ON)
|
||||
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
||||
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
||||
|
||||
@@ -55,6 +57,7 @@ set(HEADERS
|
||||
)
|
||||
|
||||
set(HEADERS_CRYPTO
|
||||
src/backend/common/interfaces/IMemoryPool.h
|
||||
src/crypto/cn/asm/CryptonightR_template.h
|
||||
src/crypto/cn/c_blake256.h
|
||||
src/crypto/cn/c_groestl.h
|
||||
@@ -71,7 +74,9 @@ set(HEADERS_CRYPTO
|
||||
src/crypto/cn/skein_port.h
|
||||
src/crypto/cn/soft_aes.h
|
||||
src/crypto/common/Algorithm.h
|
||||
src/crypto/common/Coin.h
|
||||
src/crypto/common/keccak.h
|
||||
src/crypto/common/MemoryPool.h
|
||||
src/crypto/common/Nonce.h
|
||||
src/crypto/common/portable/mm_malloc.h
|
||||
src/crypto/common/VirtualMemory.h
|
||||
@@ -108,11 +113,24 @@ set(SOURCES_CRYPTO
|
||||
src/crypto/cn/CnCtx.cpp
|
||||
src/crypto/cn/CnHash.cpp
|
||||
src/crypto/common/Algorithm.cpp
|
||||
src/crypto/common/Coin.cpp
|
||||
src/crypto/common/keccak.cpp
|
||||
src/crypto/common/MemoryPool.cpp
|
||||
src/crypto/common/Nonce.cpp
|
||||
src/crypto/common/VirtualMemory.cpp
|
||||
)
|
||||
|
||||
if (WITH_HWLOC)
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/common/NUMAMemoryPool.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/common/NUMAMemoryPool.cpp
|
||||
src/crypto/common/VirtualMemory_hwloc.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set(SOURCES_OS
|
||||
"${SOURCES_OS}"
|
||||
@@ -143,7 +161,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
EXECUTE_PROCESS(COMMAND uname -o COMMAND tr -d '\n' OUTPUT_VARIABLE OPERATING_SYSTEM)
|
||||
if (OPERATING_SYSTEM MATCHES "Android")
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} log)
|
||||
|
||||
100
README.md
100
README.md
@@ -1,5 +1,7 @@
|
||||
# XMRig
|
||||
|
||||
**:warning: [Monero will change PoW algorithm to RandomX on November 30.](https://github.com/xmrig/xmrig/issues/1204)**
|
||||
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
@@ -7,75 +9,99 @@
|
||||
[](https://github.com/xmrig/xmrig/stargazers)
|
||||
[](https://github.com/xmrig/xmrig/network)
|
||||
|
||||
XMRig is a high performance RandomX and CryptoNight CPU miner, with official support for Windows.
|
||||
XMRig High performance, open source, cross platform RandomX, CryptoNight and Argon2 CPU/GPU miner, with official support for Windows.
|
||||
|
||||
* This is the **CPU-mining** version, there is also a [NVIDIA GPU version](https://github.com/xmrig/xmrig-nvidia) and [AMD GPU version]( https://github.com/xmrig/xmrig-amd).
|
||||
## Mining backends
|
||||
- **CPU** (x64/x86/ARM)
|
||||
- **OpenCL** for AMD GPUs.
|
||||
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda).
|
||||
|
||||
<img src="doc/screenshot.png" width="808" >
|
||||
|
||||
#### Table of contents
|
||||
* [Download](#download)
|
||||
* [Usage](#usage)
|
||||
* [Build](https://github.com/xmrig/xmrig/wiki/Build)
|
||||
* [Donations](#donations)
|
||||
* [Contacts](#contacts)
|
||||
|
||||
## Download
|
||||
* Binary releases: https://github.com/xmrig/xmrig/releases
|
||||
* Git tree: https://github.com/xmrig/xmrig.git
|
||||
* Clone with `git clone https://github.com/xmrig/xmrig.git` :hammer: [Build instructions](https://github.com/xmrig/xmrig/wiki/Build).
|
||||
|
||||
## Usage
|
||||
Preferend way to configure miner is [JSON config file](src/config.json) as more flexible and human frendly, command line interface not cover all features, for example mining profiles for different algorithms. Most impotant options can be changed in runtime without miner restart by editing config or via API.
|
||||
The preferred way to configure the miner is the [JSON config file](src/config.json) as it is more flexible and human friendly. The command line interface does not cover all features, such as mining profiles for different algorithms. Important options can be changed during runtime without miner restart by editing the config file or executing API calls.
|
||||
|
||||
### Options
|
||||
* **[xmrig.com/wizard](https://xmrig.com/wizard)** helps you create initial configuration for the miner.
|
||||
* **[workers.xmrig.info](http://workers.xmrig.info)** helps manage your miners via HTTP API.
|
||||
|
||||
### Command line options
|
||||
```
|
||||
-a, --algo=ALGO specify the algorithm to use
|
||||
cn/r, cn/2, cn/1, cn/0, cn/double, cn/half, cn/fast,
|
||||
cn/rwz, cn/zls, cn/xao, cn/rto, cn/gpu,
|
||||
cn-lite/1,
|
||||
cn-heavy/xhv, cn-heavy/tube, cn-heavy/0,
|
||||
cn-pico,
|
||||
rx/wow, rx/loki
|
||||
Network:
|
||||
-o, --url=URL URL of mining server
|
||||
-O, --userpass=U:P username:password pair for mining server
|
||||
-a, --algo=ALGO mining algorithm https://xmrig.com/docs/algorithms
|
||||
--coin=COIN specify coin instead of algorithm
|
||||
-u, --user=USERNAME username for mining server
|
||||
-p, --pass=PASSWORD password for mining server
|
||||
--rig-id=ID rig identifier for pool-side statistics (needs pool support)
|
||||
-t, --threads=N number of miner threads
|
||||
-v, --av=N algorithm variation, 0 auto select
|
||||
-O, --userpass=U:P username:password pair for mining server
|
||||
-k, --keepalive send keepalived packet for prevent timeout (needs pool support)
|
||||
--nicehash enable nicehash.com support
|
||||
--rig-id=ID rig identifier for pool-side statistics (needs pool support)
|
||||
--tls enable SSL/TLS support (needs pool support)
|
||||
--tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning
|
||||
--tls-fingerprint=HEX pool TLS certificate fingerprint for strict certificate pinning
|
||||
--daemon use daemon RPC instead of pool for solo mining
|
||||
--daemon-poll-interval=N daemon poll interval in milliseconds (default: 1000)
|
||||
-r, --retries=N number of times to retry before switch to backup server (default: 5)
|
||||
-R, --retry-pause=N time to pause between retries (default: 5)
|
||||
--user-agent set custom user-agent string for pool
|
||||
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)
|
||||
--donate-over-proxy=N control donate over xmrig-proxy feature
|
||||
|
||||
CPU backend:
|
||||
--no-cpu disable CPU mining backend
|
||||
-t, --threads=N number of CPU threads
|
||||
-v, --av=N algorithm variation, 0 auto select
|
||||
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1
|
||||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)
|
||||
--cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig
|
||||
--cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable)
|
||||
--no-huge-pages disable huge pages support
|
||||
--no-color disable colored output
|
||||
--donate-level=N donate level, default 5% (5 minutes in 100 minutes)
|
||||
--user-agent set custom user-agent string for pool
|
||||
-B, --background run the miner in the background
|
||||
-c, --config=FILE load a JSON-format configuration file
|
||||
-l, --log-file=FILE log all output to a file
|
||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer.
|
||||
--print-time=N print hashrate report every N seconds
|
||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer
|
||||
--randomx-init=N threads count to initialize RandomX dataset
|
||||
--randomx-no-numa disable NUMA support for RandomX
|
||||
|
||||
API:
|
||||
--api-worker-id=ID custom worker-id for API
|
||||
--api-id=ID custom instance ID for API
|
||||
--http-enabled enable HTTP API
|
||||
--http-host=HOST bind host for HTTP API (default: 127.0.0.1)
|
||||
--http-port=N bind port for HTTP API
|
||||
--http-access-token=T access token for HTTP API
|
||||
--http-no-restricted enable full remote access to HTTP API (only if access token set)
|
||||
--randomx-init=N threads count to initialize RandomX dataset
|
||||
--randomx-no-numa disable NUMA support for RandomX
|
||||
--export-topology export hwloc topology to a XML file and exit
|
||||
--dry-run test configuration and exit
|
||||
-h, --help display this help and exit
|
||||
|
||||
OpenCL backend:
|
||||
--opencl enable OpenCL mining backend
|
||||
--opencl-devices=N comma separated list of OpenCL devices to use
|
||||
--opencl-platform=N OpenCL platform index or name
|
||||
--opencl-loader=PATH path to OpenCL-ICD-Loader (OpenCL.dll or libOpenCL.so)
|
||||
--opencl-no-cache disable OpenCL cache
|
||||
--print-platforms print available OpenCL platforms and exit
|
||||
|
||||
CUDA backend:
|
||||
--cuda enable CUDA mining backend
|
||||
--cuda-loader=PATH path to CUDA plugin (xmrig-cuda.dll or libxmrig-cuda.so)
|
||||
--cuda-devices=N comma separated list of CUDA devices to use
|
||||
--cuda-bfactor-hint=N bfactor hint for autoconfig (0-12)
|
||||
--cuda-bsleep-hint=N bsleep hint for autoconfig
|
||||
--no-nvml disable NVML (NVIDIA Management Library) support
|
||||
|
||||
Logging:
|
||||
-S, --syslog use system log for output messages
|
||||
-l, --log-file=FILE log all output to a file
|
||||
--print-time=N print hashrate report every N seconds
|
||||
--health-print-time=N print health report every N seconds
|
||||
--no-color disable colored output
|
||||
|
||||
Misc:
|
||||
-c, --config=FILE load a JSON-format configuration file
|
||||
-B, --background run the miner in the background
|
||||
-V, --version output version information and exit
|
||||
-h, --help display this help and exit
|
||||
--dry-run test configuration and exit
|
||||
--export-topology export hwloc topology to a XML file and exit
|
||||
```
|
||||
|
||||
## Donations
|
||||
|
||||
@@ -6,6 +6,8 @@ if (WITH_TLS)
|
||||
set(OPENSSL_MSVC_STATIC_RT TRUE)
|
||||
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} Crypt32)
|
||||
elseif (APPLE)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL)
|
||||
|
||||
@@ -54,6 +54,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
|
||||
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2")
|
||||
|
||||
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
|
||||
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL")
|
||||
|
||||
@@ -4,9 +4,12 @@ if (WITH_RANDOMX)
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/rx/Rx.h
|
||||
src/crypto/rx/RxAlgo.h
|
||||
src/crypto/rx/RxBasicStorage.h
|
||||
src/crypto/rx/RxCache.h
|
||||
src/crypto/rx/RxConfig.h
|
||||
src/crypto/rx/RxDataset.h
|
||||
src/crypto/rx/RxQueue.h
|
||||
src/crypto/rx/RxSeed.h
|
||||
src/crypto/rx/RxVm.h
|
||||
)
|
||||
|
||||
@@ -32,9 +35,11 @@ if (WITH_RANDOMX)
|
||||
src/crypto/randomx/vm_interpreted.cpp
|
||||
src/crypto/rx/Rx.cpp
|
||||
src/crypto/rx/RxAlgo.cpp
|
||||
src/crypto/rx/RxBasicStorage.cpp
|
||||
src/crypto/rx/RxCache.cpp
|
||||
src/crypto/rx/RxConfig.cpp
|
||||
src/crypto/rx/RxDataset.cpp
|
||||
src/crypto/rx/RxQueue.cpp
|
||||
src/crypto/rx/RxVm.cpp
|
||||
)
|
||||
|
||||
@@ -51,11 +56,33 @@ if (WITH_RANDOMX)
|
||||
)
|
||||
# cheat because cmake and ccache hate each other
|
||||
set_property(SOURCE src/crypto/randomx/jit_compiler_x86_static.S PROPERTY LANGUAGE C)
|
||||
elseif (XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/randomx/jit_compiler_a64_static.S
|
||||
src/crypto/randomx/jit_compiler_a64.cpp
|
||||
)
|
||||
# cheat because cmake and ccache hate each other
|
||||
set_property(SOURCE src/crypto/randomx/jit_compiler_a64_static.S PROPERTY LANGUAGE C)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
set_source_files_properties(src/crypto/randomx/jit_compiler_x86.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-const-variable)
|
||||
endif()
|
||||
|
||||
if (WITH_HWLOC)
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/rx/RxNUMAStorage.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/rx/RxConfig_hwloc.cpp
|
||||
src/crypto/rx/RxNUMAStorage.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/rx/RxConfig_basic.cpp
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
remove_definitions(/DXMRIG_ALGO_RANDOMX)
|
||||
endif()
|
||||
|
||||
@@ -1,36 +1,23 @@
|
||||
# Algorithms
|
||||
|
||||
Since version 3 mining [algorithm](#algorithm-names) should specified for each pool separately (`algo` option), earlier versions was use one global `algo` option and per pool `variant` option (this option was removed in v3). If your pool support [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/issues/168) you may not specify this option at all.
|
||||
|
||||
#### Example
|
||||
```json
|
||||
{
|
||||
"pools": [
|
||||
{
|
||||
"url": "...",
|
||||
"algo": "cn/r",
|
||||
...
|
||||
}
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
Algorithm can be defined in 3 ways:
|
||||
|
||||
#### Pools with mining algorithm negotiation support.
|
||||
1. By pool, using algorithm negotiation, in this case no need specify algorithm on miner side.
|
||||
2. Per pool `coin` option, currently only usable values for this option is `monero` and `arqma`.
|
||||
3. Per pool `algo` option.
|
||||
|
||||
* [www.hashvault.pro](https://www.hashvault.pro/)
|
||||
* [moneroocean.stream](https://moneroocean.stream)
|
||||
|
||||
## Algorithm names
|
||||
Option `coin` useful for pools without algorithm negotiation support or daemon to allow automatically switch algorithm in next hard fork.
|
||||
|
||||
## Algorithm names
|
||||
|
||||
| Name | Memory | Version | Notes |
|
||||
|------|--------|---------|-------|
|
||||
| `rx/arq` | 256 KB | 4.3.0+ | RandomARQ (RandomX variant for ArQmA). |
|
||||
| `rx/0` | 2 MB | 3.2.0+ | RandomX (Monero). |
|
||||
| `argon2/chukwa` | 512 KB | 3.1.0+ | Argon2id (Chukwa). |
|
||||
| `argon2/wrkz` | 256 KB | 3.1.0+ | Argon2id (WRKZ) |
|
||||
| `rx/test` | 2 MB | 3.0.0+ | RandomX (reference configuration). |
|
||||
| `rx/0` | 2 MB | 3.0.0+ | RandomX (reference configuration), reserved for future use. |
|
||||
| `rx/wow` | 1 MB | 3.0.0+ | RandomWOW. |
|
||||
| `rx/loki` | 2 MB | 3.0.0+ | RandomXL. |
|
||||
| `rx/wow` | 1 MB | 3.0.0+ | RandomWOW (RandomX variant for Wownero). |
|
||||
| `rx/loki` | 2 MB | 3.0.0+ | RandomXL (RandomX variant for Loki). |
|
||||
| `cn/fast` | 2 MB | 3.0.0+ | CryptoNight variant 1 with half iterations. |
|
||||
| `cn/rwz` | 2 MB | 2.14.0+ | CryptoNight variant 2 with 3/4 iterations and reversed shuffle operation. |
|
||||
| `cn/zls` | 2 MB | 2.14.0+ | CryptoNight variant 2 with 3/4 iterations. |
|
||||
@@ -50,3 +37,21 @@ Since version 3 mining [algorithm](#algorithm-names) should specified for each p
|
||||
| `cn-lite/1` | 1 MB | 2.5.0+ | CryptoNight-Lite variant 1. |
|
||||
| `cn-lite/0` | 1 MB | 0.8.0+ | CryptoNight-Lite variant 0. |
|
||||
| `cn/0` | 2 MB | 0.5.0+ | CryptoNight (original). |
|
||||
|
||||
## Migration to v3
|
||||
Since version 3 mining [algorithm](#algorithm-names) should specified for each pool separately (`algo` option), earlier versions was use one global `algo` option and per pool `variant` option (this option was removed in v3). If your pool support [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/issues/168) you may not specify this option at all.
|
||||
|
||||
#### Example
|
||||
```json
|
||||
{
|
||||
"pools": [
|
||||
{
|
||||
"url": "...",
|
||||
"algo": "cn/r",
|
||||
"coin": null
|
||||
...
|
||||
}
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,3 +1,116 @@
|
||||
# v4.6.2-beta
|
||||
- [#1274](https://github.com/xmrig/xmrig/issues/1274) Added `--cuda-devices` command line option.
|
||||
- [#1277](https://github.com/xmrig/xmrig/pull/1277) Fixed function names for clang on Apple.
|
||||
|
||||
# v4.6.1-beta
|
||||
- [#1272](https://github.com/xmrig/xmrig/pull/1272) Optimized hashrate calculation.
|
||||
- [#1273](https://github.com/xmrig/xmrig/issues/1273) Fixed crash when use `GET /2/backends` API endpoint with disabled CUDA.
|
||||
|
||||
# v4.6.0-beta
|
||||
- [#1263](https://github.com/xmrig/xmrig/pull/1263) Added new option `dataset_host` for NVIDIA GPUs with less than 4 GB memory (RandomX only).
|
||||
|
||||
# v4.5.0-beta
|
||||
- Added NVIDIA CUDA support via external [CUDA plugun](https://github.com/xmrig/xmrig-cuda). XMRig now is unified 3 in 1 miner.
|
||||
|
||||
# v4.4.0-beta
|
||||
- [#1068](https://github.com/xmrig/xmrig/pull/1068) Added support for `self-select` stratum protocol extension.
|
||||
- [#1240](https://github.com/xmrig/xmrig/pull/1240) Sync with the latest RandomX code.
|
||||
- [#1241](https://github.com/xmrig/xmrig/issues/1241) Fixed regression with colors on old Windows systems.
|
||||
- [#1243](https://github.com/xmrig/xmrig/pull/1243) Fixed incorrect OpenCL memory size detection in some cases.
|
||||
- [#1247](https://github.com/xmrig/xmrig/pull/1247) Fixed ARM64 RandomX code alignment.
|
||||
- [#1248](https://github.com/xmrig/xmrig/pull/1248) Fixed RandomX code cache cleanup on iOS/Darwin.
|
||||
|
||||
# v4.3.1-beta
|
||||
- Fixed regression in v4.3.0, miner didn't create `cn` mining profile with default config example.
|
||||
|
||||
# v4.3.0-beta
|
||||
- [#1227](https://github.com/xmrig/xmrig/pull/1227) Added new algorithm `rx/arq`, RandomX variant for upcoming ArQmA fork.
|
||||
- [#808](https://github.com/xmrig/xmrig/issues/808#issuecomment-539297156) Added experimental support for persistent memory for CPU mining threads.
|
||||
- [#1221](https://github.com/xmrig/xmrig/issues/1221) Improved RandomX dataset memory usage and initialization speed for NUMA machines.
|
||||
|
||||
# v4.2.1-beta
|
||||
- [#1150](https://github.com/xmrig/xmrig/issues/1150) Fixed build on FreeBSD.
|
||||
- [#1175](https://github.com/xmrig/xmrig/issues/1175) Fixed support for systems where total count of NUMA nodes not equal usable nodes count.
|
||||
- [#1199](https://github.com/xmrig/xmrig/issues/1199) Fixed excessive memory allocation for OpenCL threads with low intensity.
|
||||
- [#1212](https://github.com/xmrig/xmrig/issues/1212) Fixed low RandomX performance after fast algorithm switching.
|
||||
|
||||
# v4.2.0-beta
|
||||
- [#1202](https://github.com/xmrig/xmrig/issues/1202) Fixed algorithm verification in donate strategy.
|
||||
- Added per pool option `coin` with single possible value `monero` for pools without algorithm negotiation, for upcoming Monero fork.
|
||||
- Added config option `cpu/max-threads-hint` and command line option `--cpu-max-threads-hint`.
|
||||
|
||||
# v4.1.0-beta
|
||||
- **OpenCL backend disabled by default.**.
|
||||
- [#1183](https://github.com/xmrig/xmrig/issues/1183) Fixed compatibility with systemd.
|
||||
- [#1185](https://github.com/xmrig/xmrig/pull/1185) Added JIT compiler for RandomX on ARMv8.
|
||||
- Improved API endpoint `GET /2/backends` and added support for this endpoint to [workers.xmrig.info](http://workers.xmrig.info).
|
||||
- Added command line option `--no-cpu` to disable CPU backend.
|
||||
- Added OpenCL specific command line options: `--opencl`, `--opencl-devices`, `--opencl-platform`, `--opencl-loader` and `--opencl-no-cache`.
|
||||
- Removed command line option `--http-enabled`, HTTP API enabled automatically if any other `--http-*` option provided.
|
||||
|
||||
# v4.0.1-beta
|
||||
- [#1177](https://github.com/xmrig/xmrig/issues/1177) Fixed compatibility with old AMD drivers.
|
||||
- [#1180](https://github.com/xmrig/xmrig/issues/1180) Fixed possible duplicated shares after algorithm switching.
|
||||
- Added support for case if not all backend threads successfully started.
|
||||
- Fixed wrong config file permissions after write (only gcc builds on recent Windows 10 affected).
|
||||
|
||||
# v4.0.0-beta
|
||||
- [#1172](https://github.com/xmrig/xmrig/issues/1172) **Added OpenCL mining backend.**
|
||||
- [#268](https://github.com/xmrig/xmrig-amd/pull/268) [#270](https://github.com/xmrig/xmrig-amd/pull/270) [#271](https://github.com/xmrig/xmrig-amd/pull/271) [#273](https://github.com/xmrig/xmrig-amd/pull/273) [#274](https://github.com/xmrig/xmrig-amd/pull/274) [#1171](https://github.com/xmrig/xmrig/pull/1171) Added RandomX support for OpenCL, thanks [@SChernykh](https://github.com/SChernykh).
|
||||
- Algorithm `cn/wow` removed, as no longer alive.
|
||||
|
||||
# v3.2.0
|
||||
- Added per pool option `coin` with single possible value `monero` for pools without algorithm negotiation, for upcoming Monero fork.
|
||||
- [#1183](https://github.com/xmrig/xmrig/issues/1183) Fixed compatibility with systemd.
|
||||
|
||||
# v3.1.3
|
||||
- [#1180](https://github.com/xmrig/xmrig/issues/1180) Fixed possible duplicated shares after algorithm switching.
|
||||
- Fixed wrong config file permissions after write (only gcc builds on recent Windows 10 affected).
|
||||
|
||||
# v3.1.2
|
||||
- Many RandomX optimizations and fixes.
|
||||
- [#1132](https://github.com/xmrig/xmrig/issues/1132) Fixed build on CentOS 7.
|
||||
- [#1163](https://github.com/xmrig/xmrig/pull/1163) Optimized soft AES code, up to +30% hashrate on CPU without AES support and other optimizations.
|
||||
- [#1166](https://github.com/xmrig/xmrig/pull/1166) Fixed crash when initialize dataset with big threads count (eg 272).
|
||||
- [#1168](https://github.com/xmrig/xmrig/pull/1168) Optimized loading from scratchpad.
|
||||
- [#1128](https://github.com/xmrig/xmrig/issues/1128) Fixed CMake 2.8 compatibility.
|
||||
|
||||
# v3.1.1
|
||||
- [#1133](https://github.com/xmrig/xmrig/issues/1133) Fixed syslog regression.
|
||||
- [#1138](https://github.com/xmrig/xmrig/issues/1138) Fixed multiple network bugs.
|
||||
- [#1141](https://github.com/xmrig/xmrig/issues/1141) Fixed log in background mode.
|
||||
- [#1142](https://github.com/xmrig/xmrig/pull/1142) RandomX hashrate improved by 0.5-1.5% depending on variant and CPU.
|
||||
- [#1146](https://github.com/xmrig/xmrig/pull/1146) Fixed race condition in RandomX thread init.
|
||||
- [#1148](https://github.com/xmrig/xmrig/pull/1148) Fixed, on Linux linker marking entire executable as having an executable stack.
|
||||
- Fixed, for Argon2 algorithms command line options like `--threads` was ignored.
|
||||
- Fixed command line options for single pool, free order allowed again.
|
||||
|
||||
# v3.1.0
|
||||
- [#1107](https://github.com/xmrig/xmrig/issues/1107#issuecomment-522235892) Added Argon2 algorithm family: `argon2/chukwa` and `argon2/wrkz`.
|
||||
|
||||
# v3.0.0
|
||||
- **[#1111](https://github.com/xmrig/xmrig/pull/1111) Added RandomX (`rx/test`) algorithm for testing and benchmarking.**
|
||||
- **[#1036](https://github.com/xmrig/xmrig/pull/1036) Added RandomWOW (`rx/wow`) algorithm for [Wownero](http://wownero.org/).**
|
||||
- **[#1050](https://github.com/xmrig/xmrig/pull/1050) Added RandomXL (`rx/loki`) algorithm for [Loki](https://loki.network/).**
|
||||
- **[#1077](https://github.com/xmrig/xmrig/issues/1077) Added NUMA support via hwloc**.
|
||||
- **Added flexible [multi algorithm](doc/CPU.md) configuration.**
|
||||
- **Added unlimited switching between incompatible algorithms, all mining options can be changed in runtime.**
|
||||
- [#257](https://github.com/xmrig/xmrig-nvidia/pull/257) New logging subsystem, file and syslog now always without colors.
|
||||
- [#314](https://github.com/xmrig/xmrig-proxy/issues/314) Added donate over proxy feature.
|
||||
- [#1007](https://github.com/xmrig/xmrig/issues/1007) Old HTTP API backend based on libmicrohttpd, replaced to custom HTTP server (libuv + http_parser).
|
||||
- [#1010](https://github.com/xmrig/xmrig/pull/1010#issuecomment-482632107) Added daemon support (solo mining).
|
||||
- [#1066](https://github.com/xmrig/xmrig/issues/1066#issuecomment-518080529) Added error message if pool not ready for RandomX.
|
||||
- [#1105](https://github.com/xmrig/xmrig/issues/1105) Improved auto configuration for `cn-pico` algorithm.
|
||||
- Added commands `pause` and `resume` via JSON RPC 2.0 API (`POST /json_rpc`).
|
||||
- Added command line option `--export-topology` for export hwloc topology to a XML file.
|
||||
- Breaked backward compatibility with previous configs and command line, `variant` option replaced to `algo`, global option `algo` removed, all CPU related settings moved to `cpu` object.
|
||||
- Options `av`, `safe` and `max-cpu-usage` removed.
|
||||
- Algorithm `cn/msr` renamed to `cn/fast`.
|
||||
- Algorithm `cn/xtl` removed.
|
||||
- API endpoint `GET /1/threads` replaced to `GET /2/backends`.
|
||||
- Added global uptime and extended connection information in API.
|
||||
- API now return current algorithm.
|
||||
|
||||
# v2.99.6-beta
|
||||
- Added commands `pause` and `resume` via JSON RPC 2.0 API (`POST /json_rpc`).
|
||||
- Fixed autoconfig regression (since 2.99.5), mostly `rx/wow` was affected by this bug.
|
||||
|
||||
@@ -94,3 +94,9 @@ Enable/configure or disable ASM optimizations. Possible values: `true`, `false`,
|
||||
|
||||
#### `argon2-impl` (since v3.1.0)
|
||||
Allow override automatically detected Argon2 implementation, this option added mostly for debug purposes, default value `null` means autodetect. Other possible values: `"x86_64"`, `"SSE2"`, `"SSSE3"`, `"XOP"`, `"AVX2"`, `"AVX-512F"`. Manual selection has no safe guards, if you CPU not support required instuctions, miner will crash.
|
||||
|
||||
#### `max-threads-hint` (since v4.2.0)
|
||||
Maximum CPU threads count (in percentage) hint for autoconfig. [CPU_MAX_USAGE.md](CPU_MAX_USAGE.md)
|
||||
|
||||
#### `memory-pool` (since v4.3.0)
|
||||
Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm swithing. Default value `false` (feature disabled) or `true` or specific count of 2 MB huge pages.
|
||||
|
||||
26
doc/CPU_MAX_USAGE.md
Normal file
26
doc/CPU_MAX_USAGE.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Maximum CPU usage
|
||||
|
||||
Please read this document carefully, `max-threads-hint` (was known as `max-cpu-usage`) option is most confusing option in the miner with many myth and legends.
|
||||
This option is just hint for automatic configuration and can't precise define CPU usage.
|
||||
|
||||
### Option definition
|
||||
#### Config file:
|
||||
```json
|
||||
{
|
||||
...
|
||||
"cpu": {
|
||||
"max-threads-hint": 100,
|
||||
...
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
#### Command line
|
||||
`--cpu-max-threads-hint 100`
|
||||
|
||||
### Known issues and usage
|
||||
|
||||
* This option has no effect if miner already generated CPU configuration, to prevent config generation use `"autosave":false,`.
|
||||
* Only threads count can be changed, for 1 core CPU this option has no effect, for 2 core CPU only 2 values possible 50% and 100%, for 4 cores: 25%, 50%, 75%, 100%. etc.
|
||||
* You CPU may limited by other factors, eg cache.
|
||||
4
doc/build/CMAKE_OPTIONS.md
vendored
4
doc/build/CMAKE_OPTIONS.md
vendored
@@ -21,6 +21,8 @@ This feature add external dependency to libhwloc (1.10.0+) (except MSVC builds).
|
||||
* **`-DWITH_TLS=OFF`** disable SSL/TLS support (secure connections to pool). This feature add external dependency to OpenSSL.
|
||||
* **`-DWITH_ASM=OFF`** disable assembly optimizations for modern CryptoNight algorithms.
|
||||
* **`-DWITH_EMBEDDED_CONFIG=ON`** Enable [embedded](https://github.com/xmrig/xmrig/issues/957) config support.
|
||||
* **`-DWITH_OPENCL=OFF`** Disable OpenCL backend.
|
||||
* **`-DWITH_CUDA=OFF`** Disable CUDA backend.
|
||||
|
||||
## Debug options
|
||||
|
||||
@@ -30,7 +32,7 @@ This feature add external dependency to libhwloc (1.10.0+) (except MSVC builds).
|
||||
|
||||
## Special build options
|
||||
|
||||
* **`-DXMRIG_DEPS=<path>`** path to precompiled dependensices https://github.com/xmrig/xmrig-deps
|
||||
* **`-DXMRIG_DEPS=<path>`** path to precompiled dependencies https://github.com/xmrig/xmrig-deps
|
||||
* **`-DARM_TARGET=<number>`** override ARM target, possible values `7` (ARMv7) and `8` (ARMv8).
|
||||
* **`-DUV_INCLUDE_DIR=<path>`** custom path to libuv headers.
|
||||
* **`-DUV_LIBRARY=<path>`** custom path to libuv library.
|
||||
|
||||
262
doc/topology/AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml
Normal file
262
doc/topology/AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml
Normal file
@@ -0,0 +1,262 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE topology SYSTEM "hwloc2.dtd">
|
||||
<topology version="2.0">
|
||||
<object type="Machine" os_index="0" cpuset="0x00ffffff" complete_cpuset="0x00ffffff" allowed_cpuset="0x00ffffff" nodeset="0x0000000f" complete_nodeset="0x0000000f" allowed_nodeset="0x0000000f" gp_index="1">
|
||||
<info name="Backend" value="Windows"/>
|
||||
<info name="hwlocVersion" value="2.0.4"/>
|
||||
<object type="Package" cpuset="0x00000fff" complete_cpuset="0x00000fff" nodeset="0x00000003" complete_nodeset="0x00000003" gp_index="36">
|
||||
<info name="CPUVendor" value="AuthenticAMD"/>
|
||||
<info name="CPUFamilyNumber" value="21"/>
|
||||
<info name="CPUModelNumber" value="2"/>
|
||||
<info name="CPUModel" value="AMD Opteron(tm) Processor 6344 "/>
|
||||
<info name="CPUStepping" value="0"/>
|
||||
<object type="L3Cache" cpuset="0x0000003f" complete_cpuset="0x0000003f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="20" cache_size="12582912" depth="3" cache_linesize="64" cache_associativity="1" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="0" cpuset="0x0000003f" complete_cpuset="0x0000003f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="80" local_memory="7009357824">
|
||||
<page_type size="4096" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="4" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="3" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="2">
|
||||
<object type="PU" os_index="0" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="85"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="7" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="6" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="5">
|
||||
<object type="PU" os_index="1" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="86"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="10" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="9" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="8">
|
||||
<object type="PU" os_index="2" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="87"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="13" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="12" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="11">
|
||||
<object type="PU" os_index="3" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="88"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="16" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="15" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="14">
|
||||
<object type="PU" os_index="4" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="89"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="19" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="18" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="17">
|
||||
<object type="PU" os_index="5" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="90"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L3Cache" cpuset="0x00000fc0" complete_cpuset="0x00000fc0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="40" cache_size="12582912" depth="3" cache_linesize="64" cache_associativity="1" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="1" cpuset="0x00000fc0" complete_cpuset="0x00000fc0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="81" local_memory="8018194432">
|
||||
<page_type size="4096" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="23" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="22" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="21">
|
||||
<object type="PU" os_index="6" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="91"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="26" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="25" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="24">
|
||||
<object type="PU" os_index="7" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="92"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="29" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="28" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="27">
|
||||
<object type="PU" os_index="8" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="93"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="32" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="31" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="30">
|
||||
<object type="PU" os_index="9" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="94"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="35" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="34" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="33">
|
||||
<object type="PU" os_index="10" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="95"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="39" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="38" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="37">
|
||||
<object type="PU" os_index="11" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="96"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="Package" cpuset="0x00fff000" complete_cpuset="0x00fff000" nodeset="0x0000000c" complete_nodeset="0x0000000c" gp_index="75">
|
||||
<info name="CPUVendor" value="AuthenticAMD"/>
|
||||
<info name="CPUFamilyNumber" value="21"/>
|
||||
<info name="CPUModelNumber" value="2"/>
|
||||
<info name="CPUModel" value="AMD Opteron(tm) Processor 6344 "/>
|
||||
<info name="CPUStepping" value="0"/>
|
||||
<object type="L3Cache" cpuset="0x0003f000" complete_cpuset="0x0003f000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="59" cache_size="12582912" depth="3" cache_linesize="64" cache_associativity="1" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="2" cpuset="0x0003f000" complete_cpuset="0x0003f000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="82" local_memory="8035020800">
|
||||
<page_type size="4096" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="43" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="42" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="41">
|
||||
<object type="PU" os_index="12" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="97"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="46" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="45" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="44">
|
||||
<object type="PU" os_index="13" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="98"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="49" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="48" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="47">
|
||||
<object type="PU" os_index="14" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="99"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="52" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="51" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="50">
|
||||
<object type="PU" os_index="15" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="100"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="55" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="54" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="53">
|
||||
<object type="PU" os_index="16" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="101"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="58" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="57" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="56">
|
||||
<object type="PU" os_index="17" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="102"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L3Cache" cpuset="0x00fc0000" complete_cpuset="0x00fc0000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="79" cache_size="12582912" depth="3" cache_linesize="64" cache_associativity="1" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="3" cpuset="0x00fc0000" complete_cpuset="0x00fc0000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="83" local_memory="8097337344">
|
||||
<page_type size="4096" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="62" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="61" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="60">
|
||||
<object type="PU" os_index="18" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="103"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="65" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="64" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="63">
|
||||
<object type="PU" os_index="19" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="104"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="68" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="67" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="66">
|
||||
<object type="PU" os_index="20" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="105"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="71" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="70" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="69">
|
||||
<object type="PU" os_index="21" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="106"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="74" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="73" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="72">
|
||||
<object type="PU" os_index="22" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="107"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="78" cache_size="2097152" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="77" cache_size="16384" depth="1" cache_linesize="64" cache_associativity="4" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="76">
|
||||
<object type="PU" os_index="23" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000008" complete_nodeset="0x00000008" gp_index="108"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</topology>
|
||||
399
doc/topology/AMD_Opteron_6348_x4_N8_linux_2_0_4.xml
Normal file
399
doc/topology/AMD_Opteron_6348_x4_N8_linux_2_0_4.xml
Normal file
@@ -0,0 +1,399 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE topology SYSTEM "hwloc2.dtd">
|
||||
<topology version="2.0">
|
||||
<object type="Machine" os_index="0" cpuset="0xffffffff" complete_cpuset="0xffffffff" allowed_cpuset="0xffffffff" nodeset="0x00000066" complete_nodeset="0x000000ff" allowed_nodeset="0x00000066" gp_index="1">
|
||||
<info name="DMIProductName" value="H8QG6"/>
|
||||
<info name="DMIProductVersion" value="1234567890"/>
|
||||
<info name="DMIProductSerial" value="1234567890"/>
|
||||
<info name="DMIProductUUID" value="0"/>
|
||||
<info name="DMIBoardVendor" value="Supermicro"/>
|
||||
<info name="DMIBoardName" value="H8QG6"/>
|
||||
<info name="DMIBoardVersion" value="1234567890"/>
|
||||
<info name="DMIBoardSerial" value="0"/>
|
||||
<info name="DMIBoardAssetTag" value="1234567890"/>
|
||||
<info name="DMIChassisVendor" value="Supermicro"/>
|
||||
<info name="DMIChassisType" value="3"/>
|
||||
<info name="DMIChassisVersion" value="1234567890"/>
|
||||
<info name="DMIChassisSerial" value="1234567890."/>
|
||||
<info name="DMIChassisAssetTag" value="1234567890"/>
|
||||
<info name="DMIBIOSVendor" value="American Megatrends Inc."/>
|
||||
<info name="DMIBIOSVersion" value="080016 "/>
|
||||
<info name="DMIBIOSDate" value="10/11/2010"/>
|
||||
<info name="DMISysVendor" value="Supermicro"/>
|
||||
<info name="Backend" value="Linux"/>
|
||||
<info name="LinuxCgroup" value="/"/>
|
||||
<info name="OSName" value="Linux"/>
|
||||
<info name="OSRelease" value="4.15.0-20-generic"/>
|
||||
<info name="OSVersion" value="#21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018"/>
|
||||
<info name="HostName" value="host"/>
|
||||
<info name="Architecture" value="x86_64"/>
|
||||
<info name="hwlocVersion" value="2.0.4"/>
|
||||
<info name="ProcessName" value="xmrig"/>
|
||||
<object type="Package" os_index="0" cpuset="0x000000ff" complete_cpuset="0x000000ff" nodeset="0x00000002" complete_nodeset="0x00000003" gp_index="2">
|
||||
<info name="CPUVendor" value="AuthenticAMD"/>
|
||||
<info name="CPUFamilyNumber" value="16"/>
|
||||
<info name="CPUModelNumber" value="9"/>
|
||||
<info name="CPUModel" value="AMD Opteron(tm) Processor 6128"/>
|
||||
<info name="CPUStepping" value="1"/>
|
||||
<object type="L3Cache" cpuset="0x0000000f" complete_cpuset="0x0000000f" nodeset="0x0" complete_nodeset="0x00000001" gp_index="7" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L2Cache" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x0" complete_nodeset="0x00000001" gp_index="6" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x0" complete_nodeset="0x00000001" gp_index="5" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x0" complete_nodeset="0x00000001" gp_index="3">
|
||||
<object type="PU" os_index="0" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x0" complete_nodeset="0x00000001" gp_index="4"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x0" complete_nodeset="0x00000001" gp_index="11" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x0" complete_nodeset="0x00000001" gp_index="10" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x0" complete_nodeset="0x00000001" gp_index="8">
|
||||
<object type="PU" os_index="1" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x0" complete_nodeset="0x00000001" gp_index="9"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x0" complete_nodeset="0x00000001" gp_index="15" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x0" complete_nodeset="0x00000001" gp_index="14" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x0" complete_nodeset="0x00000001" gp_index="12">
|
||||
<object type="PU" os_index="2" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x0" complete_nodeset="0x00000001" gp_index="13"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x0" complete_nodeset="0x00000001" gp_index="19" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x0" complete_nodeset="0x00000001" gp_index="18" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x0" complete_nodeset="0x00000001" gp_index="16">
|
||||
<object type="PU" os_index="3" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x0" complete_nodeset="0x00000001" gp_index="17"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L3Cache" cpuset="0x000000f0" complete_cpuset="0x000000f0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="24" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="1" cpuset="0x000000f0" complete_cpuset="0x000000f0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="143" local_memory="4156817408">
|
||||
<page_type size="4096" count="854592"/>
|
||||
<page_type size="2097152" count="313"/>
|
||||
<page_type size="1073741824" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="23" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="22" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="20">
|
||||
<object type="PU" os_index="4" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="21"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="28" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="27" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="25">
|
||||
<object type="PU" os_index="5" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="26"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="32" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="31" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="29">
|
||||
<object type="PU" os_index="6" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="30"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="36" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="35" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="33">
|
||||
<object type="PU" os_index="7" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="34"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="Package" os_index="1" cpuset="0x0000ff00" complete_cpuset="0x0000ff00" nodeset="0x00000004" complete_nodeset="0x0000000c" gp_index="37">
|
||||
<info name="CPUVendor" value="AuthenticAMD"/>
|
||||
<info name="CPUFamilyNumber" value="16"/>
|
||||
<info name="CPUModelNumber" value="9"/>
|
||||
<info name="CPUModel" value="AMD Opteron(tm) Processor 6128"/>
|
||||
<info name="CPUStepping" value="1"/>
|
||||
<object type="L3Cache" cpuset="0x00000f00" complete_cpuset="0x00000f00" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="42" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="2" cpuset="0x00000f00" complete_cpuset="0x00000f00" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="144" local_memory="4204060672">
|
||||
<page_type size="4096" count="866126"/>
|
||||
<page_type size="2097152" count="313"/>
|
||||
<page_type size="1073741824" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="41" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="40" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="38">
|
||||
<object type="PU" os_index="8" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="39"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="46" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="45" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="43">
|
||||
<object type="PU" os_index="9" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="44"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="50" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="49" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="47">
|
||||
<object type="PU" os_index="10" cpuset="0x00000400" complete_cpuset="0x00000400" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="48"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="54" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="53" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="51">
|
||||
<object type="PU" os_index="11" cpuset="0x00000800" complete_cpuset="0x00000800" nodeset="0x00000004" complete_nodeset="0x00000004" gp_index="52"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L3Cache" cpuset="0x0000f000" complete_cpuset="0x0000f000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="59" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L2Cache" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="58" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="57" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="55">
|
||||
<object type="PU" os_index="12" cpuset="0x00001000" complete_cpuset="0x00001000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="56"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="63" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="62" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="60">
|
||||
<object type="PU" os_index="13" cpuset="0x00002000" complete_cpuset="0x00002000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="61"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="67" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="66" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="64">
|
||||
<object type="PU" os_index="14" cpuset="0x00004000" complete_cpuset="0x00004000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="65"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="71" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="70" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="68">
|
||||
<object type="PU" os_index="15" cpuset="0x00008000" complete_cpuset="0x00008000" nodeset="0x0" complete_nodeset="0x00000008" gp_index="69"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="Package" os_index="2" cpuset="0x00ff0000" complete_cpuset="0x00ff0000" nodeset="0x00000020" complete_nodeset="0x00000030" gp_index="72">
|
||||
<info name="CPUVendor" value="AuthenticAMD"/>
|
||||
<info name="CPUFamilyNumber" value="16"/>
|
||||
<info name="CPUModelNumber" value="9"/>
|
||||
<info name="CPUModel" value="AMD Opteron(tm) Processor 6128"/>
|
||||
<info name="CPUStepping" value="1"/>
|
||||
<object type="L3Cache" cpuset="0x000f0000" complete_cpuset="0x000f0000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="77" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L2Cache" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="76" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="75" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="73">
|
||||
<object type="PU" os_index="16" cpuset="0x00010000" complete_cpuset="0x00010000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="74"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="81" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="80" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="78">
|
||||
<object type="PU" os_index="17" cpuset="0x00020000" complete_cpuset="0x00020000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="79"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="85" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="84" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="82">
|
||||
<object type="PU" os_index="18" cpuset="0x00040000" complete_cpuset="0x00040000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="83"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="89" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="88" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="86">
|
||||
<object type="PU" os_index="19" cpuset="0x00080000" complete_cpuset="0x00080000" nodeset="0x0" complete_nodeset="0x00000010" gp_index="87"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L3Cache" cpuset="0x00f00000" complete_cpuset="0x00f00000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="94" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="5" cpuset="0x00f00000" complete_cpuset="0x00f00000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="147" local_memory="4226170880">
|
||||
<page_type size="4096" count="872036"/>
|
||||
<page_type size="2097152" count="312"/>
|
||||
<page_type size="1073741824" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="93" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="92" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="90">
|
||||
<object type="PU" os_index="20" cpuset="0x00100000" complete_cpuset="0x00100000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="91"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="98" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="97" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="95">
|
||||
<object type="PU" os_index="21" cpuset="0x00200000" complete_cpuset="0x00200000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="96"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="102" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="101" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="99">
|
||||
<object type="PU" os_index="22" cpuset="0x00400000" complete_cpuset="0x00400000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="100"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="106" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="105" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="103">
|
||||
<object type="PU" os_index="23" cpuset="0x00800000" complete_cpuset="0x00800000" nodeset="0x00000020" complete_nodeset="0x00000020" gp_index="104"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="Package" os_index="3" cpuset="0xff000000" complete_cpuset="0xff000000" nodeset="0x00000040" complete_nodeset="0x000000c0" gp_index="107">
|
||||
<info name="CPUVendor" value="AuthenticAMD"/>
|
||||
<info name="CPUFamilyNumber" value="16"/>
|
||||
<info name="CPUModelNumber" value="9"/>
|
||||
<info name="CPUModel" value="AMD Opteron(tm) Processor 6128"/>
|
||||
<info name="CPUStepping" value="1"/>
|
||||
<object type="L3Cache" cpuset="0x0f000000" complete_cpuset="0x0f000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="112" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="NUMANode" os_index="6" cpuset="0x0f000000" complete_cpuset="0x0f000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="148" local_memory="4221870080">
|
||||
<page_type size="4096" count="870986"/>
|
||||
<page_type size="2097152" count="312"/>
|
||||
<page_type size="1073741824" count="0"/>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x01000000" complete_cpuset="0x01000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="111" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x01000000" complete_cpuset="0x01000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="110" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x01000000" complete_cpuset="0x01000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="108">
|
||||
<object type="PU" os_index="24" cpuset="0x01000000" complete_cpuset="0x01000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="109"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x02000000" complete_cpuset="0x02000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="116" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x02000000" complete_cpuset="0x02000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="115" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x02000000" complete_cpuset="0x02000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="113">
|
||||
<object type="PU" os_index="25" cpuset="0x02000000" complete_cpuset="0x02000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="114"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x04000000" complete_cpuset="0x04000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="120" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x04000000" complete_cpuset="0x04000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="119" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x04000000" complete_cpuset="0x04000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="117">
|
||||
<object type="PU" os_index="26" cpuset="0x04000000" complete_cpuset="0x04000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="118"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x08000000" complete_cpuset="0x08000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="124" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x08000000" complete_cpuset="0x08000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="123" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x08000000" complete_cpuset="0x08000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="121">
|
||||
<object type="PU" os_index="27" cpuset="0x08000000" complete_cpuset="0x08000000" nodeset="0x00000040" complete_nodeset="0x00000040" gp_index="122"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L3Cache" cpuset="0xf0000000" complete_cpuset="0xf0000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="129" cache_size="5240832" depth="3" cache_linesize="64" cache_associativity="48" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L2Cache" cpuset="0x10000000" complete_cpuset="0x10000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="128" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x10000000" complete_cpuset="0x10000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="127" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="0" cpuset="0x10000000" complete_cpuset="0x10000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="125">
|
||||
<object type="PU" os_index="28" cpuset="0x10000000" complete_cpuset="0x10000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="126"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x20000000" complete_cpuset="0x20000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="133" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x20000000" complete_cpuset="0x20000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="132" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="1" cpuset="0x20000000" complete_cpuset="0x20000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="130">
|
||||
<object type="PU" os_index="29" cpuset="0x20000000" complete_cpuset="0x20000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="131"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x40000000" complete_cpuset="0x40000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="137" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x40000000" complete_cpuset="0x40000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="136" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="2" cpuset="0x40000000" complete_cpuset="0x40000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="134">
|
||||
<object type="PU" os_index="30" cpuset="0x40000000" complete_cpuset="0x40000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="135"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object type="L2Cache" cpuset="0x80000000" complete_cpuset="0x80000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="141" cache_size="524288" depth="2" cache_linesize="64" cache_associativity="16" cache_type="0">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="L1Cache" cpuset="0x80000000" complete_cpuset="0x80000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="140" cache_size="65536" depth="1" cache_linesize="64" cache_associativity="2" cache_type="1">
|
||||
<info name="Inclusive" value="0"/>
|
||||
<object type="Core" os_index="3" cpuset="0x80000000" complete_cpuset="0x80000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="138">
|
||||
<object type="PU" os_index="31" cpuset="0x80000000" complete_cpuset="0x80000000" nodeset="0x0" complete_nodeset="0x00000080" gp_index="139"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<distances2 type="NUMANode" nbobjs="4" kind="5" indexing="os">
|
||||
<indexes length="8">1 2 5 6 </indexes>
|
||||
<u64values length="30">10 22 16 22 22 10 22 16 16 22 </u64values>
|
||||
<u64values length="18">10 22 22 16 22 10 </u64values>
|
||||
</distances2>
|
||||
</topology>
|
||||
|
||||
@@ -59,6 +59,7 @@ function rx()
|
||||
'randomx_constants_monero.h',
|
||||
'randomx_constants_wow.h',
|
||||
'randomx_constants_loki.h',
|
||||
'randomx_constants_arqma.h',
|
||||
'aes.cl',
|
||||
'blake2b.cl',
|
||||
'randomx_vm.cl',
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
function opencl_minify(input)
|
||||
{
|
||||
let out = input.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, ''); // comments
|
||||
let out = input.replace(/\r/g, '');
|
||||
out = out.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, ''); // comments
|
||||
out = out.replace(/^#\s+/gm, '#'); // macros with spaces
|
||||
out = out.replace(/\n{2,}/g, '\n'); // empty lines
|
||||
out = out.replace(/^\s+/gm, ''); // leading whitespace
|
||||
@@ -10,7 +11,7 @@ function opencl_minify(input)
|
||||
|
||||
let array = out.split('\n').map(line => {
|
||||
if (line[0] === '#') {
|
||||
return line
|
||||
return line;
|
||||
}
|
||||
|
||||
line = line.replace(/, /g, ',');
|
||||
|
||||
6
src/3rdparty/argon2/CMakeLists.txt
vendored
6
src/3rdparty/argon2/CMakeLists.txt
vendored
@@ -22,7 +22,7 @@ set(ARGON2_X86_64_SOURCES arch/x86_64/lib/argon2-arch.c arch/x86_64/lib/cpu-flag
|
||||
if (CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
function(add_feature_impl FEATURE MSVC_FLAG DEF)
|
||||
add_library(argon2-${FEATURE} STATIC arch/x86_64/lib/argon2-${FEATURE}.c)
|
||||
target_include_directories(argon2-${FEATURE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_include_directories(argon2-${FEATURE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
target_include_directories(argon2-${FEATURE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
||||
set_target_properties(argon2-${FEATURE} PROPERTIES POSITION_INDEPENDENT_CODE True)
|
||||
|
||||
@@ -38,7 +38,7 @@ if (CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
elseif (NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
function(add_feature_impl FEATURE GCC_FLAG DEF)
|
||||
add_library(argon2-${FEATURE} STATIC arch/x86_64/lib/argon2-${FEATURE}.c)
|
||||
target_include_directories(argon2-${FEATURE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_include_directories(argon2-${FEATURE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
target_include_directories(argon2-${FEATURE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
||||
set_target_properties(argon2-${FEATURE} PROPERTIES POSITION_INDEPENDENT_CODE True)
|
||||
|
||||
@@ -84,5 +84,5 @@ endif()
|
||||
add_library(argon2 STATIC ${ARGON2_SOURCES})
|
||||
target_link_libraries(argon2 ${ARGON2_LIBS})
|
||||
|
||||
target_include_directories(argon2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_include_directories(argon2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
target_include_directories(argon2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
||||
|
||||
2
src/3rdparty/argon2/lib/argon2.c
vendored
2
src/3rdparty/argon2/lib/argon2.c
vendored
@@ -15,7 +15,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "argon2.h"
|
||||
#include "3rdparty/argon2.h"
|
||||
#include "encoding.h"
|
||||
#include "core.h"
|
||||
|
||||
|
||||
2
src/3rdparty/argon2/lib/core.h
vendored
2
src/3rdparty/argon2/lib/core.h
vendored
@@ -14,7 +14,7 @@
|
||||
#ifndef ARGON2_CORE_H
|
||||
#define ARGON2_CORE_H
|
||||
|
||||
#include "argon2.h"
|
||||
#include "3rdparty/argon2.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define ALIGN(n) __declspec(align(16))
|
||||
|
||||
2
src/3rdparty/argon2/lib/encoding.h
vendored
2
src/3rdparty/argon2/lib/encoding.h
vendored
@@ -1,6 +1,6 @@
|
||||
#ifndef ENCODING_H
|
||||
#define ENCODING_H
|
||||
#include "argon2.h"
|
||||
#include "3rdparty/argon2.h"
|
||||
|
||||
#define ARGON2_MAX_DECODED_LANES UINT32_C(255)
|
||||
#define ARGON2_MIN_DECODED_SALT_LEN UINT32_C(8)
|
||||
|
||||
2
src/3rdparty/argon2/lib/impl-select.c
vendored
2
src/3rdparty/argon2/lib/impl-select.c
vendored
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "impl-select.h"
|
||||
|
||||
#include "argon2.h"
|
||||
#include "3rdparty/argon2.h"
|
||||
|
||||
#define BENCH_SAMPLES 1024
|
||||
#define BENCH_MEM_BLOCKS 512
|
||||
|
||||
65
src/App.cpp
65
src/App.cpp
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
@@ -36,24 +36,14 @@
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "core/Miner.h"
|
||||
#include "crypto/common/VirtualMemory.h"
|
||||
#include "net/Network.h"
|
||||
#include "Summary.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
xmrig::App::App(Process *process) :
|
||||
m_console(nullptr),
|
||||
m_signals(nullptr)
|
||||
xmrig::App::App(Process *process)
|
||||
{
|
||||
m_controller = new Controller(process);
|
||||
if (m_controller->init() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_controller->config()->isBackground()) {
|
||||
m_console = new Console(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +58,26 @@ xmrig::App::~App()
|
||||
int xmrig::App::exec()
|
||||
{
|
||||
if (!m_controller->isReady()) {
|
||||
LOG_EMERG("no valid configuration found.");
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
m_signals = new Signals(this);
|
||||
|
||||
background();
|
||||
int rc = 0;
|
||||
if (background(rc)) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
VirtualMemory::init(m_controller->config()->cpu().isHugePages());
|
||||
rc = m_controller->init();
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!m_controller->isBackground()) {
|
||||
m_console = new Console(this);
|
||||
}
|
||||
|
||||
Summary::print(m_controller);
|
||||
|
||||
@@ -87,38 +89,21 @@ int xmrig::App::exec()
|
||||
|
||||
m_controller->start();
|
||||
|
||||
const int r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
uv_loop_close(uv_default_loop());
|
||||
|
||||
return r;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::App::onConsoleCommand(char command)
|
||||
{
|
||||
switch (command) {
|
||||
case 'h':
|
||||
case 'H':
|
||||
m_controller->miner()->printHashrate(true);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
case 'P':
|
||||
m_controller->miner()->setEnabled(false);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
case 'R':
|
||||
m_controller->miner()->setEnabled(true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (command == 3) {
|
||||
LOG_WARN("Ctrl+C received, exiting");
|
||||
close();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else {
|
||||
m_controller->miner()->execCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +135,11 @@ void xmrig::App::onSignal(int signum)
|
||||
void xmrig::App::close()
|
||||
{
|
||||
m_signals->stop();
|
||||
m_console->stop();
|
||||
|
||||
if (m_console) {
|
||||
m_console->stop();
|
||||
}
|
||||
|
||||
m_controller->stop();
|
||||
|
||||
Log::destroy();
|
||||
|
||||
11
src/App.h
11
src/App.h
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "base/kernel/interfaces/IConsoleListener.h"
|
||||
#include "base/kernel/interfaces/ISignalListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -44,6 +45,8 @@ class Signals;
|
||||
class App : public IConsoleListener, public ISignalListener
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(App)
|
||||
|
||||
App(Process *process);
|
||||
~App() override;
|
||||
|
||||
@@ -54,12 +57,12 @@ protected:
|
||||
void onSignal(int signum) override;
|
||||
|
||||
private:
|
||||
void background();
|
||||
bool background(int &rc);
|
||||
void close();
|
||||
|
||||
Console *m_console;
|
||||
Controller *m_controller;
|
||||
Signals *m_signals;
|
||||
Console *m_console = nullptr;
|
||||
Controller *m_controller = nullptr;
|
||||
Signals *m_signals = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,33 +23,36 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <cstdlib>
|
||||
#include <csignal>
|
||||
#include <cerrno>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include "App.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Controller.h"
|
||||
|
||||
|
||||
void xmrig::App::background()
|
||||
bool xmrig::App::background(int &rc)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
if (!m_controller->config()->isBackground()) {
|
||||
return;
|
||||
if (!m_controller->isBackground()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = fork();
|
||||
if (i < 0) {
|
||||
exit(1);
|
||||
rc = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
exit(0);
|
||||
rc = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
i = setsid();
|
||||
@@ -62,4 +65,6 @@ void xmrig::App::background()
|
||||
if (i < 0) {
|
||||
LOG_ERR("chdir() failed (errno = %d)", errno);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,12 @@
|
||||
|
||||
#include "App.h"
|
||||
#include "core/Controller.h"
|
||||
#include "core/config/Config.h"
|
||||
|
||||
|
||||
void xmrig::App::background()
|
||||
bool xmrig::App::background(int &)
|
||||
{
|
||||
if (!m_controller->config()->isBackground()) {
|
||||
return;
|
||||
if (!m_controller->isBackground()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HWND hcon = GetConsoleWindow();
|
||||
@@ -46,4 +45,6 @@ void xmrig::App::background()
|
||||
CloseHandle(h);
|
||||
FreeConsole();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <cinttypes>
|
||||
#include <cstdio>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
@@ -59,10 +59,10 @@ inline static const char *asmName(Assembly::Id assembly)
|
||||
#endif
|
||||
|
||||
|
||||
static void print_memory(Config *) {
|
||||
static void print_memory(Config *config) {
|
||||
# ifdef _WIN32
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"HUGE PAGES", VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("permission granted") : RED_BOLD("unavailable"));
|
||||
"HUGE PAGES", config->cpu().isHugePages() ? (VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("permission granted") : RED_BOLD("unavailable")) : RED_BOLD("disabled"));
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ static void print_threads(Config *config)
|
||||
static void print_commands(Config *)
|
||||
{
|
||||
if (Log::colors) {
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ")
|
||||
MAGENTA_BOLD("p") WHITE_BOLD("ause, ")
|
||||
MAGENTA_BOLD("r") WHITE_BOLD("esume"));
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BG(WHITE_BOLD_S "h") WHITE_BOLD("ashrate, ")
|
||||
MAGENTA_BG(WHITE_BOLD_S "p") WHITE_BOLD("ause, ")
|
||||
MAGENTA_BG(WHITE_BOLD_S "r") WHITE_BOLD("esume"));
|
||||
}
|
||||
else {
|
||||
Log::print(" * COMMANDS 'h' hashrate, 'p' pause, 'r' resume");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
include (src/backend/cpu/cpu.cmake)
|
||||
include (src/backend/opencl/opencl.cmake)
|
||||
include (src/backend/cuda/cuda.cmake)
|
||||
include (src/backend/common/common.cmake)
|
||||
|
||||
|
||||
@@ -7,10 +8,12 @@ set(HEADERS_BACKEND
|
||||
"${HEADERS_BACKEND_COMMON}"
|
||||
"${HEADERS_BACKEND_CPU}"
|
||||
"${HEADERS_BACKEND_OPENCL}"
|
||||
"${HEADERS_BACKEND_CUDA}"
|
||||
)
|
||||
|
||||
set(SOURCES_BACKEND
|
||||
"${SOURCES_BACKEND_COMMON}"
|
||||
"${SOURCES_BACKEND_CPU}"
|
||||
"${SOURCES_BACKEND_OPENCL}"
|
||||
"${SOURCES_BACKEND_CUDA}"
|
||||
)
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "backend/common/Hashrate.h"
|
||||
@@ -47,7 +47,6 @@ inline static const char *format(double h, char *buf, size_t size)
|
||||
|
||||
|
||||
xmrig::Hashrate::Hashrate(size_t threads) :
|
||||
m_highest(0.0),
|
||||
m_threads(threads)
|
||||
{
|
||||
m_counts = new uint64_t*[threads];
|
||||
@@ -100,30 +99,30 @@ double xmrig::Hashrate::calc(size_t threadId, size_t ms) const
|
||||
|
||||
uint64_t earliestHashCount = 0;
|
||||
uint64_t earliestStamp = 0;
|
||||
uint64_t lastestStamp = 0;
|
||||
uint64_t lastestHashCnt = 0;
|
||||
bool haveFullSet = false;
|
||||
|
||||
for (size_t i = 1; i < kBucketSize; i++) {
|
||||
const size_t idx = (m_top[threadId] - i) & kBucketMask;
|
||||
const uint64_t timeStampLimit = xmrig::Chrono::highResolutionMSecs() - ms;
|
||||
uint64_t* timestamps = m_timestamps[threadId];
|
||||
uint64_t* counts = m_counts[threadId];
|
||||
|
||||
if (m_timestamps[threadId][idx] == 0) {
|
||||
const size_t idx_start = (m_top[threadId] - 1) & kBucketMask;
|
||||
size_t idx = idx_start;
|
||||
|
||||
uint64_t lastestStamp = timestamps[idx];
|
||||
uint64_t lastestHashCnt = counts[idx];
|
||||
|
||||
do {
|
||||
if (timestamps[idx] < timeStampLimit) {
|
||||
haveFullSet = (timestamps[idx] != 0);
|
||||
if (idx != idx_start) {
|
||||
idx = (idx + 1) & kBucketMask;
|
||||
earliestStamp = timestamps[idx];
|
||||
earliestHashCount = counts[idx];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (lastestStamp == 0) {
|
||||
lastestStamp = m_timestamps[threadId][idx];
|
||||
lastestHashCnt = m_counts[threadId][idx];
|
||||
}
|
||||
|
||||
if (xmrig::Chrono::highResolutionMSecs() - m_timestamps[threadId][idx] > ms) {
|
||||
haveFullSet = true;
|
||||
break;
|
||||
}
|
||||
|
||||
earliestStamp = m_timestamps[threadId][idx];
|
||||
earliestHashCount = m_counts[threadId][idx];
|
||||
}
|
||||
idx = (idx - 1) & kBucketMask;
|
||||
} while (idx != idx_start);
|
||||
|
||||
if (!haveFullSet || earliestStamp == 0 || lastestStamp == 0) {
|
||||
return nan("");
|
||||
@@ -133,8 +132,8 @@ double xmrig::Hashrate::calc(size_t threadId, size_t ms) const
|
||||
return nan("");
|
||||
}
|
||||
|
||||
const double hashes = static_cast<double>(lastestHashCnt - earliestHashCount);
|
||||
const double time = static_cast<double>(lastestStamp - earliestStamp) / 1000.0;
|
||||
const auto hashes = static_cast<double>(lastestHashCnt - earliestHashCount);
|
||||
const auto time = static_cast<double>(lastestStamp - earliestStamp) / 1000.0;
|
||||
|
||||
return hashes / time;
|
||||
}
|
||||
@@ -150,15 +149,6 @@ void xmrig::Hashrate::add(size_t threadId, uint64_t count, uint64_t timestamp)
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Hashrate::updateHighest()
|
||||
{
|
||||
double highest = calc(ShortInterval);
|
||||
if (std::isnormal(highest) && highest > m_highest) {
|
||||
m_highest = highest;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::Hashrate::format(double h, char *buf, size_t size)
|
||||
{
|
||||
return ::format(h, buf, size);
|
||||
@@ -175,3 +165,33 @@ rapidjson::Value xmrig::Hashrate::normalize(double d)
|
||||
|
||||
return Value(floor(d * 100.0) / 100.0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
rapidjson::Value xmrig::Hashrate::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value out(kArrayType);
|
||||
out.PushBack(normalize(calc(ShortInterval)), allocator);
|
||||
out.PushBack(normalize(calc(MediumInterval)), allocator);
|
||||
out.PushBack(normalize(calc(LargeInterval)), allocator);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::Hashrate::toJSON(size_t threadId, rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value out(kArrayType);
|
||||
out.PushBack(normalize(calc(threadId, ShortInterval)), allocator);
|
||||
out.PushBack(normalize(calc(threadId, MediumInterval)), allocator);
|
||||
out.PushBack(normalize(calc(threadId, LargeInterval)), allocator);
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#define XMRIG_HASHRATE_H
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#include "base/tools/Object.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
@@ -39,6 +40,8 @@ namespace xmrig {
|
||||
class Hashrate
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Hashrate)
|
||||
|
||||
enum Intervals {
|
||||
ShortInterval = 10000,
|
||||
MediumInterval = 60000,
|
||||
@@ -50,19 +53,21 @@ public:
|
||||
double calc(size_t ms) const;
|
||||
double calc(size_t threadId, size_t ms) const;
|
||||
void add(size_t threadId, uint64_t count, uint64_t timestamp);
|
||||
void updateHighest();
|
||||
|
||||
inline double highest() const { return m_highest; }
|
||||
inline size_t threads() const { return m_threads; }
|
||||
|
||||
static const char *format(double h, char *buf, size_t size);
|
||||
static rapidjson::Value normalize(double d);
|
||||
|
||||
# ifdef XMRIG_FEATURE_API
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
rapidjson::Value toJSON(size_t threadId, rapidjson::Document &doc) const;
|
||||
# endif
|
||||
|
||||
private:
|
||||
constexpr static size_t kBucketSize = 2 << 11;
|
||||
constexpr static size_t kBucketMask = kBucketSize - 1;
|
||||
|
||||
double m_highest;
|
||||
size_t m_threads;
|
||||
uint32_t* m_top;
|
||||
uint64_t** m_counts;
|
||||
|
||||
@@ -27,10 +27,15 @@
|
||||
#define XMRIG_TAGS_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
const char *backend_tag(uint32_t backend);
|
||||
const char *cpu_tag();
|
||||
const char *net_tag();
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
@@ -38,6 +43,17 @@ const char *ocl_tag();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
const char *cuda_tag();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
const char *rx_tag();
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#define XMRIG_THREAD_H
|
||||
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
||||
#include "backend/common/interfaces/IWorker.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -42,6 +43,8 @@ template<class T>
|
||||
class Thread
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Thread)
|
||||
|
||||
inline Thread(IBackend *backend, size_t id, const T &config) : m_id(id), m_config(config), m_backend(backend) {}
|
||||
inline ~Thread() { m_thread.join(); delete m_worker; }
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
# include "backend/cuda/CudaThreads.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
@@ -167,4 +172,8 @@ template class Threads<CpuThreads>;
|
||||
template class Threads<OclThreads>;
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
template class Threads<CudaThreads>;
|
||||
#endif
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
@@ -44,15 +44,25 @@ class Threads
|
||||
public:
|
||||
inline bool has(const char *profile) const { return m_profiles.count(profile) > 0; }
|
||||
inline bool isDisabled(const Algorithm &algo) const { return m_disabled.count(algo) > 0; }
|
||||
inline bool isEmpty() const { return m_profiles.empty(); }
|
||||
inline bool isExist(const Algorithm &algo) const { return isDisabled(algo) || m_aliases.count(algo) > 0 || has(algo.shortName()); }
|
||||
inline const T &get(const Algorithm &algo, bool strict = false) const { return get(profileName(algo, strict)); }
|
||||
inline void disable(const Algorithm &algo) { m_disabled.insert(algo); }
|
||||
inline void setAlias(const Algorithm &algo, const char *profile) { m_aliases[algo] = profile; }
|
||||
|
||||
inline void move(const char *profile, T &&threads)
|
||||
inline size_t move(const char *profile, T &&threads)
|
||||
{
|
||||
if (has(profile)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const size_t count = threads.count();
|
||||
|
||||
if (!threads.isEmpty()) {
|
||||
m_profiles.insert({ profile, std::move(threads) });
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
const T &get(const String &profileName) const;
|
||||
|
||||
@@ -34,8 +34,7 @@ xmrig::Worker::Worker(size_t id, int64_t affinity, int priority) :
|
||||
m_affinity(affinity),
|
||||
m_id(id),
|
||||
m_hashCount(0),
|
||||
m_timestamp(0),
|
||||
m_count(0)
|
||||
m_timestamp(0)
|
||||
{
|
||||
m_node = VirtualMemory::bindToNUMANode(affinity);
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ protected:
|
||||
const size_t m_id;
|
||||
std::atomic<uint64_t> m_hashCount;
|
||||
std::atomic<uint64_t> m_timestamp;
|
||||
uint32_t m_node = 0;
|
||||
uint64_t m_count;
|
||||
uint32_t m_node = 0;
|
||||
uint64_t m_count = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define XMRIG_WORKERJOB_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
#include "base/net/stratum/Job.h"
|
||||
@@ -47,9 +47,9 @@ public:
|
||||
inline uint8_t index() const { return m_index; }
|
||||
|
||||
|
||||
inline void add(const Job &job, uint64_t sequence, uint32_t reserveCount)
|
||||
inline void add(const Job &job, uint32_t reserveCount, Nonce::Backend backend)
|
||||
{
|
||||
m_sequence = sequence;
|
||||
m_sequence = Nonce::sequence(backend);
|
||||
|
||||
if (currentJob() == job) {
|
||||
return;
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
save(job, reserveCount);
|
||||
save(job, reserveCount, backend);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,13 +82,15 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
inline void save(const Job &job, uint32_t reserveCount)
|
||||
inline void save(const Job &job, uint32_t reserveCount, Nonce::Backend backend)
|
||||
{
|
||||
m_index = job.index();
|
||||
const size_t size = job.size();
|
||||
m_jobs[index()] = job;
|
||||
m_rounds[index()] = 0;
|
||||
|
||||
m_jobs[index()].setBackend(backend);
|
||||
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
memcpy(m_blobs[index()] + (i * size), job.blob(), size);
|
||||
*nonce(i) = Nonce::next(index(), *nonce(i), reserveCount, job.isNicehash());
|
||||
@@ -96,7 +98,7 @@ private:
|
||||
}
|
||||
|
||||
|
||||
alignas(16) uint8_t m_blobs[2][Job::kMaxBlobSize * N];
|
||||
alignas(16) uint8_t m_blobs[2][Job::kMaxBlobSize * N]{};
|
||||
Job m_jobs[2];
|
||||
uint32_t m_rounds[2] = { 0, 0 };
|
||||
uint64_t m_sequence = 0;
|
||||
@@ -126,12 +128,14 @@ inline void xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
||||
|
||||
|
||||
template<>
|
||||
inline void xmrig::WorkerJob<1>::save(const Job &job, uint32_t reserveCount)
|
||||
inline void xmrig::WorkerJob<1>::save(const Job &job, uint32_t reserveCount, Nonce::Backend backend)
|
||||
{
|
||||
m_index = job.index();
|
||||
m_jobs[index()] = job;
|
||||
m_rounds[index()] = 0;
|
||||
|
||||
m_jobs[index()].setBackend(backend);
|
||||
|
||||
memcpy(blob(), job.blob(), job.size());
|
||||
*nonce() = Nonce::next(index(), *nonce(), reserveCount, currentJob().isNicehash());
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "backend/common/Workers.h"
|
||||
#include "backend/cpu/CpuWorker.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
@@ -36,15 +37,21 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
# include "backend/cuda/CudaWorker.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class WorkersPrivate
|
||||
{
|
||||
public:
|
||||
inline WorkersPrivate()
|
||||
{
|
||||
}
|
||||
XMRIG_DISABLE_COPY_MOVE(WorkersPrivate)
|
||||
|
||||
|
||||
WorkersPrivate() = default;
|
||||
|
||||
|
||||
inline ~WorkersPrivate()
|
||||
@@ -98,6 +105,7 @@ void xmrig::Workers<T>::start(const std::vector<T> &data)
|
||||
}
|
||||
|
||||
d_ptr->hashrate = new Hashrate(m_workers.size());
|
||||
Nonce::touch(T::backend());
|
||||
|
||||
for (Thread<T> *worker : m_workers) {
|
||||
worker->start(Workers<T>::onReady);
|
||||
@@ -131,13 +139,11 @@ void xmrig::Workers<T>::tick(uint64_t)
|
||||
|
||||
for (Thread<T> *handle : m_workers) {
|
||||
if (!handle->worker()) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
d_ptr->hashrate->add(handle->id(), handle->worker()->hashCount(), handle->worker()->timestamp());
|
||||
}
|
||||
|
||||
d_ptr->hashrate->updateHighest();
|
||||
}
|
||||
|
||||
|
||||
@@ -154,17 +160,21 @@ void xmrig::Workers<T>::onReady(void *arg)
|
||||
auto handle = static_cast<Thread<T>* >(arg);
|
||||
|
||||
IWorker *worker = create(handle);
|
||||
if (!worker || !worker->selfTest()) {
|
||||
LOG_ERR("thread %zu error: \"hash self-test failed\".", worker->id());
|
||||
assert(worker != nullptr);
|
||||
|
||||
if (!worker || !worker->selfTest()) {
|
||||
LOG_ERR("%s " RED("thread ") RED_BOLD("#%zu") RED(" self-test failed"), T::tag(), worker->id());
|
||||
|
||||
handle->backend()->start(worker, false);
|
||||
delete worker;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
assert(handle->backend() != nullptr);
|
||||
|
||||
handle->setWorker(worker);
|
||||
handle->backend()->start(worker);
|
||||
handle->backend()->start(worker, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -210,4 +220,16 @@ template class Workers<OclLaunchData>;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
template<>
|
||||
xmrig::IWorker *xmrig::Workers<CudaLaunchData>::create(Thread<CudaLaunchData> *handle)
|
||||
{
|
||||
return new CudaWorker(handle->id(), handle->config());
|
||||
}
|
||||
|
||||
|
||||
template class Workers<CudaLaunchData>;
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "backend/common/Thread.h"
|
||||
#include "backend/cpu/CpuLaunchData.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
@@ -36,6 +37,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
# include "backend/cuda/CudaLaunchData.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
@@ -47,6 +53,8 @@ template<class T>
|
||||
class Workers
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(Workers)
|
||||
|
||||
Workers();
|
||||
~Workers();
|
||||
|
||||
@@ -77,6 +85,13 @@ extern template class Workers<OclLaunchData>;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
template<>
|
||||
IWorker *Workers<CudaLaunchData>::create(Thread<CudaLaunchData> *handle);
|
||||
extern template class Workers<CudaLaunchData>;
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ set(HEADERS_BACKEND_COMMON
|
||||
src/backend/common/Tags.h
|
||||
src/backend/common/interfaces/IBackend.h
|
||||
src/backend/common/interfaces/IRxListener.h
|
||||
src/backend/common/interfaces/IRxStorage.h
|
||||
src/backend/common/interfaces/IThread.h
|
||||
src/backend/common/interfaces/IWorker.h
|
||||
src/backend/common/misc/PciTopology.h
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define XMRIG_IBACKEND_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#include "rapidjson/fwd.h"
|
||||
@@ -53,10 +53,11 @@ public:
|
||||
virtual const Hashrate *hashrate() const = 0;
|
||||
virtual const String &profileName() const = 0;
|
||||
virtual const String &type() const = 0;
|
||||
virtual void execCommand(char command) = 0;
|
||||
virtual void prepare(const Job &nextJob) = 0;
|
||||
virtual void printHashrate(bool details) = 0;
|
||||
virtual void setJob(const Job &job) = 0;
|
||||
virtual void start(IWorker *worker) = 0;
|
||||
virtual void start(IWorker *worker, bool ready) = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void tick(uint64_t ticks) = 0;
|
||||
|
||||
|
||||
53
src/backend/common/interfaces/IMemoryPool.h
Normal file
53
src/backend/common/interfaces/IMemoryPool.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2018-2019 tevador <tevador@gmail.com>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_IMEMORYPOOL_H
|
||||
#define XMRIG_IMEMORYPOOL_H
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class IMemoryPool
|
||||
{
|
||||
public:
|
||||
virtual ~IMemoryPool() = default;
|
||||
|
||||
virtual bool isHugePages(uint32_t node) const = 0;
|
||||
virtual uint8_t *get(size_t size, uint32_t node) = 0;
|
||||
virtual void release(uint32_t node) = 0;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
|
||||
#endif /* XMRIG_IMEMORYPOOL_H */
|
||||
53
src/backend/common/interfaces/IRxStorage.h
Normal file
53
src/backend/common/interfaces/IRxStorage.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2018 XMRig <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_IRXSTORAGE_H
|
||||
#define XMRIG_IRXSTORAGE_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Job;
|
||||
class RxDataset;
|
||||
class RxSeed;
|
||||
|
||||
|
||||
class IRxStorage
|
||||
{
|
||||
public:
|
||||
virtual ~IRxStorage() = default;
|
||||
|
||||
virtual RxDataset *dataset(const Job &job, uint32_t nodeId) const = 0;
|
||||
virtual std::pair<uint32_t, uint32_t> hugePages() const = 0;
|
||||
virtual void init(const RxSeed &seed, uint32_t threads, bool hugePages) = 0;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif // XMRIG_IRXSTORAGE_H
|
||||
@@ -26,8 +26,8 @@
|
||||
#define XMRIG_IWORKER_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
virtual bool selfTest() = 0;
|
||||
virtual const VirtualMemory *memory() const = 0;
|
||||
virtual size_t id() const = 0;
|
||||
virtual size_t intensity() const = 0;
|
||||
virtual uint64_t hashCount() const = 0;
|
||||
virtual uint64_t timestamp() const = 0;
|
||||
virtual void start() = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define XMRIG_PCITOPOLOGY_H
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "base/tools/String.h"
|
||||
@@ -40,19 +40,30 @@ class PciTopology
|
||||
{
|
||||
public:
|
||||
PciTopology() = default;
|
||||
PciTopology(uint32_t bus, uint32_t device, uint32_t function) : bus(bus), device(device), function(function) {}
|
||||
PciTopology(uint32_t bus, uint32_t device, uint32_t function) : m_valid(true), m_bus(bus), m_device(device), m_function(function) {}
|
||||
|
||||
uint32_t bus = 0;
|
||||
uint32_t device = 0;
|
||||
uint32_t function = 0;
|
||||
inline bool isValid() const { return m_valid; }
|
||||
inline uint8_t bus() const { return m_bus; }
|
||||
inline uint8_t device() const { return m_device; }
|
||||
inline uint8_t function() const { return m_function; }
|
||||
|
||||
String toString() const
|
||||
{
|
||||
if (!isValid()) {
|
||||
return "n/a";
|
||||
}
|
||||
|
||||
char *buf = new char[8]();
|
||||
snprintf(buf, 8, "%02x:%02x.%01x", bus, device, function);
|
||||
snprintf(buf, 8, "%02hhx:%02hhx.%01hhx", bus(), device(), function());
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_valid = false;
|
||||
uint8_t m_bus = 0;
|
||||
uint8_t m_device = 0;
|
||||
uint8_t m_function = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
#include "backend/cpu/Cpu.h"
|
||||
@@ -44,7 +44,15 @@ static xmrig::ICpuInfo *cpuInfo = nullptr;
|
||||
|
||||
xmrig::ICpuInfo *xmrig::Cpu::info()
|
||||
{
|
||||
assert(cpuInfo != nullptr);
|
||||
if (cpuInfo == nullptr) {
|
||||
# if defined(XMRIG_FEATURE_HWLOC)
|
||||
cpuInfo = new HwlocCpuInfo();
|
||||
# elif defined(XMRIG_FEATURE_LIBCPUID)
|
||||
cpuInfo = new AdvancedCpuInfo();
|
||||
# else
|
||||
cpuInfo = new BasicCpuInfo();
|
||||
# endif
|
||||
}
|
||||
|
||||
return cpuInfo;
|
||||
}
|
||||
@@ -62,7 +70,7 @@ rapidjson::Value xmrig::Cpu::toJSON(rapidjson::Document &doc)
|
||||
cpu.AddMember("brand", StringRef(i->brand()), allocator);
|
||||
cpu.AddMember("aes", i->hasAES(), allocator);
|
||||
cpu.AddMember("avx2", i->hasAVX2(), allocator);
|
||||
cpu.AddMember("x64", i->isX64(), allocator);
|
||||
cpu.AddMember("x64", ICpuInfo::isX64(), allocator);
|
||||
cpu.AddMember("l2", static_cast<uint64_t>(i->L2()), allocator);
|
||||
cpu.AddMember("l3", static_cast<uint64_t>(i->L3()), allocator);
|
||||
cpu.AddMember("cores", static_cast<uint64_t>(i->cores()), allocator);
|
||||
@@ -81,20 +89,6 @@ rapidjson::Value xmrig::Cpu::toJSON(rapidjson::Document &doc)
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Cpu::init()
|
||||
{
|
||||
assert(cpuInfo == nullptr);
|
||||
|
||||
# if defined(XMRIG_FEATURE_HWLOC)
|
||||
cpuInfo = new HwlocCpuInfo();
|
||||
# elif defined(XMRIG_FEATURE_LIBCPUID)
|
||||
cpuInfo = new AdvancedCpuInfo();
|
||||
# else
|
||||
cpuInfo = new BasicCpuInfo();
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Cpu::release()
|
||||
{
|
||||
assert(cpuInfo != nullptr);
|
||||
|
||||
@@ -37,7 +37,6 @@ class Cpu
|
||||
public:
|
||||
static ICpuInfo *info();
|
||||
static rapidjson::Value toJSON(rapidjson::Document &doc);
|
||||
static void init();
|
||||
static void release();
|
||||
|
||||
inline static Assembly::Id assembly(Assembly::Id hint) { return hint == Assembly::AUTO ? Cpu::info()->assembly() : hint; }
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace xmrig {
|
||||
extern template class Threads<CpuThreads>;
|
||||
|
||||
|
||||
static const char *tag = CYAN_BG_BOLD(" cpu ");
|
||||
static const char *tag = CYAN_BG_BOLD(WHITE_BOLD_S " cpu ");
|
||||
static const String kType = "cpu";
|
||||
static std::mutex mutex;
|
||||
|
||||
@@ -80,38 +80,51 @@ public:
|
||||
m_memory = memory;
|
||||
m_pages = 0;
|
||||
m_started = 0;
|
||||
m_errors = 0;
|
||||
m_threads = threads.size();
|
||||
m_ways = 0;
|
||||
m_ts = Chrono::steadyMSecs();
|
||||
|
||||
for (const CpuLaunchData &data : threads) {
|
||||
m_ways += data.intensity;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool started(const std::pair<size_t, size_t> &hugePages)
|
||||
inline bool started(IWorker *worker, bool ready)
|
||||
{
|
||||
m_started++;
|
||||
m_hugePages += hugePages.first;
|
||||
m_pages += hugePages.second;
|
||||
if (ready) {
|
||||
auto hugePages = worker->memory()->hugePages();
|
||||
|
||||
return m_started == m_threads;
|
||||
m_started++;
|
||||
m_hugePages += hugePages.first;
|
||||
m_pages += hugePages.second;
|
||||
m_ways += worker->intensity();
|
||||
}
|
||||
else {
|
||||
m_errors++;
|
||||
}
|
||||
|
||||
return (m_started + m_errors) == m_threads;
|
||||
}
|
||||
|
||||
inline void print() const
|
||||
{
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
if (m_started == 0) {
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), tag);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads %s%zu/%zu (%zu)" CLEAR " huge pages %s%1.0f%% %zu/%zu" CLEAR " memory " CYAN_BOLD("%zu KB") BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
tag,
|
||||
m_threads, m_ways,
|
||||
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
|
||||
m_started, m_threads, m_ways,
|
||||
(m_hugePages == m_pages ? GREEN_BOLD_S : (m_hugePages == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
||||
m_hugePages, m_pages,
|
||||
m_hugePages == 0 ? 0.0 : static_cast<double>(m_hugePages) / m_pages * 100.0,
|
||||
m_ways * m_memory / 1024,
|
||||
m_hugePages, m_pages,
|
||||
memory() / 1024,
|
||||
Chrono::steadyMSecs() - m_ts
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
size_t m_errors = 0;
|
||||
size_t m_hugePages = 0;
|
||||
size_t m_memory = 0;
|
||||
size_t m_pages = 0;
|
||||
@@ -133,10 +146,11 @@ public:
|
||||
|
||||
inline void start()
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" threads)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
tag,
|
||||
profileName.data(),
|
||||
threads.size(),
|
||||
threads.size() > 1 ? "s" : "",
|
||||
algo.l3() / 1024
|
||||
);
|
||||
|
||||
@@ -197,6 +211,24 @@ public:
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
const char *xmrig::backend_tag(uint32_t backend)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
if (backend == Nonce::OPENCL) {
|
||||
return ocl_tag();
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_CUDA
|
||||
if (backend == Nonce::CUDA) {
|
||||
return cuda_tag();
|
||||
}
|
||||
# endif
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::cpu_tag()
|
||||
{
|
||||
return tag;
|
||||
@@ -322,17 +354,19 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::start(IWorker *worker)
|
||||
void xmrig::CpuBackend::start(IWorker *worker, bool ready)
|
||||
{
|
||||
mutex.lock();
|
||||
|
||||
if (d_ptr->status.started(worker->memory()->hugePages())) {
|
||||
if (d_ptr->status.started(worker, ready)) {
|
||||
d_ptr->status.print();
|
||||
}
|
||||
|
||||
mutex.unlock();
|
||||
|
||||
worker->start();
|
||||
if (ready) {
|
||||
worker->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -390,8 +424,9 @@ rapidjson::Value xmrig::CpuBackend::toJSON(rapidjson::Document &doc) const
|
||||
return out;
|
||||
}
|
||||
|
||||
out.AddMember("hashrate", hashrate()->toJSON(doc), allocator);
|
||||
|
||||
Value threads(kArrayType);
|
||||
const Hashrate *hr = hashrate();
|
||||
|
||||
size_t i = 0;
|
||||
for (const CpuLaunchData &data : d_ptr->threads) {
|
||||
@@ -399,15 +434,9 @@ rapidjson::Value xmrig::CpuBackend::toJSON(rapidjson::Document &doc) const
|
||||
thread.AddMember("intensity", data.intensity, allocator);
|
||||
thread.AddMember("affinity", data.affinity, allocator);
|
||||
thread.AddMember("av", data.av(), allocator);
|
||||
|
||||
Value hashrate(kArrayType);
|
||||
hashrate.PushBack(Hashrate::normalize(hr->calc(i, Hashrate::ShortInterval)), allocator);
|
||||
hashrate.PushBack(Hashrate::normalize(hr->calc(i, Hashrate::MediumInterval)), allocator);
|
||||
hashrate.PushBack(Hashrate::normalize(hr->calc(i, Hashrate::LargeInterval)), allocator);
|
||||
thread.AddMember("hashrate", hashrate()->toJSON(i, doc), allocator);
|
||||
|
||||
i++;
|
||||
|
||||
thread.AddMember("hashrate", hashrate, allocator);
|
||||
threads.PushBack(thread, allocator);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#define XMRIG_CPUBACKEND_H
|
||||
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
#include "backend/common/interfaces/IBackend.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -43,10 +44,14 @@ class Miner;
|
||||
class CpuBackend : public IBackend
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(CpuBackend)
|
||||
|
||||
CpuBackend(Controller *controller);
|
||||
~CpuBackend() override;
|
||||
|
||||
protected:
|
||||
inline void execCommand(char) override {}
|
||||
|
||||
bool isEnabled() const override;
|
||||
bool isEnabled(const Algorithm &algorithm) const override;
|
||||
const Hashrate *hashrate() const override;
|
||||
@@ -55,7 +60,7 @@ protected:
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker) override;
|
||||
void start(IWorker *worker, bool ready) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t ticks) override;
|
||||
|
||||
|
||||
@@ -23,47 +23,27 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "backend/cpu/CpuConfig.h"
|
||||
#include "backend/cpu/CpuConfig_gen.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kCn = "cn";
|
||||
static const char *kEnabled = "enabled";
|
||||
static const char *kHugePages = "huge-pages";
|
||||
static const char *kHwAes = "hw-aes";
|
||||
static const char *kMaxThreadsHint = "max-threads-hint";
|
||||
static const char *kMemoryPool = "memory-pool";
|
||||
static const char *kPriority = "priority";
|
||||
|
||||
#ifdef XMRIG_FEATURE_ASM
|
||||
static const char *kAsm = "asm";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_GPU
|
||||
static const char *kCnGPU = "cn/gpu";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
static const char *kCnLite = "cn-lite";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
static const char *kCnHeavy = "cn-heavy";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
static const char *kCnPico = "cn-pico";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
static const char *kRx = "rx";
|
||||
static const char *kRxWOW = "rx/wow";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_ARGON2
|
||||
static const char *kArgon2 = "argon2";
|
||||
static const char *kArgon2Impl = "argon2-impl";
|
||||
#endif
|
||||
|
||||
@@ -72,11 +52,6 @@ extern template class Threads<CpuThreads>;
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuConfig::CpuConfig()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CpuConfig::isHwAES() const
|
||||
{
|
||||
return (m_aes == AES_AUTO ? (Cpu::info()->hasAES() ? AES_HW : AES_SOFT) : m_aes) == AES_HW;
|
||||
@@ -94,6 +69,11 @@ rapidjson::Value xmrig::CpuConfig::toJSON(rapidjson::Document &doc) const
|
||||
obj.AddMember(StringRef(kHugePages), m_hugePages, allocator);
|
||||
obj.AddMember(StringRef(kHwAes), m_aes == AES_AUTO ? Value(kNullType) : Value(m_aes == AES_HW), allocator);
|
||||
obj.AddMember(StringRef(kPriority), priority() != -1 ? Value(priority()) : Value(kNullType), allocator);
|
||||
obj.AddMember(StringRef(kMemoryPool), m_memoryPool < 1 ? Value(m_memoryPool < 0) : Value(m_memoryPool), allocator);
|
||||
|
||||
if (m_threads.isEmpty()) {
|
||||
obj.AddMember(StringRef(kMaxThreadsHint), m_limit, allocator);
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
obj.AddMember(StringRef(kAsm), m_assembly.toJSON(), allocator);
|
||||
@@ -109,6 +89,12 @@ rapidjson::Value xmrig::CpuConfig::toJSON(rapidjson::Document &doc) const
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::CpuConfig::memPoolSize() const
|
||||
{
|
||||
return m_memoryPool < 0 ? Cpu::info()->threads() : m_memoryPool;
|
||||
}
|
||||
|
||||
|
||||
std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, const Algorithm &algorithm) const
|
||||
{
|
||||
std::vector<CpuLaunchData> out;
|
||||
@@ -128,14 +114,16 @@ std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, cons
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuConfig::read(const rapidjson::Value &value, uint32_t version)
|
||||
void xmrig::CpuConfig::read(const rapidjson::Value &value)
|
||||
{
|
||||
if (value.IsObject()) {
|
||||
m_enabled = Json::getBool(value, kEnabled, m_enabled);
|
||||
m_hugePages = Json::getBool(value, kHugePages, m_hugePages);
|
||||
m_enabled = Json::getBool(value, kEnabled, m_enabled);
|
||||
m_hugePages = Json::getBool(value, kHugePages, m_hugePages);
|
||||
m_limit = Json::getUint(value, kMaxThreadsHint, m_limit);
|
||||
|
||||
setAesMode(Json::getValue(value, kHwAes));
|
||||
setPriority(Json::getInt(value, kPriority, -1));
|
||||
setMemoryPool(Json::getValue(value, kMemoryPool));
|
||||
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
m_assembly = Json::getValue(value, kAsm);
|
||||
@@ -145,16 +133,14 @@ void xmrig::CpuConfig::read(const rapidjson::Value &value, uint32_t version)
|
||||
m_argon2Impl = Json::getString(value, kArgon2Impl);
|
||||
# endif
|
||||
|
||||
if (!m_threads.read(value)) {
|
||||
generate();
|
||||
}
|
||||
m_threads.read(value);
|
||||
|
||||
if (version == 0) {
|
||||
generateArgon2();
|
||||
}
|
||||
generate();
|
||||
}
|
||||
else if (value.IsBool() && value.IsFalse()) {
|
||||
m_enabled = false;
|
||||
else if (value.IsBool()) {
|
||||
m_enabled = value.GetBool();
|
||||
|
||||
generate();
|
||||
}
|
||||
else {
|
||||
generate();
|
||||
@@ -164,52 +150,40 @@ void xmrig::CpuConfig::read(const rapidjson::Value &value, uint32_t version)
|
||||
|
||||
void xmrig::CpuConfig::generate()
|
||||
{
|
||||
m_shouldSave = true;
|
||||
ICpuInfo *cpu = Cpu::info();
|
||||
if (!isEnabled() || m_threads.has("*")) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_threads.disable(Algorithm::CN_0);
|
||||
m_threads.move(kCn, cpu->threads(Algorithm::CN_0));
|
||||
size_t count = 0;
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
m_threads.move(kCnGPU, cpu->threads(Algorithm::CN_GPU));
|
||||
# endif
|
||||
count += xmrig::generate<Algorithm::CN>(m_threads, m_limit);
|
||||
count += xmrig::generate<Algorithm::CN_LITE>(m_threads, m_limit);
|
||||
count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, m_limit);
|
||||
count += xmrig::generate<Algorithm::CN_PICO>(m_threads, m_limit);
|
||||
count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, m_limit);
|
||||
count += xmrig::generate<Algorithm::ARGON2>(m_threads, m_limit);
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_LITE
|
||||
m_threads.disable(Algorithm::CN_LITE_0);
|
||||
m_threads.move(kCnLite, cpu->threads(Algorithm::CN_LITE_1));
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_HEAVY
|
||||
m_threads.move(kCnHeavy, cpu->threads(Algorithm::CN_HEAVY_0));
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_PICO
|
||||
m_threads.move(kCnPico, cpu->threads(Algorithm::CN_PICO_0));
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
m_threads.move(kRx, cpu->threads(Algorithm::RX_0));
|
||||
m_threads.move(kRxWOW, cpu->threads(Algorithm::RX_WOW));
|
||||
# endif
|
||||
|
||||
generateArgon2();
|
||||
m_shouldSave = count > 0;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuConfig::generateArgon2()
|
||||
void xmrig::CpuConfig::setAesMode(const rapidjson::Value &value)
|
||||
{
|
||||
# ifdef XMRIG_ALGO_ARGON2
|
||||
m_threads.move(kArgon2, Cpu::info()->threads(Algorithm::AR2_CHUKWA));
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuConfig::setAesMode(const rapidjson::Value &aesMode)
|
||||
{
|
||||
if (aesMode.IsBool()) {
|
||||
m_aes = aesMode.GetBool() ? AES_HW : AES_SOFT;
|
||||
if (value.IsBool()) {
|
||||
m_aes = value.GetBool() ? AES_HW : AES_SOFT;
|
||||
}
|
||||
else {
|
||||
m_aes = AES_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuConfig::setMemoryPool(const rapidjson::Value &value)
|
||||
{
|
||||
if (value.IsBool()) {
|
||||
m_memoryPool = value.GetBool() ? -1 : 0;
|
||||
}
|
||||
else if (value.IsInt()) {
|
||||
m_memoryPool = value.GetInt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,13 @@ public:
|
||||
AES_SOFT
|
||||
};
|
||||
|
||||
CpuConfig();
|
||||
CpuConfig() = default;
|
||||
|
||||
bool isHwAES() const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
size_t memPoolSize() const;
|
||||
std::vector<CpuLaunchData> get(const Miner *miner, const Algorithm &algorithm) const;
|
||||
void read(const rapidjson::Value &value, uint32_t version);
|
||||
void read(const rapidjson::Value &value);
|
||||
|
||||
inline bool isEnabled() const { return m_enabled; }
|
||||
inline bool isHugePages() const { return m_hugePages; }
|
||||
@@ -61,8 +62,8 @@ public:
|
||||
|
||||
private:
|
||||
void generate();
|
||||
void generateArgon2();
|
||||
void setAesMode(const rapidjson::Value &aesMode);
|
||||
void setAesMode(const rapidjson::Value &value);
|
||||
void setMemoryPool(const rapidjson::Value &value);
|
||||
|
||||
inline void setPriority(int priority) { m_priority = (priority >= -1 && priority <= 5) ? priority : -1; }
|
||||
|
||||
@@ -71,9 +72,11 @@ private:
|
||||
bool m_enabled = true;
|
||||
bool m_hugePages = true;
|
||||
bool m_shouldSave = false;
|
||||
int m_memoryPool = 0;
|
||||
int m_priority = -1;
|
||||
String m_argon2Impl;
|
||||
Threads<CpuThreads> m_threads;
|
||||
uint32_t m_limit = 100;
|
||||
};
|
||||
|
||||
|
||||
|
||||
149
src/backend/cpu/CpuConfig_gen.h
Normal file
149
src/backend/cpu/CpuConfig_gen.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CPUCONFIG_GEN_H
|
||||
#define XMRIG_CPUCONFIG_GEN_H
|
||||
|
||||
|
||||
#include "backend/common/Threads.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "backend/cpu/CpuThreads.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static inline size_t generate(const char *key, Threads<CpuThreads> &threads, const Algorithm &algorithm, uint32_t limit)
|
||||
{
|
||||
if (threads.isExist(algorithm) || threads.has(key)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return threads.move(key, Cpu::info()->threads(algorithm, limit));
|
||||
}
|
||||
|
||||
|
||||
template<Algorithm::Family FAMILY>
|
||||
static inline size_t generate(Threads<CpuThreads> &, uint32_t) { return 0; }
|
||||
|
||||
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN>(Threads<CpuThreads> &threads, uint32_t limit)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
count += generate("cn", threads, Algorithm::CN_1, limit);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_0)) {
|
||||
threads.disable(Algorithm::CN_0);
|
||||
++count;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
count += generate("cn/gpu", threads, Algorithm::CN_GPU, limit);
|
||||
# endif
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_LITE>(Threads<CpuThreads> &threads, uint32_t limit)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
count += generate("cn-lite", threads, Algorithm::CN_LITE_1, limit);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_LITE_0)) {
|
||||
threads.disable(Algorithm::CN_LITE_0);
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_HEAVY>(Threads<CpuThreads> &threads, uint32_t limit)
|
||||
{
|
||||
return generate("cn-heavy", threads, Algorithm::CN_HEAVY_0, limit);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_PICO>(Threads<CpuThreads> &threads, uint32_t limit)
|
||||
{
|
||||
return generate("cn-pico", threads, Algorithm::CN_PICO_0, limit);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
template<>
|
||||
size_t inline generate<Algorithm::RANDOM_X>(Threads<CpuThreads> &threads, uint32_t limit)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
auto wow = Cpu::info()->threads(Algorithm::RX_WOW, limit);
|
||||
|
||||
if (!threads.isExist(Algorithm::RX_ARQ)) {
|
||||
auto arq = Cpu::info()->threads(Algorithm::RX_ARQ, limit);
|
||||
if (arq == wow) {
|
||||
threads.setAlias(Algorithm::RX_ARQ, "rx/wow");
|
||||
++count;
|
||||
}
|
||||
else {
|
||||
count += threads.move("rx/arq", std::move(arq));
|
||||
}
|
||||
}
|
||||
|
||||
if (!threads.isExist(Algorithm::RX_WOW)) {
|
||||
count += threads.move("rx/wow", std::move(wow));
|
||||
}
|
||||
|
||||
count += generate("rx", threads, Algorithm::RX_0, limit);
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_ARGON2
|
||||
template<>
|
||||
size_t inline generate<Algorithm::ARGON2>(Threads<CpuThreads> &threads, uint32_t limit)
|
||||
{
|
||||
return generate("argon2", threads, Algorithm::AR2_CHUKWA, limit);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CPUCONFIG_GEN_H */
|
||||
@@ -24,13 +24,15 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#include "backend/cpu/CpuLaunchData.h"
|
||||
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/cpu/CpuConfig.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread) :
|
||||
algorithm(algorithm),
|
||||
assembly(config.assembly()),
|
||||
@@ -65,3 +67,9 @@ xmrig::CnHash::AlgoVariant xmrig::CpuLaunchData::av() const
|
||||
|
||||
return static_cast<CnHash::AlgoVariant>(!hwAES ? (intensity + 5) : (intensity + 2));
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CpuLaunchData::tag()
|
||||
{
|
||||
return cpu_tag();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public:
|
||||
inline bool operator!=(const CpuLaunchData &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const CpuLaunchData &other) const { return isEqual(other); }
|
||||
|
||||
static const char *tag();
|
||||
|
||||
const Algorithm algorithm;
|
||||
const Assembly assembly;
|
||||
const bool hugePages;
|
||||
|
||||
@@ -120,6 +120,16 @@ xmrig::CpuThreads::CpuThreads(size_t count, uint32_t intensity)
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CpuThreads::isEqual(const CpuThreads &other) const
|
||||
{
|
||||
if (isEmpty() && other.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return count() == other.count() && std::equal(m_data.begin(), m_data.end(), other.m_data.begin());
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::CpuThreads::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace xmrig {
|
||||
class CpuThreads
|
||||
{
|
||||
public:
|
||||
inline CpuThreads() {}
|
||||
inline CpuThreads() = default;
|
||||
inline CpuThreads(size_t count) : m_data(count) {}
|
||||
|
||||
CpuThreads(const rapidjson::Value &value);
|
||||
@@ -51,6 +51,10 @@ public:
|
||||
inline void add(int64_t affinity, uint32_t intensity) { add(CpuThread(affinity, intensity)); }
|
||||
inline void reserve(size_t capacity) { m_data.reserve(capacity); }
|
||||
|
||||
inline bool operator!=(const CpuThreads &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const CpuThreads &other) const { return isEqual(other); }
|
||||
|
||||
bool isEqual(const CpuThreads &other) const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -62,19 +62,19 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
|
||||
m_miner(data.miner),
|
||||
m_ctx()
|
||||
{
|
||||
m_memory = new VirtualMemory(m_algorithm.l3() * N, data.hugePages);
|
||||
m_memory = new VirtualMemory(m_algorithm.l3() * N, data.hugePages, true, m_node);
|
||||
}
|
||||
|
||||
|
||||
template<size_t N>
|
||||
xmrig::CpuWorker<N>::~CpuWorker()
|
||||
{
|
||||
CnCtx::release(m_ctx, N);
|
||||
delete m_memory;
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
delete m_vm;
|
||||
# endif
|
||||
|
||||
CnCtx::release(m_ctx, N);
|
||||
delete m_memory;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ void xmrig::CpuWorker<N>::consumeJob()
|
||||
return;
|
||||
}
|
||||
|
||||
m_job.add(m_miner->job(), Nonce::sequence(Nonce::CPU), kReserveCount);
|
||||
m_job.add(m_miner->job(), kReserveCount, Nonce::CPU);
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (m_job.currentJob().algorithm().family() == Algorithm::RANDOM_X) {
|
||||
|
||||
@@ -54,6 +54,7 @@ protected:
|
||||
void start() override;
|
||||
|
||||
inline const VirtualMemory *memory() const override { return m_memory; }
|
||||
inline size_t intensity() const override { return N; }
|
||||
|
||||
private:
|
||||
inline cn_hash_fun fn(const Algorithm &algorithm) const { return CnHash::fn(algorithm, m_av, m_assembly); }
|
||||
|
||||
@@ -2,6 +2,7 @@ set(HEADERS_BACKEND_CPU
|
||||
src/backend/cpu/Cpu.h
|
||||
src/backend/cpu/CpuBackend.h
|
||||
src/backend/cpu/CpuConfig.h
|
||||
src/backend/cpu/CpuConfig_gen.h
|
||||
src/backend/cpu/CpuLaunchData.cpp
|
||||
src/backend/cpu/CpuThread.h
|
||||
src/backend/cpu/CpuThreads.h
|
||||
|
||||
@@ -45,18 +45,18 @@ public:
|
||||
inline constexpr static bool isX64() { return false; }
|
||||
# endif
|
||||
|
||||
virtual Assembly::Id assembly() const = 0;
|
||||
virtual bool hasAES() const = 0;
|
||||
virtual bool hasAVX2() const = 0;
|
||||
virtual const char *backend() const = 0;
|
||||
virtual const char *brand() const = 0;
|
||||
virtual CpuThreads threads(const Algorithm &algorithm) const = 0;
|
||||
virtual size_t cores() const = 0;
|
||||
virtual size_t L2() const = 0;
|
||||
virtual size_t L3() const = 0;
|
||||
virtual size_t nodes() const = 0;
|
||||
virtual size_t packages() const = 0;
|
||||
virtual size_t threads() const = 0;
|
||||
virtual Assembly::Id assembly() const = 0;
|
||||
virtual bool hasAES() const = 0;
|
||||
virtual bool hasAVX2() const = 0;
|
||||
virtual const char *backend() const = 0;
|
||||
virtual const char *brand() const = 0;
|
||||
virtual CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const = 0;
|
||||
virtual size_t cores() const = 0;
|
||||
virtual size_t L2() const = 0;
|
||||
virtual size_t L3() const = 0;
|
||||
virtual size_t nodes() const = 0;
|
||||
virtual size_t packages() const = 0;
|
||||
virtual size_t threads() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
#include "3rdparty/libcpuid/libcpuid.h"
|
||||
@@ -109,7 +109,7 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm) const
|
||||
xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm, uint32_t limit) const
|
||||
{
|
||||
if (threads() == 1) {
|
||||
return 1;
|
||||
@@ -153,5 +153,12 @@ xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm) co
|
||||
}
|
||||
# endif
|
||||
|
||||
return CpuThreads(std::max<size_t>(std::min<size_t>(count, threads()), 1), intensity);
|
||||
if (limit > 0 && limit < 100) {
|
||||
count = std::min(count, static_cast<size_t>(round(threads() * (limit / 100.0))));
|
||||
}
|
||||
else {
|
||||
count = std::min(count, threads());
|
||||
}
|
||||
|
||||
return CpuThreads(std::max<size_t>(count, 1), intensity);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
AdvancedCpuInfo();
|
||||
|
||||
protected:
|
||||
CpuThreads threads(const Algorithm &algorithm) const override;
|
||||
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
|
||||
|
||||
inline Assembly::Id assembly() const override { return m_assembly; }
|
||||
inline bool hasAES() const override { return m_aes; }
|
||||
|
||||
@@ -179,7 +179,7 @@ const char *xmrig::BasicCpuInfo::backend() const
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm) const
|
||||
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint32_t limit) const
|
||||
{
|
||||
const size_t count = std::thread::hardware_concurrency();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
protected:
|
||||
const char *backend() const override;
|
||||
CpuThreads threads(const Algorithm &algorithm) const override;
|
||||
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
|
||||
|
||||
inline Assembly::Id assembly() const override { return m_assembly; }
|
||||
inline bool hasAES() const override { return m_aes; }
|
||||
|
||||
@@ -63,7 +63,7 @@ const char *xmrig::BasicCpuInfo::backend() const
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &) const
|
||||
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &, uint32_t) const
|
||||
{
|
||||
return CpuThreads(threads());
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <hwloc.h>
|
||||
|
||||
|
||||
@@ -45,7 +46,6 @@
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
std::vector<uint32_t> HwlocCpuInfo::m_nodeIndexes;
|
||||
uint32_t HwlocCpuInfo::m_features = 0;
|
||||
|
||||
|
||||
@@ -127,9 +127,7 @@ static inline bool isCacheExclusive(hwloc_obj_t obj)
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
|
||||
m_backend(),
|
||||
m_cache()
|
||||
xmrig::HwlocCpuInfo::HwlocCpuInfo()
|
||||
{
|
||||
m_threads = 0;
|
||||
|
||||
@@ -149,7 +147,7 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
|
||||
# endif
|
||||
|
||||
const std::vector<hwloc_obj_t> packages = findByType(hwloc_get_root_obj(m_topology), HWLOC_OBJ_PACKAGE);
|
||||
if (packages.size()) {
|
||||
if (!packages.empty()) {
|
||||
const char *value = hwloc_obj_get_info_by_name(packages[0], "CPUModel");
|
||||
if (value) {
|
||||
strncpy(m_brand, value, 64);
|
||||
@@ -178,7 +176,7 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
|
||||
|
||||
m_threads = countByType(m_topology, HWLOC_OBJ_PU);
|
||||
m_cores = countByType(m_topology, HWLOC_OBJ_CORE);
|
||||
m_nodes = std::max<size_t>(countByType(m_topology, HWLOC_OBJ_NUMANODE), 1);
|
||||
m_nodes = std::max(hwloc_bitmap_weight(hwloc_topology_get_complete_nodeset(m_topology)), 1);
|
||||
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
|
||||
|
||||
if (m_nodes > 1) {
|
||||
@@ -186,11 +184,11 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
|
||||
m_features |= SET_THISTHREAD_MEMBIND;
|
||||
}
|
||||
|
||||
m_nodeIndexes.reserve(m_nodes);
|
||||
m_nodeset.reserve(m_nodes);
|
||||
hwloc_obj_t node = nullptr;
|
||||
|
||||
while ((node = hwloc_get_next_obj_by_type(m_topology, HWLOC_OBJ_NUMANODE, node)) != nullptr) {
|
||||
m_nodeIndexes.emplace_back(node->os_index);
|
||||
m_nodeset.emplace_back(node->os_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,10 +200,24 @@ xmrig::HwlocCpuInfo::~HwlocCpuInfo()
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuThreads xmrig::HwlocCpuInfo::threads(const Algorithm &algorithm) const
|
||||
bool xmrig::HwlocCpuInfo::membind(hwloc_const_bitmap_t nodeset)
|
||||
{
|
||||
if (!hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
|
||||
return false;
|
||||
}
|
||||
|
||||
# if HWLOC_API_VERSION >= 0x20000
|
||||
return hwloc_set_membind(m_topology, nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD | HWLOC_MEMBIND_BYNODESET) >= 0;
|
||||
# else
|
||||
return hwloc_set_membind_nodeset(m_topology, nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD) >= 0;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuThreads xmrig::HwlocCpuInfo::threads(const Algorithm &algorithm, uint32_t limit) const
|
||||
{
|
||||
if (L2() == 0 && L3() == 0) {
|
||||
return BasicCpuInfo::threads(algorithm);
|
||||
return BasicCpuInfo::threads(algorithm, limit);
|
||||
}
|
||||
|
||||
const unsigned depth = L3() > 0 ? 3 : 2;
|
||||
@@ -218,21 +230,37 @@ xmrig::CpuThreads xmrig::HwlocCpuInfo::threads(const Algorithm &algorithm) const
|
||||
|
||||
findCache(hwloc_get_root_obj(m_topology), depth, depth, [&caches](hwloc_obj_t found) { caches.emplace_back(found); });
|
||||
|
||||
for (hwloc_obj_t cache : caches) {
|
||||
processTopLevelCache(cache, algorithm, threads);
|
||||
if (limit > 0 && limit < 100 && !caches.empty()) {
|
||||
const double maxTotalThreads = round(m_threads * (limit / 100.0));
|
||||
const auto maxPerCache = std::max(static_cast<int>(round(maxTotalThreads / caches.size())), 1);
|
||||
int remaining = std::max(static_cast<int>(maxTotalThreads), 1);
|
||||
|
||||
for (hwloc_obj_t cache : caches) {
|
||||
processTopLevelCache(cache, algorithm, threads, std::min(maxPerCache, remaining));
|
||||
|
||||
remaining -= maxPerCache;
|
||||
if (remaining <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (hwloc_obj_t cache : caches) {
|
||||
processTopLevelCache(cache, algorithm, threads, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (threads.isEmpty()) {
|
||||
LOG_WARN("hwloc auto configuration for algorithm \"%s\" failed.", algorithm.shortName());
|
||||
|
||||
return BasicCpuInfo::threads(algorithm);
|
||||
return BasicCpuInfo::threads(algorithm, limit);
|
||||
}
|
||||
|
||||
return threads;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads) const
|
||||
void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const
|
||||
{
|
||||
constexpr size_t oneMiB = 1024u * 1024u;
|
||||
|
||||
@@ -296,6 +324,10 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
||||
}
|
||||
# endif
|
||||
|
||||
if (limit > 0) {
|
||||
cacheHashes = std::min(cacheHashes, limit);
|
||||
}
|
||||
|
||||
if (cacheHashes >= PUs) {
|
||||
for (hwloc_obj_t core : cores) {
|
||||
const std::vector<hwloc_obj_t> units = findByType(core, HWLOC_OBJ_PU);
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
|
||||
|
||||
#include "backend/cpu/platform/BasicCpuInfo.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
typedef struct hwloc_obj *hwloc_obj_t;
|
||||
typedef struct hwloc_topology *hwloc_topology_t;
|
||||
using hwloc_const_bitmap_t = const struct hwloc_bitmap_s *;
|
||||
using hwloc_obj_t = struct hwloc_obj *;
|
||||
using hwloc_topology_t = struct hwloc_topology *;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -39,6 +41,9 @@ namespace xmrig {
|
||||
class HwlocCpuInfo : public BasicCpuInfo
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo)
|
||||
|
||||
|
||||
enum Feature : uint32_t {
|
||||
SET_THISTHREAD_MEMBIND = 1
|
||||
};
|
||||
@@ -48,10 +53,14 @@ public:
|
||||
~HwlocCpuInfo() override;
|
||||
|
||||
static inline bool has(Feature feature) { return m_features & feature; }
|
||||
static inline const std::vector<uint32_t> &nodeIndexes() { return m_nodeIndexes; }
|
||||
|
||||
inline const std::vector<uint32_t> &nodeset() const { return m_nodeset; }
|
||||
inline hwloc_topology_t topology() const { return m_topology; }
|
||||
|
||||
bool membind(hwloc_const_bitmap_t nodeset);
|
||||
|
||||
protected:
|
||||
CpuThreads threads(const Algorithm &algorithm) const override;
|
||||
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
|
||||
|
||||
inline const char *backend() const override { return m_backend; }
|
||||
inline size_t cores() const override { return m_cores; }
|
||||
@@ -61,17 +70,18 @@ protected:
|
||||
inline size_t packages() const override { return m_packages; }
|
||||
|
||||
private:
|
||||
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads) const;
|
||||
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;
|
||||
|
||||
|
||||
static std::vector<uint32_t> m_nodeIndexes;
|
||||
static uint32_t m_features;
|
||||
|
||||
char m_backend[20];
|
||||
hwloc_topology_t m_topology;
|
||||
size_t m_cache[5];
|
||||
size_t m_cores = 0;
|
||||
size_t m_nodes = 0;
|
||||
size_t m_packages = 0;
|
||||
char m_backend[20] = { 0 };
|
||||
hwloc_topology_t m_topology = nullptr;
|
||||
size_t m_cache[5] = { 0 };
|
||||
size_t m_cores = 0;
|
||||
size_t m_nodes = 0;
|
||||
size_t m_packages = 0;
|
||||
std::vector<uint32_t> m_nodeset;
|
||||
};
|
||||
|
||||
|
||||
|
||||
526
src/backend/cuda/CudaBackend.cpp
Normal file
526
src/backend/cuda/CudaBackend.cpp
Normal file
@@ -0,0 +1,526 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "backend/cuda/CudaBackend.h"
|
||||
#include "backend/common/Hashrate.h"
|
||||
#include "backend/common/interfaces/IWorker.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/common/Workers.h"
|
||||
#include "backend/cuda/CudaConfig.h"
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
#include "backend/cuda/CudaWorker.h"
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/String.h"
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_NVML
|
||||
#include "backend/cuda/wrappers/NvmlLib.h"
|
||||
|
||||
namespace xmrig { static const char *kNvmlLabel = "NVML"; }
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
extern template class Threads<CudaThreads>;
|
||||
|
||||
|
||||
constexpr const size_t oneMiB = 1024u * 1024u;
|
||||
static const char *kLabel = "CUDA";
|
||||
static const char *tag = GREEN_BG_BOLD(WHITE_BOLD_S " nv ");
|
||||
static const String kType = "cuda";
|
||||
static std::mutex mutex;
|
||||
|
||||
|
||||
|
||||
static void printDisabled(const char *label, const char *reason)
|
||||
{
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") RED_BOLD("disabled") "%s", label, reason);
|
||||
}
|
||||
|
||||
|
||||
struct CudaLaunchStatus
|
||||
{
|
||||
public:
|
||||
inline size_t threads() const { return m_threads; }
|
||||
|
||||
inline bool started(bool ready)
|
||||
{
|
||||
ready ? m_started++ : m_errors++;
|
||||
|
||||
return (m_started + m_errors) == m_threads;
|
||||
}
|
||||
|
||||
inline void start(size_t threads)
|
||||
{
|
||||
m_started = 0;
|
||||
m_errors = 0;
|
||||
m_threads = threads;
|
||||
m_ts = Chrono::steadyMSecs();
|
||||
CudaWorker::ready = false;
|
||||
}
|
||||
|
||||
inline void print() const
|
||||
{
|
||||
if (m_started == 0) {
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), tag);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " "%s%zu/%zu" BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
tag,
|
||||
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
|
||||
m_started,
|
||||
m_threads,
|
||||
Chrono::steadyMSecs() - m_ts
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
size_t m_errors = 0;
|
||||
size_t m_started = 0;
|
||||
size_t m_threads = 0;
|
||||
uint64_t m_ts = 0;
|
||||
};
|
||||
|
||||
|
||||
class CudaBackendPrivate
|
||||
{
|
||||
public:
|
||||
inline CudaBackendPrivate(Controller *controller) :
|
||||
controller(controller)
|
||||
{
|
||||
init(controller->config()->cuda());
|
||||
}
|
||||
|
||||
|
||||
void init(const CudaConfig &cuda)
|
||||
{
|
||||
if (!cuda.isEnabled()) {
|
||||
return printDisabled(kLabel, "");
|
||||
}
|
||||
|
||||
if (!CudaLib::init(cuda.loader())) {
|
||||
return printDisabled(kLabel, RED_S " (failed to load CUDA plugin)");
|
||||
}
|
||||
|
||||
runtimeVersion = CudaLib::runtimeVersion();
|
||||
driverVersion = CudaLib::driverVersion();
|
||||
|
||||
if (!runtimeVersion || !driverVersion || !CudaLib::deviceCount()) {
|
||||
return printDisabled(kLabel, RED_S " (no devices)");
|
||||
}
|
||||
|
||||
if (!devices.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
devices = CudaLib::devices(cuda.bfactor(), cuda.bsleep(), cuda.devicesHint());
|
||||
if (devices.empty()) {
|
||||
return printDisabled(kLabel, RED_S " (no devices)");
|
||||
}
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s") "/" WHITE_BOLD("%s") BLACK_BOLD("/%s"), kLabel,
|
||||
CudaLib::version(runtimeVersion).c_str(), CudaLib::version(driverVersion).c_str(), CudaLib::pluginVersion());
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (cuda.isNvmlEnabled()) {
|
||||
if (NvmlLib::init(cuda.nvmlLoader())) {
|
||||
NvmlLib::assign(devices);
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s") "/" GREEN_BOLD("%s") " press " MAGENTA_BG(WHITE_BOLD_S "e") " for health report",
|
||||
kNvmlLabel,
|
||||
NvmlLib::version(),
|
||||
NvmlLib::driverVersion()
|
||||
);
|
||||
}
|
||||
else {
|
||||
printDisabled(kNvmlLabel, RED_S " (failed to load NVML)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
printDisabled(kNvmlLabel, "");
|
||||
}
|
||||
# endif
|
||||
|
||||
for (const CudaDevice &device : devices) {
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu") YELLOW(" %s") GREEN_BOLD(" %s ") WHITE_BOLD("%u/%u MHz") " smx:" WHITE_BOLD("%u") " arch:" WHITE_BOLD("%u%u") " mem:" CYAN("%zu/%zu") " MB",
|
||||
"CUDA GPU",
|
||||
device.index(),
|
||||
device.topology().toString().data(),
|
||||
device.name().data(),
|
||||
device.clock(),
|
||||
device.memoryClock(),
|
||||
device.smx(),
|
||||
device.computeCapability(true),
|
||||
device.computeCapability(false),
|
||||
device.freeMemSize() / oneMiB,
|
||||
device.globalMemSize() / oneMiB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void start(const Job &)
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
tag,
|
||||
profileName.data(),
|
||||
threads.size(),
|
||||
threads.size() > 1 ? "s" : "",
|
||||
algo.l3() / 1024
|
||||
);
|
||||
|
||||
Log::print(WHITE_BOLD("| # | GPU | BUS ID | I | T | B | BF | BS | MEM | NAME"));
|
||||
|
||||
size_t i = 0;
|
||||
for (const auto &data : threads) {
|
||||
Log::print("|" CYAN_BOLD("%3zu") " |" CYAN_BOLD("%4u") " |" YELLOW(" %7s") " |" CYAN_BOLD("%5d") " |" CYAN_BOLD("%4d") " |"
|
||||
CYAN_BOLD("%4d") " |" CYAN_BOLD("%3d") " |" CYAN_BOLD("%4d") " |" CYAN("%5zu") " | " GREEN("%s"),
|
||||
i,
|
||||
data.thread.index(),
|
||||
data.device.topology().toString().data(),
|
||||
data.thread.threads() * data.thread.blocks(),
|
||||
data.thread.threads(),
|
||||
data.thread.blocks(),
|
||||
data.thread.bfactor(),
|
||||
data.thread.bsleep(),
|
||||
(data.thread.threads() * data.thread.blocks()) * algo.l3() / oneMiB,
|
||||
data.device.name().data()
|
||||
);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
status.start(threads.size());
|
||||
workers.start(threads);
|
||||
}
|
||||
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
void printHealth()
|
||||
{
|
||||
for (const auto &device : devices) {
|
||||
const auto health = NvmlLib::health(device.nvmlDevice());
|
||||
|
||||
std::string clocks;
|
||||
if (health.clock && health.memClock) {
|
||||
clocks += " " + std::to_string(health.clock) + "/" + std::to_string(health.memClock) + " MHz";
|
||||
}
|
||||
|
||||
std::string fans;
|
||||
if (!health.fanSpeed.empty()) {
|
||||
for (uint32_t i = 0; i < health.fanSpeed.size(); ++i) {
|
||||
fans += " fan" + std::to_string(i) + ":" CYAN_BOLD_S + std::to_string(health.fanSpeed[i]) + "%" CLEAR;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO(CYAN_BOLD("#%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CLEAR WHITE_BOLD("%s") "%s",
|
||||
device.index(),
|
||||
device.topology().toString().data(),
|
||||
health.power,
|
||||
health.temperature < 60 ? 32 : (health.temperature > 85 ? 31 : 33),
|
||||
health.temperature,
|
||||
clocks.c_str(),
|
||||
fans.c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
Algorithm algo;
|
||||
Controller *controller;
|
||||
CudaLaunchStatus status;
|
||||
std::vector<CudaDevice> devices;
|
||||
std::vector<CudaLaunchData> threads;
|
||||
String profileName;
|
||||
uint32_t driverVersion = 0;
|
||||
uint32_t runtimeVersion = 0;
|
||||
Workers<CudaLaunchData> workers;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
const char *xmrig::cuda_tag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaBackend::CudaBackend(Controller *controller) :
|
||||
d_ptr(new CudaBackendPrivate(controller))
|
||||
{
|
||||
d_ptr->workers.setBackend(this);
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaBackend::~CudaBackend()
|
||||
{
|
||||
delete d_ptr;
|
||||
|
||||
CudaLib::close();
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
NvmlLib::close();
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaBackend::isEnabled() const
|
||||
{
|
||||
return d_ptr->controller->config()->cuda().isEnabled() && CudaLib::isInitialized() && !d_ptr->devices.empty();;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaBackend::isEnabled(const Algorithm &algorithm) const
|
||||
{
|
||||
return !d_ptr->controller->config()->cuda().threads().get(algorithm).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
const xmrig::Hashrate *xmrig::CudaBackend::hashrate() const
|
||||
{
|
||||
return d_ptr->workers.hashrate();
|
||||
}
|
||||
|
||||
|
||||
const xmrig::String &xmrig::CudaBackend::profileName() const
|
||||
{
|
||||
return d_ptr->profileName;
|
||||
}
|
||||
|
||||
|
||||
const xmrig::String &xmrig::CudaBackend::type() const
|
||||
{
|
||||
return kType;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::execCommand(char command)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (command == 'e' || command == 'E') {
|
||||
d_ptr->printHealth();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::prepare(const Job &)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::printHashrate(bool details)
|
||||
{
|
||||
if (!details || !hashrate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
char num[8 * 3] = { 0 };
|
||||
|
||||
Log::print(WHITE_BOLD_S "| CUDA # | AFFINITY | 10s H/s | 60s H/s | 15m H/s |");
|
||||
|
||||
size_t i = 0;
|
||||
for (const auto &data : d_ptr->threads) {
|
||||
Log::print("| %8zu | %8" PRId64 " | %7s | %7s | %7s |" CYAN_BOLD(" #%u") YELLOW(" %s") GREEN(" %s"),
|
||||
i,
|
||||
data.thread.affinity(),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval), num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3),
|
||||
data.device.index(),
|
||||
data.device.topology().toString().data(),
|
||||
data.device.name().data()
|
||||
);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
Log::print(WHITE_BOLD_S "| - | - | %7s | %7s | %7s |",
|
||||
Hashrate::format(hashrate()->calc(Hashrate::ShortInterval), num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::setJob(const Job &job)
|
||||
{
|
||||
const auto &cuda = d_ptr->controller->config()->cuda();
|
||||
if (cuda.isEnabled()) {
|
||||
d_ptr->init(cuda);
|
||||
}
|
||||
|
||||
if (!isEnabled()) {
|
||||
return stop();
|
||||
}
|
||||
|
||||
auto threads = cuda.get(d_ptr->controller->miner(), job.algorithm(), d_ptr->devices);
|
||||
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
|
||||
return;
|
||||
}
|
||||
|
||||
d_ptr->algo = job.algorithm();
|
||||
d_ptr->profileName = cuda.threads().profileName(job.algorithm());
|
||||
|
||||
if (d_ptr->profileName.isNull() || threads.empty()) {
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), tag);
|
||||
|
||||
return stop();
|
||||
}
|
||||
|
||||
stop();
|
||||
|
||||
d_ptr->threads = std::move(threads);
|
||||
d_ptr->start(job);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::start(IWorker *worker, bool ready)
|
||||
{
|
||||
mutex.lock();
|
||||
|
||||
if (d_ptr->status.started(ready)) {
|
||||
d_ptr->status.print();
|
||||
|
||||
CudaWorker::ready = true;
|
||||
}
|
||||
|
||||
mutex.unlock();
|
||||
|
||||
if (ready) {
|
||||
worker->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::stop()
|
||||
{
|
||||
if (d_ptr->threads.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint64_t ts = Chrono::steadyMSecs();
|
||||
|
||||
d_ptr->workers.stop();
|
||||
d_ptr->threads.clear();
|
||||
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), tag, Chrono::steadyMSecs() - ts);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::tick(uint64_t ticks)
|
||||
{
|
||||
d_ptr->workers.tick(ticks);
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (isEnabled()) {
|
||||
auto seconds = d_ptr->controller->config()->healthPrintTime();
|
||||
if (seconds && ticks && (ticks % (seconds * 2)) == 0) {
|
||||
d_ptr->printHealth();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
rapidjson::Value xmrig::CudaBackend::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value out(kObjectType);
|
||||
out.AddMember("type", type().toJSON(), allocator);
|
||||
out.AddMember("enabled", isEnabled(), allocator);
|
||||
out.AddMember("algo", d_ptr->algo.toJSON(), allocator);
|
||||
out.AddMember("profile", profileName().toJSON(), allocator);
|
||||
|
||||
if (CudaLib::isReady()) {
|
||||
Value versions(kObjectType);
|
||||
versions.AddMember("cuda-runtime", Value(CudaLib::version(d_ptr->runtimeVersion).c_str(), allocator), allocator);
|
||||
versions.AddMember("cuda-driver", Value(CudaLib::version(d_ptr->driverVersion).c_str(), allocator), allocator);
|
||||
versions.AddMember("plugin", String(CudaLib::pluginVersion()).toJSON(doc), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (NvmlLib::isReady()) {
|
||||
versions.AddMember("nvml", StringRef(NvmlLib::version()), allocator);
|
||||
versions.AddMember("driver", StringRef(NvmlLib::driverVersion()), allocator);
|
||||
}
|
||||
# endif
|
||||
|
||||
out.AddMember("versions", versions, allocator);
|
||||
}
|
||||
|
||||
if (d_ptr->threads.empty() || !hashrate()) {
|
||||
return out;
|
||||
}
|
||||
|
||||
out.AddMember("hashrate", hashrate()->toJSON(doc), allocator);
|
||||
|
||||
Value threads(kArrayType);
|
||||
|
||||
size_t i = 0;
|
||||
for (const auto &data : d_ptr->threads) {
|
||||
Value thread = data.thread.toJSON(doc);
|
||||
thread.AddMember("hashrate", hashrate()->toJSON(i, doc), allocator);
|
||||
|
||||
data.device.toJSON(thread, doc);
|
||||
|
||||
i++;
|
||||
threads.PushBack(thread, allocator);
|
||||
}
|
||||
|
||||
out.AddMember("threads", threads, allocator);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::handleRequest(IApiRequest &)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
80
src/backend/cuda/CudaBackend.h
Normal file
80
src/backend/cuda/CudaBackend.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDABACKEND_H
|
||||
#define XMRIG_CUDABACKEND_H
|
||||
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
#include "backend/common/interfaces/IBackend.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Controller;
|
||||
class CudaBackendPrivate;
|
||||
class Miner;
|
||||
|
||||
|
||||
class CudaBackend : public IBackend
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(CudaBackend)
|
||||
|
||||
CudaBackend(Controller *controller);
|
||||
|
||||
~CudaBackend() override;
|
||||
|
||||
protected:
|
||||
bool isEnabled() const override;
|
||||
bool isEnabled(const Algorithm &algorithm) const override;
|
||||
const Hashrate *hashrate() const override;
|
||||
const String &profileName() const override;
|
||||
const String &type() const override;
|
||||
void execCommand(char command) override;
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker, bool ready) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t ticks) override;
|
||||
|
||||
# ifdef XMRIG_FEATURE_API
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const override;
|
||||
void handleRequest(IApiRequest &request) override;
|
||||
# endif
|
||||
|
||||
private:
|
||||
CudaBackendPrivate *d_ptr;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDABACKEND_H */
|
||||
201
src/backend/cuda/CudaConfig.cpp
Normal file
201
src/backend/cuda/CudaConfig.cpp
Normal file
@@ -0,0 +1,201 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/CudaConfig.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/cuda/CudaConfig_gen.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static bool generated = false;
|
||||
static const char *kBfactorHint = "bfactor-hint";
|
||||
static const char *kBsleepHint = "bsleep-hint";
|
||||
static const char *kDevicesHint = "devices-hint";
|
||||
static const char *kEnabled = "enabled";
|
||||
static const char *kLoader = "loader";
|
||||
|
||||
#ifdef XMRIG_FEATURE_NVML
|
||||
static const char *kNvml = "nvml";
|
||||
#endif
|
||||
|
||||
|
||||
extern template class Threads<CudaThreads>;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::CudaConfig::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value obj(kObjectType);
|
||||
|
||||
obj.AddMember(StringRef(kEnabled), m_enabled, allocator);
|
||||
obj.AddMember(StringRef(kLoader), m_loader.toJSON(), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (m_nvmlLoader.isNull()) {
|
||||
obj.AddMember(StringRef(kNvml), m_nvml, allocator);
|
||||
}
|
||||
else {
|
||||
obj.AddMember(StringRef(kNvml), m_nvmlLoader.toJSON(), allocator);
|
||||
}
|
||||
# endif
|
||||
|
||||
m_threads.toJSON(obj, doc);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
std::vector<xmrig::CudaLaunchData> xmrig::CudaConfig::get(const Miner *miner, const Algorithm &algorithm, const std::vector<CudaDevice> &devices) const
|
||||
{
|
||||
auto deviceIndex = [&devices](uint32_t index) -> int {
|
||||
for (uint32_t i = 0; i < devices.size(); ++i) {
|
||||
if (devices[i].index() == index) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
std::vector<CudaLaunchData> out;
|
||||
const auto &threads = m_threads.get(algorithm);
|
||||
|
||||
if (threads.isEmpty()) {
|
||||
return out;
|
||||
}
|
||||
|
||||
out.reserve(threads.count());
|
||||
|
||||
for (const auto &thread : threads.data()) {
|
||||
const int index = deviceIndex(thread.index());
|
||||
if (index == -1) {
|
||||
LOG_INFO("%s" YELLOW(" skip non-existing device with index ") YELLOW_BOLD("%u"), cuda_tag(), thread.index());
|
||||
continue;
|
||||
}
|
||||
|
||||
out.emplace_back(miner, algorithm, thread, devices[static_cast<size_t>(index)]);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaConfig::read(const rapidjson::Value &value)
|
||||
{
|
||||
if (value.IsObject()) {
|
||||
m_enabled = Json::getBool(value, kEnabled, m_enabled);
|
||||
m_loader = Json::getString(value, kLoader);
|
||||
m_bfactor = std::min(Json::getUint(value, kBfactorHint, m_bfactor), 12u);
|
||||
m_bsleep = Json::getUint(value, kBsleepHint, m_bsleep);
|
||||
|
||||
setDevicesHint(Json::getString(value, kDevicesHint));
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
auto &nvml = Json::getValue(value, kNvml);
|
||||
if (nvml.IsString()) {
|
||||
m_nvmlLoader = nvml.GetString();
|
||||
}
|
||||
else if (nvml.IsBool()) {
|
||||
m_nvml = nvml.GetBool();
|
||||
}
|
||||
# endif
|
||||
|
||||
m_threads.read(value);
|
||||
|
||||
generate();
|
||||
}
|
||||
else if (value.IsBool()) {
|
||||
m_enabled = value.GetBool();
|
||||
|
||||
generate();
|
||||
}
|
||||
else {
|
||||
m_shouldSave = true;
|
||||
|
||||
generate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaConfig::generate()
|
||||
{
|
||||
if (generated) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isEnabled() || m_threads.has("*")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CudaLib::init(loader())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CudaLib::runtimeVersion() || !CudaLib::driverVersion() || !CudaLib::deviceCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto devices = CudaLib::devices(bfactor(), bsleep(), m_devicesHint);
|
||||
if (devices.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t count = 0;
|
||||
|
||||
count += xmrig::generate<Algorithm::CN>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::CN_LITE>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::CN_PICO>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, devices);
|
||||
|
||||
generated = true;
|
||||
m_shouldSave = count > 0;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaConfig::setDevicesHint(const char *devicesHint)
|
||||
{
|
||||
if (devicesHint == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto indexes = String(devicesHint).split(',');
|
||||
m_devicesHint.reserve(indexes.size());
|
||||
|
||||
for (const auto &index : indexes) {
|
||||
m_devicesHint.push_back(strtoul(index, nullptr, 10));
|
||||
}
|
||||
}
|
||||
87
src/backend/cuda/CudaConfig.h
Normal file
87
src/backend/cuda/CudaConfig.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDACONFIG_H
|
||||
#define XMRIG_CUDACONFIG_H
|
||||
|
||||
|
||||
#include "backend/cuda/CudaLaunchData.h"
|
||||
#include "backend/common/Threads.h"
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaConfig
|
||||
{
|
||||
public:
|
||||
CudaConfig() = default;
|
||||
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
std::vector<CudaLaunchData> get(const Miner *miner, const Algorithm &algorithm, const std::vector<CudaDevice> &devices) const;
|
||||
void read(const rapidjson::Value &value);
|
||||
|
||||
inline bool isEnabled() const { return m_enabled; }
|
||||
inline bool isShouldSave() const { return m_shouldSave; }
|
||||
inline const std::vector<uint32_t> &devicesHint() const { return m_devicesHint; }
|
||||
inline const String &loader() const { return m_loader; }
|
||||
inline const Threads<CudaThreads> &threads() const { return m_threads; }
|
||||
inline int32_t bfactor() const { return m_bfactor; }
|
||||
inline int32_t bsleep() const { return m_bsleep; }
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
inline bool isNvmlEnabled() const { return m_nvml; }
|
||||
inline const String &nvmlLoader() const { return m_nvmlLoader; }
|
||||
# endif
|
||||
|
||||
private:
|
||||
void generate();
|
||||
void setDevicesHint(const char *devicesHint);
|
||||
|
||||
bool m_enabled = false;
|
||||
bool m_shouldSave = false;
|
||||
std::vector<uint32_t> m_devicesHint;
|
||||
String m_loader;
|
||||
Threads<CudaThreads> m_threads;
|
||||
|
||||
# ifdef _WIN32
|
||||
int32_t m_bfactor = 6;
|
||||
int32_t m_bsleep = 25;
|
||||
# else
|
||||
int32_t m_bfactor = 0;
|
||||
int32_t m_bsleep = 0;
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
bool m_nvml = true;
|
||||
String m_nvmlLoader;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDACONFIG_H */
|
||||
137
src/backend/cuda/CudaConfig_gen.h
Normal file
137
src/backend/cuda/CudaConfig_gen.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDACONFIG_GEN_H
|
||||
#define XMRIG_CUDACONFIG_GEN_H
|
||||
|
||||
|
||||
#include "backend/common/Threads.h"
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static inline size_t generate(const char *key, Threads<CudaThreads> &threads, const Algorithm &algorithm, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
if (threads.isExist(algorithm) || threads.has(key)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return threads.move(key, CudaThreads(devices, algorithm));
|
||||
}
|
||||
|
||||
|
||||
template<Algorithm::Family FAMILY>
|
||||
static inline size_t generate(Threads<CudaThreads> &, const std::vector<CudaDevice> &) { return 0; }
|
||||
|
||||
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
count += generate("cn", threads, Algorithm::CN_1, devices);
|
||||
count += generate("cn/2", threads, Algorithm::CN_2, devices);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_0)) {
|
||||
threads.disable(Algorithm::CN_0);
|
||||
count++;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
count += generate("cn/gpu", threads, Algorithm::CN_GPU, devices);
|
||||
# endif
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_LITE>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
size_t count = generate("cn-lite", threads, Algorithm::CN_LITE_1, devices);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_LITE_0)) {
|
||||
threads.disable(Algorithm::CN_LITE_0);
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_HEAVY>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
return generate("cn-heavy", threads, Algorithm::CN_HEAVY_0, devices);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_PICO>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
template<>
|
||||
size_t inline generate<Algorithm::RANDOM_X>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
auto rx = CudaThreads(devices, Algorithm::RX_0);
|
||||
auto wow = CudaThreads(devices, Algorithm::RX_WOW);
|
||||
auto arq = CudaThreads(devices, Algorithm::RX_ARQ);
|
||||
|
||||
if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
|
||||
count += threads.move("rx/wow", std::move(wow));
|
||||
}
|
||||
|
||||
if (!threads.isExist(Algorithm::RX_ARQ) && arq != rx) {
|
||||
count += threads.move("rx/arq", std::move(arq));
|
||||
}
|
||||
|
||||
count += threads.move("rx", std::move(rx));
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDACONFIG_GEN_H */
|
||||
51
src/backend/cuda/CudaLaunchData.cpp
Normal file
51
src/backend/cuda/CudaLaunchData.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/CudaLaunchData.h"
|
||||
#include "backend/common/Tags.h"
|
||||
|
||||
|
||||
xmrig::CudaLaunchData::CudaLaunchData(const Miner *miner, const Algorithm &algorithm, const CudaThread &thread, const CudaDevice &device) :
|
||||
algorithm(algorithm),
|
||||
miner(miner),
|
||||
device(device),
|
||||
thread(thread)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLaunchData::isEqual(const CudaLaunchData &other) const
|
||||
{
|
||||
return (other.algorithm.family() == algorithm.family() &&
|
||||
other.algorithm.l3() == algorithm.l3() &&
|
||||
other.thread == thread);
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLaunchData::tag()
|
||||
{
|
||||
return cuda_tag();
|
||||
}
|
||||
66
src/backend/cuda/CudaLaunchData.h
Normal file
66
src/backend/cuda/CudaLaunchData.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDALAUNCHDATA_H
|
||||
#define XMRIG_CUDALAUNCHDATA_H
|
||||
|
||||
|
||||
#include "backend/cuda/CudaThread.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "crypto/common/Nonce.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaDevice;
|
||||
class Miner;
|
||||
|
||||
|
||||
class CudaLaunchData
|
||||
{
|
||||
public:
|
||||
CudaLaunchData(const Miner *miner, const Algorithm &algorithm, const CudaThread &thread, const CudaDevice &device);
|
||||
|
||||
bool isEqual(const CudaLaunchData &other) const;
|
||||
|
||||
inline constexpr static Nonce::Backend backend() { return Nonce::CUDA; }
|
||||
|
||||
inline bool operator!=(const CudaLaunchData &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const CudaLaunchData &other) const { return isEqual(other); }
|
||||
|
||||
static const char *tag();
|
||||
|
||||
const Algorithm algorithm;
|
||||
const Miner *miner;
|
||||
const CudaDevice &device;
|
||||
const CudaThread thread;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_OCLLAUNCHDATA_H */
|
||||
113
src/backend/cuda/CudaThread.cpp
Normal file
113
src/backend/cuda/CudaThread.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/CudaThread.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kAffinity = "affinity";
|
||||
static const char *kBFactor = "bfactor";
|
||||
static const char *kBlocks = "blocks";
|
||||
static const char *kBSleep = "bsleep";
|
||||
static const char *kIndex = "index";
|
||||
static const char *kThreads = "threads";
|
||||
static const char *kDatasetHost = "dataset_host";
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::CudaThread::CudaThread(const rapidjson::Value &value)
|
||||
{
|
||||
if (!value.IsObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_index = Json::getUint(value, kIndex);
|
||||
m_threads = Json::getInt(value, kThreads);
|
||||
m_blocks = Json::getInt(value, kBlocks);
|
||||
m_bfactor = std::min(Json::getUint(value, kBFactor, m_bfactor), 12u);
|
||||
m_bsleep = Json::getUint(value, kBSleep, m_bsleep);
|
||||
m_affinity = Json::getUint64(value, kAffinity, m_affinity);
|
||||
|
||||
if (Json::getValue(value, kDatasetHost).IsInt()) {
|
||||
m_datasetHost = Json::getInt(value, kDatasetHost, m_datasetHost) != 0;
|
||||
}
|
||||
else {
|
||||
m_datasetHost = Json::getBool(value, kDatasetHost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaThread::CudaThread(uint32_t index, nvid_ctx *ctx) :
|
||||
m_blocks(CudaLib::deviceInt(ctx, CudaLib::DeviceBlocks)),
|
||||
m_datasetHost(CudaLib::deviceInt(ctx, CudaLib::DeviceDatasetHost)),
|
||||
m_threads(CudaLib::deviceInt(ctx, CudaLib::DeviceThreads)),
|
||||
m_index(index),
|
||||
m_bfactor(CudaLib::deviceUint(ctx, CudaLib::DeviceBFactor)),
|
||||
m_bsleep(CudaLib::deviceUint(ctx, CudaLib::DeviceBSleep))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaThread::isEqual(const CudaThread &other) const
|
||||
{
|
||||
return m_blocks == other.m_blocks &&
|
||||
m_threads == other.m_threads &&
|
||||
m_affinity == other.m_affinity &&
|
||||
m_index == other.m_index &&
|
||||
m_bfactor == other.m_bfactor &&
|
||||
m_bsleep == other.m_bsleep &&
|
||||
m_datasetHost == other.m_datasetHost;
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::CudaThread::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value out(kObjectType);
|
||||
|
||||
out.AddMember(StringRef(kIndex), index(), allocator);
|
||||
out.AddMember(StringRef(kThreads), threads(), allocator);
|
||||
out.AddMember(StringRef(kBlocks), blocks(), allocator);
|
||||
out.AddMember(StringRef(kBFactor), bfactor(), allocator);
|
||||
out.AddMember(StringRef(kBSleep), bsleep(), allocator);
|
||||
out.AddMember(StringRef(kAffinity), affinity(), allocator);
|
||||
|
||||
if (m_datasetHost >= 0) {
|
||||
out.AddMember(StringRef(kDatasetHost), m_datasetHost > 0, allocator);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
81
src/backend/cuda/CudaThread.h
Normal file
81
src/backend/cuda/CudaThread.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDATHREAD_H
|
||||
#define XMRIG_CUDATHREAD_H
|
||||
|
||||
|
||||
using nvid_ctx = struct nvid_ctx;
|
||||
|
||||
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaThread
|
||||
{
|
||||
public:
|
||||
CudaThread() = delete;
|
||||
CudaThread(const rapidjson::Value &value);
|
||||
CudaThread(uint32_t index, nvid_ctx *ctx);
|
||||
|
||||
inline bool isValid() const { return m_blocks > 0 && m_threads > 0; }
|
||||
inline int32_t bfactor() const { return static_cast<int32_t>(m_bfactor); }
|
||||
inline int32_t blocks() const { return m_blocks; }
|
||||
inline int32_t bsleep() const { return static_cast<int32_t>(m_bsleep); }
|
||||
inline int32_t datasetHost() const { return m_datasetHost; }
|
||||
inline int32_t threads() const { return m_threads; }
|
||||
inline int64_t affinity() const { return m_affinity; }
|
||||
inline uint32_t index() const { return m_index; }
|
||||
|
||||
inline bool operator!=(const CudaThread &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const CudaThread &other) const { return isEqual(other); }
|
||||
|
||||
bool isEqual(const CudaThread &other) const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
|
||||
private:
|
||||
int32_t m_blocks = 0;
|
||||
int32_t m_datasetHost = -1;
|
||||
int32_t m_threads = 0;
|
||||
int64_t m_affinity = -1;
|
||||
uint32_t m_index = 0;
|
||||
|
||||
# ifdef _WIN32
|
||||
uint32_t m_bfactor = 6;
|
||||
uint32_t m_bsleep = 25;
|
||||
# else
|
||||
uint32_t m_bfactor = 0;
|
||||
uint32_t m_bsleep = 0;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDATHREAD_H */
|
||||
79
src/backend/cuda/CudaThreads.cpp
Normal file
79
src/backend/cuda/CudaThreads.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
xmrig::CudaThreads::CudaThreads(const rapidjson::Value &value)
|
||||
{
|
||||
if (value.IsArray()) {
|
||||
for (auto &v : value.GetArray()) {
|
||||
CudaThread thread(v);
|
||||
if (thread.isValid()) {
|
||||
add(std::move(thread));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaThreads::CudaThreads(const std::vector<CudaDevice> &devices, const Algorithm &algorithm)
|
||||
{
|
||||
for (const auto &device : devices) {
|
||||
device.generate(algorithm, *this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaThreads::isEqual(const CudaThreads &other) const
|
||||
{
|
||||
if (isEmpty() && other.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return count() == other.count() && std::equal(m_data.begin(), m_data.end(), other.m_data.begin());
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::CudaThreads::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value out(kArrayType);
|
||||
|
||||
out.SetArray();
|
||||
|
||||
for (const CudaThread &thread : m_data) {
|
||||
out.PushBack(thread.toJSON(doc), allocator);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
66
src/backend/cuda/CudaThreads.h
Normal file
66
src/backend/cuda/CudaThreads.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDATHREADS_H
|
||||
#define XMRIG_CUDATHREADS_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "backend/cuda/CudaThread.h"
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaThreads
|
||||
{
|
||||
public:
|
||||
CudaThreads() = default;
|
||||
CudaThreads(const rapidjson::Value &value);
|
||||
CudaThreads(const std::vector<CudaDevice> &devices, const Algorithm &algorithm);
|
||||
|
||||
inline bool isEmpty() const { return m_data.empty(); }
|
||||
inline const std::vector<CudaThread> &data() const { return m_data; }
|
||||
inline size_t count() const { return m_data.size(); }
|
||||
inline void add(CudaThread &&thread) { m_data.push_back(thread); }
|
||||
inline void reserve(size_t capacity) { m_data.reserve(capacity); }
|
||||
|
||||
inline bool operator!=(const CudaThreads &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const CudaThreads &other) const { return isEqual(other); }
|
||||
|
||||
bool isEqual(const CudaThreads &other) const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
|
||||
private:
|
||||
std::vector<CudaThread> m_data;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDATHREADS_H */
|
||||
171
src/backend/cuda/CudaWorker.cpp
Normal file
171
src/backend/cuda/CudaWorker.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/CudaWorker.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/cuda/runners/CudaCnRunner.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "core/Miner.h"
|
||||
#include "crypto/common/Nonce.h"
|
||||
#include "net/JobResults.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
# include "backend/cuda/runners/CudaRxRunner.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include <thread>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static constexpr uint32_t kReserveCount = 32768;
|
||||
std::atomic<bool> CudaWorker::ready;
|
||||
|
||||
|
||||
static inline bool isReady() { return !Nonce::isPaused() && CudaWorker::ready; }
|
||||
static inline uint32_t roundSize(uint32_t intensity) { return kReserveCount / intensity + 1; }
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
|
||||
xmrig::CudaWorker::CudaWorker(size_t id, const CudaLaunchData &data) :
|
||||
Worker(id, data.thread.affinity(), -1),
|
||||
m_algorithm(data.algorithm),
|
||||
m_miner(data.miner)
|
||||
{
|
||||
switch (m_algorithm.family()) {
|
||||
case Algorithm::RANDOM_X:
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
m_runner = new CudaRxRunner(id, data);
|
||||
# endif
|
||||
break;
|
||||
|
||||
case Algorithm::ARGON2:
|
||||
break;
|
||||
|
||||
default:
|
||||
m_runner = new CudaCnRunner(id, data);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_runner || !m_runner->init()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaWorker::~CudaWorker()
|
||||
{
|
||||
delete m_runner;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaWorker::selfTest()
|
||||
{
|
||||
return m_runner != nullptr;
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::CudaWorker::intensity() const
|
||||
{
|
||||
return m_runner ? m_runner->intensity() : 0;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaWorker::start()
|
||||
{
|
||||
while (Nonce::sequence(Nonce::CUDA) > 0) {
|
||||
if (!isReady()) {
|
||||
do {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
}
|
||||
while (!isReady() && Nonce::sequence(Nonce::CUDA) > 0);
|
||||
|
||||
if (Nonce::sequence(Nonce::CUDA) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!consumeJob()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (!Nonce::isOutdated(Nonce::CUDA, m_job.sequence())) {
|
||||
uint32_t foundNonce[10] = { 0 };
|
||||
uint32_t foundCount = 0;
|
||||
|
||||
if (!m_runner->run(*m_job.nonce(), &foundCount, foundNonce)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (foundCount) {
|
||||
JobResults::submit(m_job.currentJob(), foundNonce, foundCount);
|
||||
}
|
||||
|
||||
const size_t batch_size = intensity();
|
||||
m_job.nextRound(roundSize(batch_size), batch_size);
|
||||
|
||||
storeStats();
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
if (!consumeJob()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaWorker::consumeJob()
|
||||
{
|
||||
if (Nonce::sequence(Nonce::CUDA) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t batch_size = intensity();
|
||||
m_job.add(m_miner->job(), roundSize(batch_size) * batch_size, Nonce::CUDA);
|
||||
|
||||
return m_runner->set(m_job.currentJob(), m_job.blob());;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaWorker::storeStats()
|
||||
{
|
||||
if (!isReady()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_count += intensity();
|
||||
|
||||
Worker::storeStats();
|
||||
}
|
||||
73
src/backend/cuda/CudaWorker.h
Normal file
73
src/backend/cuda/CudaWorker.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDAWORKER_H
|
||||
#define XMRIG_CUDAWORKER_H
|
||||
|
||||
|
||||
#include "backend/common/Worker.h"
|
||||
#include "backend/common/WorkerJob.h"
|
||||
#include "backend/cuda/CudaLaunchData.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "net/JobResult.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class ICudaRunner;
|
||||
|
||||
|
||||
class CudaWorker : public Worker
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(CudaWorker)
|
||||
|
||||
CudaWorker(size_t id, const CudaLaunchData &data);
|
||||
|
||||
~CudaWorker() override;
|
||||
|
||||
static std::atomic<bool> ready;
|
||||
|
||||
protected:
|
||||
bool selfTest() override;
|
||||
size_t intensity() const override;
|
||||
void start() override;
|
||||
|
||||
private:
|
||||
bool consumeJob();
|
||||
void storeStats();
|
||||
|
||||
const Algorithm m_algorithm;
|
||||
const Miner *m_miner;
|
||||
ICudaRunner *m_runner = nullptr;
|
||||
WorkerJob<1> m_job;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDAWORKER_H */
|
||||
56
src/backend/cuda/cuda.cmake
Normal file
56
src/backend/cuda/cuda.cmake
Normal file
@@ -0,0 +1,56 @@
|
||||
if (WITH_CUDA)
|
||||
add_definitions(/DXMRIG_FEATURE_CUDA)
|
||||
|
||||
set(HEADERS_BACKEND_CUDA
|
||||
src/backend/cuda/CudaBackend.h
|
||||
src/backend/cuda/CudaConfig_gen.h
|
||||
src/backend/cuda/CudaConfig.h
|
||||
src/backend/cuda/CudaLaunchData.h
|
||||
src/backend/cuda/CudaThread.h
|
||||
src/backend/cuda/CudaThreads.h
|
||||
src/backend/cuda/CudaWorker.h
|
||||
src/backend/cuda/interfaces/ICudaRunner.h
|
||||
src/backend/cuda/runners/CudaBaseRunner.h
|
||||
src/backend/cuda/runners/CudaCnRunner.h
|
||||
src/backend/cuda/wrappers/CudaDevice.h
|
||||
src/backend/cuda/wrappers/CudaLib.h
|
||||
)
|
||||
|
||||
set(SOURCES_BACKEND_CUDA
|
||||
src/backend/cuda/CudaBackend.cpp
|
||||
src/backend/cuda/CudaConfig.cpp
|
||||
src/backend/cuda/CudaLaunchData.cpp
|
||||
src/backend/cuda/CudaThread.cpp
|
||||
src/backend/cuda/CudaThreads.cpp
|
||||
src/backend/cuda/CudaWorker.cpp
|
||||
src/backend/cuda/runners/CudaBaseRunner.cpp
|
||||
src/backend/cuda/runners/CudaCnRunner.cpp
|
||||
src/backend/cuda/wrappers/CudaDevice.cpp
|
||||
src/backend/cuda/wrappers/CudaLib.cpp
|
||||
)
|
||||
|
||||
if (WITH_NVML AND NOT APPLE)
|
||||
add_definitions(/DXMRIG_FEATURE_NVML)
|
||||
|
||||
list(APPEND HEADERS_BACKEND_CUDA
|
||||
src/backend/cuda/wrappers/nvml_lite.h
|
||||
src/backend/cuda/wrappers/NvmlHealth.h
|
||||
src/backend/cuda/wrappers/NvmlLib.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_BACKEND_CUDA src/backend/cuda/wrappers/NvmlLib.cpp)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_FEATURE_NVML)
|
||||
endif()
|
||||
|
||||
if (WITH_RANDOMX)
|
||||
list(APPEND HEADERS_BACKEND_CUDA src/backend/cuda/runners/CudaRxRunner.h)
|
||||
list(APPEND SOURCES_BACKEND_CUDA src/backend/cuda/runners/CudaRxRunner.cpp)
|
||||
endif()
|
||||
else()
|
||||
remove_definitions(/DXMRIG_FEATURE_CUDA)
|
||||
remove_definitions(/DXMRIG_FEATURE_NVML)
|
||||
|
||||
set(HEADERS_BACKEND_CUDA "")
|
||||
set(SOURCES_BACKEND_CUDA "")
|
||||
endif()
|
||||
71
src/backend/cuda/interfaces/ICudaRunner.h
Normal file
71
src/backend/cuda/interfaces/ICudaRunner.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_ICUDARUNNER_H
|
||||
#define XMRIG_ICUDARUNNER_H
|
||||
|
||||
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Job;
|
||||
|
||||
|
||||
class ICudaRunner
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(ICudaRunner)
|
||||
|
||||
ICudaRunner() = default;
|
||||
virtual ~ICudaRunner() = default;
|
||||
|
||||
// virtual cl_context ctx() const = 0;
|
||||
// virtual const Algorithm &algorithm() const = 0;
|
||||
// virtual const char *buildOptions() const = 0;
|
||||
// virtual const char *deviceKey() const = 0;
|
||||
// virtual const char *source() const = 0;
|
||||
// virtual const OclLaunchData &data() const = 0;
|
||||
virtual size_t intensity() const = 0;
|
||||
// virtual size_t threadId() const = 0;
|
||||
// virtual uint32_t deviceIndex() const = 0;
|
||||
// virtual void build() = 0;
|
||||
virtual bool init() = 0;
|
||||
virtual bool run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce) = 0;
|
||||
virtual bool set(const Job &job, uint8_t *blob) = 0;
|
||||
|
||||
protected:
|
||||
// virtual size_t bufferSize() const = 0;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif // XMRIG_ICUDARUNNER_H
|
||||
83
src/backend/cuda/runners/CudaBaseRunner.cpp
Normal file
83
src/backend/cuda/runners/CudaBaseRunner.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/runners/CudaBaseRunner.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "backend/cuda/CudaLaunchData.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
|
||||
|
||||
xmrig::CudaBaseRunner::CudaBaseRunner(size_t id, const CudaLaunchData &data) :
|
||||
m_data(data),
|
||||
m_threadId(id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaBaseRunner::~CudaBaseRunner()
|
||||
{
|
||||
CudaLib::release(m_ctx);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaBaseRunner::init()
|
||||
{
|
||||
m_ctx = CudaLib::alloc(m_data.thread.index(), m_data.thread.bfactor(), m_data.thread.bsleep());
|
||||
if (CudaLib::deviceInfo(m_ctx, m_data.thread.blocks(), m_data.thread.threads(), m_data.algorithm, m_data.thread.datasetHost()) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return callWrapper(CudaLib::deviceInit(m_ctx));
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaBaseRunner::set(const Job &job, uint8_t *blob)
|
||||
{
|
||||
m_height = job.height();
|
||||
m_target = job.target();
|
||||
|
||||
return callWrapper(CudaLib::setJob(m_ctx, blob, job.size(), job.algorithm()));
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::CudaBaseRunner::intensity() const
|
||||
{
|
||||
return m_data.thread.threads() * m_data.thread.blocks();
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaBaseRunner::callWrapper(bool result) const
|
||||
{
|
||||
if (!result) {
|
||||
const char *error = CudaLib::lastError(m_ctx);
|
||||
if (error) {
|
||||
LOG_ERR("%s" RED_S " thread " RED_BOLD("#%zu") RED_S " failed with error " RED_BOLD("%s"), cuda_tag(), m_threadId, error);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
68
src/backend/cuda/runners/CudaBaseRunner.h
Normal file
68
src/backend/cuda/runners/CudaBaseRunner.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDABASERUNNER_H
|
||||
#define XMRIG_CUDABASERUNNER_H
|
||||
|
||||
|
||||
#include "backend/cuda/interfaces/ICudaRunner.h"
|
||||
|
||||
|
||||
using nvid_ctx = struct nvid_ctx;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaLaunchData;
|
||||
|
||||
|
||||
class CudaBaseRunner : public ICudaRunner
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(CudaBaseRunner)
|
||||
|
||||
CudaBaseRunner(size_t id, const CudaLaunchData &data);
|
||||
~CudaBaseRunner() override;
|
||||
|
||||
protected:
|
||||
bool init() override;
|
||||
bool set(const Job &job, uint8_t *blob) override;
|
||||
size_t intensity() const override;
|
||||
|
||||
protected:
|
||||
bool callWrapper(bool result) const;
|
||||
|
||||
const CudaLaunchData &m_data;
|
||||
const size_t m_threadId;
|
||||
nvid_ctx *m_ctx = nullptr;
|
||||
uint64_t m_height = 0;
|
||||
uint64_t m_target = 0;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif // XMRIG_CUDABASERUNNER_H
|
||||
38
src/backend/cuda/runners/CudaCnRunner.cpp
Normal file
38
src/backend/cuda/runners/CudaCnRunner.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/runners/CudaCnRunner.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
|
||||
|
||||
xmrig::CudaCnRunner::CudaCnRunner(size_t index, const CudaLaunchData &data) : CudaBaseRunner(index, data)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaCnRunner::run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce)
|
||||
{
|
||||
return callWrapper(CudaLib::cnHash(m_ctx, startNonce, m_height, m_target, rescount, resnonce));
|
||||
}
|
||||
48
src/backend/cuda/runners/CudaCnRunner.h
Normal file
48
src/backend/cuda/runners/CudaCnRunner.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDACNRUNNER_H
|
||||
#define XMRIG_CUDACNRUNNER_H
|
||||
|
||||
|
||||
#include "backend/cuda/runners/CudaBaseRunner.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaCnRunner : public CudaBaseRunner
|
||||
{
|
||||
public:
|
||||
CudaCnRunner(size_t index, const CudaLaunchData &data);
|
||||
|
||||
protected:
|
||||
bool run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce) override;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif // XMRIG_CUDACNRUNNER_H
|
||||
66
src/backend/cuda/runners/CudaRxRunner.cpp
Normal file
66
src/backend/cuda/runners/CudaRxRunner.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/runners/CudaRxRunner.h"
|
||||
#include "backend/cuda/CudaLaunchData.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "crypto/rx/Rx.h"
|
||||
#include "crypto/rx/RxDataset.h"
|
||||
|
||||
|
||||
xmrig::CudaRxRunner::CudaRxRunner(size_t index, const CudaLaunchData &data) : CudaBaseRunner(index, data),
|
||||
m_datasetHost(data.thread.datasetHost() > 0)
|
||||
{
|
||||
m_intensity = m_data.thread.threads() * m_data.thread.blocks();
|
||||
const size_t scratchpads_size = m_intensity * m_data.algorithm.l3();
|
||||
const size_t num_scratchpads = scratchpads_size / m_data.algorithm.l3();
|
||||
|
||||
if (m_intensity > num_scratchpads) {
|
||||
m_intensity = num_scratchpads;
|
||||
}
|
||||
|
||||
m_intensity -= m_intensity % 32;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaRxRunner::run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce)
|
||||
{
|
||||
return callWrapper(CudaLib::rxHash(m_ctx, startNonce, m_target, rescount, resnonce));
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaRxRunner::set(const Job &job, uint8_t *blob)
|
||||
{
|
||||
const bool rc = CudaBaseRunner::set(job, blob);
|
||||
if (!rc || m_ready) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
auto dataset = Rx::dataset(job, 0);
|
||||
m_ready = callWrapper(CudaLib::rxPrepare(m_ctx, dataset->raw(), dataset->size(false), m_datasetHost, m_intensity));
|
||||
|
||||
return m_ready;
|
||||
}
|
||||
@@ -22,47 +22,35 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_OCLRXDATASET_H
|
||||
#define XMRIG_OCLRXDATASET_H
|
||||
#ifndef XMRIG_CUDARXRUNNER_H
|
||||
#define XMRIG_CUDARXRUNNER_H
|
||||
|
||||
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
using cl_context = struct _cl_context *;
|
||||
using cl_mem = struct _cl_mem *;
|
||||
#include "backend/cuda/runners/CudaBaseRunner.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Job;
|
||||
|
||||
|
||||
class OclRxDataset
|
||||
class CudaRxRunner : public CudaBaseRunner
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(OclRxDataset)
|
||||
CudaRxRunner(size_t index, const CudaLaunchData &data);
|
||||
|
||||
OclRxDataset() = default;
|
||||
~OclRxDataset();
|
||||
protected:
|
||||
inline size_t intensity() const override { return m_intensity; }
|
||||
|
||||
inline cl_mem get() const { return m_dataset; }
|
||||
|
||||
void createBuffer(cl_context ctx,const Job &job, bool host);
|
||||
bool run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce) override;
|
||||
bool set(const Job &job, uint8_t *blob) override;
|
||||
|
||||
private:
|
||||
cl_mem m_dataset = nullptr;
|
||||
bool m_ready = false;
|
||||
const bool m_datasetHost = false;
|
||||
size_t m_intensity = 0;
|
||||
};
|
||||
|
||||
|
||||
using OclRxDatasetPtr = std::shared_ptr<OclRxDataset>;
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_OCLINTERLEAVE_H */
|
||||
#endif // XMRIG_CUDARXRUNNER_H
|
||||
152
src/backend/cuda/wrappers/CudaDevice.cpp
Normal file
152
src/backend/cuda/wrappers/CudaDevice.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
#ifdef XMRIG_FEATURE_NVML
|
||||
# include "backend/cuda/wrappers/NvmlLib.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
xmrig::CudaDevice::CudaDevice(uint32_t index, int32_t bfactor, int32_t bsleep) :
|
||||
m_index(index)
|
||||
{
|
||||
auto ctx = CudaLib::alloc(index, bfactor, bsleep);
|
||||
if (CudaLib::deviceInfo(ctx, 0, 0, Algorithm::INVALID) != 0) {
|
||||
CudaLib::release(ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_ctx = ctx;
|
||||
m_name = CudaLib::deviceName(ctx);
|
||||
m_topology = PciTopology(CudaLib::deviceUint(ctx, CudaLib::DevicePciBusID), CudaLib::deviceUint(ctx, CudaLib::DevicePciDeviceID), 0);
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaDevice::CudaDevice(CudaDevice &&other) noexcept :
|
||||
m_index(other.m_index),
|
||||
m_ctx(other.m_ctx),
|
||||
m_topology(other.m_topology),
|
||||
m_name(std::move(other.m_name))
|
||||
{
|
||||
other.m_ctx = nullptr;
|
||||
}
|
||||
|
||||
|
||||
xmrig::CudaDevice::~CudaDevice()
|
||||
{
|
||||
CudaLib::release(m_ctx);
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::CudaDevice::freeMemSize() const
|
||||
{
|
||||
return CudaLib::deviceUlong(m_ctx, CudaLib::DeviceMemoryFree);
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::CudaDevice::globalMemSize() const
|
||||
{
|
||||
return CudaLib::deviceUlong(m_ctx, CudaLib::DeviceMemoryTotal);
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaDevice::clock() const
|
||||
{
|
||||
return CudaLib::deviceUint(m_ctx, CudaLib::DeviceClockRate) / 1000;
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaDevice::computeCapability(bool major) const
|
||||
{
|
||||
return CudaLib::deviceUint(m_ctx, major ? CudaLib::DeviceArchMajor : CudaLib::DeviceArchMinor);
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaDevice::memoryClock() const
|
||||
{
|
||||
return CudaLib::deviceUint(m_ctx, CudaLib::DeviceMemoryClockRate) / 1000;
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaDevice::smx() const
|
||||
{
|
||||
return CudaLib::deviceUint(m_ctx, CudaLib::DeviceSmx);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaDevice::generate(const Algorithm &algorithm, CudaThreads &threads) const
|
||||
{
|
||||
if (CudaLib::deviceInfo(m_ctx, -1, -1, algorithm) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
threads.add(CudaThread(m_index, m_ctx));
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
void xmrig::CudaDevice::toJSON(rapidjson::Value &out, rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
out.AddMember("name", name().toJSON(doc), allocator);
|
||||
out.AddMember("bus_id", topology().toString().toJSON(doc), allocator);
|
||||
out.AddMember("smx", smx(), allocator);
|
||||
out.AddMember("arch", arch(), allocator);
|
||||
out.AddMember("global_mem", static_cast<uint64_t>(globalMemSize()), allocator);
|
||||
out.AddMember("clock", clock(), allocator);
|
||||
out.AddMember("memory_clock", memoryClock(), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
if (m_nvmlDevice) {
|
||||
auto data = NvmlLib::health(m_nvmlDevice);
|
||||
|
||||
Value health(kObjectType);
|
||||
health.AddMember("temperature", data.temperature, allocator);
|
||||
health.AddMember("power", data.power, allocator);
|
||||
health.AddMember("clock", data.clock, allocator);
|
||||
health.AddMember("mem_clock", data.memClock, allocator);
|
||||
|
||||
Value fanSpeed(kArrayType);
|
||||
for (auto speed : data.fanSpeed) {
|
||||
fanSpeed.PushBack(speed, allocator);
|
||||
}
|
||||
health.AddMember("fan_speed", fanSpeed, allocator);
|
||||
|
||||
out.AddMember("health", health, allocator);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
94
src/backend/cuda/wrappers/CudaDevice.h
Normal file
94
src/backend/cuda/wrappers/CudaDevice.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDADEVICE_H
|
||||
#define XMRIG_CUDADEVICE_H
|
||||
|
||||
|
||||
#include "backend/common/misc/PciTopology.h"
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
||||
using nvid_ctx = struct nvid_ctx;
|
||||
using nvmlDevice_t = struct nvmlDevice_st *;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Algorithm;
|
||||
class CudaThreads;
|
||||
|
||||
|
||||
class CudaDevice
|
||||
{
|
||||
public:
|
||||
CudaDevice() = delete;
|
||||
CudaDevice(const CudaDevice &other) = delete;
|
||||
CudaDevice(CudaDevice &&other) noexcept;
|
||||
CudaDevice(uint32_t index, int32_t bfactor, int32_t bsleep);
|
||||
~CudaDevice();
|
||||
|
||||
size_t freeMemSize() const;
|
||||
size_t globalMemSize() const;
|
||||
uint32_t clock() const;
|
||||
uint32_t computeCapability(bool major = true) const;
|
||||
uint32_t memoryClock() const;
|
||||
uint32_t smx() const;
|
||||
void generate(const Algorithm &algorithm, CudaThreads &threads) const;
|
||||
|
||||
inline bool isValid() const { return m_ctx != nullptr; }
|
||||
inline const PciTopology &topology() const { return m_topology; }
|
||||
inline const String &name() const { return m_name; }
|
||||
inline uint32_t arch() const { return (computeCapability(true) * 10) + computeCapability(false); }
|
||||
inline uint32_t index() const { return m_index; }
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
inline nvmlDevice_t nvmlDevice() const { return m_nvmlDevice; }
|
||||
inline void setNvmlDevice(nvmlDevice_t device) { m_nvmlDevice = device; }
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_API
|
||||
void toJSON(rapidjson::Value &out, rapidjson::Document &doc) const;
|
||||
# endif
|
||||
|
||||
CudaDevice &operator=(const CudaDevice &other) = delete;
|
||||
CudaDevice &operator=(CudaDevice &&other) = delete;
|
||||
|
||||
private:
|
||||
const uint32_t m_index = 0;
|
||||
nvid_ctx *m_ctx = nullptr;
|
||||
PciTopology m_topology;
|
||||
String m_name;
|
||||
|
||||
# ifdef XMRIG_FEATURE_NVML
|
||||
nvmlDevice_t m_nvmlDevice = nullptr;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDADEVICE_H */
|
||||
330
src/backend/cuda/wrappers/CudaLib.cpp
Normal file
330
src/backend/cuda/wrappers/CudaLib.cpp
Normal file
@@ -0,0 +1,330 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdexcept>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
enum Version : uint32_t
|
||||
{
|
||||
ApiVersion,
|
||||
DriverVersion,
|
||||
RuntimeVersion
|
||||
};
|
||||
|
||||
|
||||
static uv_lib_t cudaLib;
|
||||
|
||||
|
||||
static const char *kAlloc = "alloc";
|
||||
static const char *kCnHash = "cnHash";
|
||||
static const char *kDeviceCount = "deviceCount";
|
||||
static const char *kDeviceInfo = "deviceInfo";
|
||||
static const char *kDeviceInit = "deviceInit";
|
||||
static const char *kDeviceInt = "deviceInt";
|
||||
static const char *kDeviceName = "deviceName";
|
||||
static const char *kDeviceUint = "deviceUint";
|
||||
static const char *kDeviceUlong = "deviceUlong";
|
||||
static const char *kInit = "init";
|
||||
static const char *kLastError = "lastError";
|
||||
static const char *kPluginVersion = "pluginVersion";
|
||||
static const char *kRelease = "release";
|
||||
static const char *kRxHash = "rxHash";
|
||||
static const char *kRxPrepare = "rxPrepare";
|
||||
static const char *kSetJob = "setJob";
|
||||
static const char *kSymbolNotFound = "symbol not found";
|
||||
static const char *kVersion = "version";
|
||||
|
||||
|
||||
using alloc_t = nvid_ctx * (*)(uint32_t, int32_t, int32_t);
|
||||
using cnHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint64_t, uint32_t *, uint32_t *);
|
||||
using deviceCount_t = uint32_t (*)();
|
||||
using deviceInfo_t = int32_t (*)(nvid_ctx *, int32_t, int32_t, int32_t, int32_t);
|
||||
using deviceInit_t = bool (*)(nvid_ctx *);
|
||||
using deviceInt_t = int32_t (*)(nvid_ctx *, CudaLib::DeviceProperty);
|
||||
using deviceName_t = const char * (*)(nvid_ctx *);
|
||||
using deviceUint_t = uint32_t (*)(nvid_ctx *, CudaLib::DeviceProperty);
|
||||
using deviceUlong_t = uint64_t (*)(nvid_ctx *, CudaLib::DeviceProperty);
|
||||
using init_t = void (*)();
|
||||
using lastError_t = const char * (*)(nvid_ctx *);
|
||||
using pluginVersion_t = const char * (*)();
|
||||
using release_t = void (*)(nvid_ctx *);
|
||||
using rxHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *);
|
||||
using rxPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, bool, uint32_t);
|
||||
using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, int32_t);
|
||||
using version_t = uint32_t (*)(Version);
|
||||
|
||||
|
||||
static alloc_t pAlloc = nullptr;
|
||||
static cnHash_t pCnHash = nullptr;
|
||||
static deviceCount_t pDeviceCount = nullptr;
|
||||
static deviceInfo_t pDeviceInfo = nullptr;
|
||||
static deviceInit_t pDeviceInit = nullptr;
|
||||
static deviceInt_t pDeviceInt = nullptr;
|
||||
static deviceName_t pDeviceName = nullptr;
|
||||
static deviceUint_t pDeviceUint = nullptr;
|
||||
static deviceUlong_t pDeviceUlong = nullptr;
|
||||
static init_t pInit = nullptr;
|
||||
static lastError_t pLastError = nullptr;
|
||||
static pluginVersion_t pPluginVersion = nullptr;
|
||||
static release_t pRelease = nullptr;
|
||||
static rxHash_t pRxHash = nullptr;
|
||||
static rxPrepare_t pRxPrepare = nullptr;
|
||||
static setJob_t pSetJob = nullptr;
|
||||
static version_t pVersion = nullptr;
|
||||
|
||||
|
||||
#define DLSYM(x) if (uv_dlsym(&cudaLib, k##x, reinterpret_cast<void**>(&p##x)) == -1) { throw std::runtime_error(kSymbolNotFound); }
|
||||
|
||||
|
||||
bool CudaLib::m_initialized = false;
|
||||
bool CudaLib::m_ready = false;
|
||||
String CudaLib::m_loader;
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
bool xmrig::CudaLib::init(const char *fileName)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_loader = fileName == nullptr ? defaultLoader() : fileName;
|
||||
m_ready = uv_dlopen(m_loader, &cudaLib) == 0 && load();
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
return m_ready;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLib::lastError() noexcept
|
||||
{
|
||||
return uv_dlerror(&cudaLib);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaLib::close()
|
||||
{
|
||||
uv_dlclose(&cudaLib);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height, uint64_t target, uint32_t *rescount, uint32_t *resnonce)
|
||||
{
|
||||
return pCnHash(ctx, startNonce, height, target, rescount, resnonce);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::deviceInit(nvid_ctx *ctx) noexcept
|
||||
{
|
||||
return pDeviceInit(ctx);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept
|
||||
{
|
||||
return pRxHash(ctx, startNonce, target, rescount, resnonce);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept
|
||||
{
|
||||
return pRxPrepare(ctx, dataset, datasetSize, dataset_host, batchSize);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept
|
||||
{
|
||||
return pSetJob(ctx, data, size, algorithm);
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLib::deviceName(nvid_ctx *ctx) noexcept
|
||||
{
|
||||
return pDeviceName(ctx);
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLib::lastError(nvid_ctx *ctx) noexcept
|
||||
{
|
||||
return pLastError(ctx);
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLib::pluginVersion() noexcept
|
||||
{
|
||||
return pPluginVersion();
|
||||
}
|
||||
|
||||
|
||||
int xmrig::CudaLib::deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host) noexcept
|
||||
{
|
||||
return pDeviceInfo(ctx, blocks, threads, algorithm, dataset_host);
|
||||
}
|
||||
|
||||
|
||||
int32_t xmrig::CudaLib::deviceInt(nvid_ctx *ctx, DeviceProperty property) noexcept
|
||||
{
|
||||
return pDeviceInt(ctx, property);
|
||||
}
|
||||
|
||||
|
||||
nvid_ctx *xmrig::CudaLib::alloc(uint32_t id, int32_t bfactor, int32_t bsleep) noexcept
|
||||
{
|
||||
return pAlloc(id, bfactor, bsleep);
|
||||
}
|
||||
|
||||
|
||||
std::string xmrig::CudaLib::version(uint32_t version)
|
||||
{
|
||||
return std::to_string(version / 1000) + "." + std::to_string((version % 1000) / 10);
|
||||
}
|
||||
|
||||
|
||||
std::vector<xmrig::CudaDevice> xmrig::CudaLib::devices(int32_t bfactor, int32_t bsleep, const std::vector<uint32_t> &hints) noexcept
|
||||
{
|
||||
const uint32_t count = deviceCount();
|
||||
if (!count) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<CudaDevice> out;
|
||||
out.reserve(count);
|
||||
|
||||
if (hints.empty()) {
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
CudaDevice device(i, bfactor, bsleep);
|
||||
if (device.isValid()) {
|
||||
out.emplace_back(std::move(device));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const uint32_t i : hints) {
|
||||
if (i >= count) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CudaDevice device(i, bfactor, bsleep);
|
||||
if (device.isValid()) {
|
||||
out.emplace_back(std::move(device));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaLib::deviceCount() noexcept
|
||||
{
|
||||
return pDeviceCount();
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaLib::deviceUint(nvid_ctx *ctx, DeviceProperty property) noexcept
|
||||
{
|
||||
return pDeviceUint(ctx, property);
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaLib::driverVersion() noexcept
|
||||
{
|
||||
return pVersion(DriverVersion);
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::CudaLib::runtimeVersion() noexcept
|
||||
{
|
||||
return pVersion(RuntimeVersion);
|
||||
}
|
||||
|
||||
|
||||
uint64_t xmrig::CudaLib::deviceUlong(nvid_ctx *ctx, DeviceProperty property) noexcept
|
||||
{
|
||||
return pDeviceUlong(ctx, property);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaLib::release(nvid_ctx *ctx) noexcept
|
||||
{
|
||||
pRelease(ctx);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::load()
|
||||
{
|
||||
if (uv_dlsym(&cudaLib, kVersion, reinterpret_cast<void**>(&pVersion)) == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pVersion(ApiVersion) != 2u) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
DLSYM(Alloc);
|
||||
DLSYM(CnHash);
|
||||
DLSYM(DeviceCount);
|
||||
DLSYM(DeviceInfo);
|
||||
DLSYM(DeviceInit);
|
||||
DLSYM(DeviceInt);
|
||||
DLSYM(DeviceName);
|
||||
DLSYM(DeviceUint);
|
||||
DLSYM(DeviceUlong);
|
||||
DLSYM(Init);
|
||||
DLSYM(LastError);
|
||||
DLSYM(PluginVersion);
|
||||
DLSYM(Release);
|
||||
DLSYM(RxHash);
|
||||
DLSYM(RxPrepare);
|
||||
DLSYM(SetJob);
|
||||
DLSYM(Version);
|
||||
} catch (std::exception &ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLib::defaultLoader()
|
||||
{
|
||||
# if defined(__APPLE__)
|
||||
return "/System/Library/Frameworks/OpenCL.framework/OpenCL"; // FIXME
|
||||
# elif defined(_WIN32)
|
||||
return "xmrig-cuda.dll";
|
||||
# else
|
||||
return "libxmrig-cuda.so";
|
||||
# endif
|
||||
}
|
||||
109
src/backend/cuda/wrappers/CudaLib.h
Normal file
109
src/backend/cuda/wrappers/CudaLib.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_CUDALIB_H
|
||||
#define XMRIG_CUDALIB_H
|
||||
|
||||
|
||||
using nvid_ctx = struct nvid_ctx;
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
#include "base/tools/String.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class CudaLib
|
||||
{
|
||||
public:
|
||||
enum DeviceProperty : uint32_t
|
||||
{
|
||||
DeviceId,
|
||||
DeviceAlgorithm,
|
||||
DeviceArchMajor,
|
||||
DeviceArchMinor,
|
||||
DeviceSmx,
|
||||
DeviceBlocks,
|
||||
DeviceThreads,
|
||||
DeviceBFactor,
|
||||
DeviceBSleep,
|
||||
DeviceClockRate,
|
||||
DeviceMemoryClockRate,
|
||||
DeviceMemoryTotal,
|
||||
DeviceMemoryFree,
|
||||
DevicePciBusID,
|
||||
DevicePciDeviceID,
|
||||
DevicePciDomainID,
|
||||
DeviceDatasetHost,
|
||||
};
|
||||
|
||||
static bool init(const char *fileName = nullptr);
|
||||
static const char *lastError() noexcept;
|
||||
static void close();
|
||||
|
||||
static inline bool isInitialized() { return m_initialized; }
|
||||
static inline bool isReady() noexcept { return m_ready; }
|
||||
static inline const String &loader() { return m_loader; }
|
||||
|
||||
static bool cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height, uint64_t target, uint32_t *rescount, uint32_t *resnonce);
|
||||
static bool deviceInit(nvid_ctx *ctx) noexcept;
|
||||
static bool rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept;
|
||||
static bool rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept;
|
||||
static bool setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept;
|
||||
static const char *deviceName(nvid_ctx *ctx) noexcept;
|
||||
static const char *lastError(nvid_ctx *ctx) noexcept;
|
||||
static const char *pluginVersion() noexcept;
|
||||
static int deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host = -1) noexcept;
|
||||
static int32_t deviceInt(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
||||
static nvid_ctx *alloc(uint32_t id, int32_t bfactor, int32_t bsleep) noexcept;
|
||||
static std::string version(uint32_t version);
|
||||
static std::vector<CudaDevice> devices(int32_t bfactor, int32_t bsleep, const std::vector<uint32_t> &hints) noexcept;
|
||||
static uint32_t deviceCount() noexcept;
|
||||
static uint32_t deviceUint(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
||||
static uint32_t driverVersion() noexcept;
|
||||
static uint32_t runtimeVersion() noexcept;
|
||||
static uint64_t deviceUlong(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
||||
static void release(nvid_ctx *ctx) noexcept;
|
||||
|
||||
private:
|
||||
static bool load();
|
||||
static const char *defaultLoader();
|
||||
|
||||
static bool m_initialized;
|
||||
static bool m_ready;
|
||||
static String m_loader;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_CUDALIB_H */
|
||||
43
src/backend/cuda/wrappers/NvmlHealth.h
Normal file
43
src/backend/cuda/wrappers/NvmlHealth.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_NVMLHEALTH_H
|
||||
#define XMRIG_NVMLHEALTH_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
struct NvmlHealth
|
||||
{
|
||||
std::vector<uint32_t> fanSpeed;
|
||||
uint32_t clock = 0;
|
||||
uint32_t memClock = 0;
|
||||
uint32_t power = 0;
|
||||
uint32_t temperature = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* XMRIG_NVMLHEALTH_H */
|
||||
227
src/backend/cuda/wrappers/NvmlLib.cpp
Normal file
227
src/backend/cuda/wrappers/NvmlLib.cpp
Normal file
@@ -0,0 +1,227 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdexcept>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/NvmlLib.h"
|
||||
#include "backend/cuda/wrappers/nvml_lite.h"
|
||||
#include "base/io/log/Log.h"
|
||||
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static uv_lib_t nvmlLib;
|
||||
|
||||
|
||||
static const char *kNvmlDeviceGetClockInfo = "nvmlDeviceGetClockInfo";
|
||||
static const char *kNvmlDeviceGetCount = "nvmlDeviceGetCount_v2";
|
||||
static const char *kNvmlDeviceGetFanSpeed = "nvmlDeviceGetFanSpeed";
|
||||
static const char *kNvmlDeviceGetFanSpeed_v2 = "nvmlDeviceGetFanSpeed_v2";
|
||||
static const char *kNvmlDeviceGetHandleByIndex = "nvmlDeviceGetHandleByIndex_v2";
|
||||
static const char *kNvmlDeviceGetPciInfo = "nvmlDeviceGetPciInfo_v2";
|
||||
static const char *kNvmlDeviceGetPowerUsage = "nvmlDeviceGetPowerUsage";
|
||||
static const char *kNvmlDeviceGetTemperature = "nvmlDeviceGetTemperature";
|
||||
static const char *kNvmlInit = "nvmlInit_v2";
|
||||
static const char *kNvmlShutdown = "nvmlShutdown";
|
||||
static const char *kNvmlSystemGetDriverVersion = "nvmlSystemGetDriverVersion";
|
||||
static const char *kNvmlSystemGetNVMLVersion = "nvmlSystemGetNVMLVersion";
|
||||
static const char *kSymbolNotFound = "symbol not found";
|
||||
|
||||
|
||||
static nvmlReturn_t (*pNvmlDeviceGetClockInfo)(nvmlDevice_t device, uint32_t type, uint32_t *clock) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetCount)(uint32_t *deviceCount) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetFanSpeed_v2)(nvmlDevice_t device, uint32_t fan, uint32_t *speed) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetFanSpeed)(nvmlDevice_t device, uint32_t *speed) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetHandleByIndex)(uint32_t index, nvmlDevice_t *device) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetPciInfo)(nvmlDevice_t device, nvmlPciInfo_t *pci) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetPowerUsage)(nvmlDevice_t device, uint32_t *power) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlDeviceGetTemperature)(nvmlDevice_t device, uint32_t sensorType, uint32_t *temp) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlInit)() = nullptr;
|
||||
static nvmlReturn_t (*pNvmlShutdown)() = nullptr;
|
||||
static nvmlReturn_t (*pNvmlSystemGetDriverVersion)(char *version, uint32_t length) = nullptr;
|
||||
static nvmlReturn_t (*pNvmlSystemGetNVMLVersion)(char *version, uint32_t length) = nullptr;
|
||||
|
||||
|
||||
#define DLSYM(x) if (uv_dlsym(&nvmlLib, k##x, reinterpret_cast<void**>(&p##x)) == -1) { throw std::runtime_error(kSymbolNotFound); }
|
||||
|
||||
|
||||
bool NvmlLib::m_initialized = false;
|
||||
bool NvmlLib::m_ready = false;
|
||||
char NvmlLib::m_driverVersion[80] = { 0 };
|
||||
char NvmlLib::m_nvmlVersion[80] = { 0 };
|
||||
String NvmlLib::m_loader;
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
bool xmrig::NvmlLib::init(const char *fileName)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_loader = fileName;
|
||||
m_ready = dlopen() && load();
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
return m_ready;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::NvmlLib::lastError() noexcept
|
||||
{
|
||||
return uv_dlerror(&nvmlLib);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::NvmlLib::close()
|
||||
{
|
||||
if (m_ready) {
|
||||
pNvmlShutdown();
|
||||
}
|
||||
|
||||
uv_dlclose(&nvmlLib);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::NvmlLib::assign(std::vector<CudaDevice> &devices)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
if (pNvmlDeviceGetCount(&count) != NVML_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
nvmlDevice_t nvmlDevice;
|
||||
if (pNvmlDeviceGetHandleByIndex(i, &nvmlDevice) != NVML_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nvmlPciInfo_t pci;
|
||||
if (pNvmlDeviceGetPciInfo(nvmlDevice, &pci) != NVML_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto &device : devices) {
|
||||
if (device.topology().bus() == pci.bus && device.topology().device() == pci.device) {
|
||||
device.setNvmlDevice(nvmlDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
NvmlHealth xmrig::NvmlLib::health(nvmlDevice_t device)
|
||||
{
|
||||
if (!device) {
|
||||
return {};
|
||||
}
|
||||
|
||||
NvmlHealth health;
|
||||
pNvmlDeviceGetTemperature(device, NVML_TEMPERATURE_GPU, &health.temperature);
|
||||
pNvmlDeviceGetPowerUsage(device, &health.power);
|
||||
pNvmlDeviceGetClockInfo(device, NVML_CLOCK_SM, &health.clock);
|
||||
pNvmlDeviceGetClockInfo(device, NVML_CLOCK_MEM, &health.memClock);
|
||||
|
||||
if (health.power) {
|
||||
health.power /= 1000;
|
||||
}
|
||||
|
||||
uint32_t speed = 0;
|
||||
|
||||
if (pNvmlDeviceGetFanSpeed_v2) {
|
||||
uint32_t i = 0;
|
||||
|
||||
while (pNvmlDeviceGetFanSpeed_v2(device, i, &speed) == NVML_SUCCESS) {
|
||||
health.fanSpeed.push_back(speed);
|
||||
++i;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
pNvmlDeviceGetFanSpeed(device, &speed);
|
||||
|
||||
health.fanSpeed.push_back(speed);
|
||||
}
|
||||
|
||||
return health;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::NvmlLib::dlopen()
|
||||
{
|
||||
if (!m_loader.isNull()) {
|
||||
return uv_dlopen(m_loader, &nvmlLib) == 0;
|
||||
}
|
||||
|
||||
# ifdef _WIN32
|
||||
if (uv_dlopen("nvml.dll", &nvmlLib) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char path[MAX_PATH] = { 0 };
|
||||
ExpandEnvironmentStringsA("%PROGRAMFILES%\\NVIDIA Corporation\\NVSMI\\nvml.dll", path, sizeof(path));
|
||||
|
||||
return uv_dlopen(path, &nvmlLib) == 0;
|
||||
# else
|
||||
return uv_dlopen("libnvidia-ml.so", &nvmlLib) == 0;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::NvmlLib::load()
|
||||
{
|
||||
try {
|
||||
DLSYM(NvmlDeviceGetClockInfo);
|
||||
DLSYM(NvmlDeviceGetCount);
|
||||
DLSYM(NvmlDeviceGetFanSpeed);
|
||||
DLSYM(NvmlDeviceGetHandleByIndex);
|
||||
DLSYM(NvmlDeviceGetPciInfo);
|
||||
DLSYM(NvmlDeviceGetPowerUsage);
|
||||
DLSYM(NvmlDeviceGetTemperature);
|
||||
DLSYM(NvmlInit);
|
||||
DLSYM(NvmlShutdown);
|
||||
DLSYM(NvmlSystemGetDriverVersion);
|
||||
DLSYM(NvmlSystemGetNVMLVersion);
|
||||
} catch (std::exception &ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uv_dlsym(&nvmlLib, kNvmlDeviceGetFanSpeed_v2, reinterpret_cast<void**>(&pNvmlDeviceGetFanSpeed_v2));
|
||||
|
||||
if (pNvmlInit() != NVML_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pNvmlSystemGetDriverVersion(m_driverVersion, sizeof(m_driverVersion));
|
||||
pNvmlSystemGetNVMLVersion(m_nvmlVersion, sizeof(m_nvmlVersion));
|
||||
|
||||
return true;
|
||||
}
|
||||
66
src/backend/cuda/wrappers/NvmlLib.h
Normal file
66
src/backend/cuda/wrappers/NvmlLib.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_NVMLLIB_H
|
||||
#define XMRIG_NVMLLIB_H
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
#include "backend/cuda/wrappers/NvmlHealth.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class NvmlLib
|
||||
{
|
||||
public:
|
||||
static bool init(const char *fileName = nullptr);
|
||||
static const char *lastError() noexcept;
|
||||
static void close();
|
||||
|
||||
static bool assign(std::vector<CudaDevice> &devices);
|
||||
static NvmlHealth health(nvmlDevice_t device);
|
||||
|
||||
static inline bool isInitialized() noexcept { return m_initialized; }
|
||||
static inline bool isReady() noexcept { return m_ready; }
|
||||
static inline const char *driverVersion() noexcept { return m_driverVersion; }
|
||||
static inline const char *version() noexcept { return m_nvmlVersion; }
|
||||
|
||||
private:
|
||||
static bool dlopen();
|
||||
static bool load();
|
||||
|
||||
static bool m_initialized;
|
||||
static bool m_ready;
|
||||
static char m_driverVersion[80];
|
||||
static char m_nvmlVersion[80];
|
||||
static String m_loader;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_NVMLLIB_H */
|
||||
55
src/backend/cuda/wrappers/nvml_lite.h
Normal file
55
src/backend/cuda/wrappers/nvml_lite.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_NVML_LITE_H
|
||||
#define XMRIG_NVML_LITE_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#define NVML_SUCCESS 0
|
||||
#define NVML_TEMPERATURE_GPU 0
|
||||
#define NVML_CLOCK_SM 1
|
||||
#define NVML_CLOCK_MEM 2
|
||||
|
||||
|
||||
using nvmlReturn_t = uint32_t;
|
||||
using nvmlDevice_t = struct nvmlDevice_st *;
|
||||
|
||||
|
||||
struct nvmlPciInfo_t
|
||||
{
|
||||
char busIdLegacy[16]{};
|
||||
unsigned int domain = 0;
|
||||
unsigned int bus = 0;
|
||||
unsigned int device = 0;
|
||||
unsigned int pciDeviceId = 0;
|
||||
unsigned int pciSubSystemId = 0;
|
||||
|
||||
char busId[32]{};
|
||||
};
|
||||
|
||||
|
||||
#endif /* XMRIG_NVML_LITE_H */
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "backend/opencl/OclConfig.h"
|
||||
#include "backend/opencl/OclLaunchData.h"
|
||||
#include "backend/opencl/OclWorker.h"
|
||||
#include "backend/opencl/runners/tools/OclSharedState.h"
|
||||
#include "backend/opencl/wrappers/OclContext.h"
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "base/io/log/Log.h"
|
||||
@@ -72,12 +73,19 @@ static void printDisabled(const char *reason)
|
||||
struct OclLaunchStatus
|
||||
{
|
||||
public:
|
||||
inline bool started() { m_started++; return m_started == m_threads; }
|
||||
inline size_t threads() const { return m_threads; }
|
||||
inline size_t threads() const { return m_threads; }
|
||||
|
||||
inline bool started(bool ready)
|
||||
{
|
||||
ready ? m_started++ : m_errors++;
|
||||
|
||||
return (m_started + m_errors) == m_threads;
|
||||
}
|
||||
|
||||
inline void start(size_t threads)
|
||||
{
|
||||
m_started = 0;
|
||||
m_errors = 0;
|
||||
m_threads = threads;
|
||||
m_ts = Chrono::steadyMSecs();
|
||||
OclWorker::ready = false;
|
||||
@@ -85,14 +93,23 @@ public:
|
||||
|
||||
inline void print() const
|
||||
{
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " CYAN_BOLD("%zu") BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
if (m_started == 0) {
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), tag);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " "%s%zu/%zu" BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
tag,
|
||||
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
|
||||
m_started,
|
||||
m_threads,
|
||||
Chrono::steadyMSecs() - m_ts
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
size_t m_errors = 0;
|
||||
size_t m_started = 0;
|
||||
size_t m_threads = 0;
|
||||
uint64_t m_ts = 0;
|
||||
@@ -119,6 +136,10 @@ public:
|
||||
return printDisabled(RED_S " (failed to load OpenCL runtime)");
|
||||
}
|
||||
|
||||
if (platform.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
platform = cl.platform();
|
||||
if (!platform.isValid()) {
|
||||
return printDisabled(RED_S " (selected OpenCL platform NOT found)");
|
||||
@@ -132,9 +153,10 @@ public:
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu ") WHITE_BOLD("%s") "/" WHITE_BOLD("%s"), "OPENCL", platform.index(), platform.name().data(), platform.version().data());
|
||||
|
||||
for (const OclDevice &device : devices) {
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu") YELLOW(" %s") " %s " WHITE_BOLD("%uMHz") " cu:" WHITE_BOLD("%u") " mem:" CYAN("%zu/%zu") " MB", "OPENCL GPU",
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("#%zu") YELLOW(" %s") " %s " WHITE_BOLD("%u MHz") " cu:" WHITE_BOLD("%u") " mem:" CYAN("%zu/%zu") " MB",
|
||||
"OPENCL GPU",
|
||||
device.index(),
|
||||
device.hasTopology() ? device.topology().toString().data() : "n/a",
|
||||
device.topology().toString().data(),
|
||||
device.printableName().data(),
|
||||
device.clock(),
|
||||
device.computeUnits(),
|
||||
@@ -144,12 +166,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
inline void start()
|
||||
inline void start(const Job &job)
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" threads)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
tag,
|
||||
profileName.data(),
|
||||
threads.size(),
|
||||
threads.size() > 1 ? "s" : "",
|
||||
algo.l3() / 1024
|
||||
);
|
||||
|
||||
@@ -161,7 +184,7 @@ public:
|
||||
CYAN_BOLD("%3u") " |" CYAN_BOLD("%3s") " |" CYAN_BOLD("%3u") " |" CYAN("%5zu") " | %s",
|
||||
i,
|
||||
data.thread.index(),
|
||||
data.device.hasTopology() ? data.device.topology().toString().data() : "n/a",
|
||||
data.device.topology().toString().data(),
|
||||
data.thread.intensity(),
|
||||
data.thread.worksize(),
|
||||
data.thread.stridedIndex(),
|
||||
@@ -174,6 +197,8 @@ public:
|
||||
i++;
|
||||
}
|
||||
|
||||
OclSharedState::start(threads, job);
|
||||
|
||||
status.start(threads.size());
|
||||
workers.start(threads);
|
||||
}
|
||||
@@ -261,7 +286,7 @@ void xmrig::OclBackend::printHashrate(bool details)
|
||||
Log::print(WHITE_BOLD_S "| OPENCL # | AFFINITY | 10s H/s | 60s H/s | 15m H/s |");
|
||||
|
||||
size_t i = 0;
|
||||
for (const OclLaunchData &data : d_ptr->threads) {
|
||||
for (const auto &data : d_ptr->threads) {
|
||||
Log::print("| %8zu | %8" PRId64 " | %7s | %7s | %7s |" CYAN_BOLD(" #%u") YELLOW(" %s") " %s",
|
||||
i,
|
||||
data.affinity,
|
||||
@@ -269,7 +294,7 @@ void xmrig::OclBackend::printHashrate(bool details)
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3),
|
||||
data.device.index(),
|
||||
data.device.hasTopology() ? data.device.topology().toString().data() : "n/a",
|
||||
data.device.topology().toString().data(),
|
||||
data.device.printableName().data()
|
||||
);
|
||||
|
||||
@@ -286,13 +311,16 @@ void xmrig::OclBackend::printHashrate(bool details)
|
||||
|
||||
void xmrig::OclBackend::setJob(const Job &job)
|
||||
{
|
||||
const auto &cl = d_ptr->controller->config()->cl();
|
||||
if (cl.isEnabled()) {
|
||||
d_ptr->init(cl);
|
||||
}
|
||||
|
||||
if (!isEnabled()) {
|
||||
return stop();
|
||||
}
|
||||
|
||||
const OclConfig &cl = d_ptr->controller->config()->cl();
|
||||
|
||||
std::vector<OclLaunchData> threads = cl.get(d_ptr->controller->miner(), job.algorithm(), d_ptr->platform, d_ptr->devices, tag);
|
||||
auto threads = cl.get(d_ptr->controller->miner(), job.algorithm(), d_ptr->platform, d_ptr->devices);
|
||||
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
|
||||
return;
|
||||
}
|
||||
@@ -306,7 +334,7 @@ void xmrig::OclBackend::setJob(const Job &job)
|
||||
return stop();
|
||||
}
|
||||
|
||||
if (!d_ptr->context.init(d_ptr->devices, threads, job)) {
|
||||
if (!d_ptr->context.init(d_ptr->devices, threads)) {
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (OpenCL context unavailable)"), tag);
|
||||
|
||||
return stop();
|
||||
@@ -315,15 +343,15 @@ void xmrig::OclBackend::setJob(const Job &job)
|
||||
stop();
|
||||
|
||||
d_ptr->threads = std::move(threads);
|
||||
d_ptr->start();
|
||||
d_ptr->start(job);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclBackend::start(IWorker *worker)
|
||||
void xmrig::OclBackend::start(IWorker *worker, bool ready)
|
||||
{
|
||||
mutex.lock();
|
||||
|
||||
if (d_ptr->status.started()) {
|
||||
if (d_ptr->status.started(ready)) {
|
||||
d_ptr->status.print();
|
||||
|
||||
OclWorker::ready = true;
|
||||
@@ -331,7 +359,9 @@ void xmrig::OclBackend::start(IWorker *worker)
|
||||
|
||||
mutex.unlock();
|
||||
|
||||
worker->start();
|
||||
if (ready) {
|
||||
worker->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -346,6 +376,8 @@ void xmrig::OclBackend::stop()
|
||||
d_ptr->workers.stop();
|
||||
d_ptr->threads.clear();
|
||||
|
||||
OclSharedState::release();
|
||||
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), tag, Chrono::steadyMSecs() - ts);
|
||||
}
|
||||
|
||||
@@ -373,22 +405,19 @@ rapidjson::Value xmrig::OclBackend::toJSON(rapidjson::Document &doc) const
|
||||
return out;
|
||||
}
|
||||
|
||||
out.AddMember("hashrate", hashrate()->toJSON(doc), allocator);
|
||||
|
||||
Value threads(kArrayType);
|
||||
const Hashrate *hr = hashrate();
|
||||
|
||||
size_t i = 0;
|
||||
for (const OclLaunchData &data : d_ptr->threads) {
|
||||
for (const auto &data : d_ptr->threads) {
|
||||
Value thread = data.thread.toJSON(doc);
|
||||
thread.AddMember("affinity", data.affinity, allocator);
|
||||
thread.AddMember("hashrate", hashrate()->toJSON(i, doc), allocator);
|
||||
|
||||
Value hashrate(kArrayType);
|
||||
hashrate.PushBack(Hashrate::normalize(hr->calc(i, Hashrate::ShortInterval)), allocator);
|
||||
hashrate.PushBack(Hashrate::normalize(hr->calc(i, Hashrate::MediumInterval)), allocator);
|
||||
hashrate.PushBack(Hashrate::normalize(hr->calc(i, Hashrate::LargeInterval)), allocator);
|
||||
data.device.toJSON(thread, doc);
|
||||
|
||||
i++;
|
||||
|
||||
thread.AddMember("hashrate", hashrate, allocator);
|
||||
threads.PushBack(thread, allocator);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
|
||||
#include "backend/common/interfaces/IBackend.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -43,17 +44,15 @@ class Miner;
|
||||
class OclBackend : public IBackend
|
||||
{
|
||||
public:
|
||||
OclBackend() = delete;
|
||||
OclBackend(const OclBackend &other) = delete;
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(OclBackend)
|
||||
|
||||
OclBackend(Controller *controller);
|
||||
OclBackend(OclBackend &&other) = delete;
|
||||
|
||||
~OclBackend() override;
|
||||
|
||||
OclBackend &operator=(const OclBackend &other) = delete;
|
||||
OclBackend &operator=(OclBackend &&other) = delete;
|
||||
|
||||
protected:
|
||||
inline void execCommand(char) override {}
|
||||
|
||||
bool isEnabled() const override;
|
||||
bool isEnabled(const Algorithm &algorithm) const override;
|
||||
const Hashrate *hashrate() const override;
|
||||
@@ -62,7 +61,7 @@ protected:
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker) override;
|
||||
void start(IWorker *worker, bool ready) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t ticks) override;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
|
||||
#include "backend/opencl/OclConfig.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/opencl/OclConfig_gen.h"
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/io/log/Log.h"
|
||||
@@ -32,10 +34,10 @@
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static const char *kAMD = "AMD";
|
||||
static const char *kCache = "cache";
|
||||
static const char *kCn = "cn";
|
||||
static const char *kCn2 = "cn/2";
|
||||
static const char *kDevicesHint = "devices-hint";
|
||||
static const char *kEnabled = "enabled";
|
||||
static const char *kINTEL = "INTEL";
|
||||
static const char *kLoader = "loader";
|
||||
@@ -43,53 +45,9 @@ static const char *kNVIDIA = "NVIDIA";
|
||||
static const char *kPlatform = "platform";
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_GPU
|
||||
static const char *kCnGPU = "cn/gpu";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
static const char *kCnLite = "cn-lite";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
static const char *kCnHeavy = "cn-heavy";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
static const char *kCnPico = "cn-pico";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
static const char *kRx = "rx";
|
||||
static const char *kRxWOW = "rx/wow";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_ARGON2
|
||||
//static const char *kArgon2 = "argon2";
|
||||
#endif
|
||||
|
||||
|
||||
extern template class Threads<OclThreads>;
|
||||
|
||||
|
||||
static size_t generate(const char *key, Threads<OclThreads> &threads, const Algorithm &algorithm, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
if (threads.has(key) || threads.isExist(algorithm)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
OclThreads profile;
|
||||
for (const OclDevice &device : devices) {
|
||||
device.generate(algorithm, profile);
|
||||
}
|
||||
|
||||
const size_t count = profile.count();
|
||||
threads.move(key, std::move(profile));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -156,10 +114,10 @@ rapidjson::Value xmrig::OclConfig::toJSON(rapidjson::Document &doc) const
|
||||
}
|
||||
|
||||
|
||||
std::vector<xmrig::OclLaunchData> xmrig::OclConfig::get(const Miner *miner, const Algorithm &algorithm, const OclPlatform &platform, const std::vector<OclDevice> &devices, const char *tag) const
|
||||
std::vector<xmrig::OclLaunchData> xmrig::OclConfig::get(const Miner *miner, const Algorithm &algorithm, const OclPlatform &platform, const std::vector<OclDevice> &devices) const
|
||||
{
|
||||
std::vector<OclLaunchData> out;
|
||||
const OclThreads &threads = m_threads.get(algorithm);
|
||||
const auto &threads = m_threads.get(algorithm);
|
||||
|
||||
if (threads.isEmpty()) {
|
||||
return out;
|
||||
@@ -167,38 +125,19 @@ std::vector<xmrig::OclLaunchData> xmrig::OclConfig::get(const Miner *miner, cons
|
||||
|
||||
out.reserve(threads.count() * 2);
|
||||
|
||||
for (const OclThread &thread : threads.data()) {
|
||||
for (const auto &thread : threads.data()) {
|
||||
if (thread.index() >= devices.size()) {
|
||||
LOG_INFO("%s" YELLOW(" skip non-existing device with index ") YELLOW_BOLD("%u"), tag, thread.index());
|
||||
LOG_INFO("%s" YELLOW(" skip non-existing device with index ") YELLOW_BOLD("%u"), ocl_tag(), thread.index());
|
||||
continue;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
auto dataset = algorithm.family() == Algorithm::RANDOM_X ? std::make_shared<OclRxDataset>() : nullptr;
|
||||
# endif
|
||||
|
||||
if (thread.threads().size() > 1) {
|
||||
auto interleave = std::make_shared<OclInterleave>(thread.threads().size());
|
||||
|
||||
for (int64_t affinity : thread.threads()) {
|
||||
OclLaunchData data(miner, algorithm, *this, platform, thread, devices[thread.index()], affinity);
|
||||
data.interleave = interleave;
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
data.dataset = dataset;
|
||||
# endif
|
||||
|
||||
out.emplace_back(std::move(data));
|
||||
out.emplace_back(miner, algorithm, *this, platform, thread, devices[thread.index()], affinity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
OclLaunchData data(miner, algorithm, *this, platform, thread, devices[thread.index()], thread.threads().front());
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
data.dataset = dataset;
|
||||
# endif
|
||||
|
||||
out.emplace_back(std::move(data));
|
||||
out.emplace_back(miner, algorithm, *this, platform, thread, devices[thread.index()], thread.threads().front());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,17 +153,20 @@ void xmrig::OclConfig::read(const rapidjson::Value &value)
|
||||
m_loader = Json::getString(value, kLoader);
|
||||
|
||||
setPlatform(Json::getValue(value, kPlatform));
|
||||
setDevicesHint(Json::getString(value, kDevicesHint));
|
||||
|
||||
if (isEnabled()) {
|
||||
m_threads.read(value);
|
||||
m_threads.read(value);
|
||||
|
||||
generate();
|
||||
}
|
||||
generate();
|
||||
}
|
||||
else if (value.IsBool() && value.IsFalse()) {
|
||||
m_enabled = false;
|
||||
else if (value.IsBool()) {
|
||||
m_enabled = value.GetBool();
|
||||
|
||||
generate();
|
||||
}
|
||||
else {
|
||||
m_shouldSave = true;
|
||||
|
||||
generate();
|
||||
}
|
||||
}
|
||||
@@ -232,55 +174,46 @@ void xmrig::OclConfig::read(const rapidjson::Value &value)
|
||||
|
||||
void xmrig::OclConfig::generate()
|
||||
{
|
||||
if (!isEnabled() || m_threads.has("*")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!OclLib::init(loader())) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto devices = platform().devices();
|
||||
const auto devices = m_devicesHint.empty() ? platform().devices() : filterDevices(platform().devices(), m_devicesHint);
|
||||
if (devices.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t count = 0;
|
||||
|
||||
count += xmrig::generate(kCn, m_threads, Algorithm::CN_0, devices);
|
||||
count += xmrig::generate(kCn2, m_threads, Algorithm::CN_2, devices);
|
||||
|
||||
if (!m_threads.isExist(Algorithm::CN_0)) {
|
||||
m_threads.disable(Algorithm::CN_0);
|
||||
count++;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
count += xmrig::generate(kCnGPU, m_threads, Algorithm::CN_GPU, devices);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_LITE
|
||||
count += xmrig::generate(kCnLite, m_threads, Algorithm::CN_LITE_1, devices);
|
||||
|
||||
if (!m_threads.isExist(Algorithm::CN_LITE_0)) {
|
||||
m_threads.disable(Algorithm::CN_LITE_0);
|
||||
count++;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_HEAVY
|
||||
count += xmrig::generate(kCnHeavy, m_threads, Algorithm::CN_HEAVY_0, devices);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_PICO
|
||||
count += xmrig::generate(kCnPico, m_threads, Algorithm::CN_PICO_0, devices);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
count += xmrig::generate(kRx, m_threads, Algorithm::RX_0, devices);
|
||||
count += xmrig::generate(kRxWOW, m_threads, Algorithm::RX_WOW, devices);
|
||||
# endif
|
||||
count += xmrig::generate<Algorithm::CN>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::CN_LITE>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::CN_PICO>(m_threads, devices);
|
||||
count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, devices);
|
||||
|
||||
m_shouldSave = count > 0;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclConfig::setDevicesHint(const char *devicesHint)
|
||||
{
|
||||
if (devicesHint == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto indexes = String(devicesHint).split(',');
|
||||
m_devicesHint.reserve(indexes.size());
|
||||
|
||||
for (const auto &index : indexes) {
|
||||
m_devicesHint.push_back(strtoul(index, nullptr, 10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclConfig::setPlatform(const rapidjson::Value &platform)
|
||||
{
|
||||
if (platform.IsString()) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
OclPlatform platform() const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
std::vector<OclLaunchData> get(const Miner *miner, const Algorithm &algorithm, const OclPlatform &platform, const std::vector<OclDevice> &devices, const char *tag) const;
|
||||
std::vector<OclLaunchData> get(const Miner *miner, const Algorithm &algorithm, const OclPlatform &platform, const std::vector<OclDevice> &devices) const;
|
||||
void read(const rapidjson::Value &value);
|
||||
|
||||
inline bool isCacheEnabled() const { return m_cache; }
|
||||
@@ -53,11 +53,13 @@ public:
|
||||
|
||||
private:
|
||||
void generate();
|
||||
void setDevicesHint(const char *devicesHint);
|
||||
void setPlatform(const rapidjson::Value &platform);
|
||||
|
||||
bool m_cache = true;
|
||||
bool m_enabled = true;
|
||||
bool m_enabled = false;
|
||||
bool m_shouldSave = false;
|
||||
std::vector<uint32_t> m_devicesHint;
|
||||
String m_loader;
|
||||
String m_platformVendor;
|
||||
Threads<OclThreads> m_threads;
|
||||
|
||||
152
src/backend/opencl/OclConfig_gen.h
Normal file
152
src/backend/opencl/OclConfig_gen.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_OCLCONFIG_GEN_H
|
||||
#define XMRIG_OCLCONFIG_GEN_H
|
||||
|
||||
|
||||
#include "backend/common/Threads.h"
|
||||
#include "backend/opencl/OclThreads.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static inline size_t generate(const char *key, Threads<OclThreads> &threads, const Algorithm &algorithm, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
if (threads.isExist(algorithm) || threads.has(key)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return threads.move(key, OclThreads(devices, algorithm));
|
||||
}
|
||||
|
||||
|
||||
template<Algorithm::Family FAMILY>
|
||||
static inline size_t generate(Threads<OclThreads> &, const std::vector<OclDevice> &) { return 0; }
|
||||
|
||||
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
count += generate("cn", threads, Algorithm::CN_1, devices);
|
||||
count += generate("cn/2", threads, Algorithm::CN_2, devices);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_0)) {
|
||||
threads.disable(Algorithm::CN_0);
|
||||
count++;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
count += generate("cn/gpu", threads, Algorithm::CN_GPU, devices);
|
||||
# endif
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_LITE>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
size_t count = generate("cn-lite", threads, Algorithm::CN_LITE_1, devices);
|
||||
|
||||
if (!threads.isExist(Algorithm::CN_LITE_0)) {
|
||||
threads.disable(Algorithm::CN_LITE_0);
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_HEAVY
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_HEAVY>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
return generate("cn-heavy", threads, Algorithm::CN_HEAVY_0, devices);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_PICO
|
||||
template<>
|
||||
size_t inline generate<Algorithm::CN_PICO>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
template<>
|
||||
size_t inline generate<Algorithm::RANDOM_X>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
auto rx = OclThreads(devices, Algorithm::RX_0);
|
||||
auto wow = OclThreads(devices, Algorithm::RX_WOW);
|
||||
auto arq = OclThreads(devices, Algorithm::RX_ARQ);
|
||||
|
||||
if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
|
||||
count += threads.move("rx/wow", std::move(wow));
|
||||
}
|
||||
|
||||
if (!threads.isExist(Algorithm::RX_ARQ) && arq != rx) {
|
||||
count += threads.move("rx/arq", std::move(arq));
|
||||
}
|
||||
|
||||
count += threads.move("rx", std::move(rx));
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static inline std::vector<OclDevice> filterDevices(const std::vector<OclDevice> &devices, const std::vector<uint32_t> &hints)
|
||||
{
|
||||
std::vector<OclDevice> out;
|
||||
out.reserve(std::min(devices.size(), hints.size()));
|
||||
|
||||
for (const auto &device : devices) {
|
||||
auto it = std::find(hints.begin(), hints.end(), device.index());
|
||||
if (it != hints.end()) {
|
||||
out.emplace_back(device);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_OCLCONFIG_GEN_H */
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
|
||||
#include "backend/opencl/OclLaunchData.h"
|
||||
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/opencl/OclConfig.h"
|
||||
|
||||
|
||||
@@ -45,3 +47,9 @@ bool xmrig::OclLaunchData::isEqual(const OclLaunchData &other) const
|
||||
return (other.algorithm == algorithm &&
|
||||
other.thread == thread);
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::OclLaunchData::tag()
|
||||
{
|
||||
return ocl_tag();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user