1
0
mirror of https://github.com/GOSTSec/ccminer synced 2025-02-03 10:24:24 +00:00

equihash: missing free on benchs

This commit is contained in:
Tanguy Pruvot 2017-10-09 14:39:00 +02:00
parent e505d1051d
commit cf18cb632c
5 changed files with 19 additions and 5 deletions

View File

@ -147,6 +147,9 @@ extern "C" int scanhash_jha(int thr_id, struct work *work, uint32_t max_nonce, u
CUDA_LOG_ERROR();
}
cuda_get_arch(thr_id);
if (cuda_arch[dev_id] >= 500) {
applog(LOG_WARNING, "You are not using the optimal algo, please try -a jackpot");
}
gpulog(LOG_INFO, thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput);
CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], (size_t) 64 * throughput));

View File

@ -59,6 +59,7 @@ void algo_free_all(int thr_id)
free_cryptonight(thr_id);
free_decred(thr_id);
free_deep(thr_id);
free_equihash(thr_id);
free_keccak256(thr_id);
free_fresh(thr_id);
free_fugue256(thr_id);

View File

@ -2081,7 +2081,7 @@ __host__ void eq_cuda_context<RB, SM, SSM, THREADS, PACKER>::solve(const char *t
// destructor
template <u32 RB, u32 SM, u32 SSM, u32 THREADS, typename PACKER>
__host__
eq_cuda_context<RB, SM, SSM, THREADS, PACKER>::~eq_cuda_context()
void eq_cuda_context<RB, SM, SSM, THREADS, PACKER>::freemem()
{
if (solutions)
free(solutions);
@ -2104,6 +2104,12 @@ eq_cuda_context<RB, SM, SSM, THREADS, PACKER>::~eq_cuda_context()
}
}
template <u32 RB, u32 SM, u32 SSM, u32 THREADS, typename PACKER>
__host__
eq_cuda_context<RB, SM, SSM, THREADS, PACKER>::~eq_cuda_context()
{
freemem();
}
#ifdef CONFIG_MODE_1
template class eq_cuda_context<CONFIG_MODE_1>;

View File

@ -90,7 +90,7 @@ template <u32 RB, u32 SM> struct equi;
struct eq_cuda_context_interface
{
virtual ~eq_cuda_context_interface();
//virtual ~eq_cuda_context_interface();
virtual void solve(const char *tequihash_header,
unsigned int tequihash_header_len,
@ -99,6 +99,7 @@ struct eq_cuda_context_interface
fn_cancel cancelf,
fn_solution solutionf,
fn_hashdone hashdonef);
public:
int thread_id;
int device_id;
@ -125,9 +126,9 @@ class eq_cuda_context : public eq_cuda_context_interface
fn_cancel cancelf,
fn_solution solutionf,
fn_hashdone hashdonef);
public:
eq_cuda_context(int thr_id, int dev_id);
void freemem();
~eq_cuda_context();
};

View File

@ -281,7 +281,11 @@ void free_equihash(int thr_id)
if (!init[thr_id])
return;
delete(solvers[thr_id]);
// assume config 1 was used... interface destructor seems bad
eq_cuda_context<CONFIG_MODE_1>* ptr = dynamic_cast<eq_cuda_context<CONFIG_MODE_1>*>(solvers[thr_id]);
ptr->freemem();
ptr = NULL;
solvers[thr_id] = NULL;
init[thr_id] = false;
@ -291,4 +295,3 @@ void free_equihash(int thr_id)
void eq_cuda_context_interface::solve(const char *tequihash_header, unsigned int tequihash_header_len,
const char* nonce, unsigned int nonce_len,
fn_cancel cancelf, fn_solution solutionf, fn_hashdone hashdonef) { }
eq_cuda_context_interface::~eq_cuda_context_interface() { }