@@ -432,14 +432,15 @@ def __init__(self):
432432 self .cores = []
433433 self .CUDAs = []
434434 self .OpCL = []
435+ self .all = []
435436 self .cv = threading .Condition ()
436437
437438 # CUDA
438- if config .cfg ['use_CUDA' ] == 'true' and 'cpyrit._cpyrit_cuda' in sys .modules :
439+ if config .cfg ['use_CUDA' ] == 'true' and 'cpyrit._cpyrit_cuda' in sys .modules and config . cfg [ 'use_OpenCL' ] == 'false' :
439440
440441 CUDA = cpyrit_cuda .listDevices ()
441442
442- for dev_idx , device in enumerate (CUDAs ):
443+ for dev_idx , device in enumerate (CUDA ):
443444 self .CUDAs .append (CUDACore (queue = self , dev_idx = dev_idx ))
444445 CUDA -= 1
445446
@@ -463,6 +464,8 @@ def __init__(self):
463464 for i in xrange (util .ncpus ):
464465 self .cores .append (CPUCore (queue = self ))
465466
467+
468+
466469 #Network
467470 if config .cfg ['rpc_server' ] == 'true' :
468471 for port in xrange (17935 , 18000 ):
@@ -485,9 +488,18 @@ def __init__(self):
485488 self .ncore_uuid = None
486489 else :
487490 self .ncore_uuid = None
491+
488492
489- def _check_cores (self ):
490493 for core in self .cores :
494+ self .all .append (core )
495+ for OCL in self .OpCL :
496+ self .all .append (OCL )
497+ for CD in self .CUDAs :
498+ self .all .append (CD )
499+
500+ def _check_cores (self ):
501+ all = []
502+ for core in self .all :
491503 if not core .shallStop and not core .isAlive ():
492504 raise SystemError ("The core '%s' has died unexpectedly" % core )
493505
@@ -518,13 +530,13 @@ def __exit__(self, exc_type, exc_val, exc_tb):
518530 self .shutdown ()
519531
520532 def shutdown (self ):
521- for core in self .cores :
533+ for core in self .all :
522534 core .shallStop = True
523- for core in self .cores :
535+ for core in self .all :
524536 core .shutdown ()
525537
526538 def isAlive (self ):
527- return all (core .isAlive () for core in self .cores )
539+ return all (core .isAlive () for core in self .all )
528540
529541 def waitForSchedule (self , maxBufferSize ):
530542 """Block until less than the given number of passwords wait for being
@@ -538,7 +550,7 @@ def waitForSchedule(self, maxBufferSize):
538550
539551 def resetStatistics (self ):
540552 """Reset all cores' statistics"""
541- for core in self .cores :
553+ for core in self .all :
542554 core .resetStatistics ()
543555
544556 def getPeakPerformance (self ):
@@ -548,7 +560,7 @@ def getPeakPerformance(self):
548560 with 100% occupancy. The real performance is lower if the caller
549561 fails to keep the pipeline filled.
550562 """
551- return sum ([c .resCount / c .compTime for c in self .cores if c .compTime ])
563+ return sum ([c .resCount / c .compTime for c in self .all if c .compTime ])
552564
553565 def enqueue (self , essid , passwords , block = True ):
554566 """Enqueue the given ESSID and iterable of passwords for processing.
0 commit comments