Reset OpenCL when settings change

- previously, changing the OpenCL vendor (or turning it on/off) required
  a restart and this wasn't clear
This commit is contained in:
Peter Šurda 2017-02-28 22:59:44 +01:00
parent 171bc83ec0
commit 8d829b587e
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
4 changed files with 15 additions and 1 deletions

View File

@ -2444,6 +2444,7 @@ class MyForm(settingsmixin.SMainWindow):
if self.settingsDialogInstance.ui.comboBoxOpenCL.currentText().toUtf8() != BMConfigParser().safeGet("bitmessagesettings", "opencl"):
BMConfigParser().set('bitmessagesettings', 'opencl', str(self.settingsDialogInstance.ui.comboBoxOpenCL.currentText()))
queues.workerQueue.put(('resetPoW', ''))
acceptableDifficultyChanged = False

View File

@ -120,6 +120,11 @@ class singleWorker(threading.Thread, StoppableThread):
self.sendOutOrStoreMyV4Pubkey(data)
except:
pass
elif command == 'resetPoW':
try:
proofofwork.resetPoW()
except:
pass
elif command == 'stopThread':
self.busy = 0
return

View File

@ -26,7 +26,12 @@ except:
libAvailable = False
def initCL():
global ctx, queue, program, enabledGpus, hash_dt
global ctx, queue, program, enabledGpus, hash_dt, vendors
gpus = []
ctx = False
enabledGpus = []
vendors = []
hash_dt = None
try:
hash_dt = numpy.dtype([('target', numpy.uint64), ('v', numpy.str_, 73)])
try:

View File

@ -231,6 +231,9 @@ def run(target, initialHash):
except:
pass #fallback
def resetPoW():
openclpow.initCL()
# init
def init():
global bitmsglib, bso, bmpow