Fabcoin Core  0.16.2
P2P Digital Currency
param.h
Go to the documentation of this file.
1 #ifndef __PARAM_H__
2 #define __PARAM_H__
3 #define PARAM_N 210
4 #define PARAM_K 9
5 #define PREFIX (PARAM_N / (PARAM_K + 1))
6 #define NR_INPUTS (1 << PREFIX)
7 // Approximate log base 2 of number of elements in hash tables
8 #define APX_NR_ELMS_LOG (PREFIX + 1)
9 // Number of rows and slots is affected by this; 20 offers the best performance
10 #define NR_ROWS_LOG 20
11 
12 // Setting this to 1 might make SILENTARMY faster, see TROUBLESHOOTING.md
13 #define OPTIM_SIMPLIFY_ROUND 1
14 
15 // Number of collision items to track, per thread
16 #define COLL_DATA_SIZE_PER_TH (NR_SLOTS * 5)
17 
18 // Ratio of time of sleeping before rechecking if task is done (0-1)
19 #define SLEEP_RECHECK_RATIO 0.60
20 // Ratio of time to busy wait for the solution (0-1)
21 // The higher value the higher CPU usage with Nvidia
22 #define SLEEP_SKIP_RATIO 0.005
23 
24 // Make hash tables OVERHEAD times larger than necessary to store the average
25 // number of elements per row. The ideal value is as small as possible to
26 // reduce memory usage, but not too small or else elements are dropped from the
27 // hash tables.
28 //
29 // The actual number of elements per row is closer to the theoretical average
30 // (less variance) when NR_ROWS_LOG is small. So accordingly OVERHEAD can be
31 // smaller.
32 //
33 // Even (as opposed to odd) values of OVERHEAD sometimes significantly decrease
34 // performance as they cause VRAM channel conflicts.
35 #if NR_ROWS_LOG == 16
36 #error "NR_ROWS_LOG = 16 is currently broken - do not use"
37 #define OVERHEAD 3
38 #elif NR_ROWS_LOG == 18
39 #define OVERHEAD 3
40 #elif NR_ROWS_LOG == 19
41 #define OVERHEAD 5
42 #elif NR_ROWS_LOG == 20 && OPTIM_SIMPLIFY_ROUND
43 #define OVERHEAD 6
44 #elif NR_ROWS_LOG == 20
45 #define OVERHEAD 9
46 #endif
47 
48 #define NR_ROWS (1 << NR_ROWS_LOG)
49 #define NR_SLOTS ((1 << (APX_NR_ELMS_LOG - NR_ROWS_LOG)) * OVERHEAD)
50 // Length of 1 element (slot) in bytes
51 #define SLOT_LEN 32
52 // Total size of hash table
53 #define HT_SIZE (NR_ROWS * NR_SLOTS * SLOT_LEN)
54 
55 #define FABCOIN_NONCE_LEN 32
56 // Number of bytes fabcoin needs out of Blake
57 #define FABCOIN_HASH_LEN 512/PARAM_N*((PARAM_N+7)/8)
58 // Number of wavefronts per SIMD for the Blake kernel.
59 // Blake is ALU-bound (beside the atomic counter being incremented) so we need
60 // at least 2 wavefronts per SIMD to hide the 2-clock latency of integer
61 // instructions. 10 is the max supported by the hw.
62 #define BLAKE_WPS 10
63 // Maximum number of solutions reported by kernel to host
64 #define MAX_SOLS 10
65 
66 #if (NR_SLOTS < 16)
67 #define BITS_PER_ROW 4
68 #define ROWS_PER_UINT 8
69 #define ROW_MASK 0x0F
70 #else
71 #define BITS_PER_ROW 8
72 #define ROWS_PER_UINT 4
73 #define ROW_MASK 0xFF
74 #endif
75 // Optional features
76 #undef ENABLE_DEBUG
77 
78 /*
79 ** Return the offset of Xi in bytes from the beginning of the slot.
80 */
81 #define xi_offset_for_round(round) (8 + ((round) / 2) * 4)
82 
83 // An (uncompressed) solution stores (1 << PARAM_K) 32-bit values
84 #define SOL_SIZE ((1 << PARAM_K) * 4)
85 typedef struct sols_s
86 {
87  uint nr;
89  uint8_t valid[MAX_SOLS];
90  uint values[MAX_SOLS][(1 << PARAM_K)];
91 }sols_t;
92 
93 #endif
uint32_t uint
Definition: libclwrapper.h:40
uint8_t valid[MAX_SOLS]
Definition: libclwrapper.h:17
uint likely_invalids
Definition: libclwrapper.h:16
uint nr
Definition: libclwrapper.h:15
uint values[MAX_SOLS][512]
Definition: libclwrapper.h:18
#define MAX_SOLS
Definition: param.h:64
struct sols_s sols_t
#define PARAM_K
Definition: param.h:4