MCPcopy Create free account
hub / github.com/brichard19/BitCrack / CLKeySearchDevice

Method CLKeySearchDevice

CLKeySearchDevice/CLKeySearchDevice.cpp:33–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33CLKeySearchDevice::CLKeySearchDevice(uint64_t device, int threads, int pointsPerThread, int blocks)
34{
35 _threads = threads;
36 _blocks = blocks;
37 _points = pointsPerThread * threads * blocks;
38 _device = (cl_device_id)device;
39
40
41 if(threads <= 0 || threads % 32 != 0) {
42 throw KeySearchException("The number of threads must be a multiple of 32");
43 }
44
45 if(pointsPerThread <= 0) {
46 throw KeySearchException("At least 1 point per thread required");
47 }
48
49 try {
50 // Create the context
51 _clContext = new cl::CLContext(_device);
52 Logger::log(LogLevel::Info, "Compiling OpenCL kernels...");
53 _clProgram = new cl::CLProgram(*_clContext, _bitcrack_cl);
54
55 // Load the kernels
56 _initKeysKernel = new cl::CLKernel(*_clProgram, "multiplyStepKernel");
57 _initKeysKernel->getWorkGroupSize();
58
59 _stepKernel = new cl::CLKernel(*_clProgram, "keyFinderKernel");
60 _stepKernelWithDouble = new cl::CLKernel(*_clProgram, "keyFinderKernelWithDouble");
61
62 _globalMemSize = _clContext->getGlobalMemorySize();
63
64 _deviceName = _clContext->getDeviceName();
65 } catch(cl::CLException ex) {
66 throw KeySearchException(ex.msg);
67 }
68
69 _iterations = 0;
70}
71
72CLKeySearchDevice::~CLKeySearchDevice()
73{

Callers

nothing calls this directly

Calls 4

KeySearchExceptionClass · 0.85
getWorkGroupSizeMethod · 0.80
getGlobalMemorySizeMethod · 0.80
getDeviceNameMethod · 0.45

Tested by

no test coverage detected