Browse Source

xmr: allow to set intensity on command line

master
Tanguy Pruvot 8 years ago
parent
commit
39aad5a003
  1. 14
      crypto/cryptonight.cu
  2. 1
      crypto/cuda_cryptonight_core.cu

14
crypto/cryptonight.cu

@ -11,8 +11,8 @@
extern char *device_config[MAX_GPUS]; // -l 32x16 extern char *device_config[MAX_GPUS]; // -l 32x16
uint32_t cn_blocks = 32; static __thread uint32_t cn_blocks = 32;
uint32_t cn_threads = 16; static __thread uint32_t cn_threads = 16;
static uint32_t *d_long_state[MAX_GPUS]; static uint32_t *d_long_state[MAX_GPUS];
static uint32_t *d_ctx_state[MAX_GPUS]; static uint32_t *d_ctx_state[MAX_GPUS];
@ -44,12 +44,16 @@ extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_
if (device_config[thr_id]) { if (device_config[thr_id]) {
sscanf(device_config[thr_id], "%ux%u", &cn_blocks, &cn_threads); sscanf(device_config[thr_id], "%ux%u", &cn_blocks, &cn_threads);
throughput = cuda_default_throughput(thr_id, cn_blocks*cn_threads); throughput = cuda_default_throughput(thr_id, cn_blocks*cn_threads);
gpulog(LOG_INFO, thr_id, "Using %u x %u (%u) threads kernel launch config", gpulog(LOG_INFO, thr_id, "Using %u x %u kernel launch config, %u threads",
cn_blocks, cn_threads, throughput); cn_blocks, cn_threads, throughput);
} else { } else {
throughput = cuda_default_throughput(thr_id, cn_blocks*cn_threads); throughput = cuda_default_throughput(thr_id, cn_blocks*cn_threads);
gpulog(LOG_INFO, thr_id, "Intensity set to %g, (%u x %u) %u threads", if (throughput != cn_blocks*cn_threads && cn_threads) {
throughput2intensity(throughput), cn_blocks, cn_threads, throughput); cn_blocks = throughput / cn_threads;
throughput = cn_threads * cn_blocks;
}
gpulog(LOG_INFO, thr_id, "Intensity set to %g, %u threads (%ux%u)",
throughput2intensity(throughput), throughput, cn_blocks, cn_threads);
} }
if(sizeof(size_t) == 4 && throughput > UINT32_MAX / MEMORY) { if(sizeof(size_t) == 4 && throughput > UINT32_MAX / MEMORY) {

1
crypto/cuda_cryptonight_core.cu

@ -10,6 +10,7 @@
#include "cryptonight.h" #include "cryptonight.h"
#ifdef WIN32 #ifdef WIN32
// to prevent ui freeze
int cn_bfactor = 8; int cn_bfactor = 8;
int cn_bsleep = 100; int cn_bsleep = 100;
#else #else

Loading…
Cancel
Save