Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add X-Work-Identifier support to RPC for better compatibility with P2…

…Pool.

Tweaked kernel worksize validation.
Bump version to 1.7.4

Signed-off-by: jedi95 <jedi95@gmail.com>
  • Loading branch information...
commit 8263f658c835532a25185b147147c5835ec65c27 1 parent 297945a
jedi95 authored
4 WorkQueue.py
View
@@ -94,12 +94,12 @@ def storeWork(self, wu):
work.base = 0
#check if there is a new block, if so reset queue
- newBlock = (wu.data[4:36] != self.block)
+ newBlock = (wu.identifier != self.block)
if newBlock:
self.queue.clear()
self.currentUnit = None
self.lastBlock = self.block
- self.block = wu.data[4:36]
+ self.block = wu.identifier
self.logger.reportDebug("New block (WorkQueue)")
#clear the idle flag since we just added work to queue
22 kernels/phatk/__init__.py
View
@@ -210,7 +210,7 @@ def __init__(self, interface):
try:
self.loadKernel(self.device)
except Exception:
- self.interface.fatal("Failed to load OpenCL kernel!")
+ self.interface.fatal('Failed to load OpenCL kernel!')
return
# Initialize a command queue to send commands to the device, and a
@@ -236,18 +236,18 @@ def loadKernel(self, device):
# get the maximum worksize of the device
maxWorkSize = self.device.get_info(cl.device_info.MAX_WORK_GROUP_SIZE)
- # If the user didn't specify their own worksize, use the maximum supported worksize of the device
+ # If the user didn't specify their own worksize,
+ # use the maximum supported worksize of the device
if self.WORKSIZE is None:
- self.interface.error('WORKSIZE not supplied, using HW max. of ' + str(maxWorkSize))
+ self.interface.debug('WORKSIZE not supplied, using HW max. of '
+ + str(maxWorkSize))
self.WORKSIZE = maxWorkSize
else:
- # If the worksize is larger than the maximum supported worksize of the device
+ # If the worksize is larger than the maximum supported
+ # worksize of the device
if (self.WORKSIZE > maxWorkSize):
- self.interface.error('WORKSIZE out of range, using HW max. of ' + str(maxWorkSize))
- self.WORKSIZE = maxWorkSize
- # If the worksize is not a power of 2
- if (self.WORKSIZE & (self.WORKSIZE - 1)) != 0:
- self.interface.error('WORKSIZE invalid, using HW max. of ' + str(maxWorkSize))
+ self.interface.error('WORKSIZE out of range, using HW max. of '
+ + str(maxWorkSize))
self.WORKSIZE = maxWorkSize
# These definitions are required for the kernel to function.
@@ -304,7 +304,7 @@ def loadKernel(self, device):
patcher = BFIPatcher(self.interface)
binaryData = patcher.patch(self.kernel.binaries[0])
- self.interface.debug("Applied BFI_INT patch")
+ self.interface.debug('Applied BFI_INT patch')
#reload the kernel with the patched binary
self.kernel = cl.Program(
@@ -321,7 +321,7 @@ def loadKernel(self, device):
self.context, [device], [binaryData]).build(self.defines)
except cl.LogicError:
- self.interface.fatal("Failed to compile OpenCL kernel!")
+ self.interface.fatal('Failed to compile OpenCL kernel!')
return
except PatchError:
self.interface.fatal('Failed to apply BFI_INT patch to kernel! '
22 kernels/phatk2/__init__.py
View
@@ -216,7 +216,7 @@ def __init__(self, interface):
try:
self.loadKernel(self.device)
except Exception:
- self.interface.fatal("Failed to load OpenCL kernel!")
+ self.interface.fatal('Failed to load OpenCL kernel!')
return
# Initialize a command queue to send commands to the device, and a
@@ -242,18 +242,18 @@ def loadKernel(self, device):
# get the maximum worksize of the device
maxWorkSize = self.device.get_info(cl.device_info.MAX_WORK_GROUP_SIZE)
- # If the user didn't specify their own worksize, use the maximum supported worksize of the device
+ # If the user didn't specify their own worksize,
+ # use the maximum supported worksize of the device
if self.WORKSIZE is None:
- self.interface.error('WORKSIZE not supplied, using HW max. of ' + str(maxWorkSize))
+ self.interface.debug('WORKSIZE not supplied, using HW max. of '
+ + str(maxWorkSize))
self.WORKSIZE = maxWorkSize
else:
- # If the worksize is larger than the maximum supported worksize of the device
+ # If the worksize is larger than the maximum supported
+ # worksize of the device
if (self.WORKSIZE > maxWorkSize):
- self.interface.error('WORKSIZE out of range, using HW max. of ' + str(maxWorkSize))
- self.WORKSIZE = maxWorkSize
- # If the worksize is not a power of 2
- if (self.WORKSIZE & (self.WORKSIZE - 1)) != 0:
- self.interface.error('WORKSIZE invalid, using HW max. of ' + str(maxWorkSize))
+ self.interface.error('WORKSIZE out of range, using HW max. of '
+ + str(maxWorkSize))
self.WORKSIZE = maxWorkSize
# These definitions are required for the kernel to function.
@@ -317,7 +317,7 @@ def loadKernel(self, device):
patcher = BFIPatcher(self.interface)
binaryData = patcher.patch(self.kernel.binaries[0])
- self.interface.debug("Applied BFI_INT patch")
+ self.interface.debug('Applied BFI_INT patch')
#reload the kernel with the patched binary
self.kernel = cl.Program(
@@ -334,7 +334,7 @@ def loadKernel(self, device):
self.context, [device], [binaryData]).build(self.defines)
except cl.LogicError:
- self.interface.fatal("Failed to compile OpenCL kernel!")
+ self.interface.fatal('Failed to compile OpenCL kernel!')
return
except PatchError:
self.interface.fatal('Failed to apply BFI_INT patch to kernel! '
22 kernels/poclbm/__init__.py
View
@@ -193,7 +193,7 @@ def __init__(self, interface):
try:
self.loadKernel(self.device)
except Exception:
- self.interface.fatal("Failed to load OpenCL kernel!")
+ self.interface.fatal('Failed to load OpenCL kernel!')
return
# Initialize a command queue to send commands to the device, and a
@@ -219,18 +219,18 @@ def loadKernel(self, device):
# get the maximum worksize of the device
maxWorkSize = self.device.get_info(cl.device_info.MAX_WORK_GROUP_SIZE)
- # If the user didn't specify their own worksize, use the maximum supported worksize of the device
+ # If the user didn't specify their own worksize,
+ # use the maximum supported worksize of the device
if self.WORKSIZE is None:
- self.interface.error('WORKSIZE not supplied, using HW max. of ' + str(maxWorkSize))
+ self.interface.debug('WORKSIZE not supplied, using HW max. of '
+ + str(maxWorkSize))
self.WORKSIZE = maxWorkSize
else:
- # If the worksize is larger than the maximum supported worksize of the device
+ # If the worksize is larger than the maximum supported
+ # worksize of the device
if (self.WORKSIZE > maxWorkSize):
- self.interface.error('WORKSIZE out of range, using HW max. of ' + str(maxWorkSize))
- self.WORKSIZE = maxWorkSize
- # If the worksize is not a power of 2
- if (self.WORKSIZE & (self.WORKSIZE - 1)) != 0:
- self.interface.error('WORKSIZE invalid, using HW max. of ' + str(maxWorkSize))
+ self.interface.error('WORKSIZE out of range, using HW max. of '
+ + str(maxWorkSize))
self.WORKSIZE = maxWorkSize
# These definitions are required for the kernel to function.
@@ -291,7 +291,7 @@ def loadKernel(self, device):
patcher = BFIPatcher(self.interface)
binaryData = patcher.patch(self.kernel.binaries[0])
- self.interface.debug("Applied BFI_INT patch")
+ self.interface.debug('Applied BFI_INT patch')
#reload the kernel with the patched binary
self.kernel = cl.Program(
@@ -308,7 +308,7 @@ def loadKernel(self, device):
self.context, [device], [binaryData]).build(self.defines)
except cl.LogicError:
- self.interface.fatal("Failed to compile OpenCL kernel!")
+ self.interface.fatal('Failed to compile OpenCL kernel!')
return
except PatchError:
self.interface.fatal('Failed to apply BFI_INT patch to kernel! '
1  minerutil/ClientBase.py
View
@@ -27,6 +27,7 @@ class AssignedWork(object):
target = None
maxtime = None
time = None
+ identifier = None
def setMaxTimeIncrement(self, n):
self.time = n
self.maxtime = struct.unpack('>I', self.data[68:72])[0] + n
1  minerutil/MMPProtocol.py
View
@@ -143,6 +143,7 @@ def cmd_WORK(self, work, mask):
wu.mask = mask
wu.target = self.target
wu.setMaxTimeIncrement(self.time)
+ wu.identifier = data[4:36]
self.runCallback('work', wu)
# Since the server is giving work, we know it has accepted our
# login details, so we can reset the factory's reconnect delay.
13 minerutil/RPCProtocol.py
View
@@ -180,7 +180,8 @@ def call(self, method, params=[]):
{
'Authorization': self.root.auth,
'User-Agent': self.root.version,
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json',
+ 'X-Work-Identifier': '1'
})
(headers, data) = response
@@ -206,10 +207,10 @@ class LongPoller(HTTPBase):
callback function.
"""
- #Changed to 1800, since 600 seconds will cause it to reconnect
+ #Changed to 3600, since 600 seconds will cause it to reconnect
#once every 10 minutes. Most pools will not cancel a long poll if the block
- #exceeds 10 minutes. 30 minutes should be a sane value for this.
- timeout = 1800
+ #exceeds 10 minutes. 60 minutes should be a sane value for this.
+ timeout = 3600
def __init__(self, url, root):
self.url = url
@@ -235,7 +236,8 @@ def _request(self):
None,
{
'Authorization': self.root.auth,
- 'User-Agent': self.root.version
+ 'User-Agent': self.root.version,
+ 'X-Work-Identifier': '1'
})
d.addBoth(self._requestComplete)
@@ -425,6 +427,7 @@ def handleWork(self, work, headers, pushed=False):
aw.target = work['target'].decode('hex')
aw.mask = work.get('mask', 32)
aw.setMaxTimeIncrement(maxtime)
+ aw.identifier = work.get('identifier', aw.data[4:36])
if pushed:
self.runCallback('push', aw)
self.runCallback('work', aw)
Please sign in to comment.
Something went wrong with that request. Please try again.