New POW calculation module #1284
|
@ -47,12 +47,12 @@ class WorkProver(threading.Thread):
|
|||
|
||||
|
||||
try:
|
||||
self.availableSolvers["fast"] = fastsolver.FastSolver(codePath)
|
||||
except:
|
||||
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 fastsolver.FastSolverError:
|
||||
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
|
||||
|
||||
try:
|
||||
self.availableSolvers["gpu"] = gpusolver.GPUSolver(codePath, GPUVendors)
|
||||
except:
|
||||
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 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
|
||||
|
||||
try:
|
||||
|
|
|||
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'
|
|
@ -4,6 +4,9 @@ import platform
|
|||
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
|
||||
import subprocess
|
||||
import ctypes
|
||||
please write all the imports in alphabetic order please write all the imports in alphabetic order
|
||||
|
||||
class FastSolverError(Exception):
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
pass
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
def loadFastSolver(codePath):
|
||||
if hasattr(sys, "winver"):
|
||||
suffix = "-32"
|
||||
|
@ -13,7 +16,10 @@ def loadFastSolver(codePath):
|
|||
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
|
||||
|
||||
pep8 validation pep8 validation
|
||||
path = os.path.join(codePath, "fastsolver/libfastsolver{}.dll".format(suffix))
|
||||
|
||||
try:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
return ctypes.WinDLL(path)
|
||||
except:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
raise FastSolverError()
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
||||
makePath = os.path.join(codePath, "fastsolver")
|
||||
path = os.path.join(codePath, "fastsolver/libfastsolver.so")
|
||||
|
@ -21,12 +27,15 @@ def loadFastSolver(codePath):
|
|||
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
|
||||
try:
|
||||
return ctypes.CDLL(path)
|
||||
except:
|
||||
if not hasattr(sys, "frozen"):
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
if hasattr(sys, "frozen"):
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
raise FastSolverError()
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
try:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
subprocess.call(["make", "-C", makePath])
|
||||
|
||||
return ctypes.CDLL(path)
|
||||
else:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
raise Exception()
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
except:
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
raise FastSolverError()
|
||||
doc type required here doc type required here
documentation required here documentation required here
|
||||
|
||||
class FastSolver(object):
|
||||
def __init__(self, codePath):
|
||||
|
|
|||
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
|
|
@ -14,8 +14,11 @@ 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?
|
||||
def __init__(self, codePath, vendors = None):
|
||||
global pyopencl, numpy
|
||||
|
||||
try:
|
||||
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
|
||||
import numpy
|
||||
except ImportError:
|
||||
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?
|
||||
raise GPUSolverError()
|
||||
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?
|
||||
|
||||
device = None
|
||||
|
||||
|
@ -30,7 +33,7 @@ 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?
|
||||
|
||||
break
|
||||
else:
|
||||
raise 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?
|
||||
raise GPUSolverError()
|
||||
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 = [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?
|
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'