Reset OpenCL when settings change

- previously, changing the OpenCL vendor (or turning it on/off) required
  a restart and this wasn't clear
master
Peter Šurda 6 years ago
parent 171bc83ec0
commit 8d829b587e
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
  1. 1
      src/bitmessageqt/__init__.py
  2. 5
      src/class_singleWorker.py
  3. 7
      src/openclpow.py
  4. 3
      src/proofofwork.py

@ -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

@ -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

@ -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:

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

Loading…
Cancel
Save