mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-08 08:23:34 -05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebb0f81f2f | ||
|
|
eb3e2b8868 | ||
|
|
583d892eb5 | ||
|
|
b145f14ad8 | ||
|
|
ce19edf36c | ||
|
|
108fd5690e | ||
|
|
c19fe3cea7 | ||
|
|
187c7680cc | ||
|
|
20061e1b8b | ||
|
|
2baccab0f9 |
@@ -1,3 +1,10 @@
|
||||
# v0.8.2
|
||||
- Fixed L2 cache size detection for AMD CPUs (Bulldozer/Piledriver/Steamroller/Excavator architecture).
|
||||
- Fixed gcc 7.1 support.
|
||||
|
||||
# v0.8.1
|
||||
- Added nicehash support, detects automaticaly by pool URL, for example `cryptonight.eu.nicehash.com:3355` or manually via option `--nicehash`.
|
||||
|
||||
# v0.8.0
|
||||
- Added double hash mode, also known as lower power mode. `--av=2` and `--av=4`.
|
||||
- Added smart automatic CPU configuration. Default threads count now depends on size of the L3 cache of CPU.
|
||||
|
||||
@@ -24,6 +24,7 @@ Based on cpuminer-multi with heavy optimizations/rewrites and removing a lot of
|
||||
* Command line options compatible with cpuminer.
|
||||
* CryptoNight-Lite support for AEON.
|
||||
* Smart automatic [CPU configuration](https://github.com/xmrig/xmrig/wiki/Threads).
|
||||
* Nicehash support
|
||||
* It's open source software.
|
||||
|
||||
## Download
|
||||
@@ -57,6 +58,7 @@ xmrig.exe -o xmr-eu.dwarfpool.com:8005 -u YOUR_WALLET -p x -k
|
||||
-c, --config=FILE load a JSON-format configuration file
|
||||
--max-cpu-usage=N maximum cpu usage for automatic threads mode (default 75)
|
||||
--safe safe adjust threads and av settings for current cpu
|
||||
--nicehash enable nicehash support
|
||||
-h, --help display this help and exit
|
||||
-V, --version output version information and exit
|
||||
```
|
||||
|
||||
@@ -116,7 +116,7 @@ inline void aes_genkey(const __m128i* memory, __m128i* k0, __m128i* k1, __m128i*
|
||||
}
|
||||
|
||||
|
||||
inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xin0, xin1, xin2, xin3, xin4, xin5, xin6, xin7;
|
||||
@@ -157,7 +157,7 @@ inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
}
|
||||
|
||||
|
||||
inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
||||
|
||||
@@ -97,7 +97,7 @@ inline void aes_genkey(const __m128i* memory, __m128i* k0, __m128i* k1, __m128i*
|
||||
}
|
||||
|
||||
|
||||
inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xin0, xin1, xin2, xin3, xin4, xin5, xin6, xin7;
|
||||
@@ -138,7 +138,7 @@ inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
}
|
||||
|
||||
|
||||
inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
||||
|
||||
@@ -116,7 +116,7 @@ inline void aes_genkey(const __m128i* memory, __m128i* k0, __m128i* k1, __m128i*
|
||||
}
|
||||
|
||||
|
||||
inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xin0, xin1, xin2, xin3, xin4, xin5, xin6, xin7;
|
||||
@@ -157,7 +157,7 @@ inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
}
|
||||
|
||||
|
||||
inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
||||
|
||||
@@ -97,7 +97,7 @@ inline void aes_genkey(const __m128i* memory, __m128i* k0, __m128i* k1, __m128i*
|
||||
}
|
||||
|
||||
|
||||
inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xin0, xin1, xin2, xin3, xin4, xin5, xin6, xin7;
|
||||
@@ -138,7 +138,7 @@ inline void cn_explode_scratchpad(const __m128i* input, __m128i* output)
|
||||
}
|
||||
|
||||
|
||||
inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
static inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
|
||||
{
|
||||
// This is more than we have registers, compiler will assign 2 keys on the stack
|
||||
__m128i xout0, xout1, xout2, xout3, xout4, xout5, xout6, xout7;
|
||||
|
||||
11
cpu.c
11
cpu.c
@@ -31,7 +31,6 @@
|
||||
#endif
|
||||
|
||||
#include "cpu.h"
|
||||
#include "utils/applog.h"
|
||||
|
||||
|
||||
#ifndef BUILD_TEST
|
||||
@@ -47,9 +46,17 @@ void cpu_init_common() {
|
||||
cpu_info.total_logical_cpus = data.total_logical_cpus;
|
||||
cpu_info.sockets = data.total_logical_cpus / data.num_logical_cpus;
|
||||
cpu_info.total_cores = data.num_cores * cpu_info.sockets;
|
||||
cpu_info.l2_cache = data.l2_cache > 0 ? data.l2_cache * cpu_info.total_cores * cpu_info.sockets : 0;
|
||||
cpu_info.l3_cache = data.l3_cache > 0 ? data.l3_cache * cpu_info.sockets : 0;
|
||||
|
||||
// Workaround for AMD CPUs https://github.com/anrieff/libcpuid/issues/97
|
||||
if (data.vendor == VENDOR_AMD && data.l3_cache <= 0 && data.l2_assoc == 16 && data.ext_family >= 21) {
|
||||
cpu_info.l2_cache = data.l2_cache * (cpu_info.total_cores / 2) * cpu_info.sockets;
|
||||
}
|
||||
else {
|
||||
cpu_info.l2_cache = data.l2_cache > 0 ? data.l2_cache * cpu_info.total_cores * cpu_info.sockets : 0;
|
||||
}
|
||||
|
||||
|
||||
# ifdef __x86_64__
|
||||
cpu_info.flags |= CPU_FLAG_X86_64;
|
||||
# endif
|
||||
|
||||
11
options.c
11
options.c
@@ -48,6 +48,7 @@ bool opt_keepalive = false;
|
||||
bool opt_background = false;
|
||||
bool opt_double_hash = false;
|
||||
bool opt_safe = false;
|
||||
bool opt_nicehash = false;
|
||||
char *opt_url = NULL;
|
||||
char *opt_backup_url = NULL;
|
||||
char *opt_userpass = NULL;
|
||||
@@ -78,6 +79,7 @@ Options:\n\
|
||||
-c, --config=FILE load a JSON-format configuration file\n\
|
||||
--max-cpu-usage=N maximum CPU usage for automatic threads mode (default 75)\n\
|
||||
--safe safe adjust threads and av settings for current CPU\n\
|
||||
--nicehash enable nicehash support\n\
|
||||
-h, --help display this help and exit\n\
|
||||
-V, --version output version information and exit\n\
|
||||
";
|
||||
@@ -97,6 +99,7 @@ static struct option const options[] = {
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "keepalive", 0, NULL ,'k' },
|
||||
{ "max-cpu-usage", 1, NULL, 1004 },
|
||||
{ "nicehash", 0, NULL, 1006 },
|
||||
{ "no-color", 0, NULL, 1002 },
|
||||
{ "pass", 1, NULL, 'p' },
|
||||
{ "retries", 1, NULL, 'r' },
|
||||
@@ -331,6 +334,10 @@ static void parse_arg(int key, char *arg) {
|
||||
opt_donate_level = v;
|
||||
break;
|
||||
|
||||
case 1006: /* --nicehash */
|
||||
opt_nicehash = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
show_usage_and_exit(1);
|
||||
}
|
||||
@@ -435,6 +442,10 @@ void parse_cmdline(int argc, char *argv[]) {
|
||||
proper_exit(1);
|
||||
}
|
||||
|
||||
if (strstr(opt_url, ".nicehash.com:") != NULL) {
|
||||
opt_nicehash = true;
|
||||
}
|
||||
|
||||
if (!opt_userpass) {
|
||||
opt_userpass = malloc(strlen(opt_user) + strlen(opt_pass) + 2);
|
||||
if (!opt_userpass) {
|
||||
|
||||
@@ -65,6 +65,7 @@ extern bool opt_keepalive;
|
||||
extern bool opt_background;
|
||||
extern bool opt_double_hash;
|
||||
extern bool opt_safe;
|
||||
extern bool opt_nicehash;
|
||||
extern char *opt_url;
|
||||
extern char *opt_backup_url;
|
||||
extern char *opt_userpass;
|
||||
|
||||
15
stratum.c
15
stratum.c
@@ -238,6 +238,12 @@ bool stratum_handle_response(char *buf) {
|
||||
json_t *id_val = json_object_get(val, "id");
|
||||
|
||||
if (!id_val || json_is_null(id_val) || !res_val) {
|
||||
const char* message;
|
||||
|
||||
if (json_is_object(err_val) && (message = json_string_value(json_object_get(err_val, "message")))) {
|
||||
applog(LOG_ERR, "error: \"%s\"", message);
|
||||
}
|
||||
|
||||
json_decref(val);
|
||||
return false;
|
||||
}
|
||||
@@ -288,7 +294,6 @@ bool stratum_keepalived(struct stratum_ctx *sctx)
|
||||
bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass)
|
||||
{
|
||||
char *sret;
|
||||
json_error_t err;
|
||||
|
||||
char *req = malloc(128 + strlen(user) + strlen(pass));
|
||||
sprintf(req, "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"%s/%s\"},\"id\":1}", user, pass, APP_NAME, APP_VERSION);
|
||||
@@ -324,7 +329,15 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p
|
||||
json_t *error = json_object_get(val, "error");
|
||||
|
||||
if (!result || json_is_false(result) || (error && !json_is_null(error))) {
|
||||
const char* message;
|
||||
|
||||
if (json_is_object(error) && (message = json_string_value(json_object_get(error, "message")))) {
|
||||
applog(LOG_ERR, "Stratum authentication failed: \"%s\"", message);
|
||||
}
|
||||
else {
|
||||
applog(LOG_ERR, "Stratum authentication failed");
|
||||
}
|
||||
|
||||
json_decref(val);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,11 +71,16 @@ static void print_cpu() {
|
||||
|
||||
|
||||
static void print_threads() {
|
||||
const char *extra = "";
|
||||
if (opt_nicehash) {
|
||||
extra = ", nicehash";
|
||||
}
|
||||
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "THREADS: " CL_WHT "%d" CL_WHT ", av=%d, %s, donate=%d%%", opt_n_threads, opt_algo_variant, get_current_algo_name(), opt_donate_level);
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "THREADS: " CL_WHT "%d" CL_WHT ", av=%d, %s, donate=%d%%%s", opt_n_threads, opt_algo_variant, get_current_algo_name(), opt_donate_level, extra);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * THREADS: %d, av=%d, %s, donate=%d%%", opt_n_threads, opt_algo_variant, get_current_algo_name(), opt_donate_level);
|
||||
applog_notime(LOG_INFO, " * THREADS: %d, av=%d, %s, donate=%d%%%s", opt_n_threads, opt_algo_variant, get_current_algo_name(), opt_donate_level, extra);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "Monero (XMR) CPU miner"
|
||||
#define APP_VERSION "0.8.0"
|
||||
#define APP_VERSION "0.8.2"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
|
||||
|
||||
#define APP_VER_MAJOR 0
|
||||
#define APP_VER_MINOR 8
|
||||
#define APP_VER_BUILD 0
|
||||
#define APP_VER_BUILD 2
|
||||
#define APP_VER_REV 0
|
||||
|
||||
#endif /* __VERSION_H__ */
|
||||
|
||||
16
xmrig.c
16
xmrig.c
@@ -280,8 +280,15 @@ static void *miner_thread(void *userdata) {
|
||||
if (memcmp(work.job_id, stratum_ctx->g_work.job_id, 64)) {
|
||||
work_copy(&work, &stratum_ctx->g_work);
|
||||
nonceptr = (uint32_t*) (((char*) work.blob) + 39);
|
||||
|
||||
if (opt_nicehash) {
|
||||
end_nonce = (*nonceptr & 0xff000000U) + (0xffffffU / opt_n_threads * (thr_id + 1) - 0x20);
|
||||
*nonceptr = (*nonceptr & 0xff000000U) + (0xffffffU / opt_n_threads * thr_id);
|
||||
}
|
||||
else {
|
||||
*nonceptr = 0xffffffffU / opt_n_threads * thr_id;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&stratum_ctx->work_lock);
|
||||
|
||||
@@ -356,9 +363,16 @@ static void *miner_thread_double(void *userdata) {
|
||||
nonceptr0 = (uint32_t*) (((char*) double_blob) + 39);
|
||||
nonceptr1 = (uint32_t*) (((char*) double_blob) + 39 + work.blob_size);
|
||||
|
||||
if (opt_nicehash) {
|
||||
end_nonce = (*nonceptr0 & 0xff000000U) + (0xffffffU / (opt_n_threads * 2) * (thr_id + 1) - 0x20);
|
||||
*nonceptr0 = (*nonceptr0 & 0xff000000U) + (0xffffffU / (opt_n_threads * 2) * thr_id);
|
||||
*nonceptr1 = (*nonceptr1 & 0xff000000U) + (0xffffffU / (opt_n_threads * 2) * (thr_id + opt_n_threads));
|
||||
}
|
||||
else {
|
||||
*nonceptr0 = 0xffffffffU / (opt_n_threads * 2) * thr_id;
|
||||
*nonceptr1 = 0xffffffffU / (opt_n_threads * 2) * (thr_id + opt_n_threads);
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&stratum_ctx->work_lock);
|
||||
|
||||
@@ -627,8 +641,8 @@ static bool start_mining() {
|
||||
* @return
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
cpu_init();
|
||||
applog_init();
|
||||
cpu_init();
|
||||
parse_cmdline(argc, argv);
|
||||
persistent_memory_allocate();
|
||||
print_summary();
|
||||
|
||||
Reference in New Issue
Block a user