explain more options

This commit is contained in:
John Tromp 2018-04-16 11:19:44 +02:00
parent 52b71897e5
commit 859f9791af
3 changed files with 26 additions and 8 deletions

View File

@ -31,6 +31,9 @@ eq4851: equi.h equi_miner.h equi_miner.cpp Makefile
eq1445: equi.h equi_miner.h equi_miner.cpp Makefile
$(GPP) -DATOMIC -DRESTBITS=4 -DWN=144 -DWK=5 equi_miner.cpp blake/blake2b.cpp -o eq1445
eq21091: equi.h equi_miner.h equi_miner.cpp Makefile
$(GPP) -DRESTBITS=5 -DWN=210 -DWK=9 equi_miner.cpp blake/blake2b.cpp -o eq21091
eq14451: equi.h equi_miner.h equi_miner.cpp Makefile
$(GPP) -DRESTBITS=4 -DWN=144 -DWK=5 equi_miner.cpp blake/blake2b.cpp -o eq14451

View File

@ -7,8 +7,10 @@ The executables ending in 1 are compiled without atomics and thus
only suitable for single-threaded use (where they get some speedup over the generic version).
Options -h HEADER -n NONCE are self explanatory.
Non-ascii headers can be provided in hexadecimal with option -x HEXHEADER.
Add option -r RANGESIZE to search a range of nonces.
For benching, options -n 255 -r 100 are useful as it gets exactly 188 solutions from 100 runs.
Finally, option -s shows the solutions.
My original submission was triggered by seeing how xenoncat's
"has much of the same ideas as mine" so that making my open sourcing conditional

View File

@ -41,36 +41,47 @@
#include "blake2-avx2/blake2bip.h"
#ifdef ASM_BLAKE
#ifdef NBLAKES
#if NBLAKES != 4
#error only 4-way assembly blake
#endif
#else
#define NBLAKES 4
#endif
#endif // ifdef NBLAKES
#ifdef __cplusplus
extern "C" {
#endif
void Blake2PrepareMidstate4(void *midstate, uchar *input);
#ifdef __cplusplus
}
#endif
//midstate: 256 bytes of buffer for output midstate, aligned by 32
//input: 140 bytes header, preferably aligned by 8
#ifdef __cplusplus
extern "C" {
#endif
void Blake2Run4(uchar *hashout, void *midstate, u32 indexctr);
#ifdef __cplusplus
}
#endif
struct blake_state {
alignas(32) uchar state[256];
};
#else
typedef blake2b_state blake_state;
#endif
#endif // ifdef ASM_BLAKE
#if defined __builtin_bswap32 && defined __LITTLE_ENDIAN
#undef htobe32
@ -90,7 +101,7 @@ typedef uint64_t u64;
typedef std::atomic<u32> au32;
#else
typedef u32 au32;
#endif
#endif // ifdef ATOMIC
#ifndef RESTBITS
#define CANTOR
@ -106,17 +117,19 @@ typedef u32 au32;
// by default buckets have a capacity of twice their expected size
// but this factor reduced it accordingly
#ifndef SAVEMEM
#if RESTBITS == 4
// can't save memory in such small buckets
#if RESTBITS < 8
// can't save much memory in such small buckets
#define SAVEMEM 1
#elif RESTBITS >= 8
#else
// an expected size of at least 512 has such relatively small
// standard deviation that we can reduce capacity with negligible discarding
// this value reduces (200,9) memory to under 144MB
// must be under sqrt(2)/2 with -DCANTOR
#define SAVEMEM 9/14
#endif
#endif
#endif // RESTBITS == 4
#endif // ifndef SAVEMEM
static const u32 NBUCKETS = 1<<BUCKBITS; // number of buckets
static const u32 BUCKMASK = NBUCKETS-1; // corresponding bucket mask