Browse Source

cuda: throughput2intensity function to show default

master
Tanguy Pruvot 8 years ago
parent
commit
65cd430d76
  1. 15
      cuda.cpp
  2. 1
      lbry/lbry.cu
  3. 1
      miner.h

15
cuda.cpp

@ -172,6 +172,21 @@ uint32_t cuda_default_throughput(int thr_id, uint32_t defcount) @@ -172,6 +172,21 @@ uint32_t cuda_default_throughput(int thr_id, uint32_t defcount)
return throughput;
}
// since 1.8.3
double throughput2intensity(uint32_t throughput)
{
double intensity = 0.;
uint32_t ws = throughput;
uint8_t i = 0;
while (ws > 1 && i++ < 32)
ws = ws >> 1;
intensity = (double) i;
if (i && ((1U << i) < throughput)) {
intensity += ((double) (throughput-(1U << i)) / (1U << i));
}
return intensity;
}
// if we use 2 threads on the same gpu, we need to reinit the threads
void cuda_reset_device(int thr_id, bool *init)
{

1
lbry/lbry.cu

@ -116,6 +116,7 @@ extern "C" int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce, @@ -116,6 +116,7 @@ extern "C" int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce,
cudaDeviceSetCacheConfig(cudaFuncCachePreferL1);
CUDA_LOG_ERROR();
}
gpulog(LOG_INFO, thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput);
if(device_sm[dev_id] <= 500)
CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], (size_t) 8 * sizeof(uint64_t) * throughput));

1
miner.h

@ -513,6 +513,7 @@ int cuda_available_memory(int thr_id); @@ -513,6 +513,7 @@ int cuda_available_memory(int thr_id);
uint32_t cuda_default_throughput(int thr_id, uint32_t defcount);
#define device_intensity(t,f,d) cuda_default_throughput(t,d)
double throughput2intensity(uint32_t throughput);
void cuda_log_lasterror(int thr_id, const char* func, int line);
void cuda_clear_lasterror();

Loading…
Cancel
Save