Skip to content

Commit

Permalink
Merge pull request #2 from SChernykh/master
Browse files Browse the repository at this point in the history
Added auto-config for RandomX
  • Loading branch information
xmrig authored Oct 29, 2019
2 parents 53683d0 + 792228a commit 6e27a3b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cuda_extra.cu
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,20 @@ int cuda_get_deviceinfo(nvid_ctx *ctx)
ctx->device_pciDeviceID = props.pciDeviceID;
ctx->device_pciDomainID = props.pciDomainID;

if ((ctx->algorithm.family() == Algorithm::RANDOM_X) && ((ctx->device_blocks < 0) || (ctx->device_threads < 0))) {
ctx->device_threads = 32;
ctx->device_blocks = props.multiProcessorCount * 2;
ctx->device_bfactor = 6;
ctx->device_bsleep = 0;

// Leave memory for 2080 MB dataset + 64 MB free
// Each thread uses 1 scratchpad plus a few small buffers on GPU
const size_t max_blocks = (freeMemory - (2080u << 20) - (64u << 20)) / (ctx->algorithm.l3() + 32768) / 32;
if (ctx->device_blocks > max_blocks) {
ctx->device_blocks = max_blocks;
}
}

// set all device option those marked as auto (-1) to a valid value
if (ctx->device_blocks < 0) {
/* good values based of my experience
Expand Down

0 comments on commit 6e27a3b

Please sign in to comment.