Skip to content

Commit 8d829b5

Browse files
committed
Reset OpenCL when settings change
- previously, changing the OpenCL vendor (or turning it on/off) required a restart and this wasn't clear
1 parent 171bc83 commit 8d829b5

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

src/bitmessageqt/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,6 +2444,7 @@ def click_actionSettings(self):
24442444

24452445
if self.settingsDialogInstance.ui.comboBoxOpenCL.currentText().toUtf8() != BMConfigParser().safeGet("bitmessagesettings", "opencl"):
24462446
BMConfigParser().set('bitmessagesettings', 'opencl', str(self.settingsDialogInstance.ui.comboBoxOpenCL.currentText()))
2447+
queues.workerQueue.put(('resetPoW', ''))
24472448

24482449
acceptableDifficultyChanged = False
24492450

src/class_singleWorker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def run(self):
120120
self.sendOutOrStoreMyV4Pubkey(data)
121121
except:
122122
pass
123+
elif command == 'resetPoW':
124+
try:
125+
proofofwork.resetPoW()
126+
except:
127+
pass
123128
elif command == 'stopThread':
124129
self.busy = 0
125130
return

src/openclpow.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
libAvailable = False
2727

2828
def initCL():
29-
global ctx, queue, program, enabledGpus, hash_dt
29+
global ctx, queue, program, enabledGpus, hash_dt, vendors
30+
gpus = []
31+
ctx = False
32+
enabledGpus = []
33+
vendors = []
34+
hash_dt = None
3035
try:
3136
hash_dt = numpy.dtype([('target', numpy.uint64), ('v', numpy.str_, 73)])
3237
try:

src/proofofwork.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ def run(target, initialHash):
231231
except:
232232
pass #fallback
233233

234+
def resetPoW():
235+
openclpow.initCL()
236+
234237
# init
235238
def init():
236239
global bitmsglib, bso, bmpow

0 commit comments

Comments
 (0)