Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
cl_gpuminer Class Reference

#include <libclwrapper.h>

Collaboration diagram for cl_gpuminer:
[legend]

Public Member Functions

 cl_gpuminer (unsigned int n, unsigned int k)
 
 ~cl_gpuminer ()
 
bool init (unsigned _platformId, unsigned _deviceId, std::vector< std::string > _kernels)
 
void run (uint8_t *header, size_t header_len, uint256 nonce, sols_t *indices, uint32_t *n_sol, uint256 *ptr)
 
void finish ()
 
unsigned int PREFIX ()
 
unsigned int NR_INPUTS ()
 
unsigned int APX_NR_ELMS_LOG ()
 
unsigned int COLL_DATA_SIZE_PER_TH ()
 
unsigned int OVERHEAD ()
 
unsigned long NR_ROWS ()
 
unsigned long NR_SLOTS ()
 
unsigned long HT_SIZE ()
 
unsigned int FABCOIN_HASH_LEN ()
 
unsigned int ROWS_PER_UINT ()
 
const char * get_error_string (cl_int error)
 
 cl_gpuminer ()
 
 ~cl_gpuminer ()
 
bool init (unsigned _platformId, unsigned _deviceId, std::vector< std::string > _kernels)
 
void run (uint8_t *header, size_t header_len, uint256 nonce, sols_t *indices, uint32_t *n_sol, uint256 *ptr)
 
void finish ()
 

Static Public Member Functions

static bool searchForAllDevices (unsigned _platformId, std::function< bool(cl::Device const &)> _callback)
 
static bool searchForAllDevices (std::function< bool(cl::Device const &)> _callback)
 
static void doForAllDevices (unsigned _platformId, std::function< void(cl::Device const &)> _callback)
 
static void doForAllDevices (std::function< void(cl::Device const &)> _callback)
 
static unsigned getNumPlatforms ()
 
static unsigned getNumDevices (unsigned _platformId=0)
 
static std::string platform_info (unsigned _platformId=0, unsigned _deviceId=0)
 
static std::vector< cl::DevicegetDevices (std::vector< cl::Platform > const &_platforms, unsigned _platformId)
 
static std::vector< cl::PlatformgetPlatforms ()
 
static void listDevices ()
 
static bool configureGPU (unsigned _platformId, unsigned _localWorkSize, unsigned _globalWorkSize)
 
static bool searchForAllDevices (unsigned _platformId, std::function< bool(cl::Device const &)> _callback)
 
static bool searchForAllDevices (std::function< bool(cl::Device const &)> _callback)
 
static void doForAllDevices (unsigned _platformId, std::function< void(cl::Device const &)> _callback)
 
static void doForAllDevices (std::function< void(cl::Device const &)> _callback)
 
static unsigned getNumPlatforms ()
 
static unsigned getNumDevices (unsigned _platformId=0)
 
static std::string platform_info (unsigned _platformId=0, unsigned _deviceId=0)
 
static std::vector< cl::DevicegetDevices (std::vector< cl::Platform > const &_platforms, unsigned _platformId)
 
static std::vector< cl::PlatformgetPlatforms ()
 
static void listDevices ()
 
static bool configureGPU (unsigned _platformId, unsigned _localWorkSize, unsigned _globalWorkSize)
 

Public Attributes

unsigned int PARAM_N
 
unsigned int PARAM_K
 
unsigned int NR_ROWS_LOG
 

Static Public Attributes

static unsigned const c_defaultLocalWorkSize = 32
 Default value of the local work size. Also known as workgroup size. More...
 
static unsigned const c_defaultGlobalWorkSizeMultiplier = 4096
 Default value of the global work size as a multiplier of the local work size. More...
 
static unsigned const c_defaultMSPerBatch = 0
 Default value of the milliseconds per global work size (per batch) More...
 

Private Member Functions

int compare_indices32 (uint32_t *a, uint32_t *b, size_t n_current_indices)
 
void normalize_indices (uint32_t *indices)
 
char * s_hexdump (const void *_a, uint32_t a_len)
 
size_t select_work_size_blake (void)
 
void sort_pair (uint32_t *a, uint32_t len)
 
uint32_t verify_sol (sols_t *sols, unsigned sol_i)
 
int compare_indices32 (uint32_t *a, uint32_t *b, size_t n_current_indices)
 
void normalize_indices (uint32_t *indices)
 
char * s_hexdump (const void *_a, uint32_t a_len)
 
size_t select_work_size_blake (void)
 
void sort_pair (uint32_t *a, uint32_t len)
 
uint32_t verify_sol (sols_t *sols, unsigned sol_i)
 
const char * get_error_string (cl_int error)
 

Private Attributes

cl::Context m_context
 
cl::CommandQueue m_queue
 
std::vector< cl::Kernelm_gpuKernels
 
cl::Buffer buf_ht [2]
 
cl::Buffer buf_sols
 
cl::Buffer buf_dbg
 
cl::Buffer rowCounters [2]
 
uint64_t nonce
 
uint64_t total
 
size_t dbg_size = 1 * sizeof (debug_t)
 
const cl_int zero = 0
 
uint32_t solutions
 
uint32_t * dst_solutions
 
unsigned m_globalWorkSize
 
bool m_openclOnePointOne
 
unsigned m_deviceBits
 
unsigned int m_stepWorkSizeAdjust
 The step used in the work size adjustment. More...
 
int m_wayWorkSizeAdjust = 0
 The Work Size way of adjustment, > 0 when previously increased, < 0 when previously decreased. More...
 

Static Private Attributes

static const unsigned int z_n = 200
 
static const unsigned int z_k = 9
 
static const size_t z_collision_bit_length = z_n / (z_k + 1)
 
static const eh_index z_N = 1 << (z_collision_bit_length + 1)
 
static unsigned s_workgroupSize = cl_gpuminer::c_defaultLocalWorkSize
 The local work size for the search. More...
 
static unsigned s_initialGlobalWorkSize = cl_gpuminer::c_defaultGlobalWorkSizeMultiplier * cl_gpuminer::c_defaultLocalWorkSize
 The initial global work size for the searches. More...
 
static unsigned s_msPerBatch = cl_gpuminer::c_defaultMSPerBatch
 The target milliseconds per batch for the search. If 0, then no adjustment will happen. More...
 
static bool s_allowCPU = false
 Allow CPU to appear as an OpenCL device or not. Default is false. More...
 
static unsigned s_extraRequiredGPUMem
 GPU memory required for other things, like window rendering e.t.c. More...
 

Detailed Description

Definition at line 68 of file libclwrapper.h.

Constructor & Destructor Documentation

cl_gpuminer::cl_gpuminer ( unsigned int  n,
unsigned int  k 
)

Definition at line 61 of file libclwrapper.cpp.

cl_gpuminer::~cl_gpuminer ( )

Definition at line 78 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

cl_gpuminer::cl_gpuminer ( )

Definition at line 60 of file libclwrapper.cpp.

Here is the call graph for this function:

cl_gpuminer::~cl_gpuminer ( )

Member Function Documentation

unsigned int cl_gpuminer::APX_NR_ELMS_LOG ( )
inline

Definition at line 263 of file libclwrapper.h.

unsigned int cl_gpuminer::COLL_DATA_SIZE_PER_TH ( )
inline

Definition at line 268 of file libclwrapper.h.

int cl_gpuminer::compare_indices32 ( uint32_t *  a,
uint32_t *  b,
size_t  n_current_indices 
)
inlineprivate

Definition at line 118 of file libclwrapper.h.

int cl_gpuminer::compare_indices32 ( uint32_t *  a,
uint32_t *  b,
size_t  n_current_indices 
)
inlineprivate

Definition at line 118 of file libclwrapper.h.

static bool cl_gpuminer::configureGPU ( unsigned  _platformId,
unsigned  _localWorkSize,
unsigned  _globalWorkSize 
)
static
bool cl_gpuminer::configureGPU ( unsigned  _platformId,
unsigned  _localWorkSize,
unsigned  _globalWorkSize 
)
static

Definition at line 170 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static void cl_gpuminer::doForAllDevices ( unsigned  _platformId,
std::function< void(cl::Device const &)>  _callback 
)
static
static void cl_gpuminer::doForAllDevices ( unsigned  _platformId,
std::function< void(cl::Device const &)>  _callback 
)
static

Here is the caller graph for this function:

static void cl_gpuminer::doForAllDevices ( std::function< void(cl::Device const &)>  _callback)
static
static void cl_gpuminer::doForAllDevices ( std::function< void(cl::Device const &)>  _callback)
static
unsigned int cl_gpuminer::FABCOIN_HASH_LEN ( )
inline

Definition at line 305 of file libclwrapper.h.

Here is the caller graph for this function:

void cl_gpuminer::finish ( )
void cl_gpuminer::finish ( )

Definition at line 276 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const char* cl_gpuminer::get_error_string ( cl_int  error)
inlineprivate

Definition at line 248 of file libclwrapper.h.

const char* cl_gpuminer::get_error_string ( cl_int  error)
inline

Definition at line 318 of file libclwrapper.h.

Here is the caller graph for this function:

std::vector< cl::Device > cl_gpuminer::getDevices ( std::vector< cl::Platform > const &  _platforms,
unsigned  _platformId 
)
static

Definition at line 126 of file libclwrapper.cpp.

Here is the caller graph for this function:

static std::vector<cl::Device> cl_gpuminer::getDevices ( std::vector< cl::Platform > const &  _platforms,
unsigned  _platformId 
)
static
static unsigned cl_gpuminer::getNumDevices ( unsigned  _platformId = 0)
static
unsigned cl_gpuminer::getNumDevices ( unsigned  _platformId = 0)
static

Definition at line 154 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned cl_gpuminer::getNumPlatforms ( )
static
unsigned cl_gpuminer::getNumPlatforms ( )
static

Definition at line 146 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< cl::Platform > cl_gpuminer::getPlatforms ( )
static

Definition at line 85 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static std::vector<cl::Platform> cl_gpuminer::getPlatforms ( )
static
unsigned long cl_gpuminer::HT_SIZE ( )
inline

Definition at line 298 of file libclwrapper.h.

Here is the caller graph for this function:

bool cl_gpuminer::init ( unsigned  _platformId,
unsigned  _deviceId,
std::vector< std::string >  _kernels 
)
bool cl_gpuminer::init ( unsigned  _platformId,
unsigned  _deviceId,
std::vector< std::string >  _kernels 
)

Definition at line 284 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void cl_gpuminer::listDevices ( )
static

Definition at line 244 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static void cl_gpuminer::listDevices ( )
static
void cl_gpuminer::normalize_indices ( uint32_t *  indices)
inlineprivate

Definition at line 130 of file libclwrapper.h.

Here is the call graph for this function:

void cl_gpuminer::normalize_indices ( uint32_t *  indices)
inlineprivate

Definition at line 130 of file libclwrapper.h.

Here is the call graph for this function:

unsigned int cl_gpuminer::NR_INPUTS ( )
inline

Definition at line 258 of file libclwrapper.h.

unsigned long cl_gpuminer::NR_ROWS ( )
inline

Definition at line 288 of file libclwrapper.h.

Here is the caller graph for this function:

unsigned long cl_gpuminer::NR_SLOTS ( )
inline

Definition at line 293 of file libclwrapper.h.

unsigned int cl_gpuminer::OVERHEAD ( )
inline

Definition at line 273 of file libclwrapper.h.

static std::string cl_gpuminer::platform_info ( unsigned  _platformId = 0,
unsigned  _deviceId = 0 
)
static
string cl_gpuminer::platform_info ( unsigned  _platformId = 0,
unsigned  _deviceId = 0 
)
static

Definition at line 104 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int cl_gpuminer::PREFIX ( )
inline

Definition at line 253 of file libclwrapper.h.

Here is the caller graph for this function:

unsigned int cl_gpuminer::ROWS_PER_UINT ( )
inline

Definition at line 310 of file libclwrapper.h.

Here is the caller graph for this function:

void cl_gpuminer::run ( uint8_t *  header,
size_t  header_len,
uint256  nonce,
sols_t indices,
uint32_t *  n_sol,
uint256 ptr 
)
void cl_gpuminer::run ( uint8_t *  header,
size_t  header_len,
uint256  nonce,
sols_t indices,
uint32_t *  n_sol,
uint256 ptr 
)

Definition at line 413 of file libclwrapper.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

char* cl_gpuminer::s_hexdump ( const void *  _a,
uint32_t  a_len 
)
inlineprivate

Definition at line 142 of file libclwrapper.h.

char* cl_gpuminer::s_hexdump ( const void *  _a,
uint32_t  a_len 
)
inlineprivate

Definition at line 142 of file libclwrapper.h.

static bool cl_gpuminer::searchForAllDevices ( unsigned  _platformId,
std::function< bool(cl::Device const &)>  _callback 
)
static

Here is the caller graph for this function:

static bool cl_gpuminer::searchForAllDevices ( unsigned  _platformId,
std::function< bool(cl::Device const &)>  _callback 
)
static
static bool cl_gpuminer::searchForAllDevices ( std::function< bool(cl::Device const &)>  _callback)
static
static bool cl_gpuminer::searchForAllDevices ( std::function< bool(cl::Device const &)>  _callback)
static
size_t cl_gpuminer::select_work_size_blake ( void  )
inlineprivate

Definition at line 152 of file libclwrapper.h.

size_t cl_gpuminer::select_work_size_blake ( void  )
inlineprivate

Definition at line 152 of file libclwrapper.h.

Here is the caller graph for this function:

void cl_gpuminer::sort_pair ( uint32_t *  a,
uint32_t  len 
)
inlineprivate

Definition at line 167 of file libclwrapper.h.

void cl_gpuminer::sort_pair ( uint32_t *  a,
uint32_t  len 
)
inlineprivate

Definition at line 167 of file libclwrapper.h.

uint32_t cl_gpuminer::verify_sol ( sols_t sols,
unsigned  sol_i 
)
inlineprivate

Definition at line 183 of file libclwrapper.h.

uint32_t cl_gpuminer::verify_sol ( sols_t sols,
unsigned  sol_i 
)
inlineprivate

Definition at line 183 of file libclwrapper.h.

Here is the caller graph for this function:

Member Data Documentation

cl::Buffer cl_gpuminer::buf_dbg
private

Definition at line 216 of file libclwrapper.h.

cl::Buffer cl_gpuminer::buf_ht
private

Definition at line 214 of file libclwrapper.h.

cl::Buffer cl_gpuminer::buf_sols
private

Definition at line 215 of file libclwrapper.h.

static unsigned const cl_gpuminer::c_defaultGlobalWorkSizeMultiplier = 4096
static

Default value of the global work size as a multiplier of the local work size.

Definition at line 108 of file libclwrapper.h.

static unsigned const cl_gpuminer::c_defaultLocalWorkSize = 32
static

Default value of the local work size. Also known as workgroup size.

Definition at line 106 of file libclwrapper.h.

static unsigned const cl_gpuminer::c_defaultMSPerBatch = 0
static

Default value of the milliseconds per global work size (per batch)

Definition at line 110 of file libclwrapper.h.

size_t cl_gpuminer::dbg_size = 1 * sizeof (debug_t)
private

Definition at line 221 of file libclwrapper.h.

uint32_t * cl_gpuminer::dst_solutions
private

Definition at line 225 of file libclwrapper.h.

cl::Context cl_gpuminer::m_context
private

Definition at line 211 of file libclwrapper.h.

unsigned cl_gpuminer::m_deviceBits
private

Definition at line 229 of file libclwrapper.h.

unsigned cl_gpuminer::m_globalWorkSize
private

Definition at line 227 of file libclwrapper.h.

std::vector< cl::Kernel > cl_gpuminer::m_gpuKernels
private

Definition at line 213 of file libclwrapper.h.

bool cl_gpuminer::m_openclOnePointOne
private

Definition at line 228 of file libclwrapper.h.

cl::CommandQueue cl_gpuminer::m_queue
private

Definition at line 212 of file libclwrapper.h.

unsigned int cl_gpuminer::m_stepWorkSizeAdjust
private

The step used in the work size adjustment.

Definition at line 232 of file libclwrapper.h.

int cl_gpuminer::m_wayWorkSizeAdjust = 0
private

The Work Size way of adjustment, > 0 when previously increased, < 0 when previously decreased.

Definition at line 234 of file libclwrapper.h.

uint64_t cl_gpuminer::nonce
private

Definition at line 219 of file libclwrapper.h.

unsigned int cl_gpuminer::NR_ROWS_LOG

Definition at line 251 of file libclwrapper.h.

unsigned int cl_gpuminer::PARAM_K

Definition at line 250 of file libclwrapper.h.

unsigned int cl_gpuminer::PARAM_N

Definition at line 249 of file libclwrapper.h.

cl::Buffer cl_gpuminer::rowCounters
private

Definition at line 217 of file libclwrapper.h.

static bool cl_gpuminer::s_allowCPU = false
staticprivate

Allow CPU to appear as an OpenCL device or not. Default is false.

Definition at line 243 of file libclwrapper.h.

static unsigned cl_gpuminer::s_extraRequiredGPUMem
staticprivate

GPU memory required for other things, like window rendering e.t.c.

User can set it via the –cl-extragpu-mem argument.

Definition at line 246 of file libclwrapper.h.

static unsigned cl_gpuminer::s_initialGlobalWorkSize = cl_gpuminer::c_defaultGlobalWorkSizeMultiplier * cl_gpuminer::c_defaultLocalWorkSize
staticprivate

The initial global work size for the searches.

Definition at line 239 of file libclwrapper.h.

static unsigned cl_gpuminer::s_msPerBatch = cl_gpuminer::c_defaultMSPerBatch
staticprivate

The target milliseconds per batch for the search. If 0, then no adjustment will happen.

Definition at line 241 of file libclwrapper.h.

static unsigned cl_gpuminer::s_workgroupSize = cl_gpuminer::c_defaultLocalWorkSize
staticprivate

The local work size for the search.

Definition at line 237 of file libclwrapper.h.

uint32_t cl_gpuminer::solutions
private

Definition at line 224 of file libclwrapper.h.

uint64_t cl_gpuminer::total
private

Definition at line 220 of file libclwrapper.h.

static const size_t cl_gpuminer::z_collision_bit_length = z_n / (z_k + 1)
staticprivate

Definition at line 115 of file libclwrapper.h.

static const unsigned int cl_gpuminer::z_k = 9
staticprivate

Definition at line 114 of file libclwrapper.h.

static const unsigned int cl_gpuminer::z_n = 200
staticprivate

Definition at line 113 of file libclwrapper.h.

static const eh_index cl_gpuminer::z_N = 1 << (z_collision_bit_length + 1)
staticprivate

Definition at line 116 of file libclwrapper.h.

const cl_int cl_gpuminer::zero = 0
private

Definition at line 223 of file libclwrapper.h.


The documentation for this class was generated from the following files: