Skip to content

Commit

Permalink
Better error handling, when there is an error with init don't run kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
omaralvarez committed Oct 21, 2016
1 parent be6c0da commit f6baa2f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libzogminer/cl_zogminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace std;
unsigned const cl_zogminer::c_defaultLocalWorkSize = 64;
unsigned const cl_zogminer::c_defaultGlobalWorkSizeMultiplier = 4096; // * CL_DEFAULT_LOCAL_WORK_SIZE
unsigned const cl_zogminer::c_defaultMSPerBatch = 0;
bool cl_zogminer::s_allowCPU = true;
bool cl_zogminer::s_allowCPU = false;
unsigned cl_zogminer::s_extraRequiredGPUMem;
unsigned cl_zogminer::s_msPerBatch = cl_zogminer::c_defaultMSPerBatch;
unsigned cl_zogminer::s_workgroupSize = cl_zogminer::c_defaultLocalWorkSize;
Expand Down
4 changes: 2 additions & 2 deletions src/libzogminer/gpusolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ GPUSolver::GPUSolver() {
*/
std::vector<std::string> kernels {"initial_bucket_hashing", "bucket_collide_and_hash", "produce_solutions"};
if(GPU)
miner->init(0, 0, kernels);
initOK = miner->init(0, 0, kernels);

}

Expand Down Expand Up @@ -103,7 +103,7 @@ bool GPUSolver::GPUSolve200_9(const eh_HashState& base_state,
@params eh_HashState& base_state - Sends to kernel in a buffer. Will update for specific kernels
*/

if(GPU) {
if(GPU && initOK) {
auto t = std::chrono::high_resolution_clock::now();

miner->run(base_state);
Expand Down
1 change: 1 addition & 0 deletions src/libzogminer/gpusolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class GPUSolver {
private:
cl_zogminer * miner;
bool GPU;
bool initOK;

//TODO Really wasteful initialize and compile kernels once, not for every iter
bool GPUSolve200_9(const eh_HashState& base_state,
Expand Down

0 comments on commit f6baa2f

Please sign in to comment.