Preparation for #1.4.0 (#30)

- Fixed CPU affinity on Windows for NUMA and CPUs with lot of cores
- Implemented per thread configurable Multihash mode (double, triple, quadruple, quintuple)
- Rebased from XMRig 2.4.4
This commit is contained in:
Ben Gräf 2018-01-19 19:42:06 +01:00 committed by GitHub
parent 5f8ea98764
commit acf27e9341
41 changed files with 2575 additions and 1104 deletions

View file

@ -27,16 +27,15 @@
#include "crypto/CryptoNight.h"
#include "Mem.h"
#include "Options.h"
bool Mem::m_doubleHash = false;
int Mem::m_algo = 0;
int Mem::m_flags = 0;
int Mem::m_threads = 0;
size_t Mem::m_hashFactor = 1;
size_t Mem::m_threads = 0;
size_t Mem::m_memorySize = 0;
uint8_t *Mem::m_memory = nullptr;
int64_t Mem::m_doubleHashThreadMask = -1L;
Mem::ThreadBitSet Mem::m_multiHashThreadMask = Mem::ThreadBitSet(-1L);
cryptonight_ctx *Mem::create(int threadId)
{
@ -45,7 +44,7 @@ cryptonight_ctx *Mem::create(int threadId)
size_t offset = 0;
for (int i=0; i < threadId; i++) {
offset += sizeof(cryptonight_ctx);
offset += isDoubleHash(i) ? scratchPadSize*2 : scratchPadSize;
offset += scratchPadSize * getThreadHashFactor(i);
}
auto* ctx = reinterpret_cast<cryptonight_ctx *>(&m_memory[offset]);