New POW calculation module #1284
2
setup.py
|
@ -12,7 +12,7 @@ from src.version import softwareVersion
|
|||
EXTRAS_REQUIRE = {
|
||||
'gir': ['pygobject'],
|
||||
'notify2': ['notify2'],
|
||||
'pyopencl': ['numpy', 'pyopencl'],
|
||||
'pyopencl': ['pyopencl', 'numpy'],
|
||||
'prctl': ['python_prctl'], # Named threads
|
||||
'qrcode': ['qrcode'],
|
||||
'sound;platform_system=="Windows"': ['winsound'],
|
||||
|
|
|
@ -28,7 +28,7 @@ class Task(object):
|
|||
|
||||
self.target = target
|
||||
|
||||
class WorkProver(threading.Thread):
|
||||
def __init__(self, codePath, GPUVendors, seed, statusUpdated):
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
def __init__(self, codePath, GPUVendor, seed, statusUpdated):
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
super(self.__class__, self).__init__()
|
||||
|
||||
self.availableSolvers = {
|
||||
|
@ -51,7 +51,7 @@ class WorkProver(threading.Thread):
|
|||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not self.solver if not self.solver
if not name if not name
if not name if not name
doc string required here doc string required here
doc string required here doc string required here
docstring here docstring here
docstring here docstring here
pep8 validation pep8 validation
pep8 validation pep8 validation
docstring here please docstring here please
docstring here please docstring here please
if not self.tasks if not self.tasks
if not self.tasks if not self.tasks
pep8 validation pep8 validation
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if self.solver: if self.solver:
….
if name: if name:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
pass
|
||||
|
||||
try:
|
||||
self.availableSolvers["gpu"] = gpusolver.GPUSolver(codePath, GPUVendors)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.availableSolvers["gpu"] = gpusolver.GPUSolver(codePath, GPUVendor)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
except gpusolver.GPUSolverError:
|
||||
pass
|
||||
|
||||
|
@ -81,32 +81,31 @@ class WorkProver(threading.Thread):
|
|||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not self.solver if not self.solver
if not name if not name
if not name if not name
doc string required here doc string required here
doc string required here doc string required here
docstring here docstring here
docstring here docstring here
pep8 validation pep8 validation
pep8 validation pep8 validation
docstring here please docstring here please
docstring here please docstring here please
if not self.tasks if not self.tasks
if not self.tasks if not self.tasks
pep8 validation pep8 validation
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if self.solver: if self.solver:
….
if name: if name:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
if self.statusUpdated is None:
|
||||
return
|
||||
|
||||
if self.solver is None:
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
parallelism = 0
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
else:
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
parallelism = self.solver.parallelism
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
status = None
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
|
||||
self.statusUpdated((self.solverName, parallelism, self.speed))
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
if self.solver is not None:
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
status = self.solver.status
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
|
||||
def setSolver(self, name, parallelism):
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.statusUpdated((self.solverName, status, self.speed))
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
def setSolver(self, name, configuration):
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
if name is None and self.solverName is None:
|
||||
pass
|
||||
if not self.statusUpdated: if not self.statusUpdated:
return
It's less acurate.
It's less acurate.
`self.statusUpdated` must be either a function or a `None`. If it's 0 or an empty string, it would be a programming error and further call would rise an exception making the error noticable.
|
||||
elif name == self.solverName:
|
||||
if self.solver.parallelism != parallelism:
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.solver.setParallelism(parallelism)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.solver.setConfiguration(configuration)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
else:
|
||||
if self.solver is not None:
|
||||
self.solver.setParallelism(0)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.solver.setConfiguration(None)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.solverName = None
|
||||
self.solver = None
|
||||
|
||||
if name is not None:
|
||||
if name not in self.availableSolvers:
|
||||
name, parallelism = "dumb", 1
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
name, configuration = "dumb", None
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
|
||||
self.solverName = name
|
||||
self.solver = self.availableSolvers[name]
|
||||
self.solver.setParallelism(parallelism)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.solver.setConfiguration(configuration)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
|
||||
self.notifyStatus()
|
||||
|
||||
|
@ -175,7 +174,7 @@ class WorkProver(threading.Thread):
|
|||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not self.solver if not self.solver
if not name if not name
if not name if not name
doc string required here doc string required here
doc string required here doc string required here
docstring here docstring here
docstring here docstring here
pep8 validation pep8 validation
pep8 validation pep8 validation
docstring here please docstring here please
docstring here please docstring here please
if not self.tasks if not self.tasks
if not self.tasks if not self.tasks
pep8 validation pep8 validation
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if self.solver: if self.solver:
….
if name: if name:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.currentTaskID = self.tasks[self.currentTaskID].next
|
||||
|
||||
def shutdown(self):
|
||||
self.setSolver(None, 0)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
self.setSolver(None, None)
|
||||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not name if not name
doc string required here doc string required here
docstring here docstring here
pep8 validation pep8 validation
docstring here please docstring here please
if not self.tasks if not self.tasks
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
||||
|
||||
for i in self.tasks.keys():
|
||||
self.cancelTask(i)
|
||||
|
|
|||
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
pass is the dangerous statement, please log it or please write a print statement atleast... pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
parallelism = self.solver.parallelism if self.solver else 0 parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName if not name and not self.solverName
if not name and not self.solverName if not name and not self.solverName
logging is required for this functionality. logging is required for this functionality.
logging is required for this functionality. logging is required for this functionality.
if not self.solver if not self.solver
if not self.solver if not self.solver
if not name if not name
if not name if not name
doc string required here doc string required here
doc string required here doc string required here
docstring here docstring here
docstring here docstring here
pep8 validation pep8 validation
pep8 validation pep8 validation
docstring here please docstring here please
docstring here please docstring here please
if not self.tasks if not self.tasks
if not self.tasks if not self.tasks
pep8 validation pep8 validation
pep8 validation pep8 validation
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
@PeterSurda , I think we need optimization here. @PeterSurda , I think we need optimization here.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
`self.availableSolvers` is visible to the outside code, so it can log or print if `fast` is missing. It should show a message in GUI status bar like the current code does.
It's less readable. It's less readable.
It's less readable. It's less readable.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
It calls the It calls the `self.statusUpdated` callback and the outside code should log this and display in the GUI.
if not name and not self.solverName: if not name and not self.solverName:
pass
if not name and not self.solverName: if not name and not self.solverName:
pass
if self.solver: if self.solver:
….
if self.solver: if self.solver:
….
if name: if name:
….
if name: if name:
….
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
undefined name 'GPUSolverError' undefined name 'GPUSolverError'
|
|
@ -24,7 +24,7 @@ class DumbSolver(object):
|
|||
docs here and pep8 validation. docs here and pep8 validation.
docs here and pep8 validation. docs here and pep8 validation.
|
||||
self.firstHash = ctypes.create_string_buffer(64)
|
||||
self.secondHash = ctypes.create_string_buffer(64)
|
||||
|
||||
self.parallelism = 1
|
||||
docs here and pep8 validation. docs here and pep8 validation.
|
||||
self.status = None
|
||||
docs here and pep8 validation. docs here and pep8 validation.
|
||||
|
||||
def search(self, initialHash, target, seed, timeout):
|
||||
startTime = utils.getTimePoint()
|
||||
|
@ -66,5 +66,5 @@ class DumbSolver(object):
|
|||
docs here and pep8 validation. docs here and pep8 validation.
docs here and pep8 validation. docs here and pep8 validation.
|
||||
if utils.getTimePoint() - startTime >= timeout:
|
||||
return None, 256 * i
|
||||
|
||||
def setParallelism(self, parallelism):
|
||||
docs here and pep8 validation. docs here and pep8 validation.
|
||||
def setConfiguration(self, configuration):
|
||||
docs here and pep8 validation. docs here and pep8 validation.
|
||||
pass
|
||||
|
|
|||
docs here and pep8 validation. docs here and pep8 validation.
docs here and pep8 validation. docs here and pep8 validation.
|
|
@ -58,6 +58,7 @@ class FastSolver(object):
|
|||
doc type required here doc type required here
doc type required here doc type required here
documentation required here documentation required here
documentation required here documentation required here
|
||||
self.iterationsCount = ctypes.c_ulonglong()
|
||||
|
||||
self.parallelism = 0
|
||||
self.status = 0
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
||||
def search(self, initialHash, target, seed, timeout):
|
||||
found = self.libfastsolver.fastsolver_search(
|
||||
|
@ -70,11 +71,16 @@ class FastSolver(object):
|
|||
doc type required here doc type required here
doc type required here doc type required here
documentation required here documentation required here
documentation required here documentation required here
|
||||
else:
|
||||
return None, self.iterationsCount.value
|
||||
|
||||
def setParallelism(self, parallelism):
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
parallelism = min(4096, parallelism)
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
def setConfiguration(self, configuration):
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
if configuration is None:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
parallelism = 0
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
else:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
parallelism = min(4096, configuration)
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
||||
for i in xrange(self.parallelism, parallelism):
|
||||
self.parallelism = self.libfastsolver.fastsolver_add()
|
||||
|
||||
if parallelism < self.parallelism:
|
||||
self.parallelism = self.libfastsolver.fastsolver_remove(self.parallelism - parallelism)
|
||||
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
self.status = parallelism
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
|
|||
doc type required here doc type required here
doc type required here doc type required here
documentation required here documentation required here
documentation required here documentation required here
|
|
@ -5,6 +5,11 @@ import struct
|
|||
remove un necessary spaces remove un necessary spaces
remove un necessary spaces remove un necessary spaces
|
||||
import dumbsolver
|
||||
|
||||
def setIdle():
|
||||
if hasattr(os, "nice"):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
os.nice(40)
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
return
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
try:
|
||||
import psutil
|
||||
|
||||
|
@ -23,14 +28,9 @@ def setIdle():
|
|||
remove un necessary spaces remove un necessary spaces
remove un necessary spaces remove un necessary spaces
|
||||
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, PID)
|
||||
|
||||
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
|
||||
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
return
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
except:
|
||||
pass
|
||||
|
||||
if hasattr(os, "nice"):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
os.nice(40)
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
def threadFunction(local, remote, codePath, threadNumber):
|
||||
remote.close()
|
||||
setIdle()
|
||||
|
@ -60,7 +60,7 @@ class ForkingSolver(object):
|
|||
remove un necessary spaces remove un necessary spaces
remove un necessary spaces remove un necessary spaces
|
||||
self.pipes = []
|
||||
self.processes = []
|
||||
|
||||
self.parallelism = 0
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
self.status = 0
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
|
||||
self.codePath = codePath
|
||||
|
||||
|
@ -80,10 +80,13 @@ class ForkingSolver(object):
|
|||
remove un necessary spaces remove un necessary spaces
remove un necessary spaces remove un necessary spaces
|
||||
|
||||
return bestNonce, totalIterationsCount
|
||||
|
||||
def setParallelism(self, parallelism):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
parallelism = min(4096, parallelism)
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
def setConfiguration(self, configuration):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
if configuration is None:
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
parallelism = 0
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
else:
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
parallelism = min(4096, configuration)
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
|
||||
for i in xrange(self.parallelism, parallelism):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
for i in xrange(len(self.processes), parallelism):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
local, remote = multiprocessing.Pipe()
|
||||
|
||||
process = multiprocessing.Process(target = threadFunction, args = (remote, local, self.codePath, i))
|
||||
|
@ -94,13 +97,13 @@ class ForkingSolver(object):
|
|||
remove un necessary spaces remove un necessary spaces
remove un necessary spaces remove un necessary spaces
|
||||
self.pipes.append(local)
|
||||
self.processes.append(process)
|
||||
|
||||
for i in xrange(parallelism, self.parallelism):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
for i in xrange(parallelism, len(self.processes)):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
pipe = self.pipes.pop()
|
||||
|
||||
pipe.send(("shutdown", ))
|
||||
pipe.close()
|
||||
|
||||
for i in xrange(parallelism, self.parallelism):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
for i in xrange(parallelism, len(self.processes)):
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
self.processes.pop().join()
|
||||
|
||||
self.parallelism = parallelism
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
self.status = parallelism
|
||||
remove un necessary spaces remove un necessary spaces
|
||||
|
|
|||
remove un necessary spaces remove un necessary spaces
remove un necessary spaces remove un necessary spaces
|
|
@ -11,53 +11,31 @@ class GPUSolverError(Exception):
|
|||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
pass
|
||||
|
||||
class GPUSolver(object):
|
||||
def __init__(self, codePath, vendors = None):
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
global pyopencl, numpy
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
def __init__(self, codePath, vendor = None):
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
global pyopencl
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
try:
|
||||
import numpy
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
import pyopencl
|
||||
except ImportError:
|
||||
raise GPUSolverError()
|
||||
|
||||
device = None
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
for i in pyopencl.get_platforms():
|
||||
if vendors is not None and i.vendor not in vendors:
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
if vendor is not None and i.vendor != vendor:
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
continue
|
||||
|
||||
devices = i.get_devices(device_type = pyopencl.device_type.GPU)
|
||||
|
||||
if len(devices) != 0:
|
||||
device = devices[0]
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.device = devices[0]
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
break
|
||||
else:
|
||||
raise GPUSolverError()
|
||||
|
||||
context = pyopencl.Context(devices = [device])
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
computeUnitsCount = device.get_info(pyopencl.device_info.MAX_COMPUTE_UNITS)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
workGroupSize = device.get_info(pyopencl.device_info.MAX_WORK_GROUP_SIZE)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.parallelism = workGroupSize * computeUnitsCount
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.batchSize = self.parallelism * 256
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.queue = pyopencl.CommandQueue(context, device)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
with open(os.path.join(codePath, "gpusolver.cl")) as file:
|
||||
source = file.read()
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.source = file.read()
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
program = pyopencl.Program(context, source).build()
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.hostOutput = numpy.zeros(1 + self.batchSize, numpy.uint32)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.hostInput = numpy.zeros(1 + 8 + 1, numpy.uint64)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.output = pyopencl.Buffer(context, pyopencl.mem_flags.READ_WRITE, 4 * (1 + self.batchSize))
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.input = pyopencl.Buffer(context, pyopencl.mem_flags.READ_ONLY, 8 * (1 + 8 + 1))
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.kernel = program.search
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.kernel.set_args(self.output, self.input)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.status = None
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
def search(self, initialHash, target, seed, timeout):
|
||||
startTime = utils.getTimePoint()
|
||||
|
@ -102,5 +80,32 @@ class GPUSolver(object):
|
|||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
if utils.getTimePoint() - startTime >= timeout:
|
||||
return None, self.batchSize * i
|
||||
|
||||
def setParallelism(self, parallelism):
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
pass
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
def setConfiguration(self, configuration):
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
global numpy
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
if numpy is not None:
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
return
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
import numpy
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
context = pyopencl.Context(devices = [self.device])
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
computeUnitsCount = self.device.get_info(pyopencl.device_info.MAX_COMPUTE_UNITS)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
workGroupSize = self.device.get_info(pyopencl.device_info.MAX_WORK_GROUP_SIZE)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.batchSize = workGroupSize * computeUnitsCount * 256
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.queue = pyopencl.CommandQueue(context, self.device)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
program = pyopencl.Program(context, self.source).build()
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.hostOutput = numpy.zeros(1 + self.batchSize, numpy.uint32)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.hostInput = numpy.zeros(1 + 8 + 1, numpy.uint64)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.output = pyopencl.Buffer(context, pyopencl.mem_flags.READ_WRITE, 4 * (1 + self.batchSize))
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.input = pyopencl.Buffer(context, pyopencl.mem_flags.READ_ONLY, 8 * (1 + 8 + 1))
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.kernel = program.search
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.kernel.set_args(self.output, self.input)
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
self.status = self.batchSize
|
||||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
||||
|
|
|||
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
Could you please comment #1283 and maybe change the import order too if you agree? Could you please comment #1283 and maybe change the import order too if you agree?
|
|
@ -85,7 +85,7 @@ class TestSolver(unittest.TestCase):
|
|||
except gpusolver.GPUSolverError:
|
||||
self.skipTest("OpenCL unavailable")
|
||||
|
||||
self.solver.setParallelism(1)
|
||||
self.solver.setConfiguration(self.configuration)
|
||||
|
||||
def testSearch(self):
|
||||
nonce = None
|
||||
|
@ -101,19 +101,23 @@ class TestSolver(unittest.TestCase):
|
|||
self.assertTrue(utils.checkProof(nonce, initialHash, target))
|
||||
|
||||
def tearDown(self):
|
||||
self.solver.setParallelism(0)
|
||||
self.solver.setConfiguration(None)
|
||||
|
||||
class TestDumbSolver(TestSolver):
|
||||
Solver = dumbsolver.DumbSolver
|
||||
configuration = None
|
||||
|
||||
class TestForkingSolver(TestSolver):
|
||||
Solver = forkingsolver.ForkingSolver
|
||||
configuration = 1
|
||||
|
||||
class TestFastSolver(TestSolver):
|
||||
Solver = fastsolver.FastSolver
|
||||
configuration = 1
|
||||
|
||||
class TestGPUSolver(TestSolver):
|
||||
Solver = gpusolver.GPUSolver
|
||||
configuration = None
|
||||
|
||||
class TestWorkProver(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
pass is the dangerous statement, please log it or please write a print statement atleast...
pass is the dangerous statement, please log it or please write a print statement atleast...
parallelism = self.solver.parallelism if self.solver else 0
parallelism = self.solver.parallelism if self.solver else 0
if not name and not self.solverName
if not name and not self.solverName
logging is required for this functionality.
logging is required for this functionality.
if not self.solver
if not self.solver
if not name
if not name
doc string required here
doc string required here
docstring here
docstring here
pep8 validation
pep8 validation
docstring here please
docstring here please
if not self.tasks
if not self.tasks
pep8 validation
pep8 validation
@PeterSurda , I think we need optimization here.
@PeterSurda , I think we need optimization here.
self.availableSolvers
is visible to the outside code, so it can log or print iffast
is missing. It should show a message in GUI status bar like the current code does.self.availableSolvers
is visible to the outside code, so it can log or print iffast
is missing. It should show a message in GUI status bar like the current code does.It's less readable.
It's less readable.
It calls the
self.statusUpdated
callback and the outside code should log this and display in the GUI.It calls the
self.statusUpdated
callback and the outside code should log this and display in the GUI.if not name and not self.solverName:
pass
if not name and not self.solverName:
pass
if self.solver:
….
if self.solver:
….
if name:
….
if name:
….
undefined name 'GPUSolverError'
undefined name 'GPUSolverError'