mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-22 20:44:49 +00:00
cputest: cleanup + calloc
This commit is contained in:
parent
5e42389b4b
commit
2c2269dcb6
@ -181,7 +181,8 @@ extern "C" int scanhash_pluck(int thr_id, uint32_t *pdata, const uint32_t *ptarg
|
|||||||
const uint32_t first_nonce = pdata[19];
|
const uint32_t first_nonce = pdata[19];
|
||||||
uint32_t endiandata[20];
|
uint32_t endiandata[20];
|
||||||
int opt_pluck_n = 128;
|
int opt_pluck_n = 128;
|
||||||
int intensity = 18; /* beware > 20 could work and create diff problems later */
|
|
||||||
|
int intensity = is_windows() ? 17 : 19; /* beware > 20 could work and create diff problems later */
|
||||||
uint32_t throughput = device_intensity(thr_id, __func__, 1U << intensity);
|
uint32_t throughput = device_intensity(thr_id, __func__, 1U << intensity);
|
||||||
// divide by 128 for this algo which require a lot of memory
|
// divide by 128 for this algo which require a lot of memory
|
||||||
throughput = throughput / 128 - 256;
|
throughput = throughput / 128 - 256;
|
||||||
|
44
util.cpp
44
util.cpp
@ -1238,6 +1238,7 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
|
|||||||
int merkle_count, i;
|
int merkle_count, i;
|
||||||
json_t *merkle_arr;
|
json_t *merkle_arr;
|
||||||
uchar **merkle;
|
uchar **merkle;
|
||||||
|
uchar(*merkle_tree)[32] = NULL;
|
||||||
int ntime;
|
int ntime;
|
||||||
|
|
||||||
job_id = json_string_value(json_array_get(params, 0));
|
job_id = json_string_value(json_array_get(params, 0));
|
||||||
@ -1643,10 +1644,10 @@ extern void applog_hash(uchar *hash)
|
|||||||
applog(LOG_DEBUG, "%s", format_hash(s, hash));
|
applog(LOG_DEBUG, "%s", format_hash(s, hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define printpfx(n,h) \
|
static uchar *scratchbuf = NULL;
|
||||||
printf("%s%12s%s: %s\n", CL_BLU, n, CL_N, format_hash(s, h))
|
|
||||||
|
|
||||||
static uchar scratchbuf[128 * 1024];
|
#define printpfx(n,h) \
|
||||||
|
printf("%s%11s%s: %s\n", CL_BLU, n, CL_N, format_hash(s, h))
|
||||||
|
|
||||||
void do_gpu_tests(void)
|
void do_gpu_tests(void)
|
||||||
{
|
{
|
||||||
@ -1681,115 +1682,92 @@ void print_hash_tests(void)
|
|||||||
{
|
{
|
||||||
char s[128] = {'\0'};
|
char s[128] = {'\0'};
|
||||||
uchar hash[128];
|
uchar hash[128];
|
||||||
uchar* buf = scratchbuf;
|
uchar* buf;
|
||||||
|
|
||||||
|
// work space for scratchpad based algos
|
||||||
|
scratchbuf = (uchar*)calloc(128, 1024);
|
||||||
|
buf = &scratchbuf[0];
|
||||||
|
// memset(buf, 0, sizeof scratchbuf); calloc fills zeros
|
||||||
|
|
||||||
//scratchbuf = (uchar*)malloc(1, 128*1024);
|
|
||||||
memset(buf, 0, sizeof scratchbuf);
|
|
||||||
// buf[0] = 1; buf[64] = 2; // for endian tests
|
// buf[0] = 1; buf[64] = 2; // for endian tests
|
||||||
|
|
||||||
printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n");
|
printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n");
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
animehash(&hash[0], &buf[0]);
|
animehash(&hash[0], &buf[0]);
|
||||||
printpfx("anime", hash);
|
printpfx("anime", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
blake256hash(&hash[0], &buf[0], 8);
|
blake256hash(&hash[0], &buf[0], 8);
|
||||||
printpfx("blakecoin", hash);
|
printpfx("blakecoin", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
blake256hash(&hash[0], &buf[0], 14);
|
blake256hash(&hash[0], &buf[0], 14);
|
||||||
printpfx("blake", hash);
|
printpfx("blake", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
deephash(&hash[0], &buf[0]);
|
deephash(&hash[0], &buf[0]);
|
||||||
printpfx("deep", hash);
|
printpfx("deep", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
fresh_hash(&hash[0], &buf[0]);
|
fresh_hash(&hash[0], &buf[0]);
|
||||||
printpfx("fresh", hash);
|
printpfx("fresh", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
fugue256_hash(&hash[0], &buf[0], 32);
|
fugue256_hash(&hash[0], &buf[0], 32);
|
||||||
printpfx("fugue256", hash);
|
printpfx("fugue256", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
groestlhash(&hash[0], &buf[0]);
|
groestlhash(&hash[0], &buf[0]);
|
||||||
printpfx("groestl", hash);
|
printpfx("groestl", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
heavycoin_hash(&hash[0], &buf[0], 32);
|
heavycoin_hash(&hash[0], &buf[0], 32);
|
||||||
printpfx("heavy", hash);
|
printpfx("heavy", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
jackpothash(&hash[0], &buf[0]);
|
jackpothash(&hash[0], &buf[0]);
|
||||||
printpfx("jackpot", hash);
|
printpfx("jackpot", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
keccak256_hash(&hash[0], &buf[0]);
|
keccak256_hash(&hash[0], &buf[0]);
|
||||||
printpfx("keccak", hash);
|
printpfx("keccak", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
doomhash(&hash[0], &buf[0]);
|
doomhash(&hash[0], &buf[0]);
|
||||||
printpfx("luffa", hash);
|
printpfx("luffa", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
lyra2_hash(&hash[0], &buf[0]);
|
lyra2_hash(&hash[0], &buf[0]);
|
||||||
printpfx("lyra2", hash);
|
printpfx("lyra2", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
myriadhash(&hash[0], &buf[0]);
|
myriadhash(&hash[0], &buf[0]);
|
||||||
printpfx("myriad", hash);
|
printpfx("myriad", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
nist5hash(&hash[0], &buf[0]);
|
nist5hash(&hash[0], &buf[0]);
|
||||||
printpfx("nist5", hash);
|
printpfx("nist5", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
pentablakehash(&hash[0], &buf[0]);
|
pentablakehash(&hash[0], &buf[0]);
|
||||||
printpfx("pentablake", hash);
|
printpfx("pentablake", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
pluckhash((uint32_t*)&hash[0], (uint32_t*)&buf[0], &buf[0], 128);
|
pluckhash((uint32_t*)&hash[0], (uint32_t*)&buf[0], &buf[0], 128);
|
||||||
printpfx("pluck", hash);
|
printpfx("pluck", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
quarkhash(&hash[0], &buf[0]);
|
quarkhash(&hash[0], &buf[0]);
|
||||||
printpfx("quark", hash);
|
printpfx("quark", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
qubithash(&hash[0], &buf[0]);
|
qubithash(&hash[0], &buf[0]);
|
||||||
printpfx("qubit", hash);
|
printpfx("qubit", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
s3hash(&hash[0], &buf[0]);
|
s3hash(&hash[0], &buf[0]);
|
||||||
printpfx("S3", hash);
|
printpfx("S3", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
wcoinhash(&hash[0], &buf[0]);
|
wcoinhash(&hash[0], &buf[0]);
|
||||||
printpfx("whirl", hash);
|
printpfx("whirl", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
whirlxHash(&hash[0], &buf[0]);
|
whirlxHash(&hash[0], &buf[0]);
|
||||||
printpfx("whirlpoolx", hash);
|
printpfx("whirlpoolx", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
x11hash(&hash[0], &buf[0]);
|
x11hash(&hash[0], &buf[0]);
|
||||||
printpfx("X11", hash);
|
printpfx("X11", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
x13hash(&hash[0], &buf[0]);
|
x13hash(&hash[0], &buf[0]);
|
||||||
printpfx("X13", hash);
|
printpfx("X13", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
x14hash(&hash[0], &buf[0]);
|
x14hash(&hash[0], &buf[0]);
|
||||||
printpfx("X14", hash);
|
printpfx("X14", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
x15hash(&hash[0], &buf[0]);
|
x15hash(&hash[0], &buf[0]);
|
||||||
printpfx("X15", hash);
|
printpfx("X15", hash);
|
||||||
|
|
||||||
memset(hash, 0, sizeof hash);
|
|
||||||
x17hash(&hash[0], &buf[0]);
|
x17hash(&hash[0], &buf[0]);
|
||||||
printpfx("X17", hash);
|
printpfx("X17", hash);
|
||||||
|
|
||||||
@ -1797,5 +1775,5 @@ void print_hash_tests(void)
|
|||||||
|
|
||||||
do_gpu_tests();
|
do_gpu_tests();
|
||||||
|
|
||||||
//free(scratchbuf);
|
free(scratchbuf);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user