blob: fcd24fa89e12ba9f70ce238dc11f057f446a5912 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#pragma once
#include "xmrstak/jconf.hpp"
#include "jconf.hpp"
#include "nvcc_code/cryptonight.hpp"
#include "xmrstak/backend/cpu/minethd.hpp"
#include "xmrstak/backend/iBackend.hpp"
#include "xmrstak/misc/environment.hpp"
#include <iostream>
#include <thread>
#include <atomic>
#include <vector>
#include <future>
namespace xmrstak
{
namespace nvidia
{
class minethd : public iBackend
{
public:
static void switch_work(miner_work& pWork);
static std::vector<iBackend*>* thread_starter(uint32_t threadOffset, miner_work& pWork);
static bool self_test();
private:
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx*);
minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg);
void start_mining();
void work_main();
void consume_work();
static std::atomic<uint64_t> iGlobalJobNo;
static std::atomic<uint64_t> iConsumeCnt;
static uint64_t iThreadCount;
uint64_t iJobNo;
static miner_work oGlobalWork;
miner_work oWork;
std::promise<void> numa_promise;
std::promise<void> thread_work_promise;
// block thread until all NVIDIA GPUs are initialized
std::future<void> thread_work_guard;
std::thread oWorkThd;
int64_t affinity;
nvid_ctx ctx;
bool bQuit;
};
} // namespace nvidia
} // namepsace xmrstak
|