Skip to content

Commit

Permalink
api: report throughput when default
Browse files Browse the repository at this point in the history
Conflicts:
	JHA/jackpotcoin.cu
	api/index.php
	cuda_nist5.cu
	fuguecoin.cpp
	groestlcoin.cpp
	heavy/heavy.cu
	lyra2/lyra2RE.cu
	myriadgroestl.cpp
	pentablake.cu
	quark/animecoin.cu
	quark/quarkcoin.cu
	qubit/deep.cu
	qubit/qubit.cu
	x11/fresh.cu
	x11/s3.cu
	x11/x11.cu
	x13/x13.cu
	x15/whirlpool.cu
	x15/x14.cu
	x15/x15.cu
	x17/x17.cu
  • Loading branch information
tpruvot authored and KlausT committed Jan 22, 2015
1 parent ef022e7 commit c92ef71
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 39 deletions.
1 change: 1 addition & 0 deletions Algo256/blake256.cu
Expand Up @@ -390,6 +390,7 @@ extern "C" int scanhash_blake256(int thr_id, uint32_t *pdata, const uint32_t *pt
#endif
int intensity = (device_sm[device_map[thr_id]] > 500) ? 22 : 20;
uint32_t throughput = opt_work_size ? opt_work_size : (1 << intensity);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, max_nonce - first_nonce);

int rc = 0;
Expand Down
1 change: 1 addition & 0 deletions Algo256/keccak256.cu
Expand Up @@ -43,6 +43,7 @@ extern "C" int scanhash_keccak256(int thr_id, uint32_t *pdata,
{
const uint32_t first_nonce = pdata[19];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 21); // 256*256*8*4
apiReportThroughput(thr_id, throughput);
throughput = min(throughput, (max_nonce - first_nonce));

if (opt_benchmark)
Expand Down
3 changes: 2 additions & 1 deletion JHA/jackpotcoin.cu
Expand Up @@ -95,7 +95,8 @@ extern "C" int scanhash_jackpot(int thr_id, uint32_t *pdata,
((uint32_t*)ptarget)[7] = 0x000f;

uint32_t throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*4096
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (!init[thr_id])
{
Expand Down
35 changes: 22 additions & 13 deletions api.cpp
Expand Up @@ -126,17 +126,6 @@ static void gpustatus(int thr_id)
#endif
cuda_gpu_clocks(cgpu);

// todo: can be 0 if set by algo (auto)
if (opt_intensity == 0 && opt_work_size) {
int i = 0;
uint32_t ws = opt_work_size;
while (ws > 1 && i++ < 32)
ws = ws >> 1;
cgpu->intensity = i;
} else {
cgpu->intensity = opt_intensity;
}

// todo: per gpu
cgpu->accepted = accepted_count;
cgpu->rejected = rejected_count;
Expand All @@ -146,10 +135,10 @@ static void gpustatus(int thr_id)
card = device_name[gpuid];

snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;"
"TEMP=%.1f;FAN=%hu;RPM=%hu;FREQ=%d;KHS=%.2f;HWF=%d;I=%d|THR=%u",
"TEMP=%.1f;FAN=%hu;RPM=%hu;FREQ=%d;KHS=%.2f;HWF=%d;I=%.2f;THR=%u|",
gpuid, cgpu->gpu_bus, card, cgpu->gpu_temp, cgpu->gpu_fan,
cgpu->gpu_fan_rpm, cgpu->gpu_clock, cgpu->khashes,
cgpu->hw_errors, cgpu->intensity, opt_work_size);
cgpu->hw_errors, cgpu->intensity, cgpu->throughput);

// append to buffer for multi gpus
strcat(buffer, buf);
Expand Down Expand Up @@ -885,3 +874,23 @@ void *api_thread(void *userdata)

return NULL;
}

/* to be able to report the default value set in each algo */
void apiReportThroughput(int thr_id, uint32_t throughput)
{
struct cgpu_info *cgpu = &thr_info[thr_id].gpu;
if (cgpu) {
cgpu->throughput = throughput;
if (opt_intensity == 0) {
uint8_t i = 0;
uint32_t ws = throughput;
while (ws > 1 && i++ < 32)
ws = ws >> 1;
cgpu->intensity_int = i;
} else {
cgpu->intensity_int = (uint8_t) opt_intensity;
}
// dec. part to finish...
cgpu->intensity = (float) cgpu->intensity_int;
}
}
1 change: 1 addition & 0 deletions api/index.php
Expand Up @@ -49,6 +49,7 @@ function translateField($key)
$intl['DIFF'] = 'Difficulty';
$intl['UPTIME'] = 'Miner up time';
$intl['TS'] = 'Last update';
$intl['THR'] = 'Throughput';

$intl['H'] = 'Bloc height';
$intl['I'] = 'Intensity';
Expand Down
1 change: 1 addition & 0 deletions cuda_nist5.cu
Expand Up @@ -74,6 +74,7 @@ extern "C" int scanhash_nist5(int thr_id, uint32_t *pdata,
((uint32_t*)ptarget)[7] = 0x00FF;

uint32_t throughput = opt_work_size ? opt_work_size : (1 << 20); // 256*4096
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int) (max_nonce - first_nonce));

if (!init[thr_id])
Expand Down
9 changes: 5 additions & 4 deletions fuguecoin.cpp
Expand Up @@ -27,16 +27,17 @@ extern "C" int scanhash_fugue256(int thr_id, uint32_t *pdata, const uint32_t *pt
{
uint32_t start_nonce = pdata[19]++;
int intensity = (device_sm[device_map[thr_id]] > 500) ? 22 : 19;
uint32_t throughPut = opt_work_size ? opt_work_size : (1 << intensity);
throughPut = min(throughPut, max_nonce - start_nonce);
uint32_t throughput = opt_work_size ? opt_work_size : (1 << intensity);
apiReportThroughput(thr_id, throughput);
throughput = min(throughput, max_nonce - start_nonce);

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0xf;

// init
if(!init[thr_id])
{
fugue256_cpu_init(thr_id, throughPut);
fugue256_cpu_init(thr_id, throughput);
init[thr_id] = true;
}

Expand All @@ -51,7 +52,7 @@ extern "C" int scanhash_fugue256(int thr_id, uint32_t *pdata, const uint32_t *pt
do {
// GPU
uint32_t foundNounce = 0xFFFFFFFF;
fugue256_cpu_hash(thr_id, throughPut, pdata[19], NULL, &foundNounce);
fugue256_cpu_hash(thr_id, throughput, pdata[19], NULL, &foundNounce);

if(foundNounce < 0xffffffff)
{
Expand Down
11 changes: 6 additions & 5 deletions groestlcoin.cpp
Expand Up @@ -64,18 +64,19 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t
uint32_t max_nonce, unsigned long *hashes_done)
{
uint32_t start_nonce = pdata[19]++;
uint32_t throughPut = opt_work_size ? opt_work_size : (1 << 19); // 256*2048
throughPut = min(throughPut, max_nonce - start_nonce);
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*2048
apiReportThroughput(thr_id, throughput);
throughput = min(throughput, max_nonce - start_nonce);

uint32_t *outputHash = (uint32_t*)malloc(throughPut * 16 * sizeof(uint32_t));
uint32_t *outputHash = (uint32_t*)malloc(throughput * 16 * sizeof(uint32_t));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x000000ff;

// init
if(!init[thr_id])
{
groestlcoin_cpu_init(thr_id, throughPut);
groestlcoin_cpu_init(thr_id, throughput);
init[thr_id] = true;
}

Expand All @@ -92,7 +93,7 @@ extern "C" int scanhash_groestlcoin(int thr_id, uint32_t *pdata, const uint32_t
uint32_t foundNounce = 0xFFFFFFFF;
const uint32_t Htarg = ptarget[7];

groestlcoin_cpu_hash(thr_id, throughPut, pdata[19], outputHash, &foundNounce);
groestlcoin_cpu_hash(thr_id, throughput, pdata[19], outputHash, &foundNounce);

if(foundNounce < 0xffffffff)
{
Expand Down
3 changes: 2 additions & 1 deletion heavy/heavy.cu
Expand Up @@ -137,7 +137,8 @@ int scanhash_heavy(int thr_id, uint32_t *pdata,
const uint32_t first_nonce = pdata[19];
// CUDA will process thousands of threads.
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 128*4096
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

int rc = 0;
uint32_t *hash = NULL;
Expand Down
3 changes: 2 additions & 1 deletion lyra2/lyra2RE.cu
Expand Up @@ -65,9 +65,10 @@ extern "C" int scanhash_lyra2(int thr_id, uint32_t *pdata,
const uint32_t first_nonce = pdata[19];
int intensity = (device_sm[device_map[thr_id]] > 500) ? 256 * 256 * 25 : 256 * 256 * 14;
if (device_sm[device_map[thr_id]] < 320) intensity = 256 * 256 * 6;

int throughput = opt_work_size ? opt_work_size : (1 << intensity); // 18=256*256*4;
uint32_t throughput = opt_work_size ? opt_work_size : intensity;
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x000f;
Expand Down
5 changes: 4 additions & 1 deletion miner.h
Expand Up @@ -378,6 +378,7 @@ extern int scanhash_x17(int thr_id, uint32_t *pdata,

/* api related */
void *api_thread(void *userdata);
void apiReportThroughput(int thr_id, uint32_t throughput);

struct cgpu_info {
uint8_t gpu_id;
Expand All @@ -386,7 +387,7 @@ struct cgpu_info {
int rejected;
int hw_errors;
double khashes;
uint8_t intensity;
uint8_t intensity_int;
uint8_t has_monitoring;
float gpu_temp;
uint16_t gpu_fan;
Expand All @@ -407,6 +408,8 @@ struct cgpu_info {

char gpu_sn[64];
char gpu_desc[64];
float intensity;
uint32_t throughput;
};

struct thr_api {
Expand Down
7 changes: 4 additions & 3 deletions myriadgroestl.cpp
Expand Up @@ -44,8 +44,9 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar

uint32_t start_nonce = pdata[19]++;

uint32_t throughPut = opt_work_size ? opt_work_size : (1 << 17);
throughPut = min(throughPut, max_nonce - start_nonce);
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 17);
apiReportThroughput(thr_id, throughput);
throughput = min(throughput, max_nonce - start_nonce);

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;
Expand All @@ -55,7 +56,7 @@ extern "C" int scanhash_myriad(int thr_id, uint32_t *pdata, const uint32_t *ptar
{
#if BIG_DEBUG
#else
myriadgroestl_cpu_init(thr_id, throughPut);
myriadgroestl_cpu_init(thr_id, throughput);
#endif
cudaMallocHost(&(h_found[thr_id]), 4 * sizeof(uint32_t));
init[thr_id] = true;
Expand Down
3 changes: 2 additions & 1 deletion pentablake.cu
Expand Up @@ -462,7 +462,8 @@ extern "C" int scanhash_pentablake(int thr_id, uint32_t *pdata, const uint32_t *
uint32_t endiandata[20];
int rc = 0;
uint32_t throughput = opt_work_size ? opt_work_size : (128 * 2560); // 18.5
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x000F;
Expand Down
3 changes: 2 additions & 1 deletion quark/animecoin.cu
Expand Up @@ -165,7 +165,8 @@ extern "C" int scanhash_anime(int thr_id, uint32_t *pdata,
{
const uint32_t first_nonce = pdata[19];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*2048
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00000f;
Expand Down
1 change: 1 addition & 0 deletions quark/quarkcoin.cu
Expand Up @@ -142,6 +142,7 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata,
int intensity = 128 * 256 * 30;
if (device_sm[device_map[thr_id]] == 520) intensity = 256 * 256 * 20;
uint32_t throughput = opt_work_size ? opt_work_size : intensity; // 256*4096
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, max_nonce - first_nonce);

if (opt_benchmark)
Expand Down
3 changes: 2 additions & 1 deletion qubit/deep.cu
Expand Up @@ -60,7 +60,8 @@ extern "C" int scanhash_deep(int thr_id, uint32_t *pdata,
const uint32_t first_nonce = pdata[19];
uint32_t endiandata[20];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000f;
Expand Down
1 change: 1 addition & 0 deletions qubit/doom.cu
Expand Up @@ -41,6 +41,7 @@ extern "C" int scanhash_doom(int thr_id, uint32_t *pdata,
const uint32_t first_nonce = pdata[19];
uint32_t endiandata[20];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 22); // 256*256*8*8
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (max_nonce - first_nonce));

if (opt_benchmark)
Expand Down
3 changes: 2 additions & 1 deletion qubit/qubit.cu
Expand Up @@ -79,7 +79,8 @@ extern "C" int scanhash_qubit(int thr_id, uint32_t *pdata,
uint32_t endiandata[20];
const uint32_t first_nonce = pdata[19];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;
Expand Down
1 change: 1 addition & 0 deletions x11/fresh.cu
Expand Up @@ -77,6 +77,7 @@ extern "C" int scanhash_fresh(int thr_id, uint32_t *pdata,
uint32_t endiandata[20];

uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8;
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int) (max_nonce - first_nonce));

if (opt_benchmark)
Expand Down
3 changes: 2 additions & 1 deletion x11/s3.cu
Expand Up @@ -62,7 +62,8 @@ extern "C" int scanhash_s3(int thr_id, uint32_t *pdata,
intensity--;
#endif
uint32_t throughput = opt_work_size ? opt_work_size : (1 << intensity);
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0xF;
Expand Down
1 change: 1 addition & 0 deletions x11/x11.cu
Expand Up @@ -152,6 +152,7 @@ extern "C" int scanhash_x11(int thr_id, uint32_t *pdata,
uint32_t throughput = opt_work_size ? opt_work_size : intensity; // 20=256*256*16;

throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);


if (opt_benchmark)
Expand Down
2 changes: 2 additions & 0 deletions x13/x13.cu
Expand Up @@ -158,6 +158,8 @@ extern "C" int scanhash_x13(int thr_id, uint32_t *pdata,
uint32_t endiandata[20];
int intensity = (device_sm[device_map[thr_id]] > 500) ? 256 * 256 * 20 : 256 * 256 * 10;
uint32_t throughput = opt_work_size ? opt_work_size : intensity; // 20=256*256*16;
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0xf;
Expand Down
3 changes: 2 additions & 1 deletion x15/whirlpool.cu
Expand Up @@ -58,7 +58,8 @@ extern "C" int scanhash_whc(int thr_id, uint32_t *pdata,
const uint32_t first_nonce = pdata[19];
uint32_t endiandata[20];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8;
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;
Expand Down
5 changes: 2 additions & 3 deletions x15/x14.cu
Expand Up @@ -158,9 +158,8 @@ extern "C" int scanhash_x14(int thr_id, uint32_t *pdata,
int intensity = 256 * 256 * 9;
if (device_sm[device_map[thr_id]] == 520) intensity = 256 * 256 * 15;
uint32_t throughput = opt_work_size ? opt_work_size : intensity; // 256*256*8;


throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, max_nonce - first_nonce);

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x000f;
Expand Down
2 changes: 2 additions & 0 deletions x15/x15.cu
Expand Up @@ -171,6 +171,8 @@ extern "C" int scanhash_x15(int thr_id, uint32_t *pdata,
int intensity = 256 * 256 * 9;
if (device_sm[device_map[thr_id]] == 520) intensity = 256 * 256 * 15;
uint32_t throughput = opt_work_size ? opt_work_size : intensity; // 256*256*8;
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00F;
Expand Down
3 changes: 2 additions & 1 deletion x17/x17.cu
Expand Up @@ -186,7 +186,8 @@ extern "C" int scanhash_x17(int thr_id, uint32_t *pdata,
{
const uint32_t first_nonce = pdata[19];
uint32_t throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8;
throughput = min(throughput, max_nonce - first_nonce);
apiReportThroughput(thr_id, (uint32_t) throughput);
throughput = min(throughput, (int)(max_nonce - first_nonce));

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x00ff;
Expand Down

0 comments on commit c92ef71

Please sign in to comment.