| 59 | } |
| 60 | |
| 61 | void CudaKeySearchDevice::init(const secp256k1::uint256 &start, int compression, const secp256k1::uint256 &stride) |
| 62 | { |
| 63 | if(start.cmp(secp256k1::N) >= 0) { |
| 64 | throw KeySearchException("Starting key is out of range"); |
| 65 | } |
| 66 | |
| 67 | _startExponent = start; |
| 68 | |
| 69 | _compression = compression; |
| 70 | |
| 71 | _stride = stride; |
| 72 | |
| 73 | cudaCall(cudaSetDevice(_device)); |
| 74 | |
| 75 | // Block on kernel calls |
| 76 | cudaCall(cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync)); |
| 77 | |
| 78 | // Use a larger portion of shared memory for L1 cache |
| 79 | cudaCall(cudaDeviceSetCacheConfig(cudaFuncCachePreferL1)); |
| 80 | |
| 81 | generateStartingPoints(); |
| 82 | |
| 83 | cudaCall(allocateChainBuf(_threads * _blocks * _pointsPerThread)); |
| 84 | |
| 85 | // Set the incrementor |
| 86 | secp256k1::ecpoint g = secp256k1::G(); |
| 87 | secp256k1::ecpoint p = secp256k1::multiplyPoint(secp256k1::uint256((uint64_t)_threads * _blocks * _pointsPerThread) * _stride, g); |
| 88 | |
| 89 | cudaCall(_resultList.init(sizeof(CudaDeviceResult), 16)); |
| 90 | |
| 91 | cudaCall(setIncrementorPoint(p.x, p.y)); |
| 92 | } |
| 93 | |
| 94 | |
| 95 | void CudaKeySearchDevice::generateStartingPoints() |
no test coverage detected