Fabcoin Core  0.16.2
P2P Digital Currency
libclwrapper.cpp
Go to the documentation of this file.
1 
2 #define _CRT_SECURE_NO_WARNINGS
3 
4 #include <cstdio>
5 #include <cstdlib>
6 //#include <chrono>
7 #include <fstream>
8 #include <streambuf>
9 #include <iostream>
10 #include <queue>
11 #include <vector>
12 #include <random>
13 //#include <atomic>
14 #include "libclwrapper.h"
15 #include "kernels/silentarmy.h" // Created from CMake
16 #include "kernels/silentarmy184.h" // Created from CMake
17 #include "../primitives/block.h"
18 
19 // workaround lame platforms
20 #if !CL_VERSION_1_2
21 #define CL_MAP_WRITE_INVALIDATE_REGION CL_MAP_WRITE
22 #define CL_MEM_HOST_READ_ONLY 0
23 #endif
24 
25 #undef min
26 #undef max
27 
28 //#define DEBUG
29 
30 using namespace std;
31 
32 unsigned const cl_gpuminer::c_defaultLocalWorkSize = 32;
33 unsigned const cl_gpuminer::c_defaultGlobalWorkSizeMultiplier = 4096; // * CL_DEFAULT_LOCAL_WORK_SIZE
34 unsigned const cl_gpuminer::c_defaultMSPerBatch = 0;
35 bool cl_gpuminer::s_allowCPU = false;
40 
41 #if defined(_WIN32)
42 extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString);
43 static std::atomic_flag s_logSpin = ATOMIC_FLAG_INIT;
44 #define CL_LOG(_contents) \
45  do \
46  { \
47  std::stringstream ss; \
48  ss << _contents; \
49  while (s_logSpin.test_and_set(std::memory_order_acquire)) {} \
50  OutputDebugStringA(ss.str().c_str()); \
51  cerr << ss.str() << endl << flush; \
52  s_logSpin.clear(std::memory_order_release); \
53  } while (false)
54 #else
55 #define CL_LOG(_contents) cout << "[OPENCL]:" << _contents << endl
56 #endif
57 
58 // Types of OpenCL devices we are interested in
59 #define CL_QUERIED_DEVICE_TYPES (CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR)
60 
61 cl_gpuminer::cl_gpuminer(unsigned int n, unsigned int k)
62 : m_openclOnePointOne()
63 {
64  PARAM_N = n;
65  PARAM_K = k;
66 
67  if( PARAM_N == 200 && PARAM_K == 9 )
68  NR_ROWS_LOG = 20;
69  else if( PARAM_N == 184 && PARAM_K == 7 )
70  NR_ROWS_LOG = 21;
71 
72  dst_solutions = (uint32_t *) malloc(10*(1<<PARAM_K)*sizeof(uint32_t));
73  if(dst_solutions == NULL)
74  std::cout << "Error allocating dst_solutions array!" << std::endl;
75 
76 }
77 
79 {
80  if(dst_solutions != NULL)
81  free(dst_solutions);
82  finish();
83 }
84 
85 std::vector<cl::Platform> cl_gpuminer::getPlatforms()
86 {
87  vector<cl::Platform> platforms;
88  try
89  {
90  cl::Platform::get(&platforms);
91  }
92  catch(cl::Error const& err)
93  {
94 #if defined(CL_PLATFORM_NOT_FOUND_KHR)
95  if (err.err() == CL_PLATFORM_NOT_FOUND_KHR)
96  CL_LOG("No OpenCL platforms found");
97  else
98 #endif
99  throw err;
100  }
101  return platforms;
102 }
103 
104 string cl_gpuminer::platform_info(unsigned _platformId, unsigned _deviceId)
105 {
106  vector<cl::Platform> platforms = getPlatforms();
107  if (platforms.empty())
108  return {};
109  // get GPU device of the selected platform
110  unsigned platform_num = min<unsigned>(_platformId, platforms.size() - 1);
111  vector<cl::Device> devices = getDevices(platforms, _platformId);
112  if (devices.empty())
113  {
114  CL_LOG("No OpenCL devices found.");
115  return {};
116  }
117 
118  // use selected default device
119  unsigned device_num = min<unsigned>(_deviceId, devices.size() - 1);
120  cl::Device& device = devices[device_num];
121  string device_version = device.getInfo<CL_DEVICE_VERSION>();
122 
123  return "{ \"platform\": \"" + platforms[platform_num].getInfo<CL_PLATFORM_NAME>() + "\", \"device\": \"" + device.getInfo<CL_DEVICE_NAME>() + "\", \"version\": \"" + device_version + "\" }";
124 }
125 
126 std::vector<cl::Device> cl_gpuminer::getDevices(std::vector<cl::Platform> const& _platforms, unsigned _platformId)
127 {
128  vector<cl::Device> devices;
129  unsigned platform_num = min<unsigned>(_platformId, _platforms.size() - 1);
130  try
131  {
132  _platforms[platform_num].getDevices(
133  s_allowCPU ? CL_DEVICE_TYPE_ALL : CL_QUERIED_DEVICE_TYPES,
134  &devices
135  );
136  }
137  catch (cl::Error const& err)
138  {
139  // if simply no devices found return empty vector
140  if (err.err() != CL_DEVICE_NOT_FOUND)
141  throw err;
142  }
143  return devices;
144 }
145 
147 {
148  vector<cl::Platform> platforms = getPlatforms();
149  if (platforms.empty())
150  return 0;
151  return platforms.size();
152 }
153 
154 unsigned cl_gpuminer::getNumDevices(unsigned _platformId)
155 {
156  vector<cl::Platform> platforms = getPlatforms();
157  if (platforms.empty())
158  return 0;
159 
160  vector<cl::Device> devices = getDevices(platforms, _platformId);
161  if (devices.empty())
162  {
163  CL_LOG("No OpenCL devices found.");
164  return 0;
165  }
166  return devices.size();
167 }
168 
169 // This needs customizing apon completion of the kernel - Checks memory requirements - May not be applicable
171  unsigned _platformId,
172  unsigned _localWorkSize,
173  unsigned _globalWorkSize
174 )
175 {
176  // Set the local/global work sizes
177  s_workgroupSize = _localWorkSize;
178  s_initialGlobalWorkSize = _globalWorkSize;
179 
180  return searchForAllDevices(_platformId, [](cl::Device const& _device) -> bool
181  {
182  cl_ulong result;
183  _device.getInfo(CL_DEVICE_GLOBAL_MEM_SIZE, &result);
184 
185  CL_LOG(
186  "Found suitable OpenCL device [" << _device.getInfo<CL_DEVICE_NAME>()
187  << "] with " << result << " bytes of GPU memory"
188  );
189  return true;
190  }
191  );
192 }
193 
194 bool cl_gpuminer::searchForAllDevices(function<bool(cl::Device const&)> _callback)
195 {
196  vector<cl::Platform> platforms = getPlatforms();
197  if (platforms.empty())
198  return false;
199  for (unsigned i = 0; i < platforms.size(); ++i)
200  if (searchForAllDevices(i, _callback))
201  return true;
202 
203  return false;
204 }
205 
206 bool cl_gpuminer::searchForAllDevices(unsigned _platformId, function<bool(cl::Device const&)> _callback)
207 {
208  vector<cl::Platform> platforms = getPlatforms();
209  if (platforms.empty())
210  return false;
211  if (_platformId >= platforms.size())
212  return false;
213 
214  vector<cl::Device> devices = getDevices(platforms, _platformId);
215  for (cl::Device const& device: devices)
216  if (_callback(device))
217  return true;
218 
219  return false;
220 }
221 
222 void cl_gpuminer::doForAllDevices(function<void(cl::Device const&)> _callback)
223 {
224  vector<cl::Platform> platforms = getPlatforms();
225  if (platforms.empty())
226  return;
227  for (unsigned i = 0; i < platforms.size(); ++i)
228  doForAllDevices(i, _callback);
229 }
230 
231 void cl_gpuminer::doForAllDevices(unsigned _platformId, function<void(cl::Device const&)> _callback)
232 {
233  vector<cl::Platform> platforms = getPlatforms();
234  if (platforms.empty())
235  return;
236  if (_platformId >= platforms.size())
237  return;
238 
239  vector<cl::Device> devices = getDevices(platforms, _platformId);
240  for (cl::Device const& device: devices)
241  _callback(device);
242 }
243 
245 {
246  string outString ="\nListing OpenCL devices.\nFORMAT: [deviceID] deviceName\n";
247  unsigned int i = 0;
248  doForAllDevices([&outString, &i](cl::Device const _device)
249  {
250  outString += "[" + to_string(i) + "] " + _device.getInfo<CL_DEVICE_NAME>() + "\n";
251  outString += "\tCL_DEVICE_TYPE: ";
252  switch (_device.getInfo<CL_DEVICE_TYPE>())
253  {
254  case CL_DEVICE_TYPE_CPU:
255  outString += "CPU\n";
256  break;
257  case CL_DEVICE_TYPE_GPU:
258  outString += "GPU\n";
259  break;
260  case CL_DEVICE_TYPE_ACCELERATOR:
261  outString += "ACCELERATOR\n";
262  break;
263  default:
264  outString += "DEFAULT\n";
265  break;
266  }
267  outString += "\tCL_DEVICE_GLOBAL_MEM_SIZE: " + to_string(_device.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>()) + "\n";
268  outString += "\tCL_DEVICE_MAX_MEM_ALLOC_SIZE: " + to_string(_device.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>()) + "\n";
269  outString += "\tCL_DEVICE_MAX_WORK_GROUP_SIZE: " + to_string(_device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>()) + "\n";
270  ++i;
271  }
272  );
273  CL_LOG(outString);
274 }
275 
277 {
278 
279  if (m_queue())
280  m_queue.finish();
281 }
282 
283 // Customise given kernel - This builds the kernel and creates memory buffers
285  unsigned _platformId,
286  unsigned _deviceId,
287  const std::vector<std::string> _kernels
288 )
289 {
290  // get all platforms
291  try
292  {
293  vector<cl::Platform> platforms = getPlatforms();
294  if (platforms.empty())
295  return false;
296 
297  // use selected platform
298  _platformId = min<unsigned>(_platformId, platforms.size() - 1);
299  CL_LOG("Using platform: " << platforms[_platformId].getInfo<CL_PLATFORM_NAME>().c_str());
300 
301  // get GPU device of the default platform
302  vector<cl::Device> devices = getDevices(platforms, _platformId);
303  if (devices.empty())
304  {
305  CL_LOG("No OpenCL devices found.");
306  return false;
307  }
308 
309  // use selected device
310  cl::Device& device = devices[min<unsigned>(_deviceId, devices.size() - 1)];
311  string device_version = device.getInfo<CL_DEVICE_VERSION>();
312  CL_LOG("Using device: " << device.getInfo<CL_DEVICE_NAME>().c_str() << "(" << device_version.c_str() << ")");
313 
314  if (strncmp("OpenCL 1.0", device_version.c_str(), 10) == 0)
315  {
316  CL_LOG("OpenCL 1.0 is not supported.");
317  return false;
318  }
319  if (strncmp("OpenCL 1.1", device_version.c_str(), 10) == 0)
320  m_openclOnePointOne = true;
321 
322  // create context
323  m_context = cl::Context(vector<cl::Device>(&device, &device + 1));
325 
326  // make sure that global work size is evenly divisible by the local workgroup size
330  // remember the device's address bits
331  m_deviceBits = device.getInfo<CL_DEVICE_ADDRESS_BITS>();
332  // make sure first step of global work size adjustment is large enough
333  m_stepWorkSizeAdjust = pow(2, m_deviceBits / 2 + 1);
334 
335  // patch source code
336  // note: CL_MINER_KERNEL is simply cl_gpuminer_kernel.cl compiled
337  // into a byte array by bin2h.cmake. There is no need to load the file by hand in runtime
338 
339  // Uncomment for loading kernel from compiled cl file.
340 #ifdef DEBUG
341  ifstream kernel_file("./libgpuminer/kernels/silentarmy.cl");
342  string code((istreambuf_iterator<char>(kernel_file)), istreambuf_iterator<char>());
343  kernel_file.close();
344 #else
345  unsigned char *pcodestr = nullptr;
346  size_t codesize = 0;
347  if( PARAM_N == 200 && PARAM_K == 9 )
348  {
349  pcodestr = (unsigned char *)CL_MINER_KERNEL;
350  codesize = CL_MINER_KERNEL_SIZE;
351  }
352  else if( PARAM_N == 184 && PARAM_K == 7 )
353  {
354  pcodestr = (unsigned char *)CL_MINER_KERNEL184;
355  codesize = CL_MINER_KERNEL_SIZE184;
356  }
357  else
358  {
359  CL_LOG("unsupported parameters: n=" << PARAM_N << ", k=" << PARAM_K);
360  return false;
361  }
362  string code(pcodestr, pcodestr+ codesize);
363 #endif
364  // create miner OpenCL program
365  cl::Program::Sources sources;
366  sources.push_back({ code.c_str(), code.size() });
367 
368  cl::Program program(m_context, sources);
369  try
370  {
371  program.build({ device });
372  CL_LOG("Printing program log");
373  CL_LOG(program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device).c_str());
374  }
375  catch (cl::Error const&)
376  {
377  CL_LOG(program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device).c_str());
378  return false;
379  }
380 
381  try
382  {
383  for (auto & _kernel : _kernels)
384  m_gpuKernels.push_back(cl::Kernel(program, _kernel.c_str()));
385  }
386  catch (cl::Error const& err)
387  {
388  CL_LOG("gpuKERNEL Creation failed: " << err.what() << "(" << err.err() << "). Bailing.");
389  return false;
390  }
391 
392  buf_dbg = cl::Buffer(m_context, CL_MEM_READ_WRITE, dbg_size, NULL, NULL);
394 
395  buf_ht[0] = cl::Buffer(m_context, CL_MEM_READ_WRITE, HT_SIZE(), NULL, NULL);
396  buf_ht[1] = cl::Buffer(m_context, CL_MEM_READ_WRITE, HT_SIZE(), NULL, NULL);
397  buf_sols = cl::Buffer(m_context, CL_MEM_READ_WRITE, sizeof(sols_t), NULL, NULL);
398  rowCounters[0] = cl::Buffer(m_context, CL_MEM_READ_WRITE, NR_ROWS(), NULL,NULL);
399  rowCounters[1] = cl::Buffer(m_context, CL_MEM_READ_WRITE, NR_ROWS(), NULL, NULL);
400 
401  m_queue.finish();
402 
403  }
404  catch (cl::Error const& err)
405  {
406  CL_LOG("CL ERROR:" << get_error_string(err.err()));
407  return false;
408  }
409  return true;
410 }
411 
412 
413 void cl_gpuminer::run(uint8_t *header, size_t header_len, uint256 nonce, sols_t *indices, uint32_t * n_sol, uint256 * ptr)
414 {
415  try
416  {
417  blake2b_state_t blake;
418  cl::Buffer buf_blake_st;
419  cl::Buffer databuf;
420  uint32_t sol_found = 0;
421  size_t local_ws = 64;
422  size_t global_ws;
423  unsigned char buf[136] = {0};
424  unsigned int round;
425 
426  assert(header_len == CBlockHeader::HEADER_SIZE || header_len == CBlockHeader::HEADER_NEWSIZE);
427  *ptr = *(uint256 *)(header + header_len - FABCOIN_NONCE_LEN);
428 
430 
431  zcash_blake2b_update(&blake, header, 128, 0);
432 
433  memcpy( buf + 8, header + 128, header_len - 128);
434  buf[0] = (header_len - 128)/8+1;
435 
436  buf_blake_st = cl::Buffer(m_context, CL_MEM_READ_ONLY, sizeof (blake.h), NULL, NULL);
437  m_queue.enqueueWriteBuffer(buf_blake_st, true, 0, sizeof(blake.h), blake.h);
438 
439  databuf = cl::Buffer(m_context, CL_MEM_READ_ONLY, 136, NULL, NULL);
440  m_queue.enqueueWriteBuffer(databuf, true, 0, 136, buf);
441  m_queue.finish();
442 
443  for (round = 0; round < PARAM_K; round++)
444  {
445  m_gpuKernels[0].setArg(0, buf_ht[round % 2]);
446  m_gpuKernels[0].setArg(1, rowCounters[round % 2]);
448 
449  if (!round)
450  {
451  m_gpuKernels[1+round].setArg(0, buf_blake_st);
452  m_gpuKernels[1+round].setArg(1, buf_ht[round % 2]);
453  m_gpuKernels[1+round].setArg(2, databuf);
454  m_gpuKernels[1+round].setArg(3, rowCounters[round % 2]);
455  global_ws = select_work_size_blake();
456  }
457  else
458  {
459  m_gpuKernels[1+round].setArg(0, buf_ht[(round - 1) % 2]);
460  m_gpuKernels[1+round].setArg(1, buf_ht[round % 2]);
461  m_gpuKernels[1+round].setArg(2, rowCounters[(round - 1) % 2]);
462  m_gpuKernels[1+round].setArg(3, rowCounters[round % 2]);
463  global_ws = NR_ROWS();
464  }
465  m_gpuKernels[1+round].setArg(4, buf_dbg);
466 
467  if (round == PARAM_K - 1)
468  {
469  m_gpuKernels[1+round].setArg(5, buf_sols);
470  }
471 
472  m_queue.enqueueNDRangeKernel(m_gpuKernels[1+round], cl::NullRange, cl::NDRange(global_ws), cl::NDRange(local_ws));
473  }
474 
475  m_gpuKernels[round+1].setArg(0, buf_ht[0]);
476  m_gpuKernels[round+1].setArg(1, buf_ht[1]);
477  m_gpuKernels[round+1].setArg(2, buf_sols);
478  m_gpuKernels[round+1].setArg(3, rowCounters[0]);
479  m_gpuKernels[round+1].setArg(4, rowCounters[1]);
480  global_ws = NR_ROWS();
481  m_queue.enqueueNDRangeKernel(m_gpuKernels[round+1], cl::NullRange, cl::NDRange(global_ws), cl::NDRange(local_ws));
482 
483  sols_t *sols;
484  size_t sz = sizeof(sols_t)*1;
485 
486  sols = (sols_t *)malloc(sz);
487  m_queue.enqueueReadBuffer(buf_sols, true, 0, sz, sols);
488  m_queue.finish();
489 
490  if (sols->nr > MAX_SOLS)
491  {
492  sols->nr = MAX_SOLS;
493  }
494 
495  for (unsigned sol_i = 0; sol_i < sols->nr; sol_i++)
496  sol_found += verify_sol(sols, sol_i);
497 
498  *n_sol = sol_found;
499  memcpy(indices, sols, sizeof(sols_t));
500  free(sols);
501  }
502  catch (cl::Error const& err)
503  {
504  CL_LOG("CL ERROR:" << get_error_string(err.err()));
505  }
506 }
static std::string platform_info(unsigned _platformId=0, unsigned _deviceId=0)
unsigned int m_stepWorkSizeAdjust
The step used in the work size adjustment.
Definition: libclwrapper.h:232
const cl_int zero
Definition: libclwrapper.h:223
const unsigned char CL_MINER_KERNEL[]
Definition: silentarmy.h:1
cl::CommandQueue m_queue
Definition: libclwrapper.h:212
cl_int getBuildInfo(const Device &device, cl_program_build_info name, T *param) const
Definition: cl.hpp:2506
static unsigned const c_defaultMSPerBatch
Default value of the milliseconds per global work size (per batch)
Definition: libclwrapper.h:110
unsigned m_globalWorkSize
Definition: libclwrapper.h:227
void zcash_blake2b_init(blake2b_state_t *st, uint8_t hash_len, uint32_t n, uint32_t k)
Definition: blake.cpp:34
static unsigned s_msPerBatch
The target milliseconds per batch for the search. If 0, then no adjustment will happen.
Definition: libclwrapper.h:241
void run(uint8_t *header, size_t header_len, uint256 nonce, sols_t *indices, uint32_t *n_sol, uint256 *ptr)
unsigned long HT_SIZE()
Definition: libclwrapper.h:298
unsigned int FABCOIN_HASH_LEN()
Definition: libclwrapper.h:305
cl_int enqueueWriteBuffer(const Buffer &buffer, cl_bool blocking,::size_t offset,::size_t size, const void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:2638
std::hash for asio::adress
Definition: Common.h:323
assert(len-trim+(2 *lenIndices)<=WIDTH)
static unsigned s_extraRequiredGPUMem
GPU memory required for other things, like window rendering e.t.c.
Definition: libclwrapper.h:246
static std::vector< cl::Platform > getPlatforms()
bytes code
Definition: SmartVM.cpp:45
static unsigned const c_defaultLocalWorkSize
Default value of the local work size. Also known as workgroup size.
Definition: libclwrapper.h:106
#define FABCOIN_NONCE_LEN
Definition: libclwrapper.h:8
static bool searchForAllDevices(unsigned _platformId, std::function< bool(cl::Device const &)> _callback)
#define CL_LOG(_contents)
cl_int finish() const
Definition: cl.hpp:3135
unsigned long NR_ROWS()
Definition: libclwrapper.h:288
size_t dbg_size
Definition: libclwrapper.h:221
static unsigned getNumDevices(unsigned _platformId=0)
static bool s_allowCPU
Allow CPU to appear as an OpenCL device or not. Default is false.
Definition: libclwrapper.h:243
bool init(unsigned _platformId, unsigned _deviceId, std::vector< std::string > _kernels)
cl_int enqueueFillBuffer(const Buffer &buffer, const void *ptr,::size_t pattern_size,::size_t offset,::size_t size, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:2657
std::vector< cl::Kernel > m_gpuKernels
Definition: libclwrapper.h:213
uint32_t * dst_solutions
Definition: libclwrapper.h:225
const char * get_error_string(cl_int error)
Definition: libclwrapper.h:318
cl_int enqueueNDRangeKernel(const Kernel &kernel, const NDRange &offset, const NDRange &global, const NDRange &local, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:2961
cl::Buffer buf_sols
Definition: libclwrapper.h:215
VECTOR_CLASS< std::pair< const char *,::size_t > > Sources
Definition: cl.hpp:2397
uint64_t nonce
Definition: libclwrapper.h:219
void zcash_blake2b_update(blake2b_state_t *st, const uint8_t *_msg, uint32_t msg_len, uint32_t is_final)
Definition: blake.cpp:78
static void listDevices()
cl::Context m_context
Definition: libclwrapper.h:211
unsigned int ROWS_PER_UINT()
Definition: libclwrapper.h:310
#define CL_QUERIED_DEVICE_TYPES
unsigned m_deviceBits
Definition: libclwrapper.h:229
uint64_t h[8]
Definition: blake.h:3
#define MAX_SOLS
Definition: libclwrapper.h:10
cl::Buffer buf_dbg
Definition: libclwrapper.h:216
256-bit opaque blob.
Definition: uint256.h:132
const size_t CL_MINER_KERNEL_SIZE184
CommandQueue interface for cl_command_queue.
Definition: cl.hpp:2566
uint nr
Definition: libclwrapper.h:15
static const size_t HEADER_SIZE
Definition: block.h:39
const size_t CL_MINER_KERNEL_SIZE
Definition: silentarmy.h:709
void * memcpy(void *a, const void *b, size_t c)
bool m_openclOnePointOne
Definition: libclwrapper.h:228
cl_int build(const VECTOR_CLASS< Device > &devices, const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
Definition: cl.hpp:2466
#define round(a, b, c, x, mul)
cl_int getInfo(cl_device_info name, T *param) const
Definition: cl.hpp:1208
static cl_int get(VECTOR_CLASS< Platform > *platforms)
Definition: cl.hpp:1397
unsigned int PARAM_K
Definition: libclwrapper.h:250
const unsigned char CL_MINER_KERNEL184[]
Definition: silentarmy184.h:1
Memory buffer interface.
Definition: cl.hpp:1748
NDRange interface.
Definition: cl.hpp:2218
cl_int enqueueReadBuffer(const Buffer &buffer, cl_bool blocking,::size_t offset,::size_t size, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:2619
size_t select_work_size_blake(void)
Definition: libclwrapper.h:152
uint32_t verify_sol(sols_t *sols, unsigned sol_i)
Definition: libclwrapper.h:183
unsigned int NR_ROWS_LOG
Definition: libclwrapper.h:251
Kernel interface that implements cl_kernel.
Definition: cl.hpp:2296
static void doForAllDevices(unsigned _platformId, std::function< void(cl::Device const &)> _callback)
static unsigned getNumPlatforms()
static unsigned s_workgroupSize
The local work size for the search.
Definition: libclwrapper.h:237
cl::Buffer rowCounters[2]
Definition: libclwrapper.h:217
Device interface for cl_device_id.
Definition: cl.hpp:1190
cl::Buffer buf_ht[2]
Definition: libclwrapper.h:214
__declspec(dllimport)
Definition: util_win32.c:26
static const size_t HEADER_NEWSIZE
Definition: block.h:40
Program interface that implements cl_program.
Definition: cl.hpp:2393
static std::vector< cl::Device > getDevices(std::vector< cl::Platform > const &_platforms, unsigned _platformId)
static unsigned const c_defaultGlobalWorkSizeMultiplier
Default value of the global work size as a multiplier of the local work size.
Definition: libclwrapper.h:108
struct sols_s sols_t
static bool configureGPU(unsigned _platformId, unsigned _localWorkSize, unsigned _globalWorkSize)
static unsigned s_initialGlobalWorkSize
The initial global work size for the searches.
Definition: libclwrapper.h:239
unsigned int PARAM_N
Definition: libclwrapper.h:249