Skip to content

Commit

Permalink
fixed issue #54 not recovering from failed calls to ADL
Browse files Browse the repository at this point in the history
  • Loading branch information
m0mchil committed Nov 28, 2012
1 parent 4a7cec2 commit 8e37a4c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions OpenCLMiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
except Exception:
print '\nNo OpenCL\n'

def is_amd(platform):
if 'amd' in platform.name.lower():
return True
return False

def has_amd():
for platform in cl.get_platforms():
if 'amd' in platform.name.lower():
if is_amd(platform):
return True
return False

Expand Down Expand Up @@ -124,9 +129,11 @@ def __init__(self, device_index, options):
self.vectors = False

self.adapterIndex = None
if ADL and 'amd' in self.device.platform.name.lower() and self.device.type == cl.device_type.GPU:
if ADL and is_amd(self.device.platform) and self.device.type == cl.device_type.GPU:
with adl_lock:
self.adapterIndex = self.get_adapter_info()[self.device_index].iAdapterIndex
self.adapterIndex = self.get_adapter_info()
if self.adapterIndex:
self.adapterIndex = self.adapterIndex[self.device_index].iAdapterIndex

def id(self):
return str(self.options.platform) + ':' + str(self.device_index) + ':' + self.device_name
Expand Down Expand Up @@ -358,7 +365,7 @@ def get_adapter_info(self):
adapterID = c_int(-1)

if ADL_Adapter_ID_Get(index, byref(adapterID)) != ADL_OK:
say_line("ADL_Adapter_Active_Get failed, cutoff temperature disabled for %s", self.id())
say_line("ADL_Adapter_ID_Get failed, cutoff temperature disabled for %s", self.id())
return

found = False
Expand Down

0 comments on commit 8e37a4c

Please sign in to comment.