Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
Free light cache on host after DAG gen, and add warning of slow DAG gen
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-m-cyr committed Jul 28, 2020
1 parent 4da38fc commit 09bf291
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libethash-cl/CLMiner.cpp
Expand Up @@ -875,8 +875,11 @@ bool CLMiner::initEpoch_internal()
throw;
}
if (light_on_host)
{
m_light.emplace_back(m_context[0], CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR,
m_epochContext.lightSize);
cllog << "WARNING: Generating DAG will take minutes, not seconds";
}
cllog << "Loading kernels";

// If we have a binary kernel to use, let's try it
Expand Down
6 changes: 6 additions & 0 deletions libethash-cuda/CUDAMiner.cpp
Expand Up @@ -126,8 +126,11 @@ bool CUDAMiner::initEpoch_internal()

// create buffer for cache
if (lightOnHost)
{
CUDA_SAFE_CALL(cudaHostAlloc(reinterpret_cast<void**>(&light),
m_epochContext.lightSize, cudaHostAllocDefault));
cudalog << "WARNING: Generating DAG will take minutes, not seconds";
}
else
CUDA_SAFE_CALL(
cudaMalloc(reinterpret_cast<void**>(&light), m_epochContext.lightSize));
Expand Down Expand Up @@ -158,6 +161,9 @@ bool CUDAMiner::initEpoch_internal()
ethash_generate_dag(
m_epochContext.dagSize, m_settings.gridSize, m_settings.blockSize, m_streams[0]);

if (lightOnHost)
CUDA_SAFE_CALL(cudaFreeHost(reinterpret_cast<void*>(light)));

cudalog << "Generated DAG + Light in "
<< std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now() - startInit)
Expand Down

0 comments on commit 09bf291

Please sign in to comment.