Added AEON support [2/2].
parent
5cb91f4621
commit
854963e51e
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"algo": "cryptonight",
|
||||
"background": false,
|
||||
"colors": true,
|
||||
"donate-level": 5,
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
|
||||
CudaWorker::CudaWorker(Handle *handle) :
|
||||
m_lite(handle->isLite()),
|
||||
m_id(handle->threadId()),
|
||||
m_threads(handle->threads()),
|
||||
m_hashCount(0),
|
||||
|
@ -52,7 +53,7 @@ CudaWorker::CudaWorker(Handle *handle) :
|
|||
|
||||
void CudaWorker::start()
|
||||
{
|
||||
if (cuda_get_deviceinfo(&m_ctx) != 1 || cryptonight_gpu_init(&m_ctx) != 1) {
|
||||
if (cuda_get_deviceinfo(&m_ctx) != 1 || (m_lite ? cryptonight_gpu_init_lite(&m_ctx) : cryptonight_gpu_init(&m_ctx)) != 1) {
|
||||
printf("Setup failed for GPU %d. Exitting.\n", (int) m_id);
|
||||
return;
|
||||
}
|
||||
|
@ -78,7 +79,14 @@ void CudaWorker::start()
|
|||
uint32_t foundCount;
|
||||
|
||||
cryptonight_extra_cpu_prepare(&m_ctx, m_nonce);
|
||||
cryptonight_gpu_hash(&m_ctx);
|
||||
|
||||
if (m_lite) {
|
||||
cryptonight_gpu_hash_lite(&m_ctx);
|
||||
}
|
||||
else {
|
||||
cryptonight_gpu_hash(&m_ctx);
|
||||
}
|
||||
|
||||
cryptonight_extra_cpu_final(&m_ctx, m_nonce, m_job.target(), &foundCount, foundNonce);
|
||||
|
||||
for (size_t i = 0; i < foundCount; i++) {
|
||||
|
|
|
@ -53,6 +53,7 @@ private:
|
|||
void save(const Job &job);
|
||||
void storeStats();
|
||||
|
||||
bool m_lite;
|
||||
const int m_id;
|
||||
const int m_threads;
|
||||
Job m_job;
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include "workers/Handle.h"
|
||||
|
||||
|
||||
Handle::Handle(int threadId, GpuThread *thread, int threads) :
|
||||
Handle::Handle(int threadId, GpuThread *thread, int threads, bool lite) :
|
||||
m_lite(lite),
|
||||
m_threadId(threadId),
|
||||
m_gpuThread(thread),
|
||||
m_threads(threads),
|
||||
|
|
|
@ -36,10 +36,11 @@ class GpuThread;
|
|||
class Handle
|
||||
{
|
||||
public:
|
||||
Handle(int threadId, GpuThread *thread, int threads);
|
||||
Handle(int threadId, GpuThread *thread, int threads, bool lite);
|
||||
void join();
|
||||
void start(void (*callback) (void *));
|
||||
|
||||
inline bool isLite() const { return m_lite; }
|
||||
inline const GpuThread *gpuThread() const { return m_gpuThread; }
|
||||
inline int threadId() const { return m_threadId; }
|
||||
inline int threads() const { return m_threads; }
|
||||
|
@ -47,6 +48,7 @@ public:
|
|||
inline void setWorker(IWorker *worker) { m_worker = worker; }
|
||||
|
||||
private:
|
||||
bool m_lite;
|
||||
const int m_threadId;
|
||||
const GpuThread *m_gpuThread;
|
||||
const int m_threads;
|
||||
|
|
|
@ -166,7 +166,7 @@ void Workers::start(const std::vector<GpuThread*> &threads)
|
|||
uv_timer_start(&m_timer, Workers::onTick, 500, 500);
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
Handle *handle = new Handle((int) i, threads[i], (int) count);
|
||||
Handle *handle = new Handle((int) i, threads[i], (int) count, Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE);
|
||||
m_workers.push_back(handle);
|
||||
handle->start(Workers::onReady);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue