mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-07 07:55:04 -05:00
Compare commits
10 Commits
v6.22.2
...
9e483b9d5a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e483b9d5a | ||
|
|
16ecb8f085 | ||
|
|
0229c65232 | ||
|
|
4a13a8a75c | ||
|
|
cd2fd9d7a6 | ||
|
|
064cd3ef20 | ||
|
|
e8bbd134f9 | ||
|
|
cf86a1e05c | ||
|
|
753e63cd96 | ||
|
|
f42b3e83a7 |
74
doc/API.md
74
doc/API.md
@@ -4,7 +4,7 @@ If you want use HTTP API you need enable it (`"enabled": true,`) then choice `po
|
||||
|
||||
Offical HTTP client for API: http://workers.xmrig.info/
|
||||
|
||||
Example configuration:
|
||||
Example configuration, used in Curl examples below:
|
||||
|
||||
```json
|
||||
"api": {
|
||||
@@ -12,11 +12,11 @@ Example configuration:
|
||||
"worker-id": null,
|
||||
},
|
||||
"http": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"host": "127.0.0.1",
|
||||
"port": 0,
|
||||
"access-token": null,
|
||||
"restricted": true
|
||||
"port": 44444,
|
||||
"access-token": "SECRET",
|
||||
"restricted": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -37,30 +37,78 @@ Versions before 2.15 was use another options for API https://github.com/xmrig/xm
|
||||
|
||||
## Endpoints
|
||||
|
||||
### GET /1/summary
|
||||
### APIVersion 2
|
||||
|
||||
Get miner summary information. [Example](api/1/summary.json).
|
||||
#### GET /2/summary
|
||||
|
||||
### GET /1/threads
|
||||
Get miner summary information. [Example](api/2/summary.json).
|
||||
|
||||
Get detailed information about miner threads. [Example](api/1/threads.json).
|
||||
#### GET /2/backends
|
||||
|
||||
Get detailed information about miner backends. [Example](api/2/backends.json).
|
||||
|
||||
### APIVersion 1 (deprecated)
|
||||
|
||||
#### GET /1/summary
|
||||
|
||||
Get miner summary information. Currently identical to `GET /2/summary`
|
||||
|
||||
#### GET /1/threads
|
||||
|
||||
**REMOVED** Get detailed information about miner threads. [Example](api/1/threads.json).
|
||||
|
||||
Functionally replaced by `GET /2/backends` which contains a `threads` item per backend.
|
||||
|
||||
### APIVersion 0 (deprecated)
|
||||
|
||||
#### GET /api.json
|
||||
|
||||
Get miner summary information. Currently identical to `GET /2/summary`
|
||||
|
||||
|
||||
## Restricted endpoints
|
||||
|
||||
All API endpoints below allow access to sensitive information and remote configure miner. You should set `access-token` and allow unrestricted access (`"restricted": false`).
|
||||
|
||||
### GET /1/config
|
||||
### JSON-RPC Interface
|
||||
|
||||
Get current miner configuration. [Example](api/1/config.json).
|
||||
#### POST /json_rpc
|
||||
|
||||
Control miner with JSON-RPC. Methods: `pause`, `resume`, `stop`, `start`
|
||||
|
||||
### PUT /1/config
|
||||
Curl example:
|
||||
|
||||
```
|
||||
curl -v --data "{\"method\":\"pause\",\"id\":1}" -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/json_rpc
|
||||
```
|
||||
|
||||
### APIVersion 2
|
||||
|
||||
#### GET /2/config
|
||||
|
||||
Get current miner configuration. [Example](api/2/config.json).
|
||||
|
||||
#### PUT /2/config
|
||||
|
||||
Update current miner configuration. Common use case, get current configuration, make changes, and upload it to miner.
|
||||
|
||||
Curl example:
|
||||
|
||||
```
|
||||
curl -v --data-binary @config.json -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/1/config
|
||||
...GET current config...
|
||||
curl -v -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/2/config > config.json
|
||||
...make changes...
|
||||
vim config.json
|
||||
...PUT changed config...
|
||||
curl -v --data-binary @config.json -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/2/config
|
||||
```
|
||||
|
||||
### APIVersion 1 (deprecated)
|
||||
|
||||
#### GET /1/config
|
||||
|
||||
Get current miner configuration. Currently identical to `GET /2/config`
|
||||
|
||||
#### PUT /1/config
|
||||
|
||||
Update current miner configuration. Currently identical to `PUT /2/config`
|
||||
|
||||
78
doc/api/2/backends.json
Normal file
78
doc/api/2/backends.json
Normal file
@@ -0,0 +1,78 @@
|
||||
[
|
||||
{
|
||||
"type": "cpu",
|
||||
"enabled": true,
|
||||
"algo": "rx/0",
|
||||
"profile": "rx",
|
||||
"hw-aes": true,
|
||||
"priority": -1,
|
||||
"msr": true,
|
||||
"asm": "intel",
|
||||
"argon2-impl": "AVX2",
|
||||
"hugepages": [6, 6],
|
||||
"memory": 6291456,
|
||||
"hashrate": [1235.78, 1228.89, null],
|
||||
"threads": [
|
||||
{
|
||||
"intensity": 1,
|
||||
"affinity": 0,
|
||||
"av": 1,
|
||||
"hashrate": [409.75, 406.58, null]
|
||||
},
|
||||
{
|
||||
"intensity": 1,
|
||||
"affinity": 2,
|
||||
"av": 1,
|
||||
"hashrate": [412.9, 411.33, null]
|
||||
},
|
||||
{
|
||||
"intensity": 1,
|
||||
"affinity": 4,
|
||||
"av": 1,
|
||||
"hashrate": [413.11, 410.98, null]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "cuda",
|
||||
"enabled": true,
|
||||
"algo": "cn-heavy/xhv",
|
||||
"profile": "cn-heavy/xhv",
|
||||
"versions": {
|
||||
"cuda-runtime": "11.6",
|
||||
"cuda-driver": "11.6",
|
||||
"plugin": "6.17.1-dev",
|
||||
"nvml": "11.512.15",
|
||||
"driver": "512.15"
|
||||
},
|
||||
"hashrate": [247.02, 247.34, null],
|
||||
"threads": [
|
||||
{
|
||||
"index": 0,
|
||||
"threads": 32,
|
||||
"blocks": 38,
|
||||
"bfactor": 6,
|
||||
"bsleep": 25,
|
||||
"affinity": -1,
|
||||
"cclock": 0,
|
||||
"mclock": 0,
|
||||
"dataset_host": false,
|
||||
"hashrate": [246.77, 247.26, null],
|
||||
"name": "NVIDIA GeForce GTX 970",
|
||||
"bus_id": "01:00.0",
|
||||
"smx": 13,
|
||||
"arch": 52,
|
||||
"global_mem": 4294836224,
|
||||
"clock": 1177,
|
||||
"memory_clock": 3666,
|
||||
"health": {
|
||||
"temperature": 69,
|
||||
"power": 161,
|
||||
"clock": 1328,
|
||||
"mem_clock": 3662,
|
||||
"fan_speed": [100]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
136
doc/api/2/config.json
Normal file
136
doc/api/2/config.json
Normal file
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"api": {
|
||||
"id": null,
|
||||
"worker-id": null
|
||||
},
|
||||
"http": {
|
||||
"enabled": true,
|
||||
"host": "127.0.0.1",
|
||||
"port": 44444,
|
||||
"access-token": "SECRET",
|
||||
"restricted": false
|
||||
},
|
||||
"autosave": true,
|
||||
"background": false,
|
||||
"colors": true,
|
||||
"title": true,
|
||||
"randomx": {
|
||||
"init": -1,
|
||||
"init-avx2": -1,
|
||||
"mode": "auto",
|
||||
"1gb-pages": true,
|
||||
"rdmsr": true,
|
||||
"wrmsr": true,
|
||||
"cache_qos": false,
|
||||
"numa": true,
|
||||
"scratchpad_prefetch_mode": 1
|
||||
},
|
||||
"cpu": {
|
||||
"enabled": true,
|
||||
"huge-pages": true,
|
||||
"huge-pages-jit": true,
|
||||
"hw-aes": null,
|
||||
"priority": null,
|
||||
"memory-pool": true,
|
||||
"yield": true,
|
||||
"asm": true,
|
||||
"argon2-impl": null,
|
||||
"argon2": [0, 2, 4, 6, 5, 7],
|
||||
"astrobwt/v2": [1, 2, 3, 4, 5, 6, 7],
|
||||
"cn": [
|
||||
[1, 0],
|
||||
[1, 2],
|
||||
[1, 4]
|
||||
],
|
||||
"cn-heavy": [
|
||||
[1, 0],
|
||||
[1, 2]
|
||||
],
|
||||
"cn-lite": [
|
||||
[1, 0],
|
||||
[1, 2],
|
||||
[1, 4],
|
||||
[1, 6],
|
||||
[1, 5],
|
||||
[1, 7]
|
||||
],
|
||||
"cn-pico": [
|
||||
[2, 1],
|
||||
[2, 2],
|
||||
[2, 3],
|
||||
[2, 4],
|
||||
[2, 5],
|
||||
[2, 6],
|
||||
[2, 7]
|
||||
],
|
||||
"cn/2": [
|
||||
[1, 0],
|
||||
[1, 2],
|
||||
[1, 4]
|
||||
],
|
||||
"cn/upx2": [
|
||||
[2, 1],
|
||||
[2, 2],
|
||||
[2, 3],
|
||||
[2, 4],
|
||||
[2, 5],
|
||||
[2, 6],
|
||||
[2, 7]
|
||||
],
|
||||
"ghostrider": [
|
||||
[8, 0],
|
||||
[8, 2],
|
||||
[8, 4]
|
||||
],
|
||||
"rx": [0, 2, 4],
|
||||
"rx/arq": [1, 2, 3, 4, 5, 6, 7],
|
||||
"rx/keva": [0, 2, 4, 6, 5, 7],
|
||||
"rx/wow": [0, 2, 4, 6, 5, 7],
|
||||
"cn-lite/0": false,
|
||||
"cn/0": "cn"
|
||||
},
|
||||
"log-file": null,
|
||||
"donate-level": 0,
|
||||
"donate-over-proxy": 0,
|
||||
"pools": [
|
||||
{
|
||||
"algo": null,
|
||||
"coin": null,
|
||||
"url": "some.pool:10064",
|
||||
"user": "4blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahbl",
|
||||
"pass": "x",
|
||||
"rig-id": null,
|
||||
"nicehash": false,
|
||||
"keepalive": true,
|
||||
"enabled": true,
|
||||
"tls": false,
|
||||
"wss": false,
|
||||
"daemon": false,
|
||||
"socks5": null,
|
||||
"self-select": null,
|
||||
"submit-to-origin": false
|
||||
}
|
||||
],
|
||||
"retries": 5,
|
||||
"retry-pause": 5,
|
||||
"print-time": 64,
|
||||
"syslog": false,
|
||||
"tls": {
|
||||
"enabled": false,
|
||||
"protocols": null,
|
||||
"cert": null,
|
||||
"cert_key": null,
|
||||
"ciphers": null,
|
||||
"ciphersuites": null,
|
||||
"dhparam": null
|
||||
},
|
||||
"dns": {
|
||||
"ipv6": false,
|
||||
"ttl": 30
|
||||
},
|
||||
"user-agent": null,
|
||||
"verbose": 1,
|
||||
"watch": true,
|
||||
"pause-on-battery": false,
|
||||
"pause-on-active": false
|
||||
}
|
||||
76
doc/api/2/summary.json
Normal file
76
doc/api/2/summary.json
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"id": "51aca77da137cb62",
|
||||
"worker_id": "tpad",
|
||||
"uptime": 106,
|
||||
"restricted": false,
|
||||
"resources": {
|
||||
"memory": {
|
||||
"free": 4977348608,
|
||||
"total": 16659546112,
|
||||
"resident_set_memory": 16441344
|
||||
},
|
||||
"load_average": [3.4, 2.7, 2.44],
|
||||
"hardware_concurrency": 8
|
||||
},
|
||||
"features": ["api", "asm", "http", "hwloc", "tls"],
|
||||
"results": {
|
||||
"diff_current": 37638,
|
||||
"shares_good": 3,
|
||||
"shares_total": 3,
|
||||
"avg_time": 35,
|
||||
"avg_time_ms": 35603,
|
||||
"hashes_total": 165638,
|
||||
"best": [358821, 344438, 73371, 0, 0, 0, 0, 0, 0, 0]
|
||||
},
|
||||
"algo": "rx/0",
|
||||
"connection": {
|
||||
"pool": "some.pool:20064",
|
||||
"ip": "127.1.2.3",
|
||||
"uptime": 106,
|
||||
"uptime_ms": 106811,
|
||||
"ping": 405,
|
||||
"failures": 0,
|
||||
"tls": "TLSv1.3",
|
||||
"tls-fingerprint": null,
|
||||
"algo": "rx/0",
|
||||
"diff": 37638,
|
||||
"accepted": 3,
|
||||
"rejected": 0,
|
||||
"avg_time": 35,
|
||||
"avg_time_ms": 35603,
|
||||
"hashes_total": 165638
|
||||
},
|
||||
"version": "6.17.1-dev",
|
||||
"kind": "miner",
|
||||
"ua": "XMRig/6.17.1-dev (Linux x86_64) libuv/1.43.0 gcc/9.4.0",
|
||||
"cpu": {
|
||||
"brand": "Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz",
|
||||
"family": 6,
|
||||
"model": 60,
|
||||
"stepping": 3,
|
||||
"proc_info": 198339,
|
||||
"aes": true,
|
||||
"avx2": true,
|
||||
"x64": true,
|
||||
"64_bit": true,
|
||||
"l2": 1048576,
|
||||
"l3": 6291456,
|
||||
"cores": 4,
|
||||
"threads": 8,
|
||||
"packages": 1,
|
||||
"nodes": 1,
|
||||
"backend": "hwloc/2.7.0",
|
||||
"msr": "intel",
|
||||
"assembly": "intel",
|
||||
"arch": "x86_64",
|
||||
"flags": ["aes", "avx", "avx2", "bmi2", "osxsave", "pdpe1gb", "sse2", "ssse3", "sse4.1", "popcnt"]
|
||||
},
|
||||
"donate_level": 0,
|
||||
"paused": false,
|
||||
"algorithms": ["cn/0", "cn/1", "cn/2", "cn/r", "cn/fast", "cn/half", "cn/xao", "cn/rto", "cn/rwz", "cn/zls", "cn/double", "cn/ccx", "cn-lite/1", "cn-heavy/0", "cn-heavy/tube", "cn-heavy/xhv", "cn-pico", "cn-pico/tlo", "cn/upx2", "rx/0", "rx/wow", "rx/arq", "rx/graft", "rx/sfx", "rx/keva", "argon2/chukwa", "argon2/chukwav2", "argon2/ninja", "astrobwt/v2", "ghostrider"],
|
||||
"hashrate": {
|
||||
"total": [1207.19, 1210.82, null],
|
||||
"highest": 1316.85
|
||||
},
|
||||
"hugepages": [6, 6]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
@@ -19,10 +19,8 @@
|
||||
#ifndef XMRIG_PCITOPOLOGY_H
|
||||
#define XMRIG_PCITOPOLOGY_H
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
||||
@@ -33,7 +31,14 @@ class PciTopology
|
||||
{
|
||||
public:
|
||||
PciTopology() = default;
|
||||
PciTopology(uint32_t bus, uint32_t device, uint32_t function) : m_valid(true), m_bus(bus), m_device(device), m_function(function) {}
|
||||
|
||||
template<typename T>
|
||||
inline PciTopology(T bus, T device, T function)
|
||||
: m_valid(true),
|
||||
m_bus(static_cast<uint8_t>(bus)),
|
||||
m_device(static_cast<uint8_t>(device)),
|
||||
m_function(static_cast<uint8_t>(function))
|
||||
{}
|
||||
|
||||
inline bool isEqual(const PciTopology &other) const { return m_valid == other.m_valid && toUint32() == other.toUint32(); }
|
||||
inline bool isValid() const { return m_valid; }
|
||||
@@ -70,4 +75,4 @@ private:
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_PCITOPOLOGY_H */
|
||||
#endif // XMRIG_PCITOPOLOGY_H
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
# endif
|
||||
|
||||
Log::print("|" CYAN_BOLD("%3zu") " |" CYAN_BOLD("%4u") " |" YELLOW(" %7s") " |" CYAN_BOLD("%10d") " |" CYAN_BOLD("%8d") " |"
|
||||
CYAN_BOLD("%7d") " |" CYAN_BOLD("%3d") " |" CYAN_BOLD("%4d") " |" CYAN("%7zu") " | " GREEN("%s"),
|
||||
CYAN_BOLD("%7d") " |" CYAN_BOLD("%3d") " |" CYAN_BOLD("%4d") " |" CYAN("%7zu") " | " GREEN_BOLD("%s"),
|
||||
i,
|
||||
data.thread.index(),
|
||||
data.device.topology().toString().data(),
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* 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>
|
||||
* Copyright 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2024 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
|
||||
@@ -22,7 +22,6 @@
|
||||
* 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"
|
||||
@@ -55,12 +54,21 @@ bool xmrig::CudaRxRunner::run(uint32_t startNonce, uint32_t *rescount, uint32_t
|
||||
|
||||
bool xmrig::CudaRxRunner::set(const Job &job, uint8_t *blob)
|
||||
{
|
||||
if (!m_datasetHost && (m_seed != job.seed())) {
|
||||
m_seed = job.seed();
|
||||
|
||||
if (m_ready) {
|
||||
const auto *dataset = Rx::dataset(job, 0);
|
||||
callWrapper(CudaLib::rxUpdateDataset(m_ctx, dataset->raw(), dataset->size(false)));
|
||||
}
|
||||
}
|
||||
|
||||
const bool rc = CudaBaseRunner::set(job, blob);
|
||||
if (!rc || m_ready) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
auto dataset = Rx::dataset(job, 0);
|
||||
const 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;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* 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>
|
||||
* Copyright 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2024 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
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include "backend/cuda/runners/CudaBaseRunner.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -46,6 +47,7 @@ protected:
|
||||
private:
|
||||
bool m_ready = false;
|
||||
const bool m_datasetHost = false;
|
||||
Buffer m_seed;
|
||||
size_t m_intensity = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* 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-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2024 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
|
||||
@@ -22,7 +22,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "backend/cuda/CudaThreads.h"
|
||||
@@ -41,7 +40,7 @@
|
||||
xmrig::CudaDevice::CudaDevice(uint32_t index, int32_t bfactor, int32_t bsleep) :
|
||||
m_index(index)
|
||||
{
|
||||
auto ctx = CudaLib::alloc(index, bfactor, bsleep);
|
||||
auto *ctx = CudaLib::alloc(index, bfactor, bsleep);
|
||||
if (!CudaLib::deviceInfo(ctx, 0, 0, Algorithm::INVALID)) {
|
||||
CudaLib::release(ctx);
|
||||
|
||||
@@ -50,7 +49,7 @@ xmrig::CudaDevice::CudaDevice(uint32_t index, int32_t bfactor, int32_t bsleep) :
|
||||
|
||||
m_ctx = ctx;
|
||||
m_name = CudaLib::deviceName(ctx);
|
||||
m_topology = PciTopology(CudaLib::deviceUint(ctx, CudaLib::DevicePciBusID), CudaLib::deviceUint(ctx, CudaLib::DevicePciDeviceID), 0);
|
||||
m_topology = { CudaLib::deviceUint(ctx, CudaLib::DevicePciBusID), CudaLib::deviceUint(ctx, CudaLib::DevicePciDeviceID), 0U };
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
#include <stdexcept>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/Env.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/kernel/Process.h"
|
||||
#include "crypto/rx/RxAlgo.h"
|
||||
|
||||
@@ -68,6 +68,7 @@ static const char *kPluginVersion = "pluginVersion";
|
||||
static const char *kRelease = "release";
|
||||
static const char *kRxHash = "rxHash";
|
||||
static const char *kRxPrepare = "rxPrepare";
|
||||
static const char *kRxUpdateDataset = "rxUpdateDataset";
|
||||
static const char *kSetJob = "setJob";
|
||||
static const char *kSetJob_v2 = "setJob_v2";
|
||||
static const char *kVersion = "version";
|
||||
@@ -92,6 +93,7 @@ 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 rxUpdateDataset_t = bool (*)(nvid_ctx *, const void *, size_t);
|
||||
using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, uint32_t);
|
||||
using setJob_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const char *);
|
||||
using version_t = uint32_t (*)(Version);
|
||||
@@ -116,6 +118,7 @@ static pluginVersion_t pPluginVersion = nullptr;
|
||||
static release_t pRelease = nullptr;
|
||||
static rxHash_t pRxHash = nullptr;
|
||||
static rxPrepare_t pRxPrepare = nullptr;
|
||||
static rxUpdateDataset_t pRxUpdateDataset = nullptr;
|
||||
static setJob_t pSetJob = nullptr;
|
||||
static setJob_v2_t pSetJob_v2 = nullptr;
|
||||
static version_t pVersion = nullptr;
|
||||
@@ -202,10 +205,26 @@ bool xmrig::CudaLib::rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target,
|
||||
|
||||
bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept
|
||||
{
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (!pRxUpdateDataset) {
|
||||
LOG_WARN("%s" YELLOW_BOLD("CUDA plugin is outdated. Please update to the latest version"), Tags::randomx());
|
||||
}
|
||||
# endif
|
||||
|
||||
return pRxPrepare(ctx, dataset, datasetSize, dataset_host, batchSize);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::rxUpdateDataset(nvid_ctx *ctx, const void *dataset, size_t datasetSize) noexcept
|
||||
{
|
||||
if (pRxUpdateDataset) {
|
||||
return pRxUpdateDataset(ctx, dataset, datasetSize);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) noexcept
|
||||
{
|
||||
return pKawPowHash(ctx, job_blob, target, rescount, resnonce, skipped_hashes);
|
||||
@@ -401,5 +420,7 @@ void xmrig::CudaLib::load()
|
||||
DLSYM(SetJob_v2);
|
||||
}
|
||||
|
||||
uv_dlsym(&cudaLib, kRxUpdateDataset, reinterpret_cast<void**>(&pRxUpdateDataset));
|
||||
|
||||
pInit();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
@@ -71,6 +71,7 @@ public:
|
||||
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 rxUpdateDataset(nvid_ctx *ctx, const void *dataset, size_t datasetSize) noexcept;
|
||||
static bool kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) noexcept;
|
||||
static bool kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, const void* dag_precalc, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) noexcept;
|
||||
static bool kawPowStopHash(nvid_ctx *ctx) noexcept;
|
||||
|
||||
@@ -5,13 +5,7 @@ if (BUILD_STATIC AND XMRIG_OS_UNIX AND WITH_OPENCL)
|
||||
endif()
|
||||
|
||||
if (WITH_OPENCL)
|
||||
add_definitions(/DXMRIG_FEATURE_OPENCL)
|
||||
add_definitions(/DCL_USE_DEPRECATED_OPENCL_1_2_APIS)
|
||||
if (XMRIG_OS_APPLE)
|
||||
add_definitions(/DCL_TARGET_OPENCL_VERSION=120)
|
||||
elseif (WITH_OPENCL_VERSION)
|
||||
add_definitions(/DCL_TARGET_OPENCL_VERSION=${WITH_OPENCL_VERSION})
|
||||
endif()
|
||||
add_definitions(/DXMRIG_FEATURE_OPENCL /DCL_USE_DEPRECATED_OPENCL_1_2_APIS)
|
||||
|
||||
set(HEADERS_BACKEND_OPENCL
|
||||
src/backend/opencl/cl/OclSource.h
|
||||
@@ -71,6 +65,13 @@ if (WITH_OPENCL)
|
||||
src/backend/opencl/wrappers/OclPlatform.cpp
|
||||
)
|
||||
|
||||
if (XMRIG_OS_APPLE)
|
||||
add_definitions(/DCL_TARGET_OPENCL_VERSION=120)
|
||||
list(APPEND SOURCES_BACKEND_OPENCL src/backend/opencl/wrappers/OclDevice_mac.cpp)
|
||||
elseif (WITH_OPENCL_VERSION)
|
||||
add_definitions(/DCL_TARGET_OPENCL_VERSION=${WITH_OPENCL_VERSION})
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND SOURCES_BACKEND_OPENCL src/backend/opencl/OclCache_win.cpp)
|
||||
else()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2021 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
@@ -17,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "backend/opencl/wrappers/OclDevice.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "backend/opencl/OclGenerator.h"
|
||||
#include "backend/opencl/OclThreads.h"
|
||||
@@ -30,19 +32,21 @@
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
// NOLINTNEXTLINE(modernize-use-using)
|
||||
typedef union
|
||||
{
|
||||
struct { cl_uint type; cl_uint data[5]; } raw;
|
||||
struct { cl_uint type; cl_char unused[17]; cl_char bus; cl_char device; cl_char function; } pcie;
|
||||
} topology_amd;
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
struct topology_amd {
|
||||
cl_uint type;
|
||||
cl_char unused[17];
|
||||
cl_char bus;
|
||||
cl_char device;
|
||||
cl_char function;
|
||||
};
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
extern bool ocl_generic_rx_generator(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
|
||||
#endif
|
||||
@@ -81,9 +85,11 @@ static OclVendor getPlatformVendorId(const String &vendor, const String &extensi
|
||||
return OCL_VENDOR_INTEL;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_OS_APPLE
|
||||
if (extensions.contains("cl_APPLE_") || vendor.contains("Apple")) {
|
||||
return OCL_VENDOR_APPLE;
|
||||
}
|
||||
# endif
|
||||
|
||||
return OCL_VENDOR_UNKNOWN;
|
||||
}
|
||||
@@ -103,117 +109,16 @@ static OclVendor getVendorId(const String &vendor)
|
||||
return OCL_VENDOR_INTEL;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_OS_APPLE
|
||||
if (vendor.contains("Apple")) {
|
||||
return OCL_VENDOR_APPLE;
|
||||
}
|
||||
# endif
|
||||
|
||||
return OCL_VENDOR_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
static OclDevice::Type getType(const String &name, const OclVendor platformVendorId)
|
||||
{
|
||||
if (platformVendorId == OCL_VENDOR_APPLE) {
|
||||
// Apple Platform: uses product names, not gfx# or codenames
|
||||
if (name.contains("AMD Radeon")) {
|
||||
if (name.contains(" 450 ") ||
|
||||
name.contains(" 455 ") ||
|
||||
name.contains(" 460 ")) {
|
||||
return OclDevice::Baffin;
|
||||
}
|
||||
|
||||
if (name.contains(" 555 ") || name.contains(" 555X ") ||
|
||||
name.contains(" 560 ") || name.contains(" 560X ") ||
|
||||
name.contains(" 570 ") || name.contains(" 570X ") ||
|
||||
name.contains(" 575 ") || name.contains(" 575X ")) {
|
||||
return OclDevice::Polaris;
|
||||
}
|
||||
|
||||
if (name.contains(" 580 ") || name.contains(" 580X ")) {
|
||||
return OclDevice::Ellesmere;
|
||||
}
|
||||
|
||||
if (name.contains(" Vega ")) {
|
||||
if (name.contains(" 48 ") ||
|
||||
name.contains(" 56 ") ||
|
||||
name.contains(" 64 ") ||
|
||||
name.contains(" 64X ")) {
|
||||
return OclDevice::Vega_10;
|
||||
}
|
||||
if (name.contains(" 16 ") ||
|
||||
name.contains(" 20 ") ||
|
||||
name.contains(" II ")) {
|
||||
return OclDevice::Vega_20;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.contains(" 5700 ") || name.contains(" W5700X ")) {
|
||||
return OclDevice::Navi_10;
|
||||
}
|
||||
|
||||
if (name.contains(" 5600 ") || name.contains(" 5600M ")) {
|
||||
return OclDevice::Navi_12;
|
||||
}
|
||||
|
||||
if (name.contains(" 5300 ") || name.contains(" 5300M ") ||
|
||||
name.contains(" 5500 ") || name.contains(" 5500M ")) {
|
||||
return OclDevice::Navi_14;
|
||||
}
|
||||
|
||||
if (name.contains(" W6800 ") || name.contains(" W6900X ")) {
|
||||
return OclDevice::Navi_21;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "gfx900" || name == "gfx901") {
|
||||
return OclDevice::Vega_10;
|
||||
}
|
||||
|
||||
if (name == "gfx902" || name == "gfx903") {
|
||||
return OclDevice::Raven;
|
||||
}
|
||||
|
||||
if (name == "gfx906" || name == "gfx907") {
|
||||
return OclDevice::Vega_20;
|
||||
}
|
||||
|
||||
if (name == "gfx1010") {
|
||||
return OclDevice::Navi_10;
|
||||
}
|
||||
|
||||
if (name == "gfx1011") {
|
||||
return OclDevice::Navi_12;
|
||||
}
|
||||
|
||||
if (name == "gfx1012") {
|
||||
return OclDevice::Navi_14;
|
||||
}
|
||||
|
||||
if (name == "gfx1030") {
|
||||
return OclDevice::Navi_21;
|
||||
}
|
||||
|
||||
if (name == "gfx804") {
|
||||
return OclDevice::Lexa;
|
||||
}
|
||||
|
||||
if (name == "Baffin") {
|
||||
return OclDevice::Baffin;
|
||||
}
|
||||
|
||||
if (name.contains("Ellesmere")) {
|
||||
return OclDevice::Ellesmere;
|
||||
}
|
||||
|
||||
if (name == "gfx803" || name.contains("polaris")) {
|
||||
return OclDevice::Polaris;
|
||||
}
|
||||
|
||||
return OclDevice::Unknown;
|
||||
}
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
@@ -231,21 +136,21 @@ xmrig::OclDevice::OclDevice(uint32_t index, cl_device_id id, cl_platform_id plat
|
||||
{
|
||||
m_vendorId = getVendorId(m_vendor);
|
||||
m_platformVendorId = getPlatformVendorId(m_platformVendor, m_extensions);
|
||||
m_type = getType(m_name, m_platformVendorId);
|
||||
m_type = getType(m_name);
|
||||
|
||||
if (m_extensions.contains("cl_amd_device_attribute_query")) {
|
||||
topology_amd topology;
|
||||
|
||||
if (OclLib::getDeviceInfo(id, CL_DEVICE_TOPOLOGY_AMD, sizeof(topology), &topology, nullptr) == CL_SUCCESS && topology.raw.type == CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD) {
|
||||
m_topology = PciTopology(static_cast<uint32_t>(topology.pcie.bus), static_cast<uint32_t>(topology.pcie.device), static_cast<uint32_t>(topology.pcie.function));
|
||||
topology_amd topology{};
|
||||
if (OclLib::getDeviceInfo(id, CL_DEVICE_TOPOLOGY_AMD, sizeof(topology), &topology) == CL_SUCCESS && topology.type == CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD) {
|
||||
m_topology = { topology.bus, topology.device, topology.function };
|
||||
}
|
||||
|
||||
m_board = OclLib::getString(id, CL_DEVICE_BOARD_NAME_AMD);
|
||||
}
|
||||
else if (m_extensions.contains("cl_nv_device_attribute_query")) {
|
||||
cl_uint bus = 0;
|
||||
if (OclLib::getDeviceInfo(id, CL_DEVICE_PCI_BUS_ID_NV, sizeof (bus), &bus, nullptr) == CL_SUCCESS) {
|
||||
if (OclLib::getDeviceInfo(id, CL_DEVICE_PCI_BUS_ID_NV, sizeof(bus), &bus) == CL_SUCCESS) {
|
||||
cl_uint slot = OclLib::getUint(id, CL_DEVICE_PCI_SLOT_ID_NV);
|
||||
m_topology = PciTopology(bus, (slot >> 3) & 0xff, slot & 7);
|
||||
m_topology = { bus, (slot >> 3) & 0xff, slot & 7 };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,17 +158,11 @@ xmrig::OclDevice::OclDevice(uint32_t index, cl_device_id id, cl_platform_id plat
|
||||
|
||||
xmrig::String xmrig::OclDevice::printableName() const
|
||||
{
|
||||
const size_t size = m_board.size() + m_name.size() + 64;
|
||||
char *buf = new char[size]();
|
||||
|
||||
if (m_board.isNull()) {
|
||||
snprintf(buf, size, GREEN_BOLD("%s"), m_name.data());
|
||||
}
|
||||
else {
|
||||
snprintf(buf, size, GREEN_BOLD("%s") " (" CYAN_BOLD("%s") ")", m_board.data(), m_name.data());
|
||||
return fmt::format(GREEN_BOLD("{}"), m_name).c_str();
|
||||
}
|
||||
|
||||
return buf;
|
||||
return fmt::format(GREEN_BOLD("{}") " (" CYAN_BOLD("{}") ")", m_board, m_name).c_str();
|
||||
}
|
||||
|
||||
|
||||
@@ -311,3 +210,35 @@ void xmrig::OclDevice::toJSON(rapidjson::Value &out, rapidjson::Document &doc) c
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef XMRIG_OS_APPLE
|
||||
xmrig::OclDevice::Type xmrig::OclDevice::getType(const String &name)
|
||||
{
|
||||
static std::map<const char *, OclDevice::Type> types = {
|
||||
{ "gfx900", Vega_10 },
|
||||
{ "gfx901", Vega_10 },
|
||||
{ "gfx902", Raven },
|
||||
{ "gfx903", Raven },
|
||||
{ "gfx906", Vega_20 },
|
||||
{ "gfx907", Vega_20 },
|
||||
{ "gfx1010", Navi_10 },
|
||||
{ "gfx1011", Navi_12 },
|
||||
{ "gfx1012", Navi_14 },
|
||||
{ "gfx1030", Navi_21 },
|
||||
{ "gfx804", Lexa },
|
||||
{ "Baffin", Baffin },
|
||||
{ "Ellesmere", Ellesmere },
|
||||
{ "gfx803", Polaris },
|
||||
{ "polaris", Polaris },
|
||||
};
|
||||
|
||||
for (auto &kv : types) {
|
||||
if (name.contains(kv.first)) {
|
||||
return kv.second;
|
||||
}
|
||||
}
|
||||
|
||||
return OclDevice::Unknown;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
# endif
|
||||
|
||||
private:
|
||||
static OclDevice::Type getType(const String &name);
|
||||
|
||||
cl_device_id m_id = nullptr;
|
||||
cl_platform_id m_platform = nullptr;
|
||||
const String m_platformVendor;
|
||||
|
||||
77
src/backend/opencl/wrappers/OclDevice_mac.cpp
Normal file
77
src/backend/opencl/wrappers/OclDevice_mac.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2021 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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/opencl/wrappers/OclDevice.h"
|
||||
|
||||
|
||||
xmrig::OclDevice::Type xmrig::OclDevice::getType(const String &name)
|
||||
{
|
||||
// Apple Platform: uses product names, not gfx# or codenames
|
||||
if (name.contains("AMD Radeon")) {
|
||||
if (name.contains(" 450 ") ||
|
||||
name.contains(" 455 ") ||
|
||||
name.contains(" 460 ")) {
|
||||
return Baffin;
|
||||
}
|
||||
|
||||
if (name.contains(" 555 ") || name.contains(" 555X ") ||
|
||||
name.contains(" 560 ") || name.contains(" 560X ") ||
|
||||
name.contains(" 570 ") || name.contains(" 570X ") ||
|
||||
name.contains(" 575 ") || name.contains(" 575X ")) {
|
||||
return Polaris;
|
||||
}
|
||||
|
||||
if (name.contains(" 580 ") || name.contains(" 580X ")) {
|
||||
return Ellesmere;
|
||||
}
|
||||
|
||||
if (name.contains(" Vega ")) {
|
||||
if (name.contains(" 48 ") ||
|
||||
name.contains(" 56 ") ||
|
||||
name.contains(" 64 ") ||
|
||||
name.contains(" 64X ")) {
|
||||
return Vega_10;
|
||||
}
|
||||
if (name.contains(" 16 ") ||
|
||||
name.contains(" 20 ") ||
|
||||
name.contains(" II ")) {
|
||||
return Vega_20;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.contains(" 5700 ") || name.contains(" W5700X ")) {
|
||||
return Navi_10;
|
||||
}
|
||||
|
||||
if (name.contains(" 5600 ") || name.contains(" 5600M ")) {
|
||||
return Navi_12;
|
||||
}
|
||||
|
||||
if (name.contains(" 5300 ") || name.contains(" 5300M ") ||
|
||||
name.contains(" 5500 ") || name.contains(" 5500M ")) {
|
||||
return Navi_14;
|
||||
}
|
||||
|
||||
if (name.contains(" W6800 ") || name.contains(" W6900X ")) {
|
||||
return Navi_21;
|
||||
}
|
||||
}
|
||||
|
||||
return OclDevice::Unknown;
|
||||
}
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
enum RequestType {
|
||||
REQ_UNKNOWN,
|
||||
REQ_SUMMARY,
|
||||
REQ_BACKENDS,
|
||||
REQ_CONFIG,
|
||||
REQ_JSON_RPC
|
||||
};
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
inline Source source() const override { return m_source; }
|
||||
inline void done(int) override { m_state = STATE_DONE; }
|
||||
|
||||
int m_version = 1;
|
||||
int m_version = 0;
|
||||
RequestType m_type = REQ_UNKNOWN;
|
||||
State m_state = STATE_NEW;
|
||||
String m_rpcMethod;
|
||||
|
||||
@@ -67,10 +67,33 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
||||
m_res(req.id()),
|
||||
m_url(req.url.c_str())
|
||||
{
|
||||
if (method() == METHOD_GET) {
|
||||
if (url() == "/1/summary" || url() == "/2/summary" || url() == "/api.json") {
|
||||
m_type = REQ_SUMMARY;
|
||||
if (url().size() > 4 && memcmp(url().data(), "/", 1) == 0 && memcmp(url().data()+2, "/", 1) == 0) {
|
||||
if (memcmp(url().data(), "/2/", 3) == 0) {
|
||||
m_version = 2;
|
||||
} else if (memcmp(url().data(), "/1/", 3) == 0) {
|
||||
m_version = 1;
|
||||
}
|
||||
switch (url().size()) {
|
||||
case 9:
|
||||
if (memcmp(url().data()+3, "config", 6) == 0) {
|
||||
m_type = REQ_CONFIG;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (memcmp(url().data()+3, "summary", 7) == 0) {
|
||||
m_type = REQ_SUMMARY;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if (memcmp(url().data()+3, "backends", 8) == 0) {
|
||||
m_type = REQ_BACKENDS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (url() == "/api.json") {
|
||||
m_type = REQ_SUMMARY;
|
||||
}
|
||||
|
||||
if (method() == METHOD_POST && url() == "/json_rpc") {
|
||||
@@ -94,12 +117,6 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (url().size() > 4) {
|
||||
if (memcmp(url().data(), "/2/", 3) == 0) {
|
||||
m_version = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,13 +45,6 @@
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "base/api/Api.h"
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kConfigPathV1 = "/1/config";
|
||||
static const char *kConfigPathV2 = "/2/config";
|
||||
|
||||
} // namespace xmrig
|
||||
#endif
|
||||
|
||||
|
||||
@@ -317,7 +310,7 @@ void xmrig::Base::onFileChanged(const String &fileName)
|
||||
void xmrig::Base::onRequest(IApiRequest &request)
|
||||
{
|
||||
if (request.method() == IApiRequest::METHOD_GET) {
|
||||
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) {
|
||||
if (request.type() == IApiRequest::REQ_CONFIG) {
|
||||
if (request.isRestricted()) {
|
||||
return request.done(403);
|
||||
}
|
||||
@@ -327,7 +320,7 @@ void xmrig::Base::onRequest(IApiRequest &request)
|
||||
}
|
||||
}
|
||||
else if (request.method() == IApiRequest::METHOD_PUT || request.method() == IApiRequest::METHOD_POST) {
|
||||
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) {
|
||||
if (request.type() == IApiRequest::REQ_CONFIG) {
|
||||
request.accept();
|
||||
|
||||
if (!reload(request.json())) {
|
||||
|
||||
@@ -710,7 +710,7 @@ void xmrig::Miner::onRequest(IApiRequest &request)
|
||||
d_ptr->getMiner(request.reply(), request.doc(), request.version());
|
||||
d_ptr->getHashrate(request.reply(), request.doc(), request.version());
|
||||
}
|
||||
else if (request.url() == "/2/backends") {
|
||||
else if (request.type() == IApiRequest::REQ_BACKENDS && request.version() == 2) {
|
||||
request.accept();
|
||||
|
||||
d_ptr->getBackends(request.reply(), request.doc());
|
||||
@@ -732,6 +732,12 @@ void xmrig::Miner::onRequest(IApiRequest &request)
|
||||
|
||||
stop();
|
||||
}
|
||||
else if (request.rpcMethod() == "start") {
|
||||
request.accept();
|
||||
|
||||
const auto config = d_ptr->controller->config();
|
||||
onConfigChanged(config, config);
|
||||
}
|
||||
}
|
||||
|
||||
for (IBackend *backend : d_ptr->backends) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
@@ -17,9 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "crypto/rx/RxBasicStorage.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig miner"
|
||||
#define APP_VERSION "6.22.2"
|
||||
#define APP_VERSION "6.22.3-dev"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2024 xmrig.com"
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#define APP_VER_MAJOR 6
|
||||
#define APP_VER_MINOR 22
|
||||
#define APP_VER_PATCH 2
|
||||
#define APP_VER_PATCH 3
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1930)
|
||||
|
||||
Reference in New Issue
Block a user